Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

DCDT_PostOffice Class Reference

Data structures and method to subscribe, insert, delete and read messages. More...

#include <DCDT_PostOffice.h>

List of all members.

Public Member Functions

 DCDT_PostOffice (DCDT_Agora *agora, int type)
 ~DCDT_PostOffice ()
void AddMember (int Mem_ID)
 Adds a new user member to the PostOffice.
void AddSysMember (int Mem_ID)
 Adds a new system member to the PostOffice.
void DeleteMemberTableEntry (int Mem_ID)
 Delete a member from the PostOffice.
void AddMsg (DCDT_Msg *MP, int Mem_ID, DCDT_RequestType Type)
 Add a new message to the PostOffice queue.
const DCDT_MsgReadNextMsg (int MemID, bool wait)
 Read next message for the member MemID.
const DCDT_MsgReadNextMsg (int MemID, int type, bool wait)
 Read next message of type type for the member MemID.
const DCDT_MsgReadLastMsg (int MemID, int type, bool wait)
 Read the last message received of type type for the member MemID.
void CleanupList ()
 Called periodically by MsgManager.
void SubscribeMsgTypeID (int Member_ID, int MsgType, DCDT_RequestType ReqType=DCDT_ALL_MSG)
void UnSubscribeMsgTypeID (int Member_ID, int MsgType, DCDT_RequestType ReqType=DCDT_ALL_MSG)
 Unsubscribe member Member_ID from the messages of type MsgType.
void UnSubscribeAll (int Member_ID)
 Unsubscribe the member Member_ID from all the messages types.
bool ReadSubscribedMsgMask (unsigned int *mask, int MemID)
 Check if SubscribedMsgMask ( used by LinkTx ) is changed.
bool UpdateSubs (int MemID)
 Chech if the Suscribed mask for the member was changed.
void SetActMsgDeletable (int Member_ID)
 Check if a message was read by all the member, if it is mark the message as deletable.

Private Member Functions

void LogMsg (DCDT_Msg *msg)
 Log the message pointed by *msg.

Private Attributes

DCDT_AgoramyAgora
int PO_Type
DCDT_PostOffice_SLWBUPostOffice_SLWB
DCDT_PostOffice_SLWDCPostOffice_SLWDC
DCDT_PostOffice_SLWSMPostOffice_SLWSM

Friends

class DCDT_MsgManager
class DCDT_Agora


Detailed Description

Data structures and method to subscribe, insert, delete and read messages.

NOTE: This class isn't a member of the Agorà, the real member that uses this class is DCDT_MsgManager.

Definition at line 94 of file DCDT_PostOffice.h.


Constructor & Destructor Documentation

DCDT_PostOffice::DCDT_PostOffice DCDT_Agora agora,
int  type
 

Definition at line 33 of file DCDT_PostOffice.cpp.

References myAgora, PO_Type, POSTOFFICE_SLWB, PostOffice_SLWB, POSTOFFICE_SLWDC, PostOffice_SLWDC, POSTOFFICE_SLWSM, and PostOffice_SLWSM.

DCDT_PostOffice::~DCDT_PostOffice  ) 
 

Definition at line 66 of file DCDT_PostOffice.cpp.


Member Function Documentation

void DCDT_PostOffice::AddMember int  Mem_ID  ) 
 

Adds a new user member to the PostOffice.

Enable an Agora' user member, idenfied by Mem_ID, to send and receive messages througth the PostOffice.

Parameters:
Mem_ID Identifier of the member to be actived

Definition at line 114 of file DCDT_PostOffice.cpp.

References DCDT_PostOffice_SLWSM::AddMember(), DCDT_PostOffice_SLWDC::AddMember(), DCDT_PostOffice_SLWBU::AddMember(), PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, and POSTOFFICE_SLWSM.

Referenced by DCDT_Agora::AddMember().

void DCDT_PostOffice::AddMsg DCDT_Msg MP,
int  Mem_ID,
DCDT_RequestType  Type
 

Add a new message to the PostOffice queue.

When the member Mem_ID wants to insert a new message the same member checks the subscription table and when a member is subscribed to those messages copy the message into the member message queue; this function also updates the message with the number of members subscribed to this message type.

Parameters:
MP pointer to the message to share
Mem_ID member identifier of the publisher

Definition at line 191 of file DCDT_PostOffice.cpp.

References DCDT_PostOffice_SLWSM::AddMsg(), DCDT_PostOffice_SLWDC::AddMsg(), DCDT_PostOffice_SLWBU::AddMsg(), DCDT_TRC_POSTOFFICE, LogMsg(), PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, POSTOFFICE_SLWSM, and TRC_EXEC.

Referenced by DCDT_Member::ShareMsg().

void DCDT_PostOffice::AddSysMember int  Mem_ID  ) 
 

Adds a new system member to the PostOffice.

Enable an Agora' system member, idenfied by Mem_ID, to send and receive messages througth the PostOffice.

Parameters:
Mem_ID Identifier of the member to be actived

Definition at line 139 of file DCDT_PostOffice.cpp.

References DCDT_PostOffice_SLWSM::AddSysMember(), DCDT_PostOffice_SLWDC::AddSysMember(), DCDT_PostOffice_SLWBU::AddSysMember(), PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, and POSTOFFICE_SLWSM.

Referenced by DCDT_Agora::AddSysMember().

void DCDT_PostOffice::CleanupList  ) 
 

Called periodically by MsgManager.

Definition at line 323 of file DCDT_PostOffice.cpp.

References DCDT_PostOffice_SLWSM::CleanupList(), DCDT_PostOffice_SLWDC::CleanupList(), DCDT_PostOffice_SLWBU::CleanupList(), PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, and POSTOFFICE_SLWSM.

Referenced by DCDT_MsgManager::DoYourJob().

void DCDT_PostOffice::DeleteMemberTableEntry int  Mem_ID  ) 
 

Delete a member from the PostOffice.

Disable an Agora' member, idenfied by Mem_ID, from sending and receiving messages througth the PostOffice.

Parameters:
Mem_ID Identifier of the member to be disabled

Definition at line 164 of file DCDT_PostOffice.cpp.

References DCDT_PostOffice_SLWSM::DeleteMemberTableEntry(), DCDT_PostOffice_SLWDC::DeleteMemberTableEntry(), DCDT_PostOffice_SLWBU::DeleteMemberTableEntry(), PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, and POSTOFFICE_SLWSM.

Referenced by DCDT_Agora::RemoveMember().

void DCDT_PostOffice::LogMsg DCDT_Msg msg  )  [inline, private]
 

Log the message pointed by *msg.

Definition at line 81 of file DCDT_PostOffice.cpp.

References DCDT_MsgHeader, DCDT_TRC_POSTOFFICE, DCDT_Msg::GetHeader(), DCDT_Msg::GetPayload(), DCDT_Msg::ReadPayloadLen(), DCDT_Msg::ReadType(), and TRC_PRINT.

Referenced by AddMsg(), and ReadNextMsg().

const DCDT_Msg * DCDT_PostOffice::ReadLastMsg int  MemID,
int  type,
bool  wait
 

Read the last message received of type type for the member MemID.

Check if there is an unread message in the member queue; if we found one we have to mark it as deletable and return a pointer to it. If, during the queue slide, we find a message marked as deletable or that isn't the last one we have to delete it and go on.

Parameters:
MemID Member identifier
type Type of the message to be read
Returns:
NULL - No new messages available.

!=NULL - Next message available.

Definition at line 297 of file DCDT_PostOffice.cpp.

References PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, POSTOFFICE_SLWSM, DCDT_PostOffice_SLWDC::ReadLastMsg(), DCDT_PostOffice_SLWBU::ReadLastMsg(), and DCDT_PostOffice_SLWSM::ReadNextMsg().

Referenced by DCDT_Member::ReceiveLastMsg().

const DCDT_Msg * DCDT_PostOffice::ReadNextMsg int  MemID,
int  type,
bool  wait
 

Read next message of type type for the member MemID.

Check if there is an unread message in the member queue; if we found one we have to mark it as deletable and return a pointer to it. If, during the queue slide, we find a message marked as deletable we have to delete it and go on.

Parameters:
MemID Member identifier
type Type of the message to be read
Returns:
NULL - No new messages available.

!=NULL - Next message available.

Definition at line 269 of file DCDT_PostOffice.cpp.

References PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, POSTOFFICE_SLWSM, DCDT_PostOffice_SLWSM::ReadNextMsg(), DCDT_PostOffice_SLWDC::ReadNextMsg(), and DCDT_PostOffice_SLWBU::ReadNextMsg().

const DCDT_Msg * DCDT_PostOffice::ReadNextMsg int  MemID,
bool  wait
 

Read next message for the member MemID.

Check if there is an unread message in the member queue; if we found one we have to mark it as deletable and return a pointer to it. If, during the queue slide, we find a message marked as deletable we have to delete it and go on.

Parameters:
MemID Member identifier
Returns:
NULL - No new messages available.

!=NULL - Next message available.

Definition at line 224 of file DCDT_PostOffice.cpp.

References DCDT_TRC_POSTOFFICE, LogMsg(), PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, DCDT_PostOffice_SLWDC::ReadNextMsg(), DCDT_PostOffice_SLWBU::ReadNextMsg(), and TRC_EXEC.

Referenced by DCDT_Member::ReceiveMsg(), and DCDT_Member::ReceiveMsgType().

bool DCDT_PostOffice::ReadSubscribedMsgMask unsigned int *  mask,
int  MemID
 

Check if SubscribedMsgMask ( used by LinkTx ) is changed.

The global mask is build upon the single message mask of each active member, the mask don't include the mask of the member MemID ( usually the calling member ); if MemID is a bridge all the members masks are used otherwise only the masks of MPM_USER and MPM_BRIDGE type members are used; so in a LinkTx member we can build the subscriber mask that needs to be passed to the other side of the link.

Parameters:
mask Pointer to the subscribed message mask
MemID Member identifier
Returns:
TRUE - SubscribedMsgMask was changed

FALSE - SubscribedMsgMask wasn't changed

Definition at line 432 of file DCDT_PostOffice.cpp.

References PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, POSTOFFICE_SLWSM, DCDT_PostOffice_SLWSM::ReadSubscribedMsgMask(), DCDT_PostOffice_SLWDC::ReadSubscribedMsgMask(), and DCDT_PostOffice_SLWBU::ReadSubscribedMsgMask().

Referenced by DCDT_LinkTx::DoYourJob().

void DCDT_PostOffice::SetActMsgDeletable int  Member_ID  )  [inline]
 

Check if a message was read by all the member, if it is mark the message as deletable.

Definition at line 317 of file DCDT_PostOffice.cpp.

void DCDT_PostOffice::SubscribeMsgTypeID int  Member_ID,
int  MsgType,
DCDT_RequestType  ReqType = DCDT_ALL_MSG
 

Definition at line 350 of file DCDT_PostOffice.cpp.

References PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, POSTOFFICE_SLWSM, DCDT_PostOffice_SLWSM::SubscribeMsgTypeID(), DCDT_PostOffice_SLWDC::SubscribeMsgTypeID(), and DCDT_PostOffice_SLWBU::SubscribeMsgTypeID().

Referenced by DCDT_Member::SubscribeMsgType().

void DCDT_PostOffice::UnSubscribeAll int  Member_ID  ) 
 

Unsubscribe the member Member_ID from all the messages types.

Parameters:
Member_ID Member identifier

Definition at line 403 of file DCDT_PostOffice.cpp.

References PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, POSTOFFICE_SLWSM, DCDT_PostOffice_SLWSM::UnSubscribeAll(), DCDT_PostOffice_SLWDC::UnSubscribeAll(), and DCDT_PostOffice_SLWBU::UnSubscribeAll().

Referenced by DCDT_Member::UnSubscribeAll().

void DCDT_PostOffice::UnSubscribeMsgTypeID int  Member_ID,
int  MsgType,
DCDT_RequestType  ReqType = DCDT_ALL_MSG
 

Unsubscribe member Member_ID from the messages of type MsgType.

Parameters:
Member_ID Member identifier
MsgType Messages type for with the member wants to be unsubscribed
ReqType 

Definition at line 378 of file DCDT_PostOffice.cpp.

References PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, POSTOFFICE_SLWSM, DCDT_PostOffice_SLWSM::UnSubscribeMsgTypeID(), DCDT_PostOffice_SLWDC::UnSubscribeMsgTypeID(), and DCDT_PostOffice_SLWBU::UnSubscribeMsgTypeID().

Referenced by DCDT_Member::UnSubscribeMsgType().

bool DCDT_PostOffice::UpdateSubs int  MemID  ) 
 

Chech if the Suscribed mask for the member was changed.

Parameters:
MemID Membed identifier

Definition at line 454 of file DCDT_PostOffice.cpp.

References PO_Type, PostOffice_SLWB, POSTOFFICE_SLWB, PostOffice_SLWDC, POSTOFFICE_SLWDC, PostOffice_SLWSM, POSTOFFICE_SLWSM, DCDT_PostOffice_SLWSM::UpdateSubs(), DCDT_PostOffice_SLWDC::UpdateSubs(), and DCDT_PostOffice_SLWBU::UpdateSubs().


Friends And Related Function Documentation

friend class DCDT_Agora [friend]
 

Definition at line 97 of file DCDT_PostOffice.h.

friend class DCDT_MsgManager [friend]
 

Definition at line 96 of file DCDT_PostOffice.h.


Member Data Documentation

DCDT_Agora* DCDT_PostOffice::myAgora [private]
 

Definition at line 123 of file DCDT_PostOffice.h.

Referenced by DCDT_PostOffice().

int DCDT_PostOffice::PO_Type [private]
 

Definition at line 124 of file DCDT_PostOffice.h.

Referenced by AddMember(), AddMsg(), AddSysMember(), CleanupList(), DCDT_PostOffice(), DeleteMemberTableEntry(), ReadLastMsg(), ReadNextMsg(), ReadSubscribedMsgMask(), SubscribeMsgTypeID(), UnSubscribeAll(), UnSubscribeMsgTypeID(), and UpdateSubs().

DCDT_PostOffice_SLWBU* DCDT_PostOffice::PostOffice_SLWB [private]
 

Definition at line 126 of file DCDT_PostOffice.h.

Referenced by AddMember(), AddMsg(), AddSysMember(), CleanupList(), DCDT_PostOffice(), DeleteMemberTableEntry(), ReadLastMsg(), ReadNextMsg(), ReadSubscribedMsgMask(), SubscribeMsgTypeID(), UnSubscribeAll(), UnSubscribeMsgTypeID(), and UpdateSubs().

DCDT_PostOffice_SLWDC* DCDT_PostOffice::PostOffice_SLWDC [private]
 

Definition at line 127 of file DCDT_PostOffice.h.

Referenced by AddMember(), AddMsg(), AddSysMember(), CleanupList(), DCDT_PostOffice(), DeleteMemberTableEntry(), ReadLastMsg(), ReadNextMsg(), ReadSubscribedMsgMask(), SubscribeMsgTypeID(), UnSubscribeAll(), UnSubscribeMsgTypeID(), and UpdateSubs().

DCDT_PostOffice_SLWSM* DCDT_PostOffice::PostOffice_SLWSM [private]
 

Definition at line 128 of file DCDT_PostOffice.h.

Referenced by AddMember(), AddMsg(), AddSysMember(), CleanupList(), DCDT_PostOffice(), DeleteMemberTableEntry(), ReadLastMsg(), ReadNextMsg(), ReadSubscribedMsgMask(), SubscribeMsgTypeID(), UnSubscribeAll(), UnSubscribeMsgTypeID(), and UpdateSubs().


The documentation for this class was generated from the following files:
Generated on Sun Jun 19 10:35:51 2005 for dcdt by  doxygen 1.3.9.1