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

#include "PhBHenyeyGreensteinPhaseFunction.H"
#include "xrmlP.H"

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

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

bool PhBHenyeyGreensteinPhaseFunction::assign_g(const SFFloat& value)
{
  // TODO: value range check!
  g = value;
  status |= g_updated;
  timestamp = interface[0]->timestamp = world ? world->time : 0;
  return true;
}

static bool assign_PhBHenyeyGreensteinPhaseFunction_g(SFNode* node, const fieldValue& value)
{
  PhBHenyeyGreensteinPhaseFunction* PhBHenyeyGreensteinPhaseFunction_node = dynamic_cast<PhBHenyeyGreensteinPhaseFunction*>(node);
  if (!PhBHenyeyGreensteinPhaseFunction_node)
    Fatal(-1, "assign_PhBHenyeyGreensteinPhaseFunction_g", "called for a non-PhBHenyeyGreensteinPhaseFunction node");
  return PhBHenyeyGreensteinPhaseFunction_node->assign_g((const SFFloat&)value);
}

void PhBHenyeyGreensteinPhaseFunction::set_g(const SFFloat& val)
{
  SFFloat tmpval(val);
  fieldValue v(&tmpval);
  interface[0]->assign(this, v);
}

PhBHenyeyGreensteinPhaseFunction::PhBHenyeyGreensteinPhaseFunction()
{
  interfaceMember* the_interface[1] = {
    new exposedField("g", fieldValue(&g), assign_PhBHenyeyGreensteinPhaseFunction_g),
  };
  SFNode::construct(PhBHenyeyGreensteinPhaseFunctionTypeId, 1, the_interface);

  g = 0;
  
  PhBPhaseFunction::util_init();
  PhBIsotropicPhaseFunction::util_init();
  PhBHenyeyGreensteinPhaseFunction::util_init();
}

void PhBHenyeyGreensteinPhaseFunction::destruct(void)
{
  PhBHenyeyGreensteinPhaseFunction::util_destruct();
  PhBIsotropicPhaseFunction::util_destruct();
  PhBPhaseFunction::util_destruct();
  SFNode::destruct();
}

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

void PhBHenyeyGreensteinPhaseFunction::clone_here(const PhBHenyeyGreensteinPhaseFunction& src)
{
  SFNode::clone(src);
  
  interface[0]->value = fieldValue(&g);
  
  g = src.g;
  
  PhBPhaseFunction::util_clone(src);
  PhBIsotropicPhaseFunction::util_clone(src);
  PhBHenyeyGreensteinPhaseFunction::util_clone(src);
}

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

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

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

}  // namespace xrml
