All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
cop::XMLTag Class Reference

stores data, to files or memory. Contains functionality to read from files and create any xml representation using libxml2 More...

#include <XMLTag.h>

Inheritance diagram for cop::XMLTag:
Inheritance graph
[legend]

List of all members.

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)
XMLTagClone () 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
XMLTagGetChild (const unsigned int &position)
XMLTagGetChild (const std::string &name)
XMLTagGetChild (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 ElemLoad (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 SensorLoad (XMLTag *tag, Sensor **)
static Matrix Load (XMLTag *tag, Matrix *m)
 Load a Mtrix.
static unsigned int OldTag ()
static XMLTagRead (xmlTextReader *pReader)
static XMLTagReadFromFile (const std::string &stFile)
template<typename T >
static XMLTagTag (std::vector< T > vector, std::string name="")
template<typename T1 , typename T2 >
static XMLTagTag (std::map< T1, T2 > map, std::string name="")
template<typename T1 , typename T2 >
static XMLTagTag (std::pair< T1, T2 > p, std::string name="")
template<typename T3 >
static XMLTagTag (AlgorithmEval< T3 > eval, std::string name="")
static XMLTagTag (int n, std::string name="")
static XMLTagTag (long n, std::string name="")
static XMLTagTag (unsigned long n, std::string name="")
static XMLTagTag (double d, std::string name="")
static XMLTagTag (std::string value, std::string name="")
static XMLTagTag (Elem *elem, std::string name="")
static XMLTagTag (Algorithm< ImprovedPose > *alg, std::string name="")
static XMLTagTag (Algorithm< std::vector< Signature * > > *alg, std::string name="")
static XMLTagTag (Algorithm< std::vector< RelPose * > > *alg, std::string name="")
static XMLTagTag (Algorithm< Descriptor * > *alg, std::string name="")
static XMLTagTag (Sensor *sensor, std::string name="")
static XMLTagTag (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
xmlDocm_doc
unsigned long m_lastChanged
std::string m_name
std::map< std::string,
std::string > 
m_properties
xmlCharm_xmlbuff

Detailed Description

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

Definition at line 71 of file XMLTag.h.


Constructor & Destructor Documentation

XMLTag::XMLTag ( std::string  name)

Constructor, sets the tag name

Parameters:
namethe tags name ( <name> </name>)

Definition at line 47 of file XMLTag.cpp.

XMLTag::~XMLTag ( ) [virtual]

Destructor

Definition at line 181 of file XMLTag.cpp.


Member Function Documentation

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.

Parameters:
childpointer to an existing tag, a null child will not be appended
positionposition where to put the cild in the child list
Returns:
final position that was selected, or -1
Remarks:
child = NULL will not be appended and -1 will be returned

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

Parameters:
namename of the property, works as a key
valuevalue 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

Parameters:
namename of the property, works as a key
valuevalue 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

Parameters:
namename of the property, works as a key
valuevalue 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

Parameters:
namename of the property, works as a key
valuevalue 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

Returns:
number of 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

Parameters:
nbnode

Definition at line 236 of file XMLTag.cpp.

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

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

Parameters:
positiondescriptor for the child
Returns:
a child tag

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]

GetName: returns the name of a tag

The name of the tag (<name></name>)

Definition at line 736 of file XMLTag.h.

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

Parameters:
namename of the property
defaultValuethe 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.

Definition at line 591 of file XMLTag.cpp.

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.

template<typename T >
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

Parameters:
tagthe tag that was read from a file or created with a Tag function
ta pointer that specifies the wished class (necessary for resolving the template)
Exceptions:
char*with an error message in case of failure

Definition at line 282 of file XMLTag.h.

template<typename T >
static std::vector<T> cop::XMLTag::Load ( XMLTag tag,
std::vector< T > *   
) [inline, static]

We read a comment

Definition at line 288 of file XMLTag.h.

template<typename T1 , typename T2 >
static std::map<T1, T2> cop::XMLTag::Load ( XMLTag tag,
std::map< T1, T2 > *  map 
) [inline, static]

Definition at line 318 of file XMLTag.h.

template<typename T1 , typename T2 >
static std::pair<T1, T2> cop::XMLTag::Load ( XMLTag tag,
std::pair< T1, T2 > *   
) [inline, static]

Definition at line 351 of file XMLTag.h.

template<typename T3 >
static AlgorithmEval<T3> cop::XMLTag::Load ( XMLTag tag,
AlgorithmEval< T3 > *   
) [inline, static]

Definition at line 363 of file XMLTag.h.

static int cop::XMLTag::Load ( XMLTag tag,
int *   
) [inline, static]

Definition at line 368 of file XMLTag.h.

static int cop::XMLTag::Load ( XMLTag tag,
unsigned long *   
) [inline, static]

Definition at line 375 of file XMLTag.h.

static double cop::XMLTag::Load ( XMLTag tag,
double *   
) [inline, static]

Definition at line 382 of file XMLTag.h.

static std::string cop::XMLTag::Load ( XMLTag tag,
std::string *   
) [inline, static]

Definition at line 389 of file XMLTag.h.

static Elem* cop::XMLTag::Load ( XMLTag tag,
Elem **   
) [inline, static]

Definition at line 396 of file XMLTag.h.

static Algorithm<std::vector<RelPose*> >* cop::XMLTag::Load ( XMLTag tag,
Algorithm< std::vector< RelPose * > > **   
) [inline, static]

Definition at line 403 of file XMLTag.h.

static Algorithm<ImprovedPose>* cop::XMLTag::Load ( XMLTag tag,
Algorithm< ImprovedPose > **   
) [inline, static]

Definition at line 410 of file XMLTag.h.

static Algorithm<Descriptor*>* cop::XMLTag::Load ( XMLTag tag,
Algorithm< Descriptor * > **   
) [inline, static]

Definition at line 418 of file XMLTag.h.

static Algorithm<std::vector<Signature*> >* cop::XMLTag::Load ( XMLTag tag,
Algorithm< std::vector< Signature * > > **   
) [inline, static]

Definition at line 426 of file XMLTag.h.

static Sensor* cop::XMLTag::Load ( XMLTag tag,
Sensor **   
) [inline, static]

Definition at line 433 of file XMLTag.h.

Matrix XMLTag::Load ( XMLTag tag,
Matrix m 
) [static]

Load a Mtrix.

Load

Parameters:
tagxml part containing a matrix (see newmat, or lo)
mvalue of the property

Definition at line 160 of file XMLTag.cpp.

static unsigned int cop::XMLTag::OldTag ( ) [inline, static]

Definition at line 740 of file XMLTag.h.

XMLTag * XMLTag::Read ( xmlTextReader pReader) [static]

Read: Reads an XMLTag from a readeer

Supporting function for ReadFromFile

Parameters:
pReaderpointer 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

Parameters:
stFileabsolut filename
Remarks:
can return NULL if the file does not contain a tag

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

Parameters:
positionposition where to erase a cild
Remarks:
the tag will not be deleted!

Definition at line 513 of file XMLTag.cpp.

void XMLTag::RemoveChild ( const std::string &  name)

RemoveChild: removes an XMLTag* from the list

Parameters:
namename of a cild
Remarks:
the tag will not be deleted!

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

Parameters:
childpointer to an existing tag, a null child will not be appended
positionposition where to put the cild in the child list
Remarks:
child == NULL will not be appended

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

Parameters:
valuecontent 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

Parameters:
valuecontent 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

Parameters:
valuecontent of the tag

Definition at line 452 of file XMLTag.cpp.

void cop::XMLTag::SetName ( std::string  name) [inline]

Definition at line 737 of file XMLTag.h.

template<typename T >
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

Parameters:
vectorcontains the element that should be saved in the tag
namedefines the name of the node, there are standard names for every implemented tag
Remarks:
pairs and vectors of any supported Type T are allowed, too

Definition at line 206 of file XMLTag.h.

template<typename T1 , typename T2 >
static XMLTag* cop::XMLTag::Tag ( std::map< T1, T2 >  map,
std::string  name = "" 
) [inline, static]

Definition at line 224 of file XMLTag.h.

template<typename T1 , typename T2 >
static XMLTag* cop::XMLTag::Tag ( std::pair< T1, T2 >  p,
std::string  name = "" 
) [inline, static]

Definition at line 238 of file XMLTag.h.

template<typename T3 >
static XMLTag* cop::XMLTag::Tag ( AlgorithmEval< T3 >  eval,
std::string  name = "" 
) [inline, static]

Definition at line 246 of file XMLTag.h.

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]

Touch

function to reset the timestamp

Parameters:
nbnode

Definition at line 596 of file XMLTag.cpp.

void XMLTag::Write ( xmlTextWriter pWriter) const [virtual]

Write: helping function for WriteToFile

Writes an XMLTag to an File,

Parameters:
pWriterpointer 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

Parameters:
stFileabsolut filename
fileReferencea pointer that receives the pointer to the new file reference tag
Remarks:
file name will not be checked

Definition at line 197 of file XMLTag.cpp.

Writes an XMLTag to an string.

WriteToFile

Remarks:
free the internally allocated memory with FreeAfterWriteToString

Definition at line 221 of file XMLTag.cpp.


Member Data Documentation

std::string cop::XMLTag::m_cData [private]

Definition at line 814 of file XMLTag.h.

Definition at line 813 of file XMLTag.h.

Definition at line 818 of file XMLTag.h.

unsigned long cop::XMLTag::m_lastChanged [private]

Definition at line 812 of file XMLTag.h.

std::string cop::XMLTag::m_name [private]

Definition at line 815 of file XMLTag.h.

std::map<std::string, std::string> cop::XMLTag::m_properties [private]

Definition at line 816 of file XMLTag.h.

Definition at line 819 of file XMLTag.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cognitive_perception
Author(s): Ulrich F Klank
autogenerated on Thu May 23 2013 07:38:35