Ignore:
Timestamp:
09/08/10 15:02:31 (14 years ago)
Author:
hozdoba
Message:

Mise à jour intermédiaire ...
A venir : commit d'une version stable intégrant l'écriture de fichiers NetCDF4.
(en cours de finalisation actuellement)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/XMLIO/abstract_object.hpp

    r112 r120  
    11#ifndef __XMLIO_OBJECT__ 
    2 #define __XMLIO_OBJECT__  
    3  
    4 // Classes utilisées issues de la STL 
    5 using std::pair; 
    6 using std::string; 
    7 using std::ostream; 
    8 using std::ostringstream; 
    9  
    10 // Classes XMLIOSERVER 
    11 using XMLIOSERVER::XMLIOException; 
    12 using XMLIOSERVER::XMLIOUndefinedValueException; 
     2#define __XMLIO_OBJECT__ 
    133 
    144namespace XMLIOSERVER 
    155{ 
    16    class AbstractObject  
     6   class AbstractObject 
    177   { 
    188      public : 
    19        
     9 
     10         const std::string& getId(void) const throw (XMLIOUndefinedValueException) 
     11         { 
     12            if (!hasId()) // Si l'identifiant de l'objet n'est pas défini. 
     13               throw XMLIOSERVER::XMLIOUndefinedValueException("Appel de la méthode AbstractObject::getId invalide."); 
     14            return (id); 
     15         } 
     16 
     17         bool hasId(void) const { return(IdDefined); } 
     18         void resetId(void) { IdDefined = false ;} 
     19         void setId(const std::string& _id) { id = _id ; IdDefined = true ;} 
     20 
     21         bool operator==(const AbstractObject& other) const 
     22         { 
     23            // Si l'un ou l'autre des objets n'a pas d'identifiant, les objets ne sont pas "égaux". 
     24            if(!this->hasId() || !other.hasId()) return false; 
     25            return (id.compare(other.id) == 0); 
     26         } 
     27 
     28         std::string printId(void) const 
     29         { if(hasId()) return (" id=\""+getId()+"\""); return (""); } 
     30 
     31         virtual ~AbstractObject(void) 
     32         {/* Ne rien faire de plus */} 
     33 
     34      protected : 
     35 
    2036         AbstractObject(void) : IdDefined(false) 
    2137         {/* Ne rien faire de plus */} 
    22           
    23          AbstractObject(const string& _id) : id(_id), IdDefined(true) 
    24          {/* Ne rien faire de plus */}       
    25     
    26          const string& getId(void) const throw (XMLIOUndefinedValueException) 
    27          { if (!IdDefined) throw XMLIOUndefinedValueException("Appel de la méthode AbstractObject::getId invalide."); return (id); }    
    28           
    29          bool hasId(void) const { return(IdDefined); } 
    30          void resetId(void) { IdDefined = false ;} 
    31          void setId(const string& _id) { id = _id ; IdDefined = true ;} 
    32           
    33          bool operator==(const AbstractObject& other) 
    34          { 
    35             // Si l'un ou l'autre des objets n'a pas d'identifiant, les objets ne sont pas "égaux". 
    36             if(!this->hasId() or !other.hasId()) return false; 
    37             return (id.compare(other.id) == 0); 
    38          } 
    39           
    40          string printId(void) const 
    41          { if(hasId()) return (" id=\""+getId()+"\""); return (""); } 
    42           
    43          virtual ~AbstractObject(void) 
     38 
     39         AbstractObject(const std::string& _id) : id(_id), IdDefined(true) 
    4440         {/* Ne rien faire de plus */} 
    45        
    46       protected : 
    4741 
    48              
    4942      private : 
    50        
    51          string id ; 
     43 
     44         std::string id ; 
    5245         bool IdDefined ; 
    53        
     46 
    5447   };// class AbstractObject 
    55     
     48 
    5649}// namespace XMLIOSERVER 
    5750 
    58 #endif // __XMLIO_OBJECT__    
     51#endif // __XMLIO_OBJECT__ 
Note: See TracChangeset for help on using the changeset viewer.