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

#include "PhBLafortuneReflector.H"
#include "xrmlP.H"

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

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

bool PhBLafortuneReflector::assign_C(const SFVec3f& value)
{
  // TODO: value range check!
  C = value;
  status |= C_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBLafortuneReflector_C(SFNode* node, const fieldValue& value)
{
  PhBLafortuneReflector* PhBLafortuneReflector_node = dynamic_cast<PhBLafortuneReflector*>(node);
  if (!PhBLafortuneReflector_node)
    Fatal(-1, "assign_PhBLafortuneReflector_C", "called for a non-PhBLafortuneReflector node");
  return PhBLafortuneReflector_node->assign_C((const SFVec3f&)value);
}

void PhBLafortuneReflector::set_C(const SFVec3f& val)
{
  SFVec3f tmpval(val);
  fieldValue v(&tmpval);
  interface[0]->assign(this, v);
}

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

static bool assign_PhBLafortuneReflector_n(SFNode* node, const fieldValue& value)
{
  PhBLafortuneReflector* PhBLafortuneReflector_node = dynamic_cast<PhBLafortuneReflector*>(node);
  if (!PhBLafortuneReflector_node)
    Fatal(-1, "assign_PhBLafortuneReflector_n", "called for a non-PhBLafortuneReflector node");
  return PhBLafortuneReflector_node->assign_n((const SFFloat&)value);
}

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

PhBLafortuneReflector::PhBLafortuneReflector()
{
  interfaceMember* the_interface[2] = {
    new exposedField("C", fieldValue(&C), assign_PhBLafortuneReflector_C),
    new exposedField("n", fieldValue(&n), assign_PhBLafortuneReflector_n),
  };
  SFNode::construct(PhBLafortuneReflectorTypeId, 2, the_interface);

  C = SFVec3f(-1,-1,1);
  n = 10;
  
  PhBScatterer::util_init();
  PhBLafortuneReflector::util_init();
}

void PhBLafortuneReflector::destruct(void)
{
  PhBLafortuneReflector::util_destruct();
  PhBScatterer::util_destruct();
  SFNode::destruct();
}

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

void PhBLafortuneReflector::clone_here(const PhBLafortuneReflector& src)
{
  SFNode::clone(src);
  
  interface[0]->value = fieldValue(&C);
  interface[1]->value = fieldValue(&n);
  
  C = src.C;
  n = src.n;
  
  PhBScatterer::util_clone(src);
  PhBLafortuneReflector::util_clone(src);
}

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

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

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

}  // namespace xrml
