lmsg/MsgHeader.hh

00001 /* -*- mode: c++; c-basic-offset: 4; -*- */
00002 #ifndef LMSG_MSGHEADER_HH
00003 #define LMSG_MSGHEADER_HH
00004 
00005 #include "lmsg/MsgAddr.hh"
00006 #include "lmsg/MsgTypes.hh"
00007 
00008 namespace lmsg {
00009 
00016   class MsgHeader {
00017 
00018     //----------------------------------  4-byte integer (alpha long is 8B)
00019     typedef int count_t;
00020   public:
00021 
00024       typedef count_t MsgType;
00025 
00029     ~MsgHeader(void);
00030 
00034     MsgHeader(void);
00035 
00040     MsgHeader(count_t type, count_t length, const MsgAddr& dest);
00041 
00046     const MsgAddr& getDest(void) const;
00047 
00052     const MsgAddr& getSource(void) const;
00053 
00059     MsgAddr& getDest(void);
00060 
00066     MsgAddr& getSource(void);
00067 
00072     MsgType getMsgType(void) const;
00073 
00078     count_t getMsgLength(void) const;
00079 
00084     count_t getBlockID(void) const;
00085 
00091     count_t getTransID(void) const;
00092 
00097     void Dump(std::ostream& out) const;
00098 
00103     void Import(void);
00104 
00109     void Export(void);
00110 
00115     void setDest(const MsgAddr& addr);
00116 
00121     void setSource(const MsgAddr& addr);
00122 
00126     void setMsgType(MsgType type);
00127 
00131     void setMsgLength(count_t length);
00132 
00136     void setBlockID(count_t id);
00137 
00141     void setTransID(count_t id);
00142 
00143   private:
00144     count_t mLength;
00145     MsgType mType;
00146     MsgAddr mDest;
00147     MsgAddr mSource;
00148     count_t mTransID;
00149     count_t mBlockID;
00150   };
00151 } // namespace lmsg
00152 
00153 //======================================  Message header accessors
00154 inline lmsg::MsgHeader::count_t 
00155 lmsg::MsgHeader::getBlockID(void) const {
00156     return mBlockID;
00157 }
00158 
00159 inline const lmsg::MsgAddr& 
00160 lmsg::MsgHeader::getDest(void) const {
00161     return mDest;
00162 }
00163 
00164 inline lmsg::MsgAddr& 
00165 lmsg::MsgHeader::getDest(void) {
00166     return mDest;
00167 }
00168 
00169 inline lmsg::MsgHeader::count_t 
00170 lmsg::MsgHeader::getMsgLength(void) const {
00171     return mLength;
00172 }
00173 
00174 inline lmsg::MsgHeader::MsgType 
00175 lmsg::MsgHeader::getMsgType(void) const {
00176     return mType;
00177 }
00178 
00179 inline const lmsg::MsgAddr& 
00180 lmsg::MsgHeader::getSource(void) const {
00181     return mSource;
00182 }
00183 
00184 inline lmsg::MsgAddr& 
00185 lmsg::MsgHeader::getSource(void) {
00186     return mSource;
00187 }
00188 
00189 inline lmsg::MsgHeader::count_t 
00190 lmsg::MsgHeader::getTransID(void) const {
00191     return mTransID;
00192 }
00193 
00194 
00195 #endif // LMSG_MSGHEADER_HH

Generated on Sun Mar 8 19:20:50 2009 for dmt by  doxygen 1.5.4