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/Simulator/Includes/SimMessage.hh

Go to the documentation of this file.
00001 // -*- Mode: c++ -*-
00002 //     File: $Source: /home/cvs/ISG-Repository/IDEA-DEV/Core/Simulator/Includes/SimMessage.hh,v $
00003 //      Tag: $Name: DR_01_11_06 $
00004 //      CVS: $Id: SimMessage.hh,v 1.5 2005/11/23 00:29:30 rijsman Exp $
00005 //     Info: $CVSROOT/IDEA-DEV/COPYRIGHT
00006 #ifndef SIMULATOR_MESSAGE_TYPE_HEADER
00007 #define SIMULATOR_MESSAGE_TYPE_HEADER
00008 
00009 #include "Message.hh"
00010 #include "MessageData.hh"
00011 #include "Trace.hh"
00012 
00013 namespace IDEA
00014 {
00022   class SimulatorDataBase:
00023     public MessageData
00024   {
00025   public:
00029     SimulatorDataBase( const std::string& identifier ):
00030       MessageData( Message::USERDEFINED,
00031                    getNextUniqueIdentifier() ),
00032       m_Identifier( identifier )
00033     {
00034     }
00038     const std::string& getIdentifier() const 
00039     { 
00040       return m_Identifier; 
00041     }
00042     
00043     virtual void* getContent() const = 0;
00047     Prototype* clone() const 
00048     {
00049       return 0; //new SimulatorDataBase( m_Identifier );
00050     }
00051   private:
00052     std::string m_Identifier;
00053   };
00054 
00062   template< class Type >
00063   class SimulatorData:
00064     public SimulatorDataBase
00065   {
00066   public:
00070     SimulatorData( const std::string& identifier, const Type& content ):
00071       SimulatorDataBase( identifier ),
00072       m_Content( content )
00073     {
00074     }
00078     ~SimulatorData()
00079     {
00080     }
00081     
00082     void* getContent() const 
00083     { 
00084       return (void*) &m_Content; 
00085     }
00086     
00090     Prototype* clone() const 
00091     {
00092       return new SimulatorData< Type >( getIdentifier(), m_Content );
00093     }
00094   private:
00095     Type m_Content;
00096   };
00097 
00105   class SimulatorMessage:
00106     public Message
00107   {
00108   public:
00109     SimulatorMessage( const Time& time, SimulatorDataBase* data ):
00110       Message( time, data )
00111     {
00112     }
00113   };
00114 }
00115 
00116 #endif //SIMULATOR_MESSAGE_TYPE_HEADER

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