00001 /********************************************************************** 00002 ** This program is part of 'MOOSE', the 00003 ** Messaging Object Oriented Simulation Environment. 00004 ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS 00005 ** It is made available under the terms of the 00006 ** GNU Lesser General Public License version 2.1 00007 ** See the file COPYING.LIB for the full notice. 00008 **********************************************************************/ 00009 00010 #ifndef _MSG_H 00011 #define _MSG_H 00012 00018 class Msg 00019 { 00020 public: 00022 Msg( ObjId mid, Element* e1, Element* e2 ); 00023 00025 virtual ~Msg(); 00026 00030 static void deleteMsg( ObjId mid ); 00031 00037 virtual Eref firstTgt( const Eref& src ) const = 0; 00038 00047 virtual void sources ( vector< vector< Eref > >& v ) const = 0; 00048 00056 virtual void targets( vector< vector< Eref > >& v ) const = 0; 00057 00061 Element* e1() const { 00062 return e1_; 00063 } 00064 00068 Element* e2() const { 00069 return e2_; 00070 } 00071 00075 Id getE1() const; 00076 00080 Id getE2() const; 00081 00082 00086 vector< string > getSrcFieldsOnE1() const; 00087 00091 vector< string > getDestFieldsOnE2() const; 00092 00096 vector< string > getSrcFieldsOnE2() const; 00097 00101 vector< string > getDestFieldsOnE1() const; 00102 00106 ObjId mid() const { 00107 return mid_; 00108 } 00109 00120 virtual ObjId findOtherEnd( ObjId ) const = 0; 00121 00122 00126 ObjId getAdjacent( ObjId ) const; 00127 00137 virtual Msg* copy( Id origSrc, Id newSrc, Id newTgt, 00138 FuncId fid, unsigned int b, unsigned int n ) const = 0; 00139 00144 bool isForward( const Element* src ) const { 00145 return ( e1_ == src ); 00146 } 00147 00151 static const Msg* getMsg( ObjId m ); 00152 00158 static const Cinfo* initCinfo(); 00159 00163 static unsigned int initMsgManagers(); 00164 00168 static void clearAllMsgs(); 00169 00173 static const Msg* lastMsg(); 00174 00176 static bool isLastTrump(); 00177 protected: 00178 ObjId mid_; 00179 00180 Element* e1_; 00181 Element* e2_; 00182 00186 static Id msgManagerId_; 00187 00189 static bool lastTrump_; 00190 00191 private: 00192 static const Msg* lastMsg_; 00193 }; 00194 00195 #endif // _MSG_H