Defining complex-persistent classes

You must make a class complex-persistent if it contains complex functionality.

To make a class complex-persistent and usable within InfoSphere® DataStage® and QualityStage®, follow these rules:

The following example shows how to apply the rules to make your class complex-persistent:

In a file named ComplexPersistentClass.h, you define a complex persistent class named ComplexPersistentClass.
#include <apt_framework/orchestrate.h>

class ComplexPersistentClass: public APT_Persistent // Rule 1
{
	APT_DECLARE_PERSISTENT(ComplexPersistentClass);// Rules 2 & 4
	APT_DECLARE_RTTI(ComplexPersistentClass); // Rule 5
	public:
		ComplexPersistentClass(int, float);
private:
		ComplexPersistentClass(); // Rule 3
		int i_;
		float f_;
};
In the file ComplexPersistentClass.C, the class is implemented as follows:
#include "ComplexPersistentClass.h"

APT_IMPLEMENT_PERSISTENT(ComplexPersistentClass); // Rule 2
APT_IMPLEMENT_RTTI_ONEBASE(ComplexPersistentClass, // Rule 5
		APT_Persistent);

ComplexPersistentClass::ComplexPersistentClass() // Rule 3
		: i_(0), f_(0.0) {}
CompexPersistentClass::ComplexPersistentClass(int i, float f)
		: i_(i), f_(f) {}

void Complex PersistentClass::serialize(APT_Archive& archive,
APT_UInt8) // Rule 4
	{
		archive || i_;
		archive || f_;
	}
The definition of APT_Persistent::serialize() uses the built-in forms of APT_Archive::operator|| to implement persistence for ComplexPersistentClass.