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.
- TStandardCaucusMember (TServiceReference& refToCaucus)
- TStandardCaucusMember (const TStandardCaucusMember &)
Interface Category:
API.
Purpose:
- Creates a caucus member that joins the caucus constructed with the specified TServiceReference.
- Copy constructor.
Calling Context:
- Call this function directly.
- Called to copy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws TCaucusException::kCouldNotJoin.
Concurrency:
Multithread safe.
Other Considerations:
None.
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.
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.
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.
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.
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.
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:
- TStream * streamFromStartSend -The stream returned from a call to StartSend.
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.
- virtual TStream * StartReceive ()
- virtual TStream * StartReceive (TCaucusMember :: Identifier & sender)
- virtual TStream * StartReceive (TCaucusMember :: Identifier & sender, bool & isLeaveMessage)
- virtual TStream * StartReceive (TCaucusMember :: Identifier & senderID, TStandardCaucusMember :: EMessageType & messageType)
Interface Category:
API.
Purpose:
- Initiates a message received operation. This function returns the stream to be used to receive the message.
- 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.
- 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.
- 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:
- Called by TCaucusReceiveMessage.
- Called by TCaucusReceiveMessage.
- Called by TCaucusReceiveMessage.
- Called by TCaucusReceiveMessage.
Parameters:
- Takes no parameters.
- TCaucusMember :: Identifier & sender -The sender of the message.
- TCaucusMember :: Identifier & sender -The sender of the message
- bool & isLeaveMessage -A flag indicating whether the message is a leave message. If the flag is true, the stream returned will have zero bytes of data.
- TCaucusMember :: Identifier & senderID -The sender of the message.
- TStandardCaucusMember :: EMessageType & messageType -The type of message to be received. EMessageType kJoin and kLeave have zero bytes of data. The others can have zero or more bytes of data.
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.
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:
- TStream * streamFromStartReceive -The stream returned from a call to StartReceive.
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.
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.
virtual void EndPause (TStream * streamFromStartPause)
Interface Category:
API.
Purpose:
Terminates a pause message transmission.
Calling Context:
Called by TStandardCaucusPauseMessage.
Parameters:
- TStream * streamFromStartPause -The stream returned from a call to StartPause.
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.
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.
virtual void EndResume (TStream * streamFromStartResume)
Interface Category:
API.
Purpose:
Terminates a resume message transmission.
Calling Context:
Called by TStandardCaucusResumeMessage.
Parameters:
- TStream * streamFromStartResume -The stream returned from a call to StartResume.
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.