class PvmStruct

Base class for all classes to be transmitted by PVM++.

Inheritance:

PvmStruct


Public Methods

[more]PvmReceiveAction AutomaticUnPack ()
installs the "unpack on receive" action, ie.
[more]PvmReceiveAction InstallHandler (PvmHandlerFunc Func)
installs the handler Func as a message handler for all messages of the current message type.
[more]PvmReceiveAction NormalReceive ()
switches back to normal mode of operation, ie.
[more]void Receive (PvmTask &From = IgnoreTask)
receives a message of the given type and returns the id of the sender in From.
[more]PvmReceiveAction ReceiveAction (const PvmReceiveAction &What)
sets the new action on receive for the current message type to What.
[more]void ReceiveFrom (const PvmTaskSet &FromSet, PvmTask &From = IgnoreTask)
receives a message of the given type, but only from one of the tasks given by FromSet, and returns the id of the sender in From.
[more]void ReceiveFrom (PvmTask From)
receives a message of the given type, but only from the task From.
[more]void Send (PvmTask To) const
sends the message to task To.
[more]void Send (const PvmTaskSet &To) const
sends the message to all tasks in the set To.
[more]PvmReceiveAction SwallowOnReceive ()
installs the "swallow on receive" action, ie.
[more]bool TimedReceive (unsigned long int &Time, PvmTask &From = IgnoreTask)
receives a message of the given type and returns the id of the sender in From.
[more]bool TimedReceiveFrom (const PvmTaskSet &FromSet, unsigned long int &Time, PvmTask &From = IgnoreTask)
receives a message of the given type, but only from one of the tasks given by FromSet, and returns the id of the sender in From.
[more]bool TimedReceiveFrom (PvmTask From, unsigned long int &Time)
receives a message of the given type, but only from the task From.


Documentation

Base class for all classes to be transmitted by PVM++.

Every struct (or class, for that matter) that should be sent between tasks must be publically derived from PvmStruct. And it has to register all its members, that should be transmitted, to PVM++. Finally it has to provide a tag, which is used internally in PVM++ to determine the type of a message upon arrival, just like in PVM. It is very important not to use one number for different classes and to use the same number for the same type in the different communicating programs! For example a definition could look like this:

      struct Test : public PvmStruct
      {
        PvmSetStructId (42); // Setting the Tag for this struct. 
                              // Don't use twice!!
        PvmRegistration ()
        {
          PvmRegister (Data);
          PvmRegister (Character);
          PvmRegister (DoubleArray, 187);
          PvmRegister (Host);
          PvmRegister (IntSet);
        }
        int Data;
        char Character;
        double DoubleArray[187];
        PvmHost Host;
        set< int > IntSet;
      };
    

As you can see, STL types can be used and will be transmitted correctly, if they are registered and if the template arguments (i.e. int in set< int >) can be registered. The following list shows all types, that can be registered (and therefore transmitted):

Arrays for all of the above types (except PvmStruct and PvmCustom, where it isn't possible due to inheritance) are supported as well. The corresponding syntax is PvmRegister (type PointerToArray, int Size).

ovoid Send(PvmTask To) const
sends the message to task To.

ovoid Send(const PvmTaskSet &To) const
sends the message to all tasks in the set To.

ovoid Receive(PvmTask &From = IgnoreTask)
receives a message of the given type and returns the id of the sender in From. The parameter can be omitted, if you're not interested in who was sending. The call blocks until a message is received.

ovoid ReceiveFrom(const PvmTaskSet &FromSet, PvmTask &From = IgnoreTask)
receives a message of the given type, but only from one of the tasks given by FromSet, and returns the id of the sender in From. This parameter can be omitted. The call blocks until a message is received.

ovoid ReceiveFrom(PvmTask From)
receives a message of the given type, but only from the task From. The call blocks until a message is received.

obool TimedReceive(unsigned long int &Time, PvmTask &From = IgnoreTask)
receives a message of the given type and returns the id of the sender in From. This parameter can be omitted. The parameter Time specifies the maximal blocking time in microseconds. If after this time no message is received, than the function returns false, otherwise it returns true and the remaining time in Time immediately after receiving the message.

obool TimedReceiveFrom(const PvmTaskSet &FromSet, unsigned long int &Time, PvmTask &From = IgnoreTask)
receives a message of the given type, but only from one of the tasks given by FromSet, and returns the id of the sender in From. This parameter can be omitted. The parameter Time specifies the maximal blocking time in microseconds. If after this time no message is received, than the function returns false, otherwise it returns true and the remaining time in Time immediately after receiving the message.

obool TimedReceiveFrom(PvmTask From, unsigned long int &Time)
receives a message of the given type, but only from the task From. The parameter Time specifies the maximal blocking time in microseconds. If after this time no message is received, than the function returns false, otherwise it returns true and the remaining time in Time immediately after receiving the message.

oPvmReceiveAction ReceiveAction(const PvmReceiveAction &What)
sets the new action on receive for the current message type to What. The old action is returned for later use with this function call.

oPvmReceiveAction InstallHandler(PvmHandlerFunc Func)
installs the handler Func as a message handler for all messages of the current message type. Such messages can't be received after a call to that function, as every time, such a message arrives, the installed handler will be called. The old action is returned for later use with the method ReceiveAction(). The parameter Func is of type void (*PvmHandlerFunc)( const class PvmStruct&, const class PvmTask& ). It gets the received message and the sender of it as parameters. A message handler might change global variables and send messages to other tasks, but it should never try to receive messages! Message handlers are not called asynchronous, i.e. they are called, whenever the program calls a Send() or Receive*()-function or the Update()-function of PvmClass.

oPvmReceiveAction AutomaticUnPack()
installs the "unpack on receive" action, ie. every subsequent arriving message of this type will automatically be unpacked into this instance. If this instance is deleted, NormalReceive is enabled again. The old action is returned for later use with the method ReceiveAction().

oPvmReceiveAction SwallowOnReceive()
installs the "swallow on receive" action, ie. every subsequent arriving message of this type will be ignored. The old action is returned for later use with the method ReceiveAction().

oPvmReceiveAction NormalReceive()
switches back to normal mode of operation, ie. you have to receive messages yourself. The old action is returned for later use with the method ReceiveAction().


Direct child classes:
PvmEmptyStruct
Friends:
class PvmInternal
class PvmHandlerTableType
void PvmPack (const PvmStruct &What)
void PvmUnPack (PvmStruct &What)

Alphabetic index Hierarchy of classes



This page was generated with the help of DOC++.