Implementation Macros
List of: Discussion Topic
Subjects: Entity, Extending ACIS
Contents: Application Development Manual

Macros that aid the implementation of some common functions (methods) for classes derived from ENTITY are defined in the ENTITY class header file entity.hxx. Macros for classes derived from ATTRIB are defined in at_macro.hxx

Generally, the common methods that do the main work are protected, as they are only called from the main entry functions or called by themselves higher up the derivation tree. The restore_common method is public, though, because the main restore function is not a method (member function), and making it a friend would prevent its being declared static (i.e., local to the defining module). The same utility routines defined for ENTITY may be overloaded for the derived class. Several of these routines require class-specific code, so several additional macros are declared to bracket that code; much of the required functionality is defined within macros.

This sequence of macros must appear in the entity implementation file before any other implementation routines--in particular before constructors and the object copy routine--but after the definition of THIS and PARENT.

This section describes the implementation macros:

ENTITY_DEF UTILITY_DEF DEBUG_DEF
SAVE_DEF RESTORE_DEF COPY_DEF
SCAN_DEF FIX_POINTER_DEF TRANSFORM_DEF
LOSE_DEF DTOR_DEF TERMINATE_DEF
SIMPLE_COPY_LOSE

For each macro, the signature of the actual function being implemented is shown, where applicable, along with a discussion of when the function is called by the system and the proper technique for implementing it.

The macros required for any derivation from ENTITY are ENTITY_DEF, SAVE_DEF, RESTORE_DEF, COPY_DEF, SCAN_DEF, FIX_POINTER_DEF, and TERMINATE_DEF. The macro ATTCOPY_DEF may be used instead of ENTITY_DEF for any class derived from ATTRIB.

With the exception of ENTITY_DEF, ATTCOPY_DEF, and TERMINATE_DEF, all of the *_DEF macros supply a closing curly brace to terminate the definition of the previous function, and then supply the declaration portion of their own function. ENTITY_DEF and ATTCOPY_DEF are the starting macros (depending on whether this is for an ENTITY or ATTRIB), and should be the first macro used in any ENTITY or ATTRIB implementation. Thus, they do not supply a closing brace, because there is not a previous macro. TERMINATE_DEF simply provides the closing brace for the last macro.
PDF/APPDEV/09ENT.PDF
HTM/DATA/ACIS/APPDEV/09ENT/0003.HTM