Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

/home/pauldt/projects/IDEA/IDEA-ALL/IDEA-DEV/Core/Agent/Includes/MessageDefinitions.hh

Go to the documentation of this file.
00001 // -*- Mode: c++ -*-
00002 //      CVS: $Id: MessageDefinitions.hh,v 1.4 2005/12/30 22:05:32 rijsman Exp $
00003 //      Tag: $name$
00004 //     Info: $CVSROOT/IDEA-DEV/COPYRIGHT
00005 
00006 #ifndef MESSAGE_DEFINITION_HEADER_FILE
00007 #define MESSAGE_DEFINITION_HEADER_FILE
00008 
00009 #include "MessageHandle.hh"
00010 #include "MessageData.hh"
00011 #include "TokenLocation.hh"
00012 #include "Trace.hh"
00013 #include "Utilities.hh"
00014 
00015 namespace IDEA
00016 {
00021   typedef Message ObjectMessage;
00026   typedef Message StartMessage;
00031   typedef Message StatusMessage;
00036   typedef Message StopMessage;
00041   typedef Message TelemetryMessage;
00046   typedef Message ValueMessage;
00051   typedef Message UserDefinedMessage;
00052   
00063   class MessageDataBase:
00064     public MessageData
00065   {
00066   public:
00070     const TokenLocation& getSourceLocation() const 
00071     { 
00072       return m_SourceLocation; 
00073     }
00077     const TokenLocation& getTargetLocation() const 
00078     { 
00079       return m_TargetLocation; 
00080     }
00087     const std::string& getSourceToken() const 
00088     {
00089       return m_SourceToken;
00090     }
00091     
00092     Prototype* clone() const 
00093     { 
00094       return new MessageDataBase( getType(), 
00095                                   m_SourceLocation, 
00096                                   m_TargetLocation, 
00097                                   m_SourceToken, 
00098                                   getIdentifier(), 
00099                                   getSubMessages(), 
00100                                   getParent() );
00101     }
00102   protected:
00108     MessageDataBase( const Message::Type& type,
00109                      const std::string& source,
00110                      const std::string& sourceClass,
00111                      const std::string& sourceTimeline,
00112                      const std::string& sourceToken,
00113                      const std::string& target,
00114                      const std::string& targetClass,
00115                      const std::string& targetTimeline,
00116                      int identifier,
00117                      const IntSet& subMessages,
00118                      int parent):
00119       MessageData( type, identifier, subMessages, parent ),
00120       m_SourceLocation( source, sourceClass, sourceTimeline ),
00121       m_TargetLocation( target, targetClass, targetTimeline ),
00122       m_SourceToken( sourceToken )
00123     {
00124     };
00125 
00130     MessageDataBase( const Message::Type& type,
00131                      const TokenLocation& sourceLocation,
00132                      const TokenLocation& targetLocation,
00133                      const std::string& sourceToken,
00134                      int identifier,
00135                      const IntSet& subMessages = IntSet(),
00136                      int parent = -1):
00137       MessageData( type, identifier, subMessages, parent ),
00138       m_SourceLocation( sourceLocation ),
00139       m_TargetLocation( targetLocation ),
00140       m_SourceToken( sourceToken )
00141     {
00142     }
00143   private:
00147     MessageDataBase();
00151     MessageDataBase(const MessageDataBase &);
00155     MessageDataBase& operator=(const MessageDataBase &);
00156 
00157     TokenLocation m_SourceLocation;
00158     TokenLocation m_TargetLocation;
00159     std::string m_SourceToken;
00160   };
00161 
00162   std::ostream& operator<< ( std::ostream& os, const MessageDataBase& data );
00163 
00173   class ObjectMessageData:
00174     public MessageDataBase
00175   {
00176   public:
00180     ObjectMessageData( const std::string& source,
00181                        const std::string& sourceClass,
00182                        const std::string& sourceTimeline,
00183                        const std::string& sourceToken,
00184                        const std::string& target,
00185                        const std::string& targetClass,
00186                        const std::string& targetTimeline,
00187                        const std::string& objectName,
00188                        const std::string& objectClass,
00189                        const std::string& objectToken,
00190                        const std::string& parameters,
00191                        int identifier = getNextUniqueIdentifier(),
00192                        const IntSet& subMessages = IntSet(),
00193                        int parent = -1):
00194       MessageDataBase( Message::OBJECT, source, sourceClass, sourceTimeline, sourceToken, target, targetClass, targetTimeline, identifier, subMessages, parent ),
00195       m_ObjectName( objectName ),
00196       m_ObjectClass( objectClass ),
00197       m_ObjectToken( objectToken ),
00198       m_Parameters( parameters )
00199     {
00200     }
00204     const std::string& getObjectName() const 
00205     { 
00206       return m_ObjectName; 
00207     }
00211     const std::string& getObjectClass() const 
00212     { 
00213       return m_ObjectClass; 
00214     }
00218     const std::string& getObjectToken() const 
00219     {
00220       return m_ObjectToken; 
00221     }
00225     const std::string& getParameters() const 
00226     {
00227       return m_Parameters; 
00228     }
00229 
00230     Prototype* clone() const
00231     {
00232       return new ObjectMessageData( getSourceLocation(), 
00233                                     getTargetLocation(), 
00234                                     getSourceToken(), 
00235                                     m_ObjectName, 
00236                                     m_ObjectClass, 
00237                                     m_ObjectToken, 
00238                                     m_Parameters,
00239                                     getIdentifier(),
00240                                     getSubMessages(),
00241                                     getParent() );
00242     }
00243   private:
00244     ObjectMessageData( const TokenLocation& sourceLocation,
00245                        const TokenLocation& targetLocation,
00246                        const std::string& sourceToken,
00247                        const std::string& objectName,
00248                        const std::string& objectClass,
00249                        const std::string& objectToken,
00250                        const std::string& parameters,
00251                        int identifier,
00252                        const IntSet& subMessages,
00253                        int parent ):
00254       MessageDataBase(  Message::OBJECT, sourceLocation, targetLocation, sourceToken, identifier, subMessages, parent ),
00255       m_ObjectName( objectName ),
00256       m_ObjectClass( objectClass ),
00257       m_ObjectToken( objectToken ),
00258       m_Parameters( parameters )
00259     {
00260     }
00261       
00262     std::string m_ObjectName;
00263     std::string m_ObjectClass;
00264     std::string m_ObjectToken;
00265     std::string m_Parameters;
00266   };
00267 
00277   class StartMessageData:
00278     public MessageDataBase
00279   {
00280   public:
00284     StartMessageData( const std::string& source,
00285                       const std::string& sourceClass,
00286                       const std::string& sourceTimeline,
00287                       const std::string& sourceToken,
00288                       const std::string& target,
00289                       const std::string& targetClass,
00290                       const std::string& targetTimeline,
00291                       int externalToken,
00292                       const std::string& parameters,
00293                       const Time& earliestStart,
00294                       const Time& latestStart,
00295                       const Time& earliestEnd,
00296                       const Time& latestEnd,
00297                       const std::string& comRelay,
00298                       int identifier = getNextUniqueIdentifier(),
00299                       const IntSet& subMessages = IntSet(),
00300                       int parent = -1 ):
00301       MessageDataBase(  Message::START, source, sourceClass, sourceTimeline, sourceToken, target, targetClass, targetTimeline, identifier, subMessages, parent ),
00302       m_ExternalTokenId( externalToken ),
00303       m_Parameters( parameters), 
00304       m_EarliestStart( earliestStart ),
00305       m_LatestStart( latestStart ),
00306       m_EarliestEnd( earliestEnd ),
00307       m_LatestEnd( latestEnd ),
00308       m_ComRelay( comRelay )
00309     {
00310     }
00316     int getExternalTokenId() const 
00317     { 
00318       return m_ExternalTokenId;
00319     }
00323     const std::string& getParameters() const 
00324     {
00325       return m_Parameters;
00326     }
00332     const Time& getEarliestStart() const 
00333     { 
00334       return m_EarliestStart;
00335     }
00341     const Time& getLatestStart() const 
00342     { 
00343       return m_LatestStart;
00344     }
00350     const Time& getEarliestEnd() const 
00351     { 
00352       return m_EarliestEnd;
00353     }
00359     const Time& getLatestEnd() const 
00360     { 
00361       return m_LatestEnd;
00362     }
00368     const std::string& getComRelay() const 
00369     { 
00370       return m_ComRelay;
00371     }
00372 
00373     Prototype* clone() const
00374     {
00375       return new StartMessageData( getSourceLocation(), 
00376                                    getTargetLocation(), 
00377                                    getSourceToken(), 
00378                                    m_ExternalTokenId,
00379                                    m_Parameters,
00380                                    m_EarliestStart,
00381                                    m_LatestStart,
00382                                    m_EarliestEnd,
00383                                    m_LatestEnd,
00384                                    m_ComRelay,
00385                                    getIdentifier(),
00386                                    getSubMessages(),
00387                                    getParent() );
00388     }
00389   private:
00390     StartMessageData( const TokenLocation& sourceLocation,
00391                       const TokenLocation& targetLocation,
00392                       const std::string& sourceToken,
00393                       int externalToken,
00394                       const std::string& parameters,
00395                       const Time& earliestStart,
00396                       const Time& latestStart,
00397                       const Time& earliestEnd,
00398                       const Time& latestEnd,
00399                       const std::string& comRelay,
00400                       int identifier,
00401                       const IntSet& subMessages,
00402                       int parent ):
00403       MessageDataBase( Message::START, sourceLocation, targetLocation, sourceToken, identifier, subMessages, parent ),
00404       m_ExternalTokenId( externalToken ),
00405       m_Parameters( parameters  ),
00406       m_EarliestStart( earliestStart  ),
00407       m_LatestStart( latestStart ),
00408       m_EarliestEnd( earliestEnd ), 
00409       m_LatestEnd( latestEnd  ),
00410       m_ComRelay( comRelay )
00411     {
00412     }
00413 
00414     int m_ExternalTokenId;
00415     std::string m_Parameters;
00416     Time m_EarliestStart;
00417     Time m_LatestStart;
00418     Time m_EarliestEnd; 
00419     Time m_LatestEnd;
00420     std::string m_ComRelay;
00421   };
00422 
00423   std::ostream& operator<< ( std::ostream& os, const StartMessageData& data );
00424 
00434   class ValueMessageData:
00435     public MessageDataBase
00436   {
00437   public:
00441     ValueMessageData( const std::string& source,
00442                       const std::string& sourceClass,
00443                       const std::string& sourceTimeline,
00444                       const std::string& sourceToken,
00445                       const std::string& target,
00446                       const std::string& targetClass,
00447                       const std::string& targetTimeline,
00448                       int token,
00449                       const std::string& value,
00450                       int index,
00451                       int identifier = getNextUniqueIdentifier(),
00452                       const IntSet& subMessages = IntSet(),
00453                       int parent = -1 ):
00454       MessageDataBase( Message::VALUE, source, sourceClass, sourceTimeline, sourceToken, target, targetClass, targetTimeline, identifier, subMessages, parent ),
00455       m_ExternalTokenId( token ),
00456       m_Value( value ),
00457       m_Index( index )
00458     {
00459     }
00463     int getExternalTokenId() const 
00464     { 
00465       return m_ExternalTokenId;
00466     }
00470     const std::string& getValue() const 
00471     { 
00472       return m_Value; 
00473     }
00477     int getIndex() const 
00478     { 
00479       return m_Index; 
00480     }
00481 
00482     Prototype* clone() const
00483     {
00484       return new ValueMessageData( getSourceLocation(),
00485                                    getTargetLocation(),
00486                                    getSourceToken(),
00487                                    m_ExternalTokenId,
00488                                    m_Value,
00489                                    m_Index, 
00490                                    getIdentifier(),
00491                                    getSubMessages(),
00492                                    getParent()  );
00493     }
00494   private:
00495     ValueMessageData( const TokenLocation& sourceLocation,
00496                       const TokenLocation& targetLocation,
00497                       const std::string& sourceToken,
00498                       int token,
00499                       const std::string& value,
00500                       int index,
00501                       int identifier,
00502                       const IntSet& subMessages,
00503                       int parent ):
00504       MessageDataBase( Message::VALUE, sourceLocation, targetLocation, sourceToken, identifier, subMessages, parent  ),
00505       m_ExternalTokenId( token ),
00506       m_Value( value ),
00507       m_Index( index )
00508     {
00509     }
00510 
00511     int m_ExternalTokenId;
00512     std::string m_Value;
00513     int m_Index;
00514   };
00515 
00516   std::ostream& operator<< ( std::ostream& os, const ValueMessageData& data );
00517 
00518 
00526   class StatusMessageData:
00527     public MessageDataBase
00528   {
00529   public:
00533     StatusMessageData( const std::string& source,
00534                        const std::string& sourceClass,
00535                        const std::string& sourceTimeline,
00536                        const std::string& sourceToken,
00537                        const std::string& target,
00538                        const std::string& targetClass,
00539                        const std::string& targetTimeline,
00540                        int token, 
00541                        const std::string& value,
00542                        int identifier = getNextUniqueIdentifier(),
00543                        const IntSet& subMessages = IntSet(),
00544                        int parent = -1 ):
00545       MessageDataBase( Message::STATUS, source, sourceClass, sourceTimeline, sourceToken, target, targetClass, targetTimeline, identifier, subMessages, parent ),
00546       m_ExternalTokenId( token ),
00547       m_Value( value )
00548     {
00549     }
00550   
00554     int getExternalTokenId() const 
00555     { 
00556       return m_ExternalTokenId;
00557     }
00561     const std::string& getValue() const 
00562     { 
00563       return m_Value; 
00564     }
00568     Prototype* clone() const
00569     {
00570       return new StatusMessageData( getSourceLocation(),
00571                                     getTargetLocation(),
00572                                     getSourceToken(),
00573                                     m_ExternalTokenId,
00574                                     m_Value, 
00575                                     getIdentifier(),
00576                                     getSubMessages(),
00577                                     getParent()  );
00578     }
00579   private:
00583     StatusMessageData( const TokenLocation& sourceLocation,
00584                        const TokenLocation& targetLocation,
00585                        const std::string& sourceToken,
00586                        int token,
00587                        const std::string& value,
00588                        int identifier,
00589                        const IntSet& subMessages,
00590                        int parent):
00591       MessageDataBase( Message::STATUS, sourceLocation, targetLocation, sourceToken, identifier, subMessages, parent ),
00592       m_ExternalTokenId( token ),
00593       m_Value( value )
00594     {
00595     }
00596 
00597     int m_ExternalTokenId;
00598     std::string m_Value;
00599   };
00600 
00601   std::ostream& operator<< ( std::ostream& os, const StatusMessageData& data );
00602 
00612   class StopMessageData:
00613     public MessageDataBase
00614   {
00615   public:
00619     StopMessageData( const std::string& source,
00620                      const std::string& sourceClass,
00621                      const std::string& sourceTimeline,
00622                      const std::string& sourceToken,
00623                      const std::string& target,
00624                      const std::string& targetClass,
00625                      const std::string& targetTimeline,
00626                      int token, 
00627                      const std::string& value,
00628                      int identifier = getNextUniqueIdentifier(),
00629                      const IntSet& subMessages = IntSet(),
00630                      int parent = -1 ):
00631       MessageDataBase( Message::STOP, source, sourceClass, sourceTimeline, sourceToken, target, targetClass, targetTimeline, identifier, subMessages, parent ),
00632       m_ExternalTokenId( token ),
00633       m_Value( value )
00634     {
00635     }
00636   
00640     int getExternalTokenId() const 
00641     { 
00642       return m_ExternalTokenId;
00643     }
00647     const std::string& getValue() const 
00648     { 
00649       return m_Value; 
00650     }
00654     Prototype* clone() const
00655     {
00656       return new StopMessageData( getSourceLocation(),
00657                                   getTargetLocation(),
00658                                   getSourceToken(),
00659                                   m_ExternalTokenId,
00660                                   m_Value, 
00661                                   getIdentifier(),
00662                                   getSubMessages(),
00663                                   getParent() );
00664     }
00665   private:
00669     StopMessageData( const TokenLocation& sourceLocation,
00670                      const TokenLocation& targetLocation,
00671                      const std::string& sourceToken,
00672                      int token,
00673                      const std::string& value,
00674                      int identifier,
00675                      const IntSet& subMessages,
00676                      int parent ):
00677       MessageDataBase( Message::STOP, sourceLocation, targetLocation, sourceToken, identifier, subMessages, parent ),
00678       m_ExternalTokenId( token ),
00679       m_Value( value )
00680     {
00681     }
00682 
00683     int m_ExternalTokenId;
00684     std::string m_Value;
00685   };
00686 
00687   std::ostream& operator<< ( std::ostream& os, const StopMessageData& data );
00688 
00696   class TelemetryMessageData:
00697     public MessageDataBase
00698   {
00699   public:
00703     TelemetryMessageData( const std::string& source,
00704                           const std::string& sourceClass,
00705                           const std::string& sourceTimeline,
00706                           const std::string& sourceToken,
00707                           const std::string& target,
00708                           const std::string& targetClass,
00709                           const std::string& targetTimeline,
00710                           const std::string& value,
00711                           int index,
00712                           int identifier = getNextUniqueIdentifier(),
00713                           const IntSet& subMessages = IntSet(),
00714                           int parent = -1 ):
00715       MessageDataBase( Message::TELEMETRY, source, sourceClass, sourceTimeline, sourceToken, target, targetClass, targetTimeline, identifier, subMessages, parent ),
00716       m_Value( value ),
00717       m_Index( index )
00718     {
00719     }
00723     const std::string& getValue() const 
00724     { 
00725       return m_Value; 
00726     }
00730     int getIndex() const 
00731     { 
00732       return m_Index; 
00733     }
00734     
00735     Prototype* clone() const
00736     {
00737       return new TelemetryMessageData( getSourceLocation(),
00738                                        getTargetLocation(),
00739                                        getSourceToken(),
00740                                        m_Value,
00741                                        m_Index, 
00742                                        getIdentifier(),
00743                                        getSubMessages(),
00744                                        getParent()  );
00745     }
00746   private:
00747     TelemetryMessageData( const TokenLocation& sourceLocation,
00748                           const TokenLocation& targetLocation,
00749                           const std::string& sourceToken,
00750                           const std::string& value,
00751                           int index, 
00752                           int identifier,
00753                           const IntSet& subMessages,
00754                           int parent ):
00755       MessageDataBase( Message::TELEMETRY, sourceLocation, targetLocation, sourceToken, identifier, subMessages, parent ),
00756       m_Value( value ),
00757       m_Index( index )
00758     {
00759     }
00760 
00761     std::string m_Value;
00762     int m_Index;
00763   };
00764 
00765   std::ostream& operator<< ( std::ostream& os, const TelemetryMessageData& data );
00766 
00767 } //namespace IDEA
00768 
00769 #endif // MESSAGE_DEFINITION_HEADER_FILE
00770 
00771 
00772 
00773 
00774 

Contact information
© IDEA
Generated on Fri Feb 3 17:09:40 2006 for IDEA.