SourcePro® API Reference Guide

 
Macros

Module Description

Header File
#include <rw/serial/RWObjectStreamMacros.h>

This group includes macro definitions used to define operations that enable objects to be serialized.

While not directly part of object streams, these macros make heavy use of the object streams interface, delegating most of the work of object serialization back to the object stream implementation. Object streams are thus able to control nearly all aspects of object serialization, not just the format of primitive data types like virtual streams.

Some of these macros have positional restrictions with respect to each other. As a general rule of thumb, the RW_XXX_AS_SELF macros come before RW_XXX_AS_BASE macros. For more insight, please see Section 6.4, "Basic Examples," in the Advanced Tools Module User's Guide.

Macros

#define RW_BEGIN_EXTERNAL_STREAM_CONTENTS(Class)
 
#define RW_BEGIN_STREAM_CONTENTS(Class)
 
#define RW_DECLARE_EXTERNAL_STREAM_FNS(Class)
 
#define RW_DECLARE_EXTERNAL_STREAMABLE_AS_BASE(Class, Other)
 
#define RW_DECLARE_EXTERNAL_STREAMABLE_AS_SELF(Class)
 
#define RW_DECLARE_EXTERNAL_STREAMABLE_POINTER(Class)
 
#define RW_DECLARE_FRIEND_CTOR_METHOD(Derived, Base)
 
#define RW_DECLARE_STREAMABLE_AS_BASE(Class, Other)
 
#define RW_DECLARE_STREAMABLE_AS_SELF(Class)
 
#define RW_DECLARE_STREAMABLE_COLLECTABLE_MAP(container)
 
#define RW_DECLARE_STREAMABLE_COLLECTABLE_SEQUENCE(container)
 
#define RW_DECLARE_STREAMABLE_POINTER(Class)
 
#define RW_DECLARE_STREAMABLE_PTR_MAP(container)
 
#define RW_DECLARE_STREAMABLE_PTR_SEQUENCE(container)
 
#define RW_DECLARE_STREAMABLE_STD_MAP(container)
 
#define RW_DECLARE_STREAMABLE_STD_SEQUENCE(container)
 
#define RW_DECLARE_STREAMABLE_VAL_MAP(container)
 
#define RW_DECLARE_STREAMABLE_VAL_SEQUENCE(container)
 
#define RW_DECLARE_VIRTUAL_STREAM_FNS(Class)
 
#define RW_DEFINE_EXTERNAL_STREAMABLE_AS_BASE(Class, Other)
 
#define RW_DEFINE_EXTERNAL_STREAMABLE_AS_SELF(Class)
 
#define RW_DEFINE_EXTERNAL_STREAMABLE_POINTER(Class)
 
#define RW_DEFINE_STREAMABLE_AS_BASE(Class, Other)
 
#define RW_DEFINE_STREAMABLE_AS_SELF(Class)
 
#define RW_DEFINE_STREAMABLE_POINTER(Class)
 
#define RW_DEFINE_STREAMABLE_TEMPLATE_POINTER(Class)
 
#define RW_END_EXTERNAL_STREAM_CONTENTS
 
#define RW_END_STREAM_CONTENTS
 
#define RW_INPUT_STREAM
 
#define RW_OUTPUT_STREAM
 
#define RW_STREAM_ATTR_ENUM_GET_SET(Name, Type, get, set)
 
#define RW_STREAM_ATTR_ENUM_MEMBER(Name, memberName)
 
#define RW_STREAM_ATTR_GET_SET(Name, Type, get, set)
 
#define RW_STREAM_ATTR_MEMBER(Name, memberName)
 
#define RW_STREAM_EXTERNAL_PARENT(Base)
 
#define RW_STREAM_PARENT(Base)
 
#define RW_WHEN_INPUT(body)
 
#define RW_WHEN_OUTPUT(body)
 

Macro Definition Documentation

#define RW_BEGIN_EXTERNAL_STREAM_CONTENTS (   Class)

Starts the streamContents() function. Put in separate source file. For external serialization only. (For intrusive, use RW_BEGIN_STREAM_CONTENTS.)

#define RW_BEGIN_STREAM_CONTENTS (   Class)

Starts the streamContents() function. Put in source file for class. For intrusive serialization only. (For external, use RW_BEGIN_EXTERNAL_STREAM_CONTENTS.)

#define RW_DECLARE_EXTERNAL_STREAM_FNS (   Class)

Declares streamContents(), used to add the contents of your object to a virtual stream, and other things. For external serialization only. (For intrusive, use RW_DECLARE_VIRTUAL_STREAM_FNS.)

#define RW_DECLARE_EXTERNAL_STREAMABLE_AS_BASE (   Class,
  Other 
)

Allows concrete derived types to be streamed out and streamed back in as pointers to their base class. Place RW_DECLARE_EXTERNAL_STREAMABLE_AS_BASE in your header, after the declaration of the class. Usually you will want to place this macro after you have used the RW_DECLARE_EXTERNAL_STREAMABLE_AS_SELF macro. For external serialization only. (For intrusive, use RW_DEFINE_STREAMABLE_AS_BASE.)

See also
RW_DEFINE_EXTERNAL_STREAMABLE_AS_BASE
#define RW_DECLARE_EXTERNAL_STREAMABLE_AS_SELF (   Class)

Apply this macro to a class if its instantiations will be serialized as pointers directly to the instantiations. Place RW_DECLARE_EXTERNAL_STREAMABLE_AS_SELF in the header of your serializable class. For external serialization only. (For intrusive, use RW_DECLARE_STREAMABLE_AS_SELF.)

See also
RW_DEFINE_EXTERNAL_STREAMABLE_POINTER
#define RW_DECLARE_EXTERNAL_STREAMABLE_POINTER (   Class)

Defines the global serialization operators. Place RW_DECLARE_EXTERNAL_STREAMABLE_POINTER in the header of your serializable class. For external serialization only. (For intrusive, use RW_DECLARE_STREAMABLE_POINTER.)

See also
RW_DEFINE_EXTERNAL_STREAMABLE_POINTER
#define RW_DECLARE_FRIEND_CTOR_METHOD (   Derived,
  Base 
)

When a derived class has a non-public default constructor, use this macro within the derived class declaration for each base class that might be streamed in as a polymorphic pointer.

#define RW_DECLARE_STREAMABLE_AS_BASE (   Class,
  Other 
)

Allows concrete derived types to be streamed out and streamed back in as pointers to their base class. Place RW_DECLARE_STREAMABLE_AS_BASE in the header of your serializable class. Usually you will want to place this macro after the RW_DECLARE_STREAMABLE_AS_SELF macro. For intrusive serialization only. (For external, use RW_DECLARE_EXTERNAL_STREAMABLE_AS_BASE.)

#define RW_DECLARE_STREAMABLE_AS_SELF (   Class)

Apply this macro to a class if its instantiations will be serialized as pointers directly to the instantiations. For intrusive serialization only. (For external, use RW_DEFINE_EXTERNAL_STREAMABLE_AS_SELF.)

#define RW_DECLARE_STREAMABLE_COLLECTABLE_MAP (   container)

Declares global serialization operators for streaming RWCollectable-based maps (associations). Intrusive or external. Put in header file outside the class declaration.

#define RW_DECLARE_STREAMABLE_COLLECTABLE_SEQUENCE (   container)

Declares global serialization operators for streaming RWCollectable-based collections. Intrusive or external. Put in header file outside the class declaration.

#define RW_DECLARE_STREAMABLE_POINTER (   Class)

RW_DECLARE_STREAMABLE_POINTER declares the global serialization operators for pointers.

Place RW_DECLARE_STREAMABLE_POINTER in the header for the class (outside of the class declaration). For intrusive serialization only. (For external, use RW_DECLARE_EXTERNAL_STREAMABLE_POINTER.)

See also
RW_DEFINE_STREAMABLE_POINTER
#define RW_DECLARE_STREAMABLE_PTR_MAP (   container)

Declares global serialization operators, for streaming maps (associations) of pointers. Intrusive or external. Put in header file outside the class declaration.

#define RW_DECLARE_STREAMABLE_PTR_SEQUENCE (   container)

Declares global serialization operators, for streaming Rogue Wave pointer-based template collections. Intrusive or external. Put in header file outside the class declaration.

#define RW_DECLARE_STREAMABLE_STD_MAP (   container)

Declares global serialization operators, for streaming maps (associations) of C++ Standard Library types. Intrusive or external. Put in header file outside the class declaration.

#define RW_DECLARE_STREAMABLE_STD_SEQUENCE (   container)

Declares global serialization operators, for streaming C++ Standard Library sequences. Intrusive or external. Put in header file outside the class declaration.

#define RW_DECLARE_STREAMABLE_VAL_MAP (   container)

Declares global serialization operators, for streaming maps (associations) of value-based templates. Intrusive or external. Put in header file outside the class declaration.

#define RW_DECLARE_STREAMABLE_VAL_SEQUENCE (   container)

Declares global serialization operators, for streaming Rogue Wave value-based template collections. Intrusive or external. Put in header file outside the class declaration.

#define RW_DECLARE_VIRTUAL_STREAM_FNS (   Class)

Declares streamContents(), used to add the contents of your object to a virtual stream, and other things. Put in header file inside the class declaration. For intrusive serialization only. (For external, use RW_DECLARE_EXTERNAL_STREAM_FNS).

#define RW_DEFINE_EXTERNAL_STREAMABLE_AS_BASE (   Class,
  Other 
)

Allows concrete derived types to be streamed out and streamed back in as pointers to their base class. Place RW_DEFINE_EXTERNAL_STREAMABLE_AS_BASE in the source file for your serializable class. Usually you will want to place this macro after you have used the RW_DECLARE_EXTERNAL_STREAMABLE_AS_SELF macro. For external serialization only. (For intrusive, use RW_DECLARE_STREAMABLE_AS_BASE.)

See also
RW_DECLARE_EXTERNAL_STREAMABLE_AS_BASE
#define RW_DEFINE_EXTERNAL_STREAMABLE_AS_SELF (   Class)

Apply this macro to a class if its instantiations will be serialized as pointers directly to the instantiations. Place RW_DEFINE_EXTERNAL_STREAMABLE_AS_SELF in the source file of your serializable class. For external serialization only. (For intrusive, use RW_DEFINE_STREAMABLE_AS_SELF.)

See also
RW_DECLARE_EXTERNAL_STREAMABLE_POINTER
#define RW_DEFINE_EXTERNAL_STREAMABLE_POINTER (   Class)

Defines the global serialization operators. Place RW_DEFINE_EXTERNAL_STREAMABLE_POINTER in the source file for your serializable class. For external serialization only. (For intrusive, use RW_DEFINE_STREAMABLE_POINTER.)

See also
RW_DECLARE_EXTERNAL_STREAMABLE_POINTER
#define RW_DEFINE_STREAMABLE_AS_BASE (   Class,
  Other 
)

Allows concrete derived types to be streamed out and streamed back in as pointers to their base class. Place RW_DEFINE_STREAMABLE_AS_BASE in the source file of your serializable class. Usually you will want to place this macro after the RW_DEFINE_STREAMABLE_AS_SELF macro. For intrusive serialization only. (For external, use RW_DEFINE_EXTERNAL_STREAMABLE_AS_BASE.)

#define RW_DEFINE_STREAMABLE_AS_SELF (   Class)

Apply this macro to a class if its instantiations will be serialized as pointers directly to the instantiations. For intrusive serialization only. (For external, use RW_DEFINE_EXTERNAL_STREAMABLE_AS_SELF.)

#define RW_DEFINE_STREAMABLE_POINTER (   Class)

RW_DEFINE_STREAMABLE_POINTER defines the global serialization operators for pointers.

Place RW_DEFINE_STREAMABLE_POINTER in the source file for class. For intrusive serialization only. (For external, use RW_DEFINE_EXTERNAL_STREAMABLE_POINTER. For template classes, use RW_DEFINE_STREAMABLE_TEMPLATE_POINTER in the header file.)

See also
RW_DECLARE_STREAMABLE_POINTER
#define RW_DEFINE_STREAMABLE_TEMPLATE_POINTER (   Class)

Defines the global serialization operators to provide serialization support for template classes. (For other classes, use RW_DEFINE_STREAMABLE_POINTER in the source file.)

#define RW_END_EXTERNAL_STREAM_CONTENTS

Ends the streamContents() function. Put in separate source file. For external serialization only. (For intrusive, use RW_END_STREAM_CONTENTS.)

#define RW_END_STREAM_CONTENTS

Ends the streamContents() function. Put in source file for class. For intrusive serialization only. (For external, use RW_END_EXTERNAL_STREAM_CONTENTS.)

#define RW_INPUT_STREAM

Used in custom code to access the object input stream

#define RW_OUTPUT_STREAM

Used in custom code to access the object output stream

#define RW_STREAM_ATTR_ENUM_GET_SET (   Name,
  Type,
  get,
  set 
)

Use this macro to identify an enum type attribute of the class to be streamed in terms of a get() and set() function pair. This is useful in external streaming when the internal data member is private, but has public get() and set() functions.

#define RW_STREAM_ATTR_ENUM_MEMBER (   Name,
  memberName 
)

Use this macro to identify a data member as an enum type attribute of the class. If using external streaming, then the data member must be public.

#define RW_STREAM_ATTR_GET_SET (   Name,
  Type,
  get,
  set 
)

Use this macro to identify an attribute of the class to be streamed in terms of a get() and set() function pair. This is useful in external streaming when the internal data member is private, but has public get() and set() functions.

#define RW_STREAM_ATTR_MEMBER (   Name,
  memberName 
)

Use this macro to identify a data member as an attribute of the class. If using external streaming, then the data member must be public.

#define RW_STREAM_EXTERNAL_PARENT (   Base)

For classes derived from a serializable base class. Calls streamContents() on the base class to stream the contents of the base class before streaming the derived class. Put in separate source file. For external serialization only. (For intrusive, use RW_STREAM_PARENT.)

#define RW_STREAM_PARENT (   Base)

For classes derived from a serializable base class. Calls streamContents() on the base class to stream the contents of the base class before streaming the derived class. Put in source file for class. For intrusive serialization only. (For external, use RW_STREAM_EXTERNAL_PARENT.)

#define RW_WHEN_INPUT (   body)

Used to insert custom code into stream contents that only executes during input operations.

#define RW_WHEN_OUTPUT (   body)

Used to insert custom code into stream contents that only executes during output operations.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.