00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef Actor_h
00027 #define Actor_h
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class ObjectBroker;
00039 class Message;
00040 class Channel;
00041 class ChannelAddress;
00042 class MovableObject;
00043 class Matrix;
00044 class Vector;
00045 class ID;
00046 class FEM_ObjectBroker;
00047
00048 class ActorMethod
00049 {
00050 public:
00051 int tag;
00052 int (*theMethod)();
00053 };
00054
00055 class Actor
00056 {
00057 public:
00058 Actor(Channel &theChannel,
00059 FEM_ObjectBroker &theBroker,
00060 int numActorMethods =0);
00061
00062 virtual ~Actor();
00063
00064 virtual int run(void) = 0;
00065
00066 virtual int addMethod(int tag, int (*fp)());
00067 virtual int getMethod();
00068 virtual int processMethod(int tag);
00069
00070 virtual int sendObject(MovableObject &theObject,
00071 ChannelAddress *theAddress =0);
00072 virtual int recvObject(MovableObject &theObject,
00073 ChannelAddress *theAddress =0);
00074
00075 virtual int sendMessage(const Message &theMessage,
00076 ChannelAddress *theAddress =0);
00077 virtual int recvMessage(Message &theMessage,
00078 ChannelAddress *theAddress =0);
00079
00080 virtual int sendMatrix(const Matrix &theMatrix,
00081 ChannelAddress *theAddress =0);
00082 virtual int recvMatrix(Matrix &theMatrix,
00083 ChannelAddress *theAddress =0);
00084
00085 virtual int sendVector(const Vector &theVector,
00086 ChannelAddress *theAddress =0);
00087 virtual int recvVector(Vector &theVector,
00088 ChannelAddress *theAddress =0);
00089
00090 virtual int sendID(const ID &theID,
00091 ChannelAddress *theAddress =0);
00092 virtual int recvID(ID &theID,
00093 ChannelAddress *theAddress =0);
00094
00095 Channel *getChannelPtr(void) const;
00096 FEM_ObjectBroker *getObjectBrokerPtr(void) const;
00097 ChannelAddress *getShadowsAddressPtr(void) const;
00098
00099 virtual int barrierCheck(int result);
00100 void setCommitTag(int commitTag);
00101
00102 protected:
00103 FEM_ObjectBroker *theBroker;
00104 Channel *theChannel;
00105
00106 private:
00107 int numMethods, maxNumMethods;
00108 ActorMethod **actorMethods;
00109 ChannelAddress *theRemoteShadowsAddress;
00110
00111 int commitTag;
00112 };
00113
00114 #endif
00115