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

#include "Inline.H"
#include "xrmlP.H"

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

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

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

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

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

bool Inline::assign_bboxCenter(const SFVec3f& value)
{
  // TODO: value range check!
  bboxCenter = value;
  status |= bboxCenter_updated;
  timestamp = interface[1]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_Inline_bboxCenter(SFNode* node, const fieldValue& value)
{
  Inline* Inline_node = dynamic_cast<Inline*>(node);
  if (!Inline_node)
    Fatal(-1, "assign_Inline_bboxCenter", "called for a non-Inline node");
  return Inline_node->assign_bboxCenter((const SFVec3f&)value);
}

bool Inline::assign_bboxSize(const SFVec3f& value)
{
  // TODO: value range check!
  bboxSize = value;
  status |= bboxSize_updated;
  timestamp = interface[2]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_Inline_bboxSize(SFNode* node, const fieldValue& value)
{
  Inline* Inline_node = dynamic_cast<Inline*>(node);
  if (!Inline_node)
    Fatal(-1, "assign_Inline_bboxSize", "called for a non-Inline node");
  return Inline_node->assign_bboxSize((const SFVec3f&)value);
}

Inline::Inline()
{
  interfaceMember* the_interface[3] = {
    new exposedField("url", fieldValue(&url), assign_Inline_url),
    new field("bboxCenter", fieldValue(&bboxCenter), assign_Inline_bboxCenter),
    new field("bboxSize", fieldValue(&bboxSize), assign_Inline_bboxSize),
  };
  SFNode::construct(InlineTypeId, 3, the_interface);

  url = MFString(0);
  bboxCenter = SFVec3f(0,0,0);
  bboxSize = SFVec3f(-1,-1,-1);
  
  Grouping::util_init();
  Children::util_init();
  Inline::util_init();
}

void Inline::destruct(void)
{
  Inline::util_destruct();
  Grouping::util_destruct();
  Children::util_destruct();
  SFNode::destruct();
}

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

void Inline::clone_here(const Inline& src)
{
  SFNode::clone(src);
  
  interface[0]->value = fieldValue(&url);
  interface[1]->value = fieldValue(&bboxCenter);
  interface[2]->value = fieldValue(&bboxSize);
  
  url = src.url;
  bboxCenter = src.bboxCenter;
  bboxSize = src.bboxSize;
  
  Grouping::util_clone(src);
  Children::util_clone(src);
  Inline::util_clone(src);
}

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

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

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

}  // namespace xrml
