aliasmanager.cpp
Go to the documentation of this file.
00001 #include "yaml-cpp-pm/aliasmanager.h"
00002 #include "yaml-cpp-pm/node.h"
00003 #include <cassert>
00004 #include <sstream>
00005 
00006 namespace YAML_PM
00007 {
00008         AliasManager::AliasManager(): m_curAnchor(0)
00009         {
00010         }
00011 
00012         void AliasManager::RegisterReference(const Node& node)
00013         {
00014                 m_anchorByIdentity.insert(std::make_pair(&node, _CreateNewAnchor()));
00015         }
00016 
00017         anchor_t AliasManager::LookupAnchor(const Node& node) const
00018         {
00019                 AnchorByIdentity::const_iterator it = m_anchorByIdentity.find(&node);
00020                 if(it == m_anchorByIdentity.end())
00021                         return 0;
00022                 return it->second;
00023         }
00024 
00025         anchor_t AliasManager::_CreateNewAnchor()
00026         {
00027                 return ++m_curAnchor;
00028         }
00029 }


upstream_src
Author(s):
autogenerated on Mon Oct 6 2014 10:27:39