Class: TStandardCaucusMember

Declaration: StandardCaucus.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TCaucusMember

Inherited By:

None.

Purpose:

TStandardCaucusMember derives from TCaucusMember and is a concrete class that uses message streams as its transport. The TStandardCaucusMember constructor takes a TServiceReference reference. It is up to the client to construct or obtain the TServiceReference that corresponds to the TServiceDefinition used to construct the caucus. To construct a TServiceReference, use the const TLocalObjectType&, kCaucusObjectType. The enum EMessageType is the list of messages TStandardCaucusMember can understand. TStandardCaucusReceiveMessage returns with the type of message and the member that sent it. TCaucusSendMessage and TCaucusReceiveMessage will work with a TStandardCaucusMember if you do not care about message types. If you use TCaucusSendMessage and TCaucusReceiveMessage, Join, Leave, Pause, and Resume messages are ignored.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Derived classes must override the virtual functions Leave, GetIdentity, StartSend, EndSend, StartReceive, EndReceive, StartPause, EndPause, StartResume, and EndResume.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Member Function: TStandardCaucusMember::TStandardCaucusMember

  1. TStandardCaucusMember (TServiceReference& refToCaucus)
  2. TStandardCaucusMember (const TStandardCaucusMember &)

Interface Category:

API.

Purpose:

  1. Creates a caucus member that joins the caucus constructed with the specified TServiceReference.
  2. Copy constructor.

Calling Context:

  1. Call this function directly.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws TCaucusException::kCouldNotJoin.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::operator=

TStandardCaucusMember & operator =(const TStandardCaucusMember &)

Interface Category:

API.

Purpose:

Assignment operator. The caucus member leaves its current caucus and joins the caucus of the parameter object.

Calling Context:

Call this function by using the operator in an assignment statement.

Parameters:

Return Value:

Returns a const reference to the left-hand side object.

Exceptions:

Throws TCaucusException::kCouldNotJoinCaucus if it could not join the new caucus. If it could not join, then the object is not usable and should be deallocated. Passes all other exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::~TStandardCaucusMember

virtual ~ TStandardCaucusMember ()

Interface Category:

API.

Purpose:

Destructor. This function sends a Leave message to the caucus.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::Leave

virtual void Leave ()

Interface Category:

API.

Purpose:

Leaves the caucus of which this object is a member. Caucus members leave the caucus by calling Leave. All caucus members including the sending member receive a Leave message. When Leave is called, all threads blocked waiting for that TCaucusMember instance's StartReceive member function unblock and receive TCaucusException::kNotInCaucus exceptions. If Leave is called more than once, the additional calls have no effect. If a caucus member crashes, then eventually the caucus implementation will notice this fact, and at that time, the other caucus members receive a Leave message. The amount of time this takes depends upon the implementation.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::GetIdentity

virtual TCaucusMember::Identifier GetIdentity () const

Interface Category:

API.

Purpose:

Returns the unique caucus member identifier. It's only valid when the member has joined a caucus. When a thread joins a caucus by creating a TStandardCaucusMember, it receives an identity that is unique for the duration of the TStandardCaucusMember. This identity can be used to keep track of the activities of the different members. If a thread leaves, and then rejoins a caucus, it receives a new identity. Hence, it is a new member as far as the caucus is concerned. The GetIdentity call returns the identity of the TStandardCaucusMember. This is an integer of type Identifier.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns member identity of type TCaucusMember::Identifier.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::StartSend

virtual TStream * StartSend ()

Interface Category:

API.

Purpose:

Initiates a message send operation. This function returns the stream used to send the message.

Calling Context:

Called by TCaucusSendMessage.

Parameters:

Return Value:

Returns the stream used to send the message.

Exceptions:

Throws TCaucusException::kNotInCaucus if the member has not joined a caucus. All others are passed through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::EndSend

virtual void EndSend (TStream * streamFromStartSend)

Interface Category:

API.

Purpose:

Terminates a message send operation. The input parameter is the stream returned from a call to StartSend, and is the message to be terminated. This function cleans up the stream.

Calling Context:

Called by TCaucusSendMessage.

Parameters:

Return Value:

None.

Exceptions:

Throws TCaucusException::kNotInCaucus if the member has not joined or is not longer a member of the caucus. All others are passed through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::StartReceive

  1. virtual TStream * StartReceive ()
  2. virtual TStream * StartReceive (TCaucusMember :: Identifier & sender)
  3. virtual TStream * StartReceive (TCaucusMember :: Identifier & sender, bool & isLeaveMessage)
  4. virtual TStream * StartReceive (TCaucusMember :: Identifier & senderID, TStandardCaucusMember :: EMessageType & messageType)

Interface Category:

API.

Purpose:

  1. Initiates a message received operation. This function returns the stream to be used to receive the message.
  2. Initiates a message received operation. This function returns the stream to be used to receive the message. The identifier is set to the sender's member identifier.
  3. Initiates a message received operation. This function returns the stream to be used to receive the message. The identifier is set to the sender's member identifier. The Boolean flag is set to true if the message is a leave message. The leave message has zero bytes of data.
  4. Initiates a message received operation. This function returns the stream to be used to receive the message. The identifier is set to the sender's member identifier. The message type is set to one of the possible EMessageTypes: kJoin, kLeave, kData, kPause, or kResume.

Calling Context:

  1. Called by TCaucusReceiveMessage.
  2. Called by TCaucusReceiveMessage.
  3. Called by TCaucusReceiveMessage.
  4. Called by TCaucusReceiveMessage.

Parameters:

Return Value:

Returns the stream to be used to receive the message.

Exceptions:

Throws TCaucusException::kNotInCaucus if the member has not joined or is not longer a member of the caucus. All others are passed through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::EndReceive

virtual void EndReceive (TStream * streamFromStartReceive)

Interface Category:

API.

Purpose:

Terminates a message receive operation. The input parameter is the stream returned from a call to StartReceive, and is the message to be terminated. This function cleans up the stream.

Calling Context:

Called by TCaucusReceiveMessage.

Parameters:

Return Value:

None.

Exceptions:

Throws TCaucusException::kNotInCaucus if the member has not joined or is not longer a member of the caucus. All others are passed through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::StartPause

virtual TStream * StartPause ()

Interface Category:

API.

Purpose:

Initiates a pause message transmission.

Calling Context:

Called by TStandardCaucusPauseMessage.

Parameters:

Return Value:

Returns the stream to be used to send the pause message.

Exceptions:

Throws TCaucusException::kNotInCaucus if the member has not joined or is not longer a member of the caucus. All others are passed through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::EndPause

virtual void EndPause (TStream * streamFromStartPause)

Interface Category:

API.

Purpose:

Terminates a pause message transmission.

Calling Context:

Called by TStandardCaucusPauseMessage.

Parameters:

Return Value:

None.

Exceptions:

Throws TCaucusException::kNotInCaucus if the member has not joined or is not longer a member of the caucus. All others are passed through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::StartResume

virtual TStream * StartResume ()

Interface Category:

API.

Purpose:

Initiates a resume message transmission.

Calling Context:

Called by TStandardCaucusResumeMessage.

Parameters:

Return Value:

Returns the stream to be used to send the resume message.

Exceptions:

Throws TCaucusException::kNotInCaucus if the member has not joined or is not longer a member of the caucus. All others are passed through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TStandardCaucusMember::EndResume

virtual void EndResume (TStream * streamFromStartResume)

Interface Category:

API.

Purpose:

Terminates a resume message transmission.

Calling Context:

Called by TStandardCaucusResumeMessage.

Parameters:

Return Value:

None.

Exceptions:

Throws TCaucusException::kNotInCaucus if the member has not joined or is not longer a member of the caucus. All others are passed through.

Concurrency:

Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.