OMK::MultipleConfigurationParameter Class Reference

class MultipleConfigurationParameter : stores multiple configuration parameters. More...

#include <OMKMultipleConfigurationParameter.h>

Inheritance diagram for OMK::MultipleConfigurationParameter:

Inheritance graph
[legend]
Collaboration diagram for OMK::MultipleConfigurationParameter:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::pair< std::string,
ConfigurationParameterDescriptor * > 
DataContainedType
 define how individual subdescriptors are stored
typedef std::vector< DataContainedTypeDataContainerType
 define the data structure use to store all subdescriptors
typedef std::map< std::string,
ConfigurationParameterDescriptor * > 
FastAccessContainer
 define an additional data structure for fast acces to named subdescriptors

Public Member Functions

 MultipleConfigurationParameter ()
 constructor
 MultipleConfigurationParameter (const MultipleConfigurationParameter &)
 copy constructor
virtual ~MultipleConfigurationParameter ()
 destructor
virtual const std::string & getAssociatedString () const
 get a string representation of these configuration parameters
virtual const ConfigurationParameterDescriptorgetSubDescriptorByName (const std::string &descriptorName) const
 get a named subdescriptor
virtual const ConfigurationParameterDescriptorgetSubDescriptorByPosition (int descriptorPosition) const
 get a subdescriptor by it's position
virtual ConfigurationParameterDescriptorgetSubDescriptorByName (const std::string &descriptorName)
 get a named subdescriptor
virtual ConfigurationParameterDescriptorgetSubDescriptorByPosition (int descriptorPosition)
 get a subdescriptor by it's position
virtual const std::string & getNameOfSubDescriptor (int descriptorPosition) const
 get a the name of a subdescriptor of a certain position
virtual int getNumberOfSubItems () const
 get the number of subdescriptors
virtual int appendSubDescriptor (ConfigurationParameterDescriptor *subDescriptor)
 add an unnamed subdescriptor
virtual int appendSubDescriptorNamed (const std::string &descriptorName, ConfigurationParameterDescriptor *subDescriptor)
 add an named subdescriptor.
virtual int replaceSubDescriptorNamed (const std::string &descriptorName, ConfigurationParameterDescriptor *subDescriptor)
 replace a named subdescriptor
virtual int replaceSubDescriptor (int position, ConfigurationParameterDescriptor *subDescriptor)
 replace a named subdescriptor
virtual int appendSubDescriptorsOf (const MultipleConfigurationParameter &otherDescriptor)
 append all the descriptor contained in an other multipleConfigurationParameterDescriptor
virtual ConfigurationParameterDescriptorclone () const
 create a clone of this configuration parameter
virtual void extract (std::istream &=std::cin)
 extraction from an input stream
virtual void insertInStream (std::ostream &=std::cout) const
 insertion in an output stream
virtual void printToStream (std::ostream &out, int offset) const
 pretty insertion in an output stream (using an offset value)
virtual void unpack (IncomingSynchronisationMessage &)
 unpack from a synchronisation message
virtual void pack (OutgoingSynchronisationMessage &) const
 pack in a synchronisation message

Public Attributes

FastAccessContainer _hashtable
 this data structure serves as a fast access storage for named descriptors.

Protected Attributes

DataContainerType _subDescriptors
 this data structure contains all the elements of the descriptor
std::string _associatedString
 cache to construct the associated string
bool _associatedStringValid
 validity of the stored associated string

Detailed Description

class MultipleConfigurationParameter : stores multiple configuration parameters.

Author:
David Margery
Version:
1.1 (Revision
Revision
1.3
, last change by $author$) 1.0->1.1 added fast access capability

Definition at line 33 of file OMKMultipleConfigurationParameter.h.


Member Typedef Documentation

typedef std::pair<std::string, ConfigurationParameterDescriptor *> OMK::MultipleConfigurationParameter::DataContainedType

define how individual subdescriptors are stored

Definition at line 110 of file OMKMultipleConfigurationParameter.h.

typedef std::vector< DataContainedType > OMK::MultipleConfigurationParameter::DataContainerType

define the data structure use to store all subdescriptors

Definition at line 113 of file OMKMultipleConfigurationParameter.h.

typedef std::map<std::string, ConfigurationParameterDescriptor * > OMK::MultipleConfigurationParameter::FastAccessContainer

define an additional data structure for fast acces to named subdescriptors

Definition at line 116 of file OMKMultipleConfigurationParameter.h.


Constructor & Destructor Documentation

MultipleConfigurationParameter::MultipleConfigurationParameter (  ) 

constructor

Definition at line 80 of file OMKMultipleConfigurationParameter.cpp.

Referenced by clone().

00080                                                                 :
00081    ConfigurationParameterDescriptor (),
00082    _subDescriptors (),
00083    _associatedStringValid ( false ) 
00084 {
00085 
00086 }

MultipleConfigurationParameter::MultipleConfigurationParameter ( const MultipleConfigurationParameter  ) 

copy constructor

Definition at line 37 of file OMKMultipleConfigurationParameter.cpp.

References _associatedString, _associatedStringValid, _hashtable, and _subDescriptors.

00037                                                                                                            :
00038    ConfigurationParameterDescriptor ( orig ),
00039    _subDescriptors ()
00040 {
00041    if (orig._associatedStringValid)
00042       {
00043          _associatedStringValid = true ;
00044          _associatedString= orig._associatedString ;
00045       }
00046    else 
00047       {
00048          _associatedStringValid = false ;
00049       }
00050 
00051    //reconstruct the data containers after having duplicated the subdescriptors
00052    FastAccessContainer::const_iterator j ;
00053    for (DataContainerType::const_iterator i = orig._subDescriptors.begin() ;
00054         i != orig._subDescriptors.end() ;
00055         ++i)
00056       {
00057          ConfigurationParameterDescriptor * subdescriptorCopy = (*i).second->clone() ;
00058          _subDescriptors.push_back( DataContainerType::value_type( (*i).first,
00059                                                                   subdescriptorCopy )
00060                                     ) ;
00061 
00062          j = orig._hashtable.find ((*i).first ) ;
00063          if ( j != orig._hashtable.end() )
00064             {
00065                _hashtable.insert ( FastAccessContainer::value_type ( (*i).first,
00066                                                                      subdescriptorCopy ) ) ;
00067             }
00068       }
00069 }

MultipleConfigurationParameter::~MultipleConfigurationParameter (  )  [virtual]

destructor

Definition at line 88 of file OMKMultipleConfigurationParameter.cpp.

References _subDescriptors, and OMTRACEID.

00089 {
00090    DataContainerType::iterator i ;
00091    for ( i = _subDescriptors.begin() ;
00092          i != _subDescriptors.end() ;
00093          i++ )
00094       {
00095     OMTRACEID("Deleting", i->first << " Config* ");
00096           if ( i->second)
00097       delete i->second ;
00098       }
00099 }


Member Function Documentation

const std::string & MultipleConfigurationParameter::getAssociatedString (  )  const [virtual]

get a string representation of these configuration parameters

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 103 of file OMKMultipleConfigurationParameter.cpp.

References _associatedString, _associatedStringValid, _subDescriptors, and getNumberOfSubItems().

00104 {
00105    if ( ! _associatedStringValid ) 
00106       {
00107          string emptyString ;
00108          int numberOfSubItems = getNumberOfSubItems() ;
00109          _associatedString = "{ \n" ;
00110          DataContainerType::const_iterator i = _subDescriptors.begin() ;
00111          for ( int j = 0 ;
00112                j < numberOfSubItems - 1;
00113                ++j )
00114             {
00115                //indent the subdescriptors
00116                _associatedString += "   " ;
00117                if ( i-> first != emptyString ) 
00118                   {
00119                      _associatedString += i-> first ;
00120                      _associatedString += " = " ;
00121                   }
00122                _associatedString += i->second->getAssociatedString() ;
00123                _associatedString += ",\n" ;
00124                i++ ;
00125             }
00126          //print the last item
00127          _associatedString += "   " ;
00128          if ( i-> first != emptyString ) 
00129             {
00130                _associatedString += i-> first ;
00131                _associatedString += " = " ;
00132             }
00133          _associatedString += i->second->getAssociatedString() ;
00134          _associatedString += "\n" ;
00135          
00136          
00137          _associatedString += "}" ;
00138       }
00139    _associatedStringValid = true ; 
00140    return _associatedString ;
00141 } 

const ConfigurationParameterDescriptor * MultipleConfigurationParameter::getSubDescriptorByName ( const std::string &  descriptorName  )  const [virtual]

get a named subdescriptor

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 242 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, and OMASSERT.

Referenced by appendSubDescriptorsOf(), OMK::ObjectDescriptor::extract(), OMK::ObjectDescriptor::interpretConfigurationParameterAsObjectDescription(), OMK::ObjectDescriptor::interpretSchedulingParameters(), OMK::PvmController::PvmController(), OMK::ObjectDescriptor::setDistribution(), OMK::ObjectDescriptor::setFrequency(), and OMK::ObjectDescriptor::setProcess().

00243 {
00244    ConfigurationParameterDescriptor * result = NULL ;
00245    FastAccessContainer::const_iterator i ;
00246    i = _hashtable.find (descriptorName) ;
00247    if ( i != _hashtable.end() )
00248       {
00249          result = i->second ;
00250          OMASSERT( result != NULL ) ;
00251       }
00252    else
00253       {
00254         result = NULL ;
00255       }
00256    return result ;
00257 }

const ConfigurationParameterDescriptor * MultipleConfigurationParameter::getSubDescriptorByPosition ( int  descriptorPosition  )  const [virtual]

get a subdescriptor by it's position

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 279 of file OMKMultipleConfigurationParameter.cpp.

References _subDescriptors, and OMASSERT.

Referenced by OMK::ObjectDescriptor::interpretConfigurationParameterAsListOfSons(), and OMK::PvmController::PvmController().

00280 {
00281    if (((unsigned)descriptorPosition) >= _subDescriptors.size() ) 
00282       {
00283          return NULL ;
00284       }
00285    else
00286       {
00287          OMASSERT( _subDescriptors[descriptorPosition].second != NULL ) ;
00288          return _subDescriptors[descriptorPosition].second ;
00289       }
00290 }

ConfigurationParameterDescriptor * MultipleConfigurationParameter::getSubDescriptorByName ( const std::string &  descriptorName  )  [virtual]

get a named subdescriptor

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 260 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, and OMASSERT.

00261 {
00262    ConfigurationParameterDescriptor * result = NULL ;
00263    FastAccessContainer::const_iterator  i ;
00264    i = _hashtable.find (descriptorName) ;
00265    if ( i != _hashtable.end() )
00266       {
00267          result = i->second ;
00268          OMASSERT( result != NULL ) ;
00269       }
00270    else
00271       {
00272         result = NULL ;
00273       }
00274    return result ;
00275 }

ConfigurationParameterDescriptor * MultipleConfigurationParameter::getSubDescriptorByPosition ( int  descriptorPosition  )  [virtual]

get a subdescriptor by it's position

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 299 of file OMKMultipleConfigurationParameter.cpp.

References _subDescriptors, and OMASSERT.

00300 {
00301    if ( ((unsigned)descriptorPosition) >= _subDescriptors.size() ) 
00302       {
00303          return NULL ;
00304       }
00305    else
00306       {
00307          OMASSERT( _subDescriptors[descriptorPosition].second != NULL ) ;
00308          return _subDescriptors[descriptorPosition].second ;
00309       }
00310 }

const std::string & MultipleConfigurationParameter::getNameOfSubDescriptor ( int  descriptorPosition  )  const [virtual]

get a the name of a subdescriptor of a certain position

Definition at line 292 of file OMKMultipleConfigurationParameter.cpp.

References _subDescriptors, and OMASSERT.

Referenced by OMK::ObjectDescriptor::interpretConfigurationParameterAsListOfSons(), and OMK::PvmController::PvmController().

00293 {
00294    OMASSERT( ((unsigned)descriptorPosition) < _subDescriptors.size() )  ;
00295    return _subDescriptors[descriptorPosition].first ;
00296 }

int MultipleConfigurationParameter::getNumberOfSubItems (  )  const [virtual]

get the number of subdescriptors

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 314 of file OMKMultipleConfigurationParameter.cpp.

References _subDescriptors.

Referenced by getAssociatedString(), OMK::ObjectDescriptor::interpretConfigurationParameterAsListOfSons(), printToStream(), and OMK::PvmController::PvmController().

00315 {
00316    return _subDescriptors.size() ;
00317 }

int MultipleConfigurationParameter::appendSubDescriptor ( ConfigurationParameterDescriptor subDescriptor  )  [virtual]

add an unnamed subdescriptor

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 321 of file OMKMultipleConfigurationParameter.cpp.

References _subDescriptors, and OMASSERT.

00322 {
00323    OMASSERT( subDescriptor != NULL ) ;
00324    _subDescriptors.push_back ( DataContainedType ( std::string() ,subDescriptor ) ) ;
00325    return _subDescriptors.size() - 1 ;
00326 }

int MultipleConfigurationParameter::appendSubDescriptorNamed ( const std::string &  descriptorName,
ConfigurationParameterDescriptor subDescriptor 
) [virtual]

add an named subdescriptor.

If a descriptor with the same name allready exist, replaces it

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 330 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, _subDescriptors, OMASSERT, and replaceSubDescriptorNamed().

Referenced by OMK::ObjectDescriptor::interpretSchedulingParameters(), OMK::ObjectDescriptor::ObjectDescriptor(), replaceSubDescriptorNamed(), OMK::ObjectDescriptor::setDistribution(), OMK::ObjectDescriptor::setFrequency(), and OMK::ObjectDescriptor::setProcess().

00331 {
00332    OMASSERT( subDescriptor != NULL ) ;
00333    pair<FastAccessContainer::iterator ,bool > result = _hashtable.insert( FastAccessContainer::value_type(descriptorName, subDescriptor) ) ;
00334    // only add the sub descriptor if no subsdescriptor with the same name was allready added
00335    if (result.second)
00336       {
00337          _subDescriptors.push_back ( DataContainedType ( descriptorName, subDescriptor ) ) ;
00338       }
00339    else
00340       {
00341          replaceSubDescriptorNamed ( descriptorName, subDescriptor ) ;
00342       }
00343    return _subDescriptors.size() - 1 ;
00344 }

int MultipleConfigurationParameter::replaceSubDescriptorNamed ( const std::string &  descriptorName,
ConfigurationParameterDescriptor subDescriptor 
) [virtual]

replace a named subdescriptor

Definition at line 428 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, _subDescriptors, appendSubDescriptorNamed(), and OMASSERT.

Referenced by appendSubDescriptorNamed(), and appendSubDescriptorsOf().

00429 {
00430    FastAccessContainer::iterator i ;
00431    i = _hashtable.find (descriptorName) ;
00432    if ( i == _hashtable.end() ) 
00433       {
00434          return appendSubDescriptorNamed ( descriptorName, subDescriptor) ;
00435       }
00436    else 
00437       {
00438          int result = 0 ;
00439 
00440          //find descriptorName in the vector
00441          DataContainerType::iterator j = _subDescriptors.begin() ;
00442 
00443          //It should be present
00444          OMASSERT( j != _subDescriptors.end() );
00445 
00446          while ( (*j).first != descriptorName )
00447             {
00448                ++j ;
00449                ++result ;
00450                //descriptorName should be present
00451                OMASSERT( j != _subDescriptors.end() );
00452             }
00453          
00454          //delete the old descriptor
00455          delete (*i).second ;
00456          
00457          //replace it
00458          (*i).second = subDescriptor ;
00459          (*j).second = subDescriptor ;
00460 
00461          OMASSERT(_subDescriptors[result].second == subDescriptor) ;
00462          return result ;
00463       }
00464 }

int MultipleConfigurationParameter::replaceSubDescriptor ( int  position,
ConfigurationParameterDescriptor subDescriptor 
) [virtual]

replace a named subdescriptor

Definition at line 467 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, _subDescriptors, and OMASSERT.

00468 {
00469    OMASSERT( ((unsigned)position) < _subDescriptors.size() ) ;
00470    std::string descriptorName = _subDescriptors[position].first ;
00471    std::string emptyString ;
00472    ConfigurationParameterDescriptor * replacedDescription = _subDescriptors[position].second ;
00473 
00474    if ( descriptorName != emptyString ) 
00475       {
00476          FastAccessContainer::iterator i ;
00477          i = _hashtable.find (descriptorName) ;
00478   
00479          //the descriptor should be present in the hash table
00480          OMASSERT( i != _hashtable.end() ) ;
00481          (*i).second = subDescriptor ;
00482       }
00483    delete replacedDescription ; 
00484    _subDescriptors[position].second = subDescriptor ;    
00485    return position ;
00486 }

int MultipleConfigurationParameter::appendSubDescriptorsOf ( const MultipleConfigurationParameter otherDescriptor  )  [virtual]

append all the descriptor contained in an other multipleConfigurationParameterDescriptor

Returns:
the index of the last appended sub descriptor.

Definition at line 347 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, _subDescriptors, appendSubDescriptorsOf(), OMK::ConfigurationParameterDescriptor::getAssociatedString(), getSubDescriptorByName(), OMASSERT, OMK_DEBUG_OMK_OBJ, OMTRACEID, and replaceSubDescriptorNamed().

Referenced by appendSubDescriptorsOf().

00348 {
00349    if ( _hashtable.size() == 0 )
00350       {
00351          *this = otherDescriptor ;
00352       }
00353    else
00354       {
00355          std::string emptyString ; 
00356          for ( DataContainerType::const_iterator i = otherDescriptor._subDescriptors.begin() ;
00357                i != otherDescriptor._subDescriptors.end() ;
00358                ++i)
00359             {
00360                //_subDescriptors.push_back ( *i ) ;
00361                if ( (*i).first != emptyString )
00362                   {
00363                      ConfigurationParameterDescriptor * existingDescriptor = getSubDescriptorByName ((*i).first) ;
00364                      if ( existingDescriptor == NULL )
00365                         {
00366                            ConfigurationParameterDescriptor * newDescriptor =  (*i).second->clone() ;
00367                            _hashtable.insert( FastAccessContainer::value_type ( (*i).first , newDescriptor ) ) ;           
00368                            _subDescriptors.push_back( DataContainedType((*i).first,newDescriptor) ) ;   
00369                         }
00370                      else
00371                         {
00372         ostringstream warningMessage ;
00373                            warningMessage << "While merging two MultipleConfigurationParameter: "
00374                                           <<"2 subdescriptors named "<<(*i).first<<" found: ";
00375                            
00376                            MultipleConfigurationParameter * originalDescriptor ;
00377                            originalDescriptor = dynamic_cast<MultipleConfigurationParameter * > (existingDescriptor) ;
00378                            MultipleConfigurationParameter * appendedDescriptor ;
00379                            appendedDescriptor = dynamic_cast<MultipleConfigurationParameter * > ((*i).second) ;
00380                            if ( (originalDescriptor != NULL) &&
00381                                 (appendedDescriptor != NULL) )
00382                               {
00383                                  if ( originalDescriptor->_hashtable.size() == 0 )
00384                                     {
00385                                        //it is a list of values, replace
00386                                        replaceSubDescriptorNamed ((*i).first, appendedDescriptor) ;
00387                                     }
00388                                  else
00389                                     {
00390                                        originalDescriptor->appendSubDescriptorsOf ( *appendedDescriptor ) ; 
00391                                     }
00392                               }
00393                            else 
00394                               {
00395                                  _hashtable.erase ( (*i).first ) ;      
00396                                  
00397                                  //find (*i).first in the vector
00398                                  DataContainerType::iterator j = _subDescriptors.begin() ;
00399                                  
00400                                  //(*i).first should be present in the vector
00401                                  OMASSERT( j != _subDescriptors.end() );
00402                                  while ( (*j).first != (*i).first )
00403                               {
00404                                  ++j ;
00405                                  OMASSERT( j != _subDescriptors.end() );
00406                               }
00407                                  
00408                                  ConfigurationParameterDescriptor * newDescriptor =  (*i).second->clone() ;
00409                                  
00410                                  _hashtable.insert( FastAccessContainer::value_type ( (*i).first , newDescriptor ) ) ;
00411 
00412                                  (*j).second = newDescriptor ;
00413                                  
00414                                  warningMessage<<"Replaced original value: that was "<<existingDescriptor->getAssociatedString() ;
00415                                  OMASSERT( existingDescriptor != NULL ) ;
00416                                  delete existingDescriptor ;
00417                               }
00418           OMTRACEID( OMK_DEBUG_OMK_OBJ, warningMessage.str() ) ;
00419                         }
00420                   }
00421             }
00422       }
00423    return _subDescriptors.size() - 1 ;
00424 }

ConfigurationParameterDescriptor * MultipleConfigurationParameter::clone (  )  const [virtual]

create a clone of this configuration parameter

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 72 of file OMKMultipleConfigurationParameter.cpp.

References MultipleConfigurationParameter().

Referenced by OMK::ObjectDescriptor::interpretSchedulingParameters(), and OMK::ObjectDescriptor::ObjectDescriptor().

00073 {
00074    return new MultipleConfigurationParameter( *this ) ;
00075 }

void MultipleConfigurationParameter::extract ( std::istream &  = std::cin  )  [virtual]

extraction from an input stream

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 523 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, and _subDescriptors.

Referenced by unpack().

00524 {
00525    _hashtable.clear () ;
00526    _subDescriptors.clear () ;
00527 
00528    KernelIstreamLexer<istream> inputStream (in) ;
00529    DLGLexer scan( & inputStream ) ;
00530    ANTLRTokenBuffer pipe ( & scan ) ;
00531    ANTLRTokenPtr aToken = new ANTLRToken() ;
00532    scan.setToken(mytoken(aToken)) ;
00533    genericKernelParser extractor  ( &pipe ) ;
00534    extractor.init() ;
00535    extractor.multipleValue ( this ) ;
00536 }

void MultipleConfigurationParameter::insertInStream ( std::ostream &  = std::cout  )  const [virtual]

insertion in an output stream

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 518 of file OMKMultipleConfigurationParameter.cpp.

References printToStream().

00519 {
00520    printToStream ( out, 0 ) ;
00521  }

void MultipleConfigurationParameter::printToStream ( std::ostream &  out,
int  offset 
) const [virtual]

pretty insertion in an output stream (using an offset value)

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 144 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, _subDescriptors, getNumberOfSubItems(), and OMK::printTabToStream().

Referenced by insertInStream(), pack(), and OMK::ObjectDescriptor::printToStream().

00145 {
00146    std::string emptyString ;
00147    int numberOfSubItems = getNumberOfSubItems() ;
00148 
00149    DataContainerType::const_iterator i = _subDescriptors.begin() ;
00150    if ( i != _subDescriptors.end () ) 
00151       {
00152          bool inList ;
00153          if ( i->first == emptyString )
00154             {
00155                if ( ! _hashtable.empty() )
00156                   {
00157                      out<<endl;
00158                      printTabToStream(out,offset) ;
00159                      out << "{"  ;
00160                      out<<endl;
00161                      printTabToStream(out,offset+2) ;
00162                   }
00163                out << "[ " ;
00164                inList = true ;
00165             }
00166          else
00167             {
00168                out<<endl;
00169                printTabToStream(out,offset) ;
00170                out << "{"  ;
00171                inList = false ;
00172             }
00173          
00174          for ( int j = 0 ;
00175                j != numberOfSubItems ;
00176                ++j )
00177             {
00178                //at each step, if not printing a list of unamed values, new line has just been inserted
00179                if ( inList ) 
00180                   {
00181                      if ( i-> first != emptyString ) 
00182                         {
00183                            // the list was finished by the preceeding value
00184                            out << "]" ;
00185                            inList = false ;
00186                            out<<endl;
00187                            printTabToStream (out, offset + 2 ) ;
00188                            out<< i->first <<" ";
00189                            i->second->printToStream (out, offset + 2  ) ;
00190                         }
00191                      else 
00192                         {
00193                            i->second->printToStream (out, offset + 4  ) ;
00194                            out<<" ";
00195                         }
00196                   }
00197                else 
00198                   {
00199                      if ( i-> first == emptyString )
00200                         {
00201                            //starting a list
00202                            out << "[ " ;
00203                            inList = true ;
00204                            i->second->printToStream (out, offset + 4  ) ;
00205                            out<<" ";
00206                         }
00207                      else
00208                         {
00209                            out << endl ;
00210                            printTabToStream (out, offset + 2 ) ;
00211                            out<< i->first <<" " ;
00212                            i->second->printToStream (out, offset + 4  ) ;
00213                         }
00214                   }
00215                i++ ;
00216             }
00217          if (inList)
00218             {
00219                out<<"]";
00220                if ( ! _hashtable.empty() )
00221                   {
00222                      out<<endl;
00223                      printTabToStream (out, offset ) ;
00224                      out<<"}";
00225                   }
00226             }
00227          else
00228             {
00229                out<<endl;
00230                printTabToStream (out, offset ) ;
00231                out<<"}";
00232             }
00233       }
00234    else 
00235       {
00236          out<<" - undefined - ";
00237       }
00238 }

void MultipleConfigurationParameter::unpack ( IncomingSynchronisationMessage  )  [virtual]

unpack from a synchronisation message

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 497 of file OMKMultipleConfigurationParameter.cpp.

References _hashtable, _subDescriptors, and extract().

00498 {
00499    _hashtable.clear () ;
00500    _subDescriptors.clear () ;
00501 
00502    string messageBuffer ;
00503    in >> messageBuffer ;
00504    istringstream message ( messageBuffer ) ;
00505    extract (message ) ;
00506    
00507 //     //this doesn't work, because a IncomingSynchronisationMessage dosn't known the size of what has to be extracted
00508 //     KernelIstreamLexer<IncomingSynchronisationMessage> inputStream (in) ;
00509 //     DLGLexer scan( & inputStream ) ;
00510 //     ANTLRTokenBuffer pipe ( & scan ) ;
00511 //     ANTLRTokenPtr aToken = new ANTLRToken() ;
00512 //     scan.setToken(mytoken(aToken)) ;
00513 //     genericKernelParser extractor  ( &pipe ) ;
00514 //     extractor.init() ;
00515 //     extractor.multipleValue ( this ) ;
00516 }

void MultipleConfigurationParameter::pack ( OutgoingSynchronisationMessage  )  const [virtual]

pack in a synchronisation message

Implements OMK::ConfigurationParameterDescriptor.

Definition at line 490 of file OMKMultipleConfigurationParameter.cpp.

References printToStream().

00491 {
00492    ostringstream char_out ;
00493    printToStream ( char_out, 0 ) ;
00494    out << char_out.str() ;
00495 }


Member Data Documentation

FastAccessContainer OMK::MultipleConfigurationParameter::_hashtable

this data structure serves as a fast access storage for named descriptors.

All named descriptors are also present in _subDescriptors

Definition at line 120 of file OMKMultipleConfigurationParameter.h.

Referenced by appendSubDescriptorNamed(), appendSubDescriptorsOf(), extract(), getSubDescriptorByName(), MultipleConfigurationParameter(), printToStream(), replaceSubDescriptor(), replaceSubDescriptorNamed(), and unpack().

DataContainerType OMK::MultipleConfigurationParameter::_subDescriptors [protected]

this data structure contains all the elements of the descriptor

Definition at line 124 of file OMKMultipleConfigurationParameter.h.

Referenced by appendSubDescriptor(), appendSubDescriptorNamed(), appendSubDescriptorsOf(), extract(), getAssociatedString(), getNameOfSubDescriptor(), getNumberOfSubItems(), getSubDescriptorByPosition(), MultipleConfigurationParameter(), printToStream(), replaceSubDescriptor(), replaceSubDescriptorNamed(), unpack(), and ~MultipleConfigurationParameter().

std::string OMK::MultipleConfigurationParameter::_associatedString [mutable, protected]

cache to construct the associated string

Definition at line 127 of file OMKMultipleConfigurationParameter.h.

Referenced by getAssociatedString(), and MultipleConfigurationParameter().

bool OMK::MultipleConfigurationParameter::_associatedStringValid [mutable, protected]

validity of the stored associated string

Definition at line 130 of file OMKMultipleConfigurationParameter.h.

Referenced by getAssociatedString(), and MultipleConfigurationParameter().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:02 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007