class PvmCustom

Base class for classes with non-standard packing and unpacking.

Inheritance:

PvmCustom


Public Methods

[more]virtual void Pack () const
must be overridden with a function, that packs all relevant data of the derived class.
[more]virtual void UnPack ()
must be overridden with a function, that unpacks all relevant data of the derived class.


Documentation

Base class for classes with non-standard packing and unpacking.

This class is the base class for all data, you want to transmit, for which there are no standard PvmRegister()-Calls (see PvmStruct). For all types, that can be registered via PvmRegister()-Calls, there are functions called PvmPack( const Type & ) and PvmUnpack ( type ), which can be used in the Pack() and UnPack()-methods of PvmCustom. You can also use this mechanism, if you want to transmit data "compressed". For example you could have a huge array, that is mostly used with little data:

      struct MyHugeArray : public PvmCustom
      {
        int Size;
        int Huge[100000];
        void Pack () const
          {
            PvmPack (Size);
            for (int i = 0; i < Size; ++i)
              PvmPack (Huge[i]);
          }
        void UnPack ()
          {
            PvmUnpack (Size);
            for (int i = 0; i < Size; ++i)
              PvmUnpack (Huge[i]);
          }
      };

      struct Test : public PvmStruct
      {
        PvmSetStructId (43); 
        PvmRegistration ()
        {
          PvmRegister (Data);
        }
        MyHugeArray Data;
      };

      int 
      main ()
      {
        Test A;
        A.Data.Size = 3;
        A.Data.Huge[ 0 ] = 4;
        A.Data.Huge[ 1 ] = 8;
        A.Data.Huge[ 2 ] = 16;
        A.Send (Pvm ().I ().Parent ()); // Only 4 ints are sent, not 100001 !
      }
    
ovirtual void Pack() const
must be overridden with a function, that packs all relevant data of the derived class.

ovirtual void UnPack()
must be overridden with a function, that unpacks all relevant data of the derived class.


This class has no child classes.

Alphabetic index Hierarchy of classes



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