## class Custom

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

### Public Methods

  virtual void | Pack () const must be overridden with a function, that packs all relevant data of the derived class.
  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 Register ()-Calls (see Struct). For all types, that can be registered via Register()-Calls, there are functions called Pack (const Type &) and Unpack (type), which can be used in the Pack () and UnPack ()-methods of Custom. 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 Pvm::Custom
>           {
>             int Size;
>             int Huge[100000];
>             void Pack () const
>               {
>                 Pvm::Pack (Size);
>                 for (int i = 0; i < Size; ++i)
>                   Pvm::Pack (Huge[i]);
>               }
>             void UnPack ()
>               {
>                 Pvm::Unpack (Size);
>                 for (int i = 0; i < Size; ++i)
>                   Pvm::Unpack (Huge[i]);
>               }
>           };

>           struct Test : public Pvm::Struct
>           {
>             PvmSetStructId (43);
>             PvmRegistration ()
>             {
>               Pvm::Register (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::Pvm ().I ().Parent ()); // Only 4 ints are sent, not 100001 !
>           }

`virtual void Pack() const = 0`
  must be overridden with a function, that packs all relevant data of the derived class.

`virtual void UnPack() = 0`
  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++.