32 #ifndef VLXVisitorLinkMapper_INCLUDE_ONCE 33 #define VLXVisitorLinkMapper_INCLUDE_ONCE 65 if (obj->
uid() !=
"#NULL")
67 const std::map< std::string, vl::ref<VLXStructure> >::const_iterator it = mLinkMap->find(obj->
uid());
68 if (it == mLinkMap->end())
69 (*mLinkMap)[obj->
uid()] = obj;
72 if ( it->second != obj )
75 vl::Log::error(
vl::Say(
"ID '%s' used by '%s' is already assigned to another node '%s'!\n") << obj->
uid() << obj->
tag() << it->second->tag() );
88 for(
size_t i=0; i<obj->
value().size(); ++i)
91 obj->
value()[i].value().getStructure()->acceptVisitor(
this);
94 obj->
value()[i].value().getList()->acceptVisitor(
this);
107 for(
size_t i=0; i<list->
value().size(); ++i)
110 list->
value()[i].getStructure()->acceptVisitor(
this);
113 list->
value()[i].getList()->acceptVisitor(
this);
129 EError
error()
const {
return mError; }
134 std::map< std::string, vl::ref<VLXStructure> >* mLinkMap;
A simple String formatting class.
static void warning(const String &message)
Use this function to provide information about situations that might lead to errors or loss of data...
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
An array of 64 bits floating point numbers, can also have a tag.
virtual void visitStructure(VLXStructure *obj)
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Compiles the link-map which associates a VLXStructure to it's ID, to be used later by other visitors...
std::vector< VLXValue > & value()
A list of key/VLXValue pairs, can also have a tag.
virtual void visitList(VLXList *list)
A simple sequence of VLXValue objects, can also have a tag.
const std::string & tag() const
virtual void visitArray(VLXArrayReal *)
std::vector< KeyValue > & value()
void setError(EError err)
An array of 64 bits integers, can also have a tag.
Base class for all visitors visiting a VLX hierarchy.
const std::string & uid() const
VisitorLinkMapper(std::map< std::string, vl::ref< VLXStructure > > *map=NULL)
The ref<> class is used to reference-count an Object.
bool isVisited(void *node)
virtual void visitArray(VLXArrayInteger *)
void declareID(VLXStructure *obj)
void setLinkMap(std::map< std::string, vl::ref< VLXStructure > > *map)