stores data, to files or memory. Contains functionality to read from files and create any xml representation using libxml2 More...
#include <XMLTag.h>
Public Member Functions | |
int | AddChild (XMLTag *child, int position=-1) |
void | AddProperty (const std::string &name, const std::string &value) |
void | AddProperty (const std::string &name, const unsigned long &value) |
void | AddProperty (const std::string &name, const long &value) |
void | AddProperty (const std::string &name, const int &value) |
void | AddProperty (const std::string &name, const double &value) |
XMLTag * | Clone () const |
unsigned int | CountChildren () const |
unsigned long | date () |
void | FreeAfterWriteToString () |
Free internal memory after WriteToString. | |
double | GetCDataDouble () const |
int | GetCDataInt () const |
std::string | GetCDataST () const |
unsigned long | GetCDataUlong () const |
XMLTag * | GetChild (const unsigned int &position) |
XMLTag * | GetChild (const std::string &name) |
XMLTag * | GetChild (const std::string &name, int innerindex) |
std::string & | GetName () |
std::string | GetProperty (const std::string &name, std::string defaultValue="") |
double | GetPropertyDouble (const std::string &name, double defaultValue=0.0) |
int | GetPropertyInt (const std::string &name, int defaultValue=0) |
int | getQueryType () |
std::vector< std::string > | GetSubFilenames () |
GetSubFilenames collects all additional files the xml file depends. | |
void | RemoveChild (const unsigned int &position) |
void | RemoveChild (const std::string &name) |
void | ReplaceChild (XMLTag *child, int position) |
void | ReplaceSubFilenames (std::string global_path) |
void | SetCData (const int &value) |
void | SetCData (const long &value) |
void | SetCData (const unsigned long &value) |
void | SetCData (const double &value) |
void | SetCData (const std::string &value) |
void | SetName (std::string name) |
virtual void | Write (xmlTextWriter *pWriter) const |
void | WriteToFile (const std::string &stFile, XMLTag **fileReference=NULL) const |
char * | WriteToString () |
Writes an XMLTag to an string. | |
XMLTag (std::string name) | |
virtual | ~XMLTag () |
Static Public Member Functions | |
template<typename T > | |
static T | Load (XMLTag *tag, T *t) |
template<typename T > | |
static std::vector< T > | Load (XMLTag *tag, std::vector< T > *) |
template<typename T1 , typename T2 > | |
static std::map< T1, T2 > | Load (XMLTag *tag, std::map< T1, T2 > *map) |
template<typename T1 , typename T2 > | |
static std::pair< T1, T2 > | Load (XMLTag *tag, std::pair< T1, T2 > *) |
template<typename T3 > | |
static AlgorithmEval< T3 > | Load (XMLTag *tag, AlgorithmEval< T3 > *) |
static int | Load (XMLTag *tag, int *) |
static int | Load (XMLTag *tag, unsigned long *) |
static double | Load (XMLTag *tag, double *) |
static std::string | Load (XMLTag *tag, std::string *) |
static Elem * | Load (XMLTag *tag, Elem **) |
static Algorithm< std::vector < RelPose * > > * | Load (XMLTag *tag, Algorithm< std::vector< RelPose * > > **) |
static Algorithm< ImprovedPose > * | Load (XMLTag *tag, Algorithm< ImprovedPose > **) |
static Algorithm< Descriptor * > * | Load (XMLTag *tag, Algorithm< Descriptor * > **) |
static Algorithm< std::vector < Signature * > > * | Load (XMLTag *tag, Algorithm< std::vector< Signature * > > **) |
static Sensor * | Load (XMLTag *tag, Sensor **) |
static Matrix | Load (XMLTag *tag, Matrix *m) |
Load a Mtrix. | |
static unsigned int | OldTag () |
static XMLTag * | Read (xmlTextReader *pReader) |
static XMLTag * | ReadFromFile (const std::string &stFile) |
template<typename T > | |
static XMLTag * | Tag (std::vector< T > vector, std::string name="") |
template<typename T1 , typename T2 > | |
static XMLTag * | Tag (std::map< T1, T2 > map, std::string name="") |
template<typename T1 , typename T2 > | |
static XMLTag * | Tag (std::pair< T1, T2 > p, std::string name="") |
template<typename T3 > | |
static XMLTag * | Tag (AlgorithmEval< T3 > eval, std::string name="") |
static XMLTag * | Tag (int n, std::string name="") |
static XMLTag * | Tag (long n, std::string name="") |
static XMLTag * | Tag (unsigned long n, std::string name="") |
static XMLTag * | Tag (double d, std::string name="") |
static XMLTag * | Tag (std::string value, std::string name="") |
static XMLTag * | Tag (Elem *elem, std::string name="") |
static XMLTag * | Tag (Algorithm< ImprovedPose > *alg, std::string name="") |
static XMLTag * | Tag (Algorithm< std::vector< Signature * > > *alg, std::string name="") |
static XMLTag * | Tag (Algorithm< std::vector< RelPose * > > *alg, std::string name="") |
static XMLTag * | Tag (Algorithm< Descriptor * > *alg, std::string name="") |
static XMLTag * | Tag (Sensor *sensor, std::string name="") |
static XMLTag * | Tag (const Matrix &alg, std::string name="") |
Private Member Functions | |
void | DocWrite (xmlNode *n) const |
void | GetSubFilenames (std::vector< std::string > &strings) |
collects recursively all additional files the xml file depends | |
void | Touch () |
Private Attributes | |
std::string | m_cData |
std::vector< XMLTag * > | m_children |
xmlDoc * | m_doc |
unsigned long | m_lastChanged |
std::string | m_name |
std::map< std::string, std::string > | m_properties |
xmlChar * | m_xmlbuff |
stores data, to files or memory. Contains functionality to read from files and create any xml representation using libxml2
class XMLTag intern class for handling xml transfer
XMLTag::XMLTag | ( | std::string | name | ) |
Constructor, sets the tag name
name | the tags name ( <name> </name>) |
Definition at line 47 of file XMLTag.cpp.
XMLTag::~XMLTag | ( | ) | [virtual] |
Destructor
Definition at line 181 of file XMLTag.cpp.
int XMLTag::AddChild | ( | XMLTag * | child, |
int | position = -1 |
||
) |
AddChild: adds a child node to a tag
Adds a child node to a tag, the position where to put it can be influenced if the position is larger or smaller than the possible range the element will be put at the end of the list.
child | pointer to an existing tag, a null child will not be appended |
position | position where to put the cild in the child list |
Definition at line 479 of file XMLTag.cpp.
void XMLTag::AddProperty | ( | const std::string & | name, |
const std::string & | value | ||
) |
AddProperty: adds a property as an attribute to the current tag
adds a property as an attribute to the current tag
name | name of the property, works as a key |
value | value of the property |
Definition at line 359 of file XMLTag.cpp.
void XMLTag::AddProperty | ( | const std::string & | name, |
const unsigned long & | value | ||
) |
AddProperty: adds a property as an attribute to the current tag
adds a property as an attribute to the current tag
name | name of the property, works as a key |
value | value of the property |
Definition at line 366 of file XMLTag.cpp.
void XMLTag::AddProperty | ( | const std::string & | name, |
const long & | value | ||
) |
Definition at line 374 of file XMLTag.cpp.
void XMLTag::AddProperty | ( | const std::string & | name, |
const int & | value | ||
) |
AddProperty: adds a property as an attribute to the current tag
adds a property as an attribute to the current tag
name | name of the property, works as a key |
value | value of the property |
Definition at line 383 of file XMLTag.cpp.
void XMLTag::AddProperty | ( | const std::string & | name, |
const double & | value | ||
) |
AddProperty: adds a property as an attribute to the current tag
adds a property as an attribute to the current tag
name | name of the property, works as a key |
value | value of the property |
Definition at line 392 of file XMLTag.cpp.
XMLTag * XMLTag::Clone | ( | ) | const |
Clone: clones the current tag and returns it
clone includes recursive copying of all children
Definition at line 300 of file XMLTag.cpp.
unsigned int XMLTag::CountChildren | ( | ) | const |
CountChildren: counts the childdren-tags of the current tag
Counts the children
Definition at line 508 of file XMLTag.cpp.
unsigned long XMLTag::date | ( | ) |
Definition at line 586 of file XMLTag.cpp.
void XMLTag::DocWrite | ( | xmlNode * | n | ) | const [private] |
DocWrite: adds the content to a memory buffer
writes a tag to the given node
n | bnode |
Definition at line 236 of file XMLTag.cpp.
void XMLTag::FreeAfterWriteToString | ( | ) |
Free internal memory after WriteToString.
FreeAfterWriteToString
Definition at line 251 of file XMLTag.cpp.
double XMLTag::GetCDataDouble | ( | ) | const |
Definition at line 418 of file XMLTag.cpp.
int XMLTag::GetCDataInt | ( | ) | const |
GetCData*: returns the current content
Definition at line 408 of file XMLTag.cpp.
std::string XMLTag::GetCDataST | ( | ) | const |
Definition at line 422 of file XMLTag.cpp.
unsigned long XMLTag::GetCDataUlong | ( | ) | const |
Definition at line 413 of file XMLTag.cpp.
XMLTag * XMLTag::GetChild | ( | const unsigned int & | position | ) |
GetChild: returns a child tag
returns a child tag
position | descriptor for the child |
Definition at line 537 of file XMLTag.cpp.
XMLTag * XMLTag::GetChild | ( | const std::string & | name | ) |
Definition at line 553 of file XMLTag.cpp.
XMLTag * XMLTag::GetChild | ( | const std::string & | name, |
int | innerindex | ||
) |
Definition at line 568 of file XMLTag.cpp.
std::string& cop::XMLTag::GetName | ( | ) | [inline] |
std::string XMLTag::GetProperty | ( | const std::string & | name, |
std::string | defaultValue = "" |
||
) |
GetProperty*: returns the value of a property
Returns the current value of a property
name | name of the property |
defaultValue | the value if there is no poperty of this name is empty ("", 0, 0.0) |
Definition at line 458 of file XMLTag.cpp.
double XMLTag::GetPropertyDouble | ( | const std::string & | name, |
double | defaultValue = 0.0 |
||
) |
Definition at line 465 of file XMLTag.cpp.
int XMLTag::GetPropertyInt | ( | const std::string & | name, |
int | defaultValue = 0 |
||
) |
Definition at line 472 of file XMLTag.cpp.
int XMLTag::getQueryType | ( | ) |
Definition at line 591 of file XMLTag.cpp.
std::vector< std::string > XMLTag::GetSubFilenames | ( | ) |
GetSubFilenames collects all additional files the xml file depends.
GetSubFilenames:
Definition at line 601 of file XMLTag.cpp.
void XMLTag::GetSubFilenames | ( | std::vector< std::string > & | strings | ) | [private] |
collects recursively all additional files the xml file depends
GetSubFilenames:
Definition at line 609 of file XMLTag.cpp.
static T cop::XMLTag::Load | ( | XMLTag * | tag, |
T * | t | ||
) | [inline, static] |
Load: Load a Type T from a XMLTag
Supported Types are for example: vector, pair, double, int, string, Matrix Elem, Algorithm, Camera
tag | the tag that was read from a file or created with a Tag function |
t | a pointer that specifies the wished class (necessary for resolving the template) |
char* | with an error message in case of failure |
static std::vector<T> cop::XMLTag::Load | ( | XMLTag * | tag, |
std::vector< T > * | |||
) | [inline, static] |
static std::map<T1, T2> cop::XMLTag::Load | ( | XMLTag * | tag, |
std::map< T1, T2 > * | map | ||
) | [inline, static] |
static std::pair<T1, T2> cop::XMLTag::Load | ( | XMLTag * | tag, |
std::pair< T1, T2 > * | |||
) | [inline, static] |
static AlgorithmEval<T3> cop::XMLTag::Load | ( | XMLTag * | tag, |
AlgorithmEval< T3 > * | |||
) | [inline, static] |
static int cop::XMLTag::Load | ( | XMLTag * | tag, |
int * | |||
) | [inline, static] |
static int cop::XMLTag::Load | ( | XMLTag * | tag, |
unsigned long * | |||
) | [inline, static] |
static double cop::XMLTag::Load | ( | XMLTag * | tag, |
double * | |||
) | [inline, static] |
static std::string cop::XMLTag::Load | ( | XMLTag * | tag, |
std::string * | |||
) | [inline, static] |
static Elem* cop::XMLTag::Load | ( | XMLTag * | tag, |
Elem ** | |||
) | [inline, static] |
static Algorithm<std::vector<RelPose*> >* cop::XMLTag::Load | ( | XMLTag * | tag, |
Algorithm< std::vector< RelPose * > > ** | |||
) | [inline, static] |
static Algorithm<ImprovedPose>* cop::XMLTag::Load | ( | XMLTag * | tag, |
Algorithm< ImprovedPose > ** | |||
) | [inline, static] |
static Algorithm<Descriptor*>* cop::XMLTag::Load | ( | XMLTag * | tag, |
Algorithm< Descriptor * > ** | |||
) | [inline, static] |
static Algorithm<std::vector<Signature*> >* cop::XMLTag::Load | ( | XMLTag * | tag, |
Algorithm< std::vector< Signature * > > ** | |||
) | [inline, static] |
static Sensor* cop::XMLTag::Load | ( | XMLTag * | tag, |
Sensor ** | |||
) | [inline, static] |
Matrix XMLTag::Load | ( | XMLTag * | tag, |
Matrix * | m | ||
) | [static] |
Load a Mtrix.
Load
tag | xml part containing a matrix (see newmat, or lo) |
m | value of the property |
Definition at line 160 of file XMLTag.cpp.
static unsigned int cop::XMLTag::OldTag | ( | ) | [inline, static] |
XMLTag * XMLTag::Read | ( | xmlTextReader * | pReader | ) | [static] |
Read: Reads an XMLTag from a readeer
Supporting function for ReadFromFile
pReader | pointer to an libxml2 xmlTextReader |
Definition at line 315 of file XMLTag.cpp.
XMLTag * XMLTag::ReadFromFile | ( | const std::string & | stFile | ) | [static] |
ReadFromFile: Creates a new XMLTag from a file
As constructor this would have had the same function signature as the std. constructor so its a static function
stFile | absolut filename |
Definition at line 281 of file XMLTag.cpp.
void XMLTag::RemoveChild | ( | const unsigned int & | position | ) |
RemoveChild: removes an XMLTag* from the list
Removes a child node
position | position where to erase a cild |
Definition at line 513 of file XMLTag.cpp.
void XMLTag::RemoveChild | ( | const std::string & | name | ) |
RemoveChild: removes an XMLTag* from the list
name | name of a cild |
Definition at line 522 of file XMLTag.cpp.
void XMLTag::ReplaceChild | ( | XMLTag * | child, |
int | position | ||
) |
ReplaceChild: adds a child node to a tag
Replaces a child node to a tag, the position where to put it can be influenced by position
child | pointer to an existing tag, a null child will not be appended |
position | position where to put the cild in the child list |
Definition at line 493 of file XMLTag.cpp.
void XMLTag::ReplaceSubFilenames | ( | std::string | global_path | ) |
Definition at line 656 of file XMLTag.cpp.
void XMLTag::SetCData | ( | const int & | value | ) |
SetCData: sets the current content of the tag
sets the current content of a tag
value | content of the tag |
Definition at line 427 of file XMLTag.cpp.
void XMLTag::SetCData | ( | const long & | value | ) |
Definition at line 443 of file XMLTag.cpp.
void XMLTag::SetCData | ( | const unsigned long & | value | ) |
Definition at line 435 of file XMLTag.cpp.
void XMLTag::SetCData | ( | const double & | value | ) |
SetCData: sets the current content of the tag
sets the current content of a tag
value | content of the tag |
Definition at line 400 of file XMLTag.cpp.
void XMLTag::SetCData | ( | const std::string & | value | ) |
SetCData: sets the current content of the tag
sets the current content of a tag
value | content of the tag |
Definition at line 452 of file XMLTag.cpp.
void cop::XMLTag::SetName | ( | std::string | name | ) | [inline] |
static XMLTag* cop::XMLTag::Tag | ( | std::vector< T > | vector, |
std::string | name = "" |
||
) | [inline, static] |
Tag: creates XMLTags from standard types, like vector pair, int, double, Elem
vector | contains the element that should be saved in the tag |
name | defines the name of the node, there are standard names for every implemented tag |
static XMLTag* cop::XMLTag::Tag | ( | std::map< T1, T2 > | map, |
std::string | name = "" |
||
) | [inline, static] |
static XMLTag* cop::XMLTag::Tag | ( | std::pair< T1, T2 > | p, |
std::string | name = "" |
||
) | [inline, static] |
static XMLTag* cop::XMLTag::Tag | ( | AlgorithmEval< T3 > | eval, |
std::string | name = "" |
||
) | [inline, static] |
XMLTag * XMLTag::Tag | ( | int | n, |
std::string | name = "" |
||
) | [static] |
Definition at line 53 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | long | n, |
std::string | name = "" |
||
) | [static] |
Definition at line 63 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | unsigned long | n, |
std::string | name = "" |
||
) | [static] |
Definition at line 72 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | double | d, |
std::string | name = "" |
||
) | [static] |
Definition at line 81 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | std::string | value, |
std::string | name = "" |
||
) | [static] |
Definition at line 90 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | Elem * | elem, |
std::string | name = "" |
||
) | [static] |
Definition at line 99 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | Algorithm< ImprovedPose > * | alg, |
std::string | name = "" |
||
) | [static] |
Definition at line 105 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | Algorithm< std::vector< Signature * > > * | alg, |
std::string | name = "" |
||
) | [static] |
Definition at line 112 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | Algorithm< std::vector< RelPose * > > * | alg, |
std::string | name = "" |
||
) | [static] |
Definition at line 120 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | Algorithm< Descriptor * > * | alg, |
std::string | name = "" |
||
) | [static] |
Definition at line 127 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | Sensor * | sensor, |
std::string | name = "" |
||
) | [static] |
Definition at line 135 of file XMLTag.cpp.
XMLTag * XMLTag::Tag | ( | const Matrix & | alg, |
std::string | name = "" |
||
) | [static] |
Definition at line 141 of file XMLTag.cpp.
void XMLTag::Touch | ( | ) | [private] |
void XMLTag::Write | ( | xmlTextWriter * | pWriter | ) | const [virtual] |
Write: helping function for WriteToFile
Writes an XMLTag to an File,
pWriter | pointer to the xmlWriter |
Definition at line 261 of file XMLTag.cpp.
void XMLTag::WriteToFile | ( | const std::string & | stFile, |
XMLTag ** | fileReference = NULL |
||
) | const |
Methods WriteToFile: Writes an XMLTag to an File
Writes an XMLTag to an File, can return a XMLTag* that refers the file. Such a file reference will be resolved when it is a child of another node and GetChild is called
stFile | absolut filename |
fileReference | a pointer that receives the pointer to the new file reference tag |
Definition at line 197 of file XMLTag.cpp.
char * XMLTag::WriteToString | ( | ) |
Writes an XMLTag to an string.
WriteToFile
Definition at line 221 of file XMLTag.cpp.
std::string cop::XMLTag::m_cData [private] |
std::vector<XMLTag*> cop::XMLTag::m_children [private] |
xmlDoc* cop::XMLTag::m_doc [private] |
unsigned long cop::XMLTag::m_lastChanged [private] |
std::string cop::XMLTag::m_name [private] |
std::map<std::string, std::string> cop::XMLTag::m_properties [private] |
xmlChar* cop::XMLTag::m_xmlbuff [private] |