#include "ClonerStateVariables.h" #include "X3DAbstractNode.h" #include #include #include using namespace std; namespace X3DTK { ClonerStateVariables::ClonerStateVariables() : StateVariables(), _root(0) { } ClonerStateVariables::~ClonerStateVariables() { } void ClonerStateVariables::initRoot() { _root = 0; } void ClonerStateVariables::init() { _nodeStack.push_front(0); } void ClonerStateVariables::finish() { _nodeStack.clear(); _nodeCoupleMap.clear(); } void ClonerStateVariables::addCoupleNode(SFNode N, SFNode NN) { _nodeCoupleMap[N] = NN; } void ClonerStateVariables::pushNode(SFNode N) { SFNode T = getTop(); if (T != 0) T->setChild(N); // filling the stack. _nodeStack.push_front(N); // init root node. if (_root == 0) _root = N; } void ClonerStateVariables::popNode() { _nodeStack.pop_front(); } SFNode ClonerStateVariables::getNode(SFNode N) const { map::const_iterator it = _nodeCoupleMap.find(N); if (it != _nodeCoupleMap.end()) return (*it).second; return 0; } }