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

DCDT_Member Class Reference

Virual class that defines an Agora member. More...

#include <DCDT_Member.h>

Inheritance diagram for DCDT_Member:

DCDT_Finder DCDT_InnerLinkManager DCDT_LinkRx DCDT_LinkTx DCDT_MsgManager List of all members.

Public Member Functions

 DCDT_Member (DCDT_Agora *, DCDT_TIME period)
 DCDT_Member (DCDT_Agora *)
virtual ~DCDT_Member ()
DCDT_MemberGetMember (int myID)
void * LifeCycle ()
 Member main function executed by the member's thread.
void SetID (int ID)
int ReadID ()
bool CheckProfile (unsigned int mask)
void Shutdown (int num_sec)
virtual void Init ()
virtual void Close ()
virtual void DoYourJob (int par=0)=0
int Activate (const char *thdName=NULL)
 Create a new thread that execute this member.
void Run ()
 Execute our DoYourJob method periodically, if we are a periodical member or continuously.
void Suspend ()
void WakeUp ()
void Exit ()
void SubscribeMsgType (int type, DCDT_RequestType ReqType=DCDT_ALL_MSG)
void UnSubscribeMsgType (int type, DCDT_RequestType ReqType=DCDT_ALL_MSG)
void UnSubscribeAll ()
const DCDT_MsgReceiveMsg (bool wait)
const DCDT_MsgReceiveMsgType (int type, bool wait)
const DCDT_MsgReceiveLastMsg (int type, bool wait)
DCDT_MsgCreateMsg (int type, int delivery_warranty)
DCDT_MsgCreateMsg (int type)
void ShareMsg (DCDT_Msg *)
DCDT_MsgDupMsg (DCDT_Msg *)
void Wait (DCDT_TIME sleep_time)
void Wait (struct timeval deadline)

Public Attributes

unsigned int Profile

Protected Attributes

DCDT_PostOfficemyPostOffice
char myIPAddr [INET_ADDRSTRLEN]
DCDT_AgoramyAgora
 Agora that the member belongs to.
DCDT_FindermyFinder
 Our Finder, valid only for system members.
int myID
 Member ID.
int myAgoraID
 Agora ID.
bool EndOfSession
DCDT_TIME Period
 Execution period, if == 0 -> cyclic member.
DCDT_TIME ExecTime
 Last cycle duration of DoYourJob method.
DCDT_TIME CycleTime
 Last cycle duration.
DCDT_TIME StartTime
 When this member was activated.
timeval deadline
int Status
int SubsMsgMask [NUMINT_MSGTYPE]
 Message subscription mask.
pthread_t myThread
pthread_attr_t myThreadAttr

Friends

class DCDT_Agora

Detailed Description

Virual class that defines an Agora member.

Definition at line 44 of file DCDT_Member.h.


Constructor & Destructor Documentation

DCDT_Member::DCDT_Member DCDT_Agora ,
DCDT_TIME  period
 

Definition at line 45 of file DCDT_Member.cpp.

References ExecTime, myAgora, myIPAddr, Period, and DCDT_Agora::ReadIPStrAddr().

DCDT_Member::DCDT_Member DCDT_Agora  ) 
 

Definition at line 54 of file DCDT_Member.cpp.

References ExecTime, myAgora, myIPAddr, Period, and DCDT_Agora::ReadIPStrAddr().

DCDT_Member::~DCDT_Member  )  [virtual]
 

Definition at line 62 of file DCDT_Member.cpp.


Member Function Documentation

int DCDT_Member::Activate const char *  thd_name = NULL  ) 
 

Create a new thread that execute this member.

The new thread uses realtime scheduling policy and was detached from the calling process.

Definition at line 68 of file DCDT_Member.cpp.

References DCDT_TRC_MEMBER, myID, myThread, ThreadStartRoutine(), TRC_ADD_THREAD, TRC_ERROR, and TRC_PRINT.

Referenced by DCDT_Agora::ActivateMember(), and DCDT_Agora::ActivateSysMember().

bool DCDT_Member::CheckProfile unsigned int  mask  )  [inline]
 

Definition at line 148 of file DCDT_Member.h.

References Profile.

virtual void DCDT_Member::Close  )  [inline, virtual]
 

Reimplemented in DCDT_LinkRx, DCDT_LinkTx, and DCDT_MsgManager.

Definition at line 67 of file DCDT_Member.h.

Referenced by LifeCycle().

DCDT_Msg * DCDT_Member::CreateMsg int  type  )  [inline]
 

Definition at line 188 of file DCDT_Member.h.

References DCDT_TRC_MEMBER, myAgoraID, myID, DCDT_Msg::SetAgoraID(), DCDT_Msg::SetDeliveryWarranty(), DCDT_Msg::SetMemberID(), and TRC_PRINT.

DCDT_Msg * DCDT_Member::CreateMsg int  type,
int  delivery_warranty
[inline]
 

Definition at line 176 of file DCDT_Member.h.

References DCDT_TRC_MEMBER, myAgoraID, myID, DCDT_Msg::SetAgoraID(), DCDT_Msg::SetDeliveryWarranty(), DCDT_Msg::SetMemberID(), and TRC_PRINT.

Referenced by DCDT_LinkTx::DCDT_LinkTx().

virtual void DCDT_Member::DoYourJob int  par = 0  )  [pure virtual]
 

Implemented in DCDT_Finder, DCDT_InnerLinkManager, DCDT_LinkRx, DCDT_LinkTx, and DCDT_MsgManager.

Referenced by Run().

DCDT_Msg * DCDT_Member::DupMsg DCDT_Msg  )  [inline]
 

Definition at line 217 of file DCDT_Member.h.

References DCDT_TRC_MEMBER, DCDT_Msg::GetPayload(), DCDT_Msg::ReadPayloadLen(), DCDT_Msg::ReadPriority(), DCDT_Msg::ReadType(), DCDT_Msg::SetPayload(), and TRC_PRINT.

void DCDT_Member::Exit  )  [inline]
 

Definition at line 77 of file DCDT_Member.h.

DCDT_Member* DCDT_Member::GetMember int  myID  )  [inline]
 

virtual void DCDT_Member::Init  )  [inline, virtual]
 

Reimplemented in DCDT_Finder, DCDT_InnerLinkManager, DCDT_LinkRx, DCDT_LinkTx, and DCDT_MsgManager.

Definition at line 66 of file DCDT_Member.h.

Referenced by LifeCycle().

void * DCDT_Member::LifeCycle  )  [inline]
 

Member main function executed by the member's thread.

This functions implements the basic member behavior. 1 - Call Init() 2 - Wait until the Agora' is DCDT_LETSWORK state 3 - Execute the periodical function DoYourJob 4 - Call Close() 5 - Terminate thread

Definition at line 110 of file DCDT_Member.cpp.

References Close(), Delay(), DCDT_Agora::GetStatus(), GetTime(), Init(), myAgora, myID, Run(), DCDT_Agora::SetActive(), DCDT_Agora::SetInactive(), StartTime, and Status.

Referenced by ThreadStartRoutine().

int DCDT_Member::ReadID  )  [inline]
 

Definition at line 144 of file DCDT_Member.h.

Referenced by DCDT_LinkTx::DoYourJob(), and ThreadStartRoutine().

const DCDT_Msg * DCDT_Member::ReceiveLastMsg int  type,
bool  wait
[inline]
 

Definition at line 172 of file DCDT_Member.h.

References myID, myPostOffice, and DCDT_PostOffice::ReadLastMsg().

const DCDT_Msg * DCDT_Member::ReceiveMsg bool  wait  )  [inline]
 

Definition at line 164 of file DCDT_Member.h.

References myID, myPostOffice, and DCDT_PostOffice::ReadNextMsg().

Referenced by DCDT_LinkTx::DoYourJob().

const DCDT_Msg * DCDT_Member::ReceiveMsgType int  type,
bool  wait
[inline]
 

Definition at line 168 of file DCDT_Member.h.

References myID, myPostOffice, and DCDT_PostOffice::ReadNextMsg().

void DCDT_Member::Run  )  [inline]
 

Execute our DoYourJob method periodically, if we are a periodical member or continuously.

Definition at line 148 of file DCDT_Member.cpp.

References CycleTime, DCDT_TIME, DCDT_TRC_MEMBER, deadline, DoYourJob(), ExecTime, DCDT_Agora::GetStatus(), GetTime(), myAgora, myID, Period, StartTime, Status, TRC_PRINT, tv2DCDT_TIME(), and Wait().

Referenced by LifeCycle().

void DCDT_Member::SetID int  ID  )  [inline]
 

Definition at line 140 of file DCDT_Member.h.

References myID.

void DCDT_Member::ShareMsg DCDT_Msg  )  [inline]
 

Definition at line 200 of file DCDT_Member.h.

References DCDT_PostOffice::AddMsg(), DCDT_Agora::CheckMemberProfile(), DCDT_LOCAL_MSG, DCDT_REMOTE_MSG, DCDT_TRC_MEMBER, MPM_BRIDGE, MPM_LINK, myAgora, myID, myPostOffice, and TRC_PRINT.

Referenced by DCDT_LinkRx::DoYourJob().

void DCDT_Member::Shutdown int  num_sec  )  [inline]
 

Definition at line 238 of file DCDT_Member.h.

References DCDT_TERMINATING, Delay(), myAgora, and DCDT_Agora::SetStatus().

void DCDT_Member::SubscribeMsgType int  type,
DCDT_RequestType  ReqType = DCDT_ALL_MSG
[inline]
 

Definition at line 152 of file DCDT_Member.h.

References myID, myPostOffice, and DCDT_PostOffice::SubscribeMsgTypeID().

Referenced by DCDT_LinkTx::Subscribe().

void DCDT_Member::Suspend  )  [inline]
 

Definition at line 142 of file DCDT_Member.cpp.

void DCDT_Member::UnSubscribeAll  )  [inline]
 

Definition at line 160 of file DCDT_Member.h.

References myID, myPostOffice, and DCDT_PostOffice::UnSubscribeAll().

Referenced by DCDT_LinkTx::DoYourJob(), and DCDT_LinkRx::DoYourJob().

void DCDT_Member::UnSubscribeMsgType int  type,
DCDT_RequestType  ReqType = DCDT_ALL_MSG
[inline]
 

Definition at line 156 of file DCDT_Member.h.

References myID, myPostOffice, and DCDT_PostOffice::UnSubscribeMsgTypeID().

void DCDT_Member::Wait struct timeval  deadline  )  [inline]
 

Definition at line 235 of file DCDT_Member.cpp.

References DCDT_TIME, and Delay().

void DCDT_Member::Wait DCDT_TIME  sleep_time  )  [inline]
 

Definition at line 229 of file DCDT_Member.cpp.

References Delay().

Referenced by Run().

void DCDT_Member::WakeUp  )  [inline]
 


Friends And Related Function Documentation

friend class DCDT_Agora [friend]
 

Definition at line 45 of file DCDT_Member.h.


Member Data Documentation

DCDT_TIME DCDT_Member::CycleTime [protected]
 

Last cycle duration.

Definition at line 116 of file DCDT_Member.h.

Referenced by Run().

struct timeval DCDT_Member::deadline [protected]
 

Definition at line 124 of file DCDT_Member.h.

Referenced by Run().

bool DCDT_Member::EndOfSession [protected]
 

Definition at line 113 of file DCDT_Member.h.

DCDT_TIME DCDT_Member::ExecTime [protected]
 

Last cycle duration of DoYourJob method.

Definition at line 116 of file DCDT_Member.h.

Referenced by DCDT_Member(), and Run().

DCDT_Agora* DCDT_Member::myAgora [protected]
 

Agora that the member belongs to.

Definition at line 102 of file DCDT_Member.h.

Referenced by DCDT_Member(), LifeCycle(), Run(), ShareMsg(), and Shutdown().

int DCDT_Member::myAgoraID [protected]
 

Agora ID.

Definition at line 111 of file DCDT_Member.h.

Referenced by DCDT_Agora::AddMember(), DCDT_Agora::AddSysMember(), and CreateMsg().

DCDT_Finder* DCDT_Member::myFinder [protected]
 

Our Finder, valid only for system members.

Definition at line 105 of file DCDT_Member.h.

Referenced by DCDT_Agora::AddMember(), and DCDT_Agora::AddSysMember().

int DCDT_Member::myID [protected]
 

Member ID.

Definition at line 108 of file DCDT_Member.h.

Referenced by Activate(), DCDT_Agora::AddMember(), DCDT_Agora::AddSysMember(), CreateMsg(), LifeCycle(), ReceiveLastMsg(), ReceiveMsg(), ReceiveMsgType(), DCDT_Agora::RemoveMember(), Run(), SetID(), ShareMsg(), SubscribeMsgType(), UnSubscribeAll(), and UnSubscribeMsgType().

char DCDT_Member::myIPAddr[INET_ADDRSTRLEN] [protected]
 

Definition at line 99 of file DCDT_Member.h.

Referenced by DCDT_Agora::AddMember(), and DCDT_Member().

DCDT_PostOffice* DCDT_Member::myPostOffice [protected]
 

Definition at line 98 of file DCDT_Member.h.

Referenced by DCDT_Agora::AddMember(), DCDT_Agora::AddSysMember(), ReceiveLastMsg(), ReceiveMsg(), ReceiveMsgType(), ShareMsg(), SubscribeMsgType(), UnSubscribeAll(), and UnSubscribeMsgType().

pthread_t DCDT_Member::myThread [protected]
 

Definition at line 136 of file DCDT_Member.h.

Referenced by Activate(), and DCDT_Agora::RemoveMember().

pthread_attr_t DCDT_Member::myThreadAttr [protected]
 

Definition at line 137 of file DCDT_Member.h.

DCDT_TIME DCDT_Member::Period [protected]
 

Execution period, if == 0 -> cyclic member.

Definition at line 116 of file DCDT_Member.h.

Referenced by DCDT_Member(), and Run().

unsigned int DCDT_Member::Profile
 

Definition at line 63 of file DCDT_Member.h.

Referenced by DCDT_Agora::AddMember(), DCDT_Agora::AddSysMember(), and CheckProfile().

DCDT_TIME DCDT_Member::StartTime [protected]
 

When this member was activated.

Definition at line 116 of file DCDT_Member.h.

Referenced by LifeCycle(), and Run().

int DCDT_Member::Status [protected]
 

Definition at line 126 of file DCDT_Member.h.

Referenced by DCDT_Agora::CheckIfAllMemberReady(), DCDT_Agora::LetsWork(), LifeCycle(), DCDT_Agora::RemoveMember(), and Run().

int DCDT_Member::SubsMsgMask[NUMINT_MSGTYPE] [protected]
 

Message subscription mask.

Definition at line 133 of file DCDT_Member.h.


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