#include "X3DAbstractNodeForward.h"

namespace X3DTK {

template<class T, class V>
MFNodeRecorder<T, V>::MFNodeRecorder(const SFString &name, MFNode T:: *nodes)
: X3DMFNodeRecorder(), _name(name), _nodes(nodes)
{
}

template<class T, class V>
void MFNodeRecorder<T, V>::record(X3DAbstractNode *N) const
{
  SFType *type = X3DAbstractNode_getType(N);
    
  for (std::vector<std::pair<SFString, X3DMFNodeFunctor *> >::iterator it = type->nodesMap().begin(); it != type->nodesMap().end(); ++it)
  {
    if ((*it).first == _name)
      return;
  }
  
  type->nodesMap().push_back(std::pair<SFString, X3DMFNodeFunctor *>(_name, new MFNodeFunctor<T, V>(_nodes))); 
}

}
