|
The "organization entity class" organizes the
ENTITY derivation hierarchy and provides a name space (using a unique sentinel) for each customer or project. It is derived from the
ENTITY class. The developer should derive application entities from his own organization entity class (also known as the
master entity) and not directly from the
ENTITY class. The sentinel name for the class will appear in the SAT file and assures that there is no confusion about how to restore the derived entity. Refer to Chapter 8,
Extending the Modeler, for more information about sentinels and organization classes.
|
|
|
Note
|
Contact Spatial's customer support department to have a unique sentinel assigned to your ACIS development project, to insure that the chosen sentinel is not being used by any other customer or by ACIS.
|
|
|
The following macros are used for constructing an application's master entity. This is the sentinel-level organization entity class that is constructed entirely by the macros:
|
|
|
MASTER_ENTITY_DECL
|
Used to declare a master (organization) entity class. Arguments include the class name, the component name, and the macros
ENTITY_FUNCTIONS and
LOOKUP_FUNCTION.
|
|
|
MASTER_ENTITY_DEFN
|
Used to implement a master (organization) entity class. Arguments include the extension ID and the macros
ENTITY_DEF,
LOOKUP_DEF,
SAVE_DEF,
RESTORE_DEF,
COPY_DEF,
SCAN_DEF,
FIX_POINTER_DEF, and
TERMINATE_DEF.
|
|
|
The following macros are used for constructing an application's master attribute. This is the sentinel-level organization attribute class that is constructed entirely by the macros:
|
|
|
MASTER_ATTRIB_DECL
|
Declares an master (organization) attribute class, which has no data or methods of its own. This macro includes the macros defined by the
ATTRIB_FUNCTIONS macro.
|
|
|
MASTER_ATTRIB_DEFN
|
Generates all the code necessary to define an master (organization) attribute class.
|
|
|
Example Master Entity
|
|
|
This section contains code fragments for defining an example master entity, called
ENTITY_XYZ (using sentinel "XYZ") from which other classes can then be derived. Both the header file and implementation file are shown. This example assumes the class is defined in a module (directory) named
xyzmod. In section
Implementation Macros, some short code fragments are used to illustrate the macros. These use an example entity,
MY_ENTITY, which could be derived from the organization entity
ENTITY_XYZ.
|
|
|
Header File
|
|
|
This example header file is named
xyz.hxx.
|
|
|
C++ Example
|
|
|
#include "kernel/acis.hxx"
|
|
#include "kernel/kerndata/data/entity.hxx"
|
|
#include "kernel/dcl_xyzmod.h"
|
|
|
#define ENTITY_XYZ_LEVEL ( ENTITY_LEVEL + 1)
|
|
|
// Identifier for the type of ENTITY
|
|
extern DECL_XYZMOD int ENTITY_XYZ_TYPE;
|
|
|
// Use ACIS macro to declare master entity
|
|
MASTER_ENTITY_DECL(ENTITY_XYZ, XYZMOD )
|
|
|
Example 9-1. xyz.hxx
|
|
|
Implementation File
|
|
|
This example implementation file is named
xyz.cxx.
|
|
|
C++ Example
|
|
|
#include "kernel/acis.hxx"
|
|
|
#include "xyzmod/xyz.hxx"
|
|
#include "kernel/kerndata/data/datamsc.hxx"
|
|
|
// This ENTITY is:
|
|
#define THIS() ENTITY_XYZ
|
|
#define THIS_LIB XYZMOD
|
|
|
// Base class is:
|
|
#define PARENT() ENTITY
|
|
#define PARENT_LIB KERN
|
|
|
// Name of entity:
|
|
#define ENTITY_XYZ_NAME "xyz"
|
|
|
// Use ACIS macro to define master entity
|
|
MASTER_ENTITY_DEFN("xyz master entity" )
|
|
|
Example 9-2. xyz.cxx
|