// MovieTextureP.C: MovieTexture nodes (private source).
// Automatically generated with nodegen 0.51 - do not edit.

#include "MovieTexture.H"
#include "xrmlP.H"

namespace xrml {
int MovieTexture::major_version(void) { return 0; }
int MovieTexture::minor_version(void) { return 5; }
bool MovieTexture::is_leaf_class(void) { return true; }

bool IsMovieTexture(SFNode* node)
{
  return (dynamic_cast<MovieTexture*>(node) != 0);
}

bool MovieTexture::assign_loop(const SFBool& value)
{
  // TODO: value range check!
  loop = value;
  status |= loop_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_MovieTexture_loop(SFNode* node, const fieldValue& value)
{
  MovieTexture* MovieTexture_node = dynamic_cast<MovieTexture*>(node);
  if (!MovieTexture_node)
    Fatal(-1, "assign_MovieTexture_loop", "called for a non-MovieTexture node");
  return MovieTexture_node->assign_loop((const SFBool&)value);
}

void MovieTexture::set_loop(const SFBool& val)
{
  SFBool tmpval(val);
  fieldValue v(&tmpval);
  interface[0]->assign(this, v);
}

bool MovieTexture::assign_speed(const SFFloat& value)
{
  // TODO: value range check!
  speed = value;
  status |= speed_updated;
  timestamp = interface[1]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_MovieTexture_speed(SFNode* node, const fieldValue& value)
{
  MovieTexture* MovieTexture_node = dynamic_cast<MovieTexture*>(node);
  if (!MovieTexture_node)
    Fatal(-1, "assign_MovieTexture_speed", "called for a non-MovieTexture node");
  return MovieTexture_node->assign_speed((const SFFloat&)value);
}

void MovieTexture::set_speed(const SFFloat& val)
{
  SFFloat tmpval(val);
  fieldValue v(&tmpval);
  interface[1]->assign(this, v);
}

bool MovieTexture::assign_startTime(const SFTime& value)
{
  // TODO: value range check!
  startTime = value;
  status |= startTime_updated;
  timestamp = interface[2]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_MovieTexture_startTime(SFNode* node, const fieldValue& value)
{
  MovieTexture* MovieTexture_node = dynamic_cast<MovieTexture*>(node);
  if (!MovieTexture_node)
    Fatal(-1, "assign_MovieTexture_startTime", "called for a non-MovieTexture node");
  return MovieTexture_node->assign_startTime((const SFTime&)value);
}

void MovieTexture::set_startTime(const SFTime& val)
{
  SFTime tmpval(val);
  fieldValue v(&tmpval);
  interface[2]->assign(this, v);
}

bool MovieTexture::assign_stopTime(const SFTime& value)
{
  // TODO: value range check!
  stopTime = value;
  status |= stopTime_updated;
  timestamp = interface[3]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_MovieTexture_stopTime(SFNode* node, const fieldValue& value)
{
  MovieTexture* MovieTexture_node = dynamic_cast<MovieTexture*>(node);
  if (!MovieTexture_node)
    Fatal(-1, "assign_MovieTexture_stopTime", "called for a non-MovieTexture node");
  return MovieTexture_node->assign_stopTime((const SFTime&)value);
}

void MovieTexture::set_stopTime(const SFTime& val)
{
  SFTime tmpval(val);
  fieldValue v(&tmpval);
  interface[3]->assign(this, v);
}

bool MovieTexture::assign_url(const MFString& value)
{
  // TODO: value range check!
  url = value;
  status |= url_updated;
  timestamp = interface[4]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_MovieTexture_url(SFNode* node, const fieldValue& value)
{
  MovieTexture* MovieTexture_node = dynamic_cast<MovieTexture*>(node);
  if (!MovieTexture_node)
    Fatal(-1, "assign_MovieTexture_url", "called for a non-MovieTexture node");
  return MovieTexture_node->assign_url((const MFString&)value);
}

void MovieTexture::set_url(const MFString& val)
{
  MFString tmpval(val);
  fieldValue v(&tmpval);
  interface[4]->assign(this, v);
}

bool MovieTexture::assign_repeatS(const SFBool& value)
{
  // TODO: value range check!
  repeatS = value;
  status |= repeatS_updated;
  timestamp = interface[5]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_MovieTexture_repeatS(SFNode* node, const fieldValue& value)
{
  MovieTexture* MovieTexture_node = dynamic_cast<MovieTexture*>(node);
  if (!MovieTexture_node)
    Fatal(-1, "assign_MovieTexture_repeatS", "called for a non-MovieTexture node");
  return MovieTexture_node->assign_repeatS((const SFBool&)value);
}

bool MovieTexture::assign_repeatT(const SFBool& value)
{
  // TODO: value range check!
  repeatT = value;
  status |= repeatT_updated;
  timestamp = interface[6]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_MovieTexture_repeatT(SFNode* node, const fieldValue& value)
{
  MovieTexture* MovieTexture_node = dynamic_cast<MovieTexture*>(node);
  if (!MovieTexture_node)
    Fatal(-1, "assign_MovieTexture_repeatT", "called for a non-MovieTexture node");
  return MovieTexture_node->assign_repeatT((const SFBool&)value);
}

void MovieTexture::post_duration_changed(void)
{
  interface[7]->post(this, interface[7]->value);
}

void MovieTexture::post_duration_changed(const SFTime& val)
{
  duration_changed = val;
  status |= duration_changed_updated;
  post_duration_changed();
}

void MovieTexture::post_isActive(void)
{
  interface[8]->post(this, interface[8]->value);
}

void MovieTexture::post_isActive(const SFBool& val)
{
  isActive = val;
  status |= isActive_updated;
  post_isActive();
}

MovieTexture::MovieTexture()
{
  interfaceMember* the_interface[9] = {
    new exposedField("loop", fieldValue(&loop), assign_MovieTexture_loop),
    new exposedField("speed", fieldValue(&speed), assign_MovieTexture_speed),
    new exposedField("startTime", fieldValue(&startTime), assign_MovieTexture_startTime),
    new exposedField("stopTime", fieldValue(&stopTime), assign_MovieTexture_stopTime),
    new exposedField("url", fieldValue(&url), assign_MovieTexture_url),
    new field("repeatS", fieldValue(&repeatS), assign_MovieTexture_repeatS),
    new field("repeatT", fieldValue(&repeatT), assign_MovieTexture_repeatT),
    new eventOut("duration_changed", fieldValue(&duration_changed)),
    new eventOut("isActive", fieldValue(&isActive)),
  };
  SFNode::construct(MovieTextureTypeId, 9, the_interface);

  loop = 0;
  speed = 1;
  startTime = 0;
  stopTime = 0;
  url = MFString(0);
  repeatS = 1;
  repeatT = 1;
  duration_changed = 0;
  isActive = 0;
  
  TimeDependent::util_init();
  SoundSource::util_init();
  PhBTexture::util_init();
  Texture::util_init();
  MovieTexture::util_init();
}

void MovieTexture::destruct(void)
{
  MovieTexture::util_destruct();
  TimeDependent::util_destruct();
  SoundSource::util_destruct();
  Texture::util_destruct();
  PhBTexture::util_destruct();
  SFNode::destruct();
}

MovieTexture::~MovieTexture()
{
  destruct();
}

void MovieTexture::clone_here(const MovieTexture& src)
{
  SFNode::clone(src);
  
  interface[0]->value = fieldValue(&loop);
  interface[1]->value = fieldValue(&speed);
  interface[2]->value = fieldValue(&startTime);
  interface[3]->value = fieldValue(&stopTime);
  interface[4]->value = fieldValue(&url);
  interface[5]->value = fieldValue(&repeatS);
  interface[6]->value = fieldValue(&repeatT);
  interface[7]->value = fieldValue(&duration_changed);
  interface[8]->value = fieldValue(&isActive);
  
  loop = src.loop;
  speed = src.speed;
  startTime = src.startTime;
  stopTime = src.stopTime;
  url = src.url;
  repeatS = src.repeatS;
  repeatT = src.repeatT;
  duration_changed = src.duration_changed;
  isActive = src.isActive;
  
  TimeDependent::util_clone(src);
  SoundSource::util_clone(src);
  PhBTexture::util_clone(src);
  Texture::util_clone(src);
  MovieTexture::util_clone(src);
}

MovieTexture::MovieTexture(const MovieTexture& src)
{
  clone_here(src);
}

MovieTexture& MovieTexture::operator=(const MovieTexture& src)
{
  if (this != &src) {
    destruct();
    clone_here(src);
  }
  return *this;
}

SFNode* MovieTexture::instantiate(Proto *enclosing_proto)
{
  if (nameIndex>=0)
    // named node: return pointer to pre-made instance
    return enclosing_proto ? enclosing_proto->namedNodes[nameIndex] : this;
  
  MovieTexture* instance = new MovieTexture(*this);
  instance->instantiate_interface(enclosing_proto);
  return instance;
}

}  // namespace xrml
