xc
Public Member Functions | List of all members
XC::Actor Class Referenceabstract

Remote object associated with a shadow (local) object. More...

#include <Actor.h>

Inheritance diagram for XC::Actor:
Inheritance graph
[legend]
Collaboration diagram for XC::Actor:
Collaboration graph
[legend]

Public Member Functions

 Actor (Channel &theChannel, FEM_ObjectBroker &theBroker, int numActorMethods=0)
 Constructor to init the list. More...
 
 Actor (const Actor &)
 Copy constructor.
 
Actoroperator= (const Actor &)
 Assignment operator.
 
virtual ~Actor (void)
 Destructor.
 
virtual int run (void)=0
 
virtual int addMethod (int tag, int(*fp)())
 Method to add a function to the list of available actor methods. More...
 
virtual int getMethod ()
 Method to return the integer tag of the next method the actor has been asked to invoke. More...
 
virtual int processMethod (int tag)
 Method to process the function whose id is tag. More...
 
virtual int sendObject (MovableObject &theObject, ChannelAddress *theAddress=0)
 Sends object theObject. More...
 
virtual int recvObject (MovableObject &theObject, ChannelAddress *theAddress=0)
 Receives object theObject. More...
 
virtual int sendMessage (const Message &theMessage, ChannelAddress *theAddress=0)
 Sends the message. More...
 
virtual int recvMessage (Message &theMessage, ChannelAddress *theAddress=0)
 Receives the message. More...
 
virtual int sendMatrix (const Matrix &theMatrix, ChannelAddress *theAddress=0)
 Sends the matrix. More...
 
virtual int recvMatrix (Matrix &theMatrix, ChannelAddress *theAddress=0)
 Receives the matrix. More...
 
virtual int sendVector (const Vector &theVector, ChannelAddress *theAddress=0)
 Sends the vector. More...
 
virtual int recvVector (Vector &theVector, ChannelAddress *theAddress=0)
 Receive the vector. More...
 
virtual int sendID (const ID &theID, ChannelAddress *theAddress=0)
 Send the vector of integerstheID. More...
 
virtual int recvID (ID &theID, ChannelAddress *theAddress=0)
 Receive the integer vectortheID. More...
 
ChannelAddressgetShadowsAddressPtr (void) const
 Return a pointer to the channel address for the shadow object that created the actor. More...
 
- Public Member Functions inherited from XC::ShadowActorBase
 ShadowActorBase (Channel &theChannel, FEM_ObjectBroker &)
 Constructor. More...
 
 ShadowActorBase (int actorType, FEM_ObjectBroker &myBroker, MachineBroker &theMachineBroker, int compDemand)
 Constructor. More...
 
void setCommitTag (int commitTag)
 Set the value for #commitTag.
 
int getCommitTag (void) const
 Return the #commitTag member.
 
ChannelgetChannelPtr (void) const
 Returns a pointer to the object channel theChannel.
 
virtual int barrierCheck (int result)
 barrier check.
 
- Public Member Functions inherited from XC::ObjectWithObjBroker
 ObjectWithObjBroker (FEM_ObjectBroker *)
 Object broker to use. More...
 
 ObjectWithObjBroker (FEM_ObjectBroker &)
 Constructor. Sets the broker.
 
FEM_ObjectBrokergetObjectBrokerPtr (void) const
 Returns a pointer to the broker #theBroker.
 

Additional Inherited Members

- Protected Attributes inherited from XC::ShadowActorBase
ChanneltheChannel
 Communication channel to use.
 
- Protected Attributes inherited from XC::ObjectWithObjBroker
FEM_ObjectBrokertheBroker
 

Detailed Description

Remote object associated with a shadow (local) object.

An actor is associated with a shadow object. The shadow acts like a normal object in the users address space, data and processing that is done by the shadow may be stored and processed in a remote process, the actor resides in this remote address space. The actor and the shadow both have a channel, a communication port. This allows the two to communicate with each other.

Constructor & Destructor Documentation

◆ Actor()

XC::Actor::Actor ( Channel theChan,
FEM_ObjectBroker myBroker,
int  numActorMethods = 0 
)

Constructor to init the list.

This is called by the remote process upon initialization to construct the local actor object. It is used to create an Actor object in that remote address space which will communicate with objects in other processes through a channel object, theChan and which uses myBroker to receive movable objects sent from other processes. The subclass will be able to add at most numActorMethods actor methods using addMethod() call. The base classes constructor invokes setUpActor() on theChannel object. It then sets the Address of the remote shadow object which created the actor process by invoking getLastSendersAddress() on theChannel.

Member Function Documentation

◆ addMethod()

int XC::Actor::addMethod ( int  tag,
int(*)()  fp 
)
virtual

Method to add a function to the list of available actor methods.

Aadd as a function to the actor object the function fp, this function is identified by the tag value. This function will be invoked by the actor on invocation of processMethod()} with tag as the argument. The object checks to see that the tag has not been used previously. If it has not and the number of functions so far added is less than #numActorMethods the function is added and $0$ is returned, otherwise a $-1$ (if tag was already used) or $-2$ (if #numActorMethods already added) or a $-3$ (if running out of space) is returned to indicate the function was not added.

◆ getMethod()

int XC::Actor::getMethod ( void  )
virtual

Method to return the integer tag of the next method the actor has been asked to invoke.

A method which returns the next integer value sitting in the actors channel. This int value corresponds to the tag of the next method that the shadow object wants the actor to perform. If an error occurs $-1$ will be returned.

◆ getShadowsAddressPtr()

XC::ChannelAddress * XC::Actor::getShadowsAddressPtr ( void  ) const

Return a pointer to the channel address for the shadow object that created the actor.

◆ processMethod()

int XC::Actor::processMethod ( int  tag)
virtual

Method to process the function whose id is tag.

This causes the actor object to invoke the function that was added to the actor with the {tag} identifier. If no method with {tag} exists a $-1$ is returned.

◆ recvID()

int XC::Actor::recvID ( ID theID,
ChannelAddress theAddress = 0 
)
virtual

Receive the integer vectortheID.

A method which will receive theID from the actors channel either from the address given by theAddress or from the address of the shadow object that created the actor if no address is specified. Returns the result of invoking recvID(0,0,theID,theAddress) on the actors channel object if an address is specified, otherwise the result of invoking recvID(0,0,theID,this->getShadowAdressPtr()) on the actors channel object is returned.

◆ recvMatrix()

int XC::Actor::recvMatrix ( Matrix theMatrix,
ChannelAddress theAddress = 0 
)
virtual

Receives the matrix.

A method which will receive theMatrix from the actors channel either from the address given by theAddress or from the address of the shadow object that created the actor if no address is specified. Returns the result of invoking recvMatrix(0,0,theMatrix,theAddress) on the actors channel object if an address is specified, otherwise the result of invoking recvMatrix(0,0,theMatrix,this->getShadowAdressPtr()) on the actors channel object is returned.

◆ recvMessage()

int XC::Actor::recvMessage ( Message theMessage,
ChannelAddress theAddress = 0 
)
virtual

Receives the message.

A method which will receive the data in the theMessage from the actors channel either from the address given by theAddress or from the address of the shadow object that created the actor if no address is specified. Returns the result of invoking recvMsg(0,0,theMessage,theAddress)} on the actors channel object if an address is specified, otherwise the result of invoking recvMsg(0,0,theMessage,this->getShadowAdressPtr())} on the actors channel object is returned.

◆ recvObject()

int XC::Actor::recvObject ( MovableObject theObject,
ChannelAddress theAddress = 0 
)
virtual

Receives object theObject.

A method which will receive theObject from the actors channel either from the address given by theAddress or from the address of the shadow object that created the actor if no address is specified. Returns the result of invoking recvObj(0, theObject,theBroker,theAddress)} on the actors channel object if an address is specified, otherwise the result of invoking recvObj(theMessage,theBroker,this->getShadowAdressPtr()) on the actors channel object is returned.

◆ recvVector()

int XC::Actor::recvVector ( Vector theVector,
ChannelAddress theAddress = 0 
)
virtual

Receive the vector.

A method which will receive theVector from the actors channel either from the address given by theAddress or from the address of the shadow object that created the actor if no address is specified. Returns the result of invoking recvVector(0,0,theVector,theAddress) on the actors channel object if an address is specified, otherwise the result of invoking recvVector(0,0,theVector,this->getShadowAdressPtr()) on the actors channel object is returned.

◆ sendID()

int XC::Actor::sendID ( const ID theID,
ChannelAddress theAddress = 0 
)
virtual

Send the vector of integerstheID.

A method which will send theID through the actors channel either to the address given by theAddress or to the address of the shadow object that created the actor if no address is specified. Returns the result of invoking sendID(0,0,theID,theAddress) on the actors channel object if an address is specified, otherwise the result of invoking sendID(0,0,theID,this->getShadowAdressPtr())} on the actors channel object is returned.

◆ sendMatrix()

int XC::Actor::sendMatrix ( const Matrix theMatrix,
ChannelAddress theAddress = 0 
)
virtual

Sends the matrix.

A method which will send theMatrix through the actors channel either to the address given by theAddress or to the address of the shadow object that created the actor if no address is specified. Returns the result of invoking sendMatrix(0,0,theMatrix,theAddress)} on the actors channel object if an address is specified, otherwise the result of invoking sendMatrix(0,0,theMatrix,this->getShadowAdressPtr()) on the actors channel object is returned.

◆ sendMessage()

int XC::Actor::sendMessage ( const Message theMessage,
ChannelAddress theAddress = 0 
)
virtual

Sends the message.

A method which will send the data in the theMessage through the actors channel either to the address given by theAddress or to the address of the shadow object that created the actor if no address is specified. Returns the result of invoking sendMsg(0,0,theMessage,theAddress) on the actors channel object if an address is specified, otherwise the result of invoking sendMsg(theMessage,this->getShadowAdressPtr())} on the actors channel object is returned.

◆ sendObject()

int XC::Actor::sendObject ( MovableObject theObject,
ChannelAddress theAddress = 0 
)
virtual

Sends object theObject.

A method which will send #theObject through the actors channel either to the address given by theAddress or to the address of the shadow object that created the actor if no address is specified. Returns the result of invoking sendObj(0, theObject,theBroker,theAddress) on the actors channel object if an address is specified, otherwise the result of invoking sendObj(theMessage,theBroker,this->getShadowAdressPtr()) on the actors channel object is returned.

◆ sendVector()

int XC::Actor::sendVector ( const Vector theVector,
ChannelAddress theAddress = 0 
)
virtual

Sends the vector.

A method which will send theVector through the actors channel either to the address given by theAddress or to the address of the shadow object that created the actor if no address is specified. Returns the result of invoking sendVector(0,0,theVector,theAddress) on the actors channel object if an address is specified, otherwise the result of invoking sendVector(0,0,theVector,this->getShadowAdressPtr())} on the actors channel object is returned.


The documentation for this class was generated from the following files: