// NavigationInfoP.C: NavigationInfo nodes (private source).
// Automatically generated with nodegen 0.5a - do not edit.

#include "NavigationInfo.H"
#include "xrmlP.H"

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

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

static void process_NavigationInfo_set_bind(SFNode* node, const fieldValue& value)
{
  NavigationInfo* NavigationInfo_node = dynamic_cast<NavigationInfo*>(node);
  if (!NavigationInfo_node)
    Fatal(-1, "process_NavigationInfo_set_bind", "called for a non-NavigationInfo node");
  NavigationInfo_node->set_bind((const SFBool&)value);
}

bool NavigationInfo::assign_avatarSize(const MFFloat& value)
{
  // TODO: value range check!
  avatarSize = value;
  status |= avatarSize_updated;
  timestamp = interface[1]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_NavigationInfo_avatarSize(SFNode* node, const fieldValue& value)
{
  NavigationInfo* NavigationInfo_node = dynamic_cast<NavigationInfo*>(node);
  if (!NavigationInfo_node)
    Fatal(-1, "assign_NavigationInfo_avatarSize", "called for a non-NavigationInfo node");
  return NavigationInfo_node->assign_avatarSize((const MFFloat&)value);
}

void NavigationInfo::set_avatarSize(const MFFloat& val)
{
  MFFloat tmpval(val);
  fieldValue v(&tmpval);
  interface[1]->assign(this, v);
}

bool NavigationInfo::assign_headlight(const SFBool& value)
{
  // TODO: value range check!
  headlight = value;
  status |= headlight_updated;
  timestamp = interface[2]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_NavigationInfo_headlight(SFNode* node, const fieldValue& value)
{
  NavigationInfo* NavigationInfo_node = dynamic_cast<NavigationInfo*>(node);
  if (!NavigationInfo_node)
    Fatal(-1, "assign_NavigationInfo_headlight", "called for a non-NavigationInfo node");
  return NavigationInfo_node->assign_headlight((const SFBool&)value);
}

void NavigationInfo::set_headlight(const SFBool& val)
{
  SFBool tmpval(val);
  fieldValue v(&tmpval);
  interface[2]->assign(this, v);
}

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

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

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

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

static bool assign_NavigationInfo_type(SFNode* node, const fieldValue& value)
{
  NavigationInfo* NavigationInfo_node = dynamic_cast<NavigationInfo*>(node);
  if (!NavigationInfo_node)
    Fatal(-1, "assign_NavigationInfo_type", "called for a non-NavigationInfo node");
  return NavigationInfo_node->assign_type((const MFString&)value);
}

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

bool NavigationInfo::assign_visibilityLimit(const SFFloat& value)
{
  // TODO: value range check!
  visibilityLimit = value;
  status |= visibilityLimit_updated;
  timestamp = interface[5]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_NavigationInfo_visibilityLimit(SFNode* node, const fieldValue& value)
{
  NavigationInfo* NavigationInfo_node = dynamic_cast<NavigationInfo*>(node);
  if (!NavigationInfo_node)
    Fatal(-1, "assign_NavigationInfo_visibilityLimit", "called for a non-NavigationInfo node");
  return NavigationInfo_node->assign_visibilityLimit((const SFFloat&)value);
}

void NavigationInfo::set_visibilityLimit(const SFFloat& val)
{
  SFFloat tmpval(val);
  fieldValue v(&tmpval);
  interface[5]->assign(this, v);
}

void NavigationInfo::post_isBound(void)
{
  interface[6]->post(this, interface[6]->value);
}

void NavigationInfo::post_isBound(const SFBool& val)
{
  isBound = val;
  status |= isBound_updated;
  post_isBound();
}

NavigationInfo::NavigationInfo()
{
  interfaceMember* the_interface[7] = {
    new eventIn("set_bind", tSFBool, process_NavigationInfo_set_bind),
    new exposedField("avatarSize", fieldValue(&avatarSize), assign_NavigationInfo_avatarSize),
    new exposedField("headlight", fieldValue(&headlight), assign_NavigationInfo_headlight),
    new exposedField("speed", fieldValue(&speed), assign_NavigationInfo_speed),
    new exposedField("type", fieldValue(&type), assign_NavigationInfo_type),
    new exposedField("visibilityLimit", fieldValue(&visibilityLimit), assign_NavigationInfo_visibilityLimit),
    new eventOut("isBound", fieldValue(&isBound)),
  };
  SFNode::construct(NavigationInfoTypeId, 7, the_interface);

  const SFFloat _avatarSize[3] = {0.25, 1.6, 0.75};
  avatarSize = MFFloat(3,(SFFloat *)_avatarSize);
  headlight = 1;
  speed = 1;
  const SFString _type[2] = {"WALK", "ANY"};
  type = MFString(2,(SFString *)_type);
  visibilityLimit = 0;
  isBound = 0;
  
  Bindable::util_init();
  Children::util_init();
  NavigationInfo::util_init();
}

void NavigationInfo::destruct(void)
{
  NavigationInfo::util_destruct();
  Bindable::util_destruct();
  Children::util_destruct();
  SFNode::destruct();
}

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

void NavigationInfo::clone_here(const NavigationInfo& src)
{
  SFNode::clone(src);
  
  interface[1]->value = fieldValue(&avatarSize);
  interface[2]->value = fieldValue(&headlight);
  interface[3]->value = fieldValue(&speed);
  interface[4]->value = fieldValue(&type);
  interface[5]->value = fieldValue(&visibilityLimit);
  interface[6]->value = fieldValue(&isBound);
  
  avatarSize = src.avatarSize;
  headlight = src.headlight;
  speed = src.speed;
  type = src.type;
  visibilityLimit = src.visibilityLimit;
  isBound = src.isBound;
  
  Bindable::util_clone(src);
  Children::util_clone(src);
  NavigationInfo::util_clone(src);
}

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

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

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

}  // namespace xrml
