MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Msg.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #ifndef _MSG_H
11 #define _MSG_H
12 
18 class Msg
19 {
20  public:
22  Msg( ObjId mid, Element* e1, Element* e2 );
23 
25  virtual ~Msg();
26 
30  static void deleteMsg( ObjId mid );
31 
37  virtual Eref firstTgt( const Eref& src ) const = 0;
38 
47  virtual void sources ( vector< vector< Eref > >& v ) const = 0;
48 
56  virtual void targets( vector< vector< Eref > >& v ) const = 0;
57 
61  Element* e1() const {
62  return e1_;
63  }
64 
68  Element* e2() const {
69  return e2_;
70  }
71 
75  Id getE1() const;
76 
80  Id getE2() const;
81 
82 
86  vector< string > getSrcFieldsOnE1() const;
87 
91  vector< string > getDestFieldsOnE2() const;
92 
96  vector< string > getSrcFieldsOnE2() const;
97 
101  vector< string > getDestFieldsOnE1() const;
102 
106  ObjId mid() const {
107  return mid_;
108  }
109 
120  virtual ObjId findOtherEnd( ObjId ) const = 0;
121 
122 
126  ObjId getAdjacent( ObjId ) const;
127 
137  virtual Msg* copy( Id origSrc, Id newSrc, Id newTgt,
138  FuncId fid, unsigned int b, unsigned int n ) const = 0;
139 
144  bool isForward( const Element* src ) const {
145  return ( e1_ == src );
146  }
147 
151  static const Msg* getMsg( ObjId m );
152 
158  static const Cinfo* initCinfo();
159 
163  static unsigned int initMsgManagers();
164 
168  static void clearAllMsgs();
169 
173  static const Msg* lastMsg();
174 
176  static bool isLastTrump();
177  protected:
179 
182 
187 
189  static bool lastTrump_;
190 
191  private:
192  static const Msg* lastMsg_;
193 };
194 
195 #endif // _MSG_H
virtual ObjId findOtherEnd(ObjId) const =0
Element * e2() const
Definition: Msg.h:68
ObjId getAdjacent(ObjId) const
Definition: Msg.cpp:156
ObjId mid() const
Definition: Msg.h:106
virtual Eref firstTgt(const Eref &src) const =0
Id getE1() const
Definition: Msg.cpp:67
vector< string > getDestFieldsOnE2() const
Definition: Msg.cpp:99
Definition: ObjId.h:20
virtual void sources(vector< vector< Eref > > &v) const =0
virtual void targets(vector< vector< Eref > > &v) const =0
bool isForward(const Element *src) const
Definition: Msg.h:144
static bool isLastTrump()
True when MOOSE has been terminated and is being cleaned up.
Definition: Msg.cpp:320
static bool lastTrump_
Flag to indicate termination of program.
Definition: Msg.h:189
static void deleteMsg(ObjId mid)
Definition: Msg.cpp:52
static Id msgManagerId_
Element 2 attached to Msg.
Definition: Msg.h:186
Id getE2() const
Definition: Msg.cpp:75
Definition: Eref.h:26
virtual ~Msg()
Destructor.
Definition: Msg.cpp:38
Definition: Msg.h:18
Element * e1_
Index of this Msg on the msg_ vector.
Definition: Msg.h:180
ObjId mid_
Definition: Msg.h:178
Element * e1() const
Definition: Msg.h:61
static const Msg * lastMsg()
Definition: Msg.cpp:315
static unsigned int initMsgManagers()
Definition: Msg.cpp:236
vector< string > getSrcFieldsOnE1() const
Definition: Msg.cpp:80
vector< string > getSrcFieldsOnE2() const
Definition: Msg.cpp:118
Definition: Id.h:17
static const Msg * getMsg(ObjId m)
Definition: Msg.cpp:59
virtual Msg * copy(Id origSrc, Id newSrc, Id newTgt, FuncId fid, unsigned int b, unsigned int n) const =0
Element * e2_
Element 1 attached to Msg.
Definition: Msg.h:181
vector< string > getDestFieldsOnE1() const
Definition: Msg.cpp:137
unsigned int FuncId
Definition: header.h:42
Definition: Cinfo.h:18
static const Msg * lastMsg_
Definition: Msg.h:192
Msg(ObjId mid, Element *e1, Element *e2)
Constructor.
Definition: Msg.cpp:30
static const Cinfo * initCinfo()
Definition: Msg.cpp:165
static void clearAllMsgs()
Definition: Msg.cpp:286