beautypg.com

HP Integrity NonStop J-Series User Manual

Page 185

background image

For non-templatized classes, use RWDECLARE_PERSISTABLE.

RWDECLARE_PERSISTABLE is a macro found in rw/edefs.h. To use it, add the following
lines to your header file (*.h):

#include
RWDECLARE_PERSISTABLE(YourClass)

RWDECLARE_PERSISTABLE(YourClass) will expand to declare the following global
functions:

RWvostream& operator<<(RWvostream& strm, const YourClass& item);
RWvistream& operator>>(RWvistream& strm, YourClass& obj);
RWvistream& operator>>(RWvistream& strm, YourClass*& pObj);
RWFile& operator<<(RWFile& strm, const YourClass& item);
RWFile& operator>>(RWFile& strm, YourClass& obj);
RWFile& operator>>(RWFile& strm, YourClass*& pObj);

For templatized classes with a single template parameter T, use the macro
RWDECLARE_PERSISTABLE_TEMPLATE.

RWDECLARE_PERSISTABLE_TEMPLATE is also found in rw/edefs.h. To use it, add the
following lines to your header file (*.h):

#include
RWDECLARE_PERSISTABLE_TEMPLATE(YourClass)

RWDECLARE_PERSISTABLE_TEMPLATE(YourClass) will expand to declare the
following global functions:

template
RWvostream& operator<<
(RWvostream& strm, const YourClass& item);
template
RWvistream& operator>>
(RWvistream& strm, YourClass& obj);
template
RWvistream& operator>>
(RWvistream& strm, YourClass*& pObj);
template
RWFile& operator<<(RWFile& strm, const YourClass& item);
template
RWFile& operator>>(RWFile& strm, YourClass& obj);
template
RWFile& operator>>(RWFile& strm, YourClass*& pObj);

For templatized classes with more than one and less than five template parameters, use
one of the following macros from rw/edefs.h.:

// For YourClass:
RWDECLARE_PERSISTABLE_TEMPLATE_2(YourClass)
// For YourClass:
RWDECLARE_PERSISTABLE_TEMPLATE_3(YourClass)

This manual is related to the following products: