|
The organization class is called
ENT_XYZ. Its purpose is to identify all classes derived from it as coming from the organization, in this example,
XYZ. The abstract class is defined in the
ent_xyz.hxx header file and the
ent_xyz.cxx source file.
|
|
|
C++ Example
|
|
|
// ent_xyz.hxx
|
|
|
#if !defined( ENTITY_XYZ_CLASS )
|
|
#include "kernel/logical.h"
|
|
#include "kernel/kerndata/data/en_macro.hxx"
|
|
|
// Identifier used to find out (via identity() defined below) to
|
|
// what an entity pointer refers.
|
|
extern int ENTITY_XYZ_TYPE;
|
|
|
// Identifier that gives number of levels of derivation of this
|
|
// class from ENTITY.
|
|
#define ENTITY_XYZ_LEVEL (ENTITY_LEVEL + 1)
|
|
|
// The XYZ master data structure entity, of which all its private
|
|
// specific types are subclasses.
|
|
MASTER_ENTITY_DECL( ENTITY_XYZ, NONE )
|
|
|
#define ENTITY_XYZ_CLASS
|
|
#endif
|
|
|
Example 8-8. ent_xyz.hxx
|
|
|
C++ Example
|
|
|
//ent_xyz.cxx
|
|
|
#include <stdio.h>
|
|
#include "kernel/acis.hxx"
|
|
#include "kernel/dcl_kern.h"
|
|
#include "kernel/kerndata/data/datamsc.hxx"
|
|
#include "ent_xyz.hxx"
|
|
|
// Identifier used externally to identify a particular entity
|
|
// type. This is only used within the save/restore system for
|
|
// translating to/from external file format.
|
|
|
// Macros used to tell the master macro who we are and where we
|
|
// stand in the hierarchy
|
|
#define THIS() ENTITY_XYZ
|
|
#define THIS_LIB NONE
|
|
#define PARENT() ENTITY
|
|
#define PARENT_LIB KERN
|
|
#define ENTITY_XYZ_NAME "xyz"
|
|
|
// Now a grand macro to do the rest of the implementation.
|
|
MASTER_ENTITY_DEFN( "xyz master entity" );
|
|
|
Example 8-9. ent_xyz.cxx
|