source: XMLIO_V2/dev/dev_rv/src/XMLIO/attribut_registrar.hpp @ 102

Last change on this file since 102 was 98, checked in by ymipsl, 14 years ago
File size: 1.9 KB
Line 
1#ifndef __ATTRIBUT_REGISTRAR__
2#define __ATTRIBUT_REGISTRAR__
3
4#include "attribut.hpp"
5
6namespace XMLIOSERVER
7{
8   class AttributRegistrar
9   {
10      public :
11       
12         AttributRegistrar():attrList()
13         {/* Ne rien faire de plus */}
14     
15         void RegisterAttribut(BaseAttribut* attribut){ attrList.addObject(attribut); }         
16         StrHashMap<BaseAttribut>& getAttributList(void) { return (attrList); }         
17         size_t getNbAttributes() const {return (attrList.getSize()); }
18         bool hasAttribut(const string _id) { return (attrList.hasMappedValue(_id)); }
19         
20         BaseAttribut* getAttribut(const string _id) throw (XMLIOUndefinedValueException) { return (attrList[_id]); }
21       
22         void setSAttribut(const string& att_name, const std::string& value)
23         {
24            //std::cout << "Attribut :" <<  att_name<< ", " << value<< std::endl;
25
26            if (hasAttribut(att_name))
27            { getAttribut(att_name)->setFromString(value) ; }
28            else
29            {
30               ostringstream oss;
31               oss << "CAttributRegistrar::setAttribut<ValueType>, could not find <<" << att_name <<">> attribut in registred list" <<">>";
32               throw XMLIOUndefinedValueException(oss.str());
33            }         
34         }
35         
36         friend ostream& operator<< (ostream& out, const AttributRegistrar& c) 
37         { out << c.toString(); return (out);}   
38               
39      protected :
40     
41         string toString(void) const
42         {
43            ostringstream st("A réimplémenter");
44            // A compléter
45            return (st.str());
46         }
47         
48      public :
49         
50        ~AttributRegistrar(void)
51        {/* Ne rien faire de plus */}
52       
53      private :
54         StrHashMap<BaseAttribut> attrList;
55       
56   }; // class AttributRegistrar 
57}; // namespace XMLIOSERVER
58
59
60#endif //__ATTRIBUT_REGISTRAR__
Note: See TracBrowser for help on using the repository browser.