Google

class Struct

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

Inheritance:

Struct


Public Methods

[more]::Pvm::ReceiveAction AutomaticUnPack ()
installs the "unpack on receive" action, ie.
[more]::Pvm::ReceiveAction InstallHandler (HandlerFunc Func)
installs the handler Func as a message handler for all messages of the current message type.
[more]::Pvm::ReceiveAction NormalReceive ()
switches back to normal mode of operation, ie.
[more]void Receive (Task &From = IgnoreTask)
receives a message of the given type and returns the id of the sender in From.
[more]::Pvm::ReceiveAction ReceiveAction (const ::Pvm::ReceiveAction &What)
sets the new action on receive for the current message type to What.
[more]void ReceiveFrom (const TaskSet &FromSet, Task &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 (Task From)
receives a message of the given type, but only from the task From.
[more]void Send (Task To) const
sends the message to task To.
[more]void Send (const TaskSet &To) const
sends the message to all tasks in the set To.
[more]::Pvm::ReceiveAction SwallowOnReceive ()
installs the "swallow on receive" action, ie.
[more]bool TimedReceive (unsigned long int &Time, Task &From = IgnoreTask)
receives a message of the given type and returns the id of the sender in From.
[more]bool TimedReceiveFrom (const TaskSet &FromSet, unsigned long int &Time, Task &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 (Task 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 Struct. 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 Pvm::Struct
      {
        PvmSetStructId (42); // Setting the Tag for this struct. 
                              // Don't use twice!!
        PvmRegistration ()
        {
          Pvm::Register (Data);
          Pvm::Register (Character);
          Pvm::Register (DoubleArray, 187);
          Pvm::Register (Host);
          Pvm::Register (IntSet);
        }
        int Data;
        char Character;
        double DoubleArray[187];
        Pvm::Host Host;
        std::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):

  • bool.
  • char.
  • unsigned char.
  • short int.
  • int.
  • float.
  • double.
  • long int.
  • unsigned short.
  • unsigned int.
  • unsigned long int.
  • Pvm::Host.
  • Pvm::HostSet.
  • Pvm::Task.
  • Pvm::TaskSet.
  • std::string.
  • std::complex< Type >, if Type can be registered.
  • std::pair< First, Second >, if First and Second can be registered.
  • std::vector< Key >, if Key can be registered.
  • std::list< Key >, if Key can be registered.
  • std::deque< Key >, if Key can be registered.
  • std::set< Key >, if Key can be registered.
  • std::multiset< Key >, if Key can be registered.
  • std::map< Key >, if Key can be registered.
  • std::multimap< Key >, if Key can be registered.
  • Classes derived from Pvm::Struct.
  • Classes derived from Pvm::Custom.

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

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

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

ovoid Receive(Task &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 TaskSet &FromSet, Task &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(Task 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, Task &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 TaskSet &FromSet, unsigned long int &Time, Task &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(Task 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.

o::Pvm::ReceiveAction ReceiveAction(const ::Pvm::ReceiveAction &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.

o::Pvm::ReceiveAction InstallHandler(HandlerFunc 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 (*HandlerFunc)( const class Struct&, const class Task& ). 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 Class.

o::Pvm::ReceiveAction 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().

o::Pvm::ReceiveAction 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().

o::Pvm::ReceiveAction 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:
EmptyStruct
Friends:
class AccessPrivate
class HandlerTableType
void Pack (const Struct &What)
void UnPack (Struct &What)

Alphabetic index Hierarchy of classes



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