Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxTagList Class Reference

A list of tags. More...

#include <HxTagList.h>

List of all members.

Public Types

typedef HxTagTagPtr
 Type definition for a pointer to an HxTag. More...

typedef std::list< TagPtrList
 Type definition for a list of tag pointers. More...


Public Methods

 HxTagList ()
 Constructor. More...

 HxTagList (const HxTagList &)
 Copy constructor. More...

 ~HxTagList ()
 Destructor. More...

HxTagList & operator= (const HxTagList &)
 Assignment operator. More...

void erase ()
 Make the tag list empty. More...

void addTag (HxTag *)
 Add a tag, use via HxAddTag. More...

HxTaggetTag (HxString name) const
 Get a tag, use via HxGetTag. More...

HxString toString () const
 Make a sttring with names of all tags. More...

std::ostream & put (std::ostream &) const
 To put the list on an ostream. More...


Detailed Description

A list of tags.

Basically, a tag is a combination of a name and a value. The name is represented by an HxString and the value is represented by an instantiation of HxTagTem, which is a specialization of HxTag. A value can be anything as long as it can be copy-constructed.

Use HxAddTag to add tags to the list. Use HxGetTag(const HxTagList&,HxString) and HxGetTag(const HxTagList&,HxString,ValT) to obtain values stored in the list. Use HxTagIsSet to check whether a tag is in the list.


Member Typedef Documentation

typedef HxTag* HxTagList::TagPtr
 

Type definition for a pointer to an HxTag.

typedef std::list<TagPtr> HxTagList::List
 

Type definition for a list of tag pointers.


Constructor & Destructor Documentation

HxTagList::HxTagList   [inline]
 

Constructor.

00038 {}

HxTagList::HxTagList const HxTagList &    rhs
 

Copy constructor.

00016 {
00017     List::const_iterator ptr;
00018     for (ptr = rhs._list.begin(); ptr != rhs._list.end(); ptr++)
00019     {
00020         _list.push_back((*ptr)->clone());
00021     }
00022 }

HxTagList::~HxTagList  
 

Destructor.

00039 {
00040     List::iterator ptr;
00041 
00042     for (ptr = _list.begin(); ptr != _list.end(); ptr++)
00043         delete (*ptr);
00044 }


Member Function Documentation

HxTagList & HxTagList::operator= const HxTagList &    rhs
 

Assignment operator.

00026 {
00027     List::const_iterator ptr;
00028     for (ptr = _list.begin(); ptr != _list.end(); ptr++)
00029         delete (*ptr);
00030     _list.erase(_list.begin(), _list.end());
00031     for (ptr = rhs._list.begin(); ptr != rhs._list.end(); ptr++)
00032     {
00033         _list.push_back((*ptr)->clone());
00034     }
00035     return *this;
00036 }

void HxTagList::erase  
 

Make the tag list empty.

00048 {
00049     List::const_iterator ptr;
00050     for (ptr = _list.begin(); ptr != _list.end(); ptr++)
00051         delete (*ptr);
00052     _list.erase(_list.begin(), _list.end());
00053 }

void HxTagList::addTag HxTag   tag
 

Add a tag, use via HxAddTag.

00077 {
00078     List::iterator ptr = findTag(tag->getName());
00079     
00080     if (ptr != _list.end() )
00081     {
00082         delete (*ptr);
00083         _list.erase(ptr);
00084     }
00085     _list.push_front(tag);
00086 }

HxTag * HxTagList::getTag HxString    name const
 

Get a tag, use via HxGetTag.

00090 {
00091     List::const_iterator ptr = findTag(name);
00092     return ptr != _list.end() ? (*ptr) : 0;
00093 }

HxString HxTagList::toString   const
 

Make a sttring with names of all tags.

00097 {
00098     int i = 0;
00099     HxString s("(");
00100     List::const_iterator ptr;
00101     for (ptr = _list.begin(); ptr != _list.end(); ptr++)
00102     {
00103         if (i > 0)
00104             s += ", ";
00105         s += (*ptr)->getName();
00106 
00107     }
00108     s += ")";
00109     return s;
00110 }

std::ostream & HxTagList::put std::ostream &    os const
 

To put the list on an ostream.

00114 {
00115     List::const_iterator ptr;
00116     for (ptr = _list.begin(); ptr != _list.end(); ptr++)
00117         os << (*ptr) << STD_ENDL;
00118     return os;
00119 }


The documentation for this class was generated from the following files:
Generated on Mon Jan 27 15:49:10 2003 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001