Creating an Organization Attribute Class


Each application developer must create an organization class from which to derive all application specific attributes. This class cannot be instantiated. Its purpose is to uniquely identify the owning development organization. This section provides an example of creating an organization attribute class by copying the .hxx and .cxx files that define an existing ACIS organization attribute class and modifying those files.

Header File

To create an organization attribute class header file:

  1. Name the attribute organization class ATTRIB_<sentinel> where <sentinel> is a unique two or three letter code obtained from Spatials customer support department. In this example, the sentinel ABC is used.
  2. Copy the at_tsl.hxx file (the header file for the ATTRIB_TSL class) from the ACIS installation directory and rename it at_abc.hxx.
  3. Change the copied file as shown in the following example. Replace all the bold names in the file (tsl or TSL) with the new organization classs sentinel. In this example, the sentinel ABC (shown in bold italics as abc or ABC) is used.

Note: In this example, the organization attribute class is defined in the KERN module (where ATTRIB_TSL is defined. To define a class in a different module, additional changes to the file would be needed.

The following example of the attribute header file shows the sentinels that are to be replaced in bold font. In the new file, the new sentinel is shown in bold italic font.

C++ Example

// Attribute declaration for a private container attribute. Each
// application developer receives one of these customized for
// their use.
// All attributes specific to the application developer are then
// made derived classes of this attribute, ensuring that
// different developers can assign identifiers independently
// without mutual interference.
#if !defined(ATTRIB_TSL_CLASS)
#define ATTRIB_TSL_CLASS
#include dcl_kern.h
#include attrib.hxx
extern DECL_KERN int ATTRIB_TSL_TYPE;
#define ATTRIB_TSL_LEVEL (ATTRIB_LEVEL + 1)
MASTER_ATTRIB_DECL( ATTRIB_TSL, KERN )
#endif

Example. Original at_tsl.hxx

After customizing at_tsl.hxx into at_abc.hxx, the organization class file should appear similar to the following example.

C++ Example

#if !defined(ATTRIB_ABC_CLASS)
#define ATTRIB_ABC_CLASS
#include dcl_kern.h
#include attrib.hxx
extern int ATTRIB_ABC_TYPE;
#define ATTRIB_ABC_LEVEL (ATTRIB_LEVEL + 1)
MASTER_ATTRIB_DECL( ATTRIB_ABC, NONE )
#endif

Example. Customized at_abc.hxx

Macro MASTER_ATTR_DECL completes the file. The first argument is the new organization attribute class name; the second is the module name. If creating an attribute that is not meant for export, use "NONE" as the module name.

Implementation File

To create an organization attribute class .cxx implementation file:

  1. Copy the at_tsl.cxx file from the ACIS installation directory and rename it at_abc.cxx. (If you do not have the source file, enter the content from this example into a file.)
  2. Change the bold sentinels as was done for the at_abc.hxx header file.
  3. Enter statements to include the header files necessary to define the attribute.

Note:  File acis.hxx should always be the first header file included in every ACIS application implementation file.

The following example of the attribute implementation file shows the sentinels that are to be replaced in bold font. In the new file, the new sentinel is shown in bold italic font.

C++ Example

#include <stdio.h>
#include "acis.hxx"
#include "dcl_kern.h"
#include "at_tsl.hxx"
#include "datamsc.hxx"
// Define macros for this attribute and its parent, to provide
// the information to the definition macro.
#define THIS() ATTRIB_TSL
#define THIS_LIB KERN
#define PARENT() ATTRIB
#define PARENT_LIB KERN
// 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, but must be unique
// amongst attributes derived directly from ATTRIB, across all
// application developers.
#define ATTRIB_TSL_NAME "tsl"
MASTER_ATTRIB_DEFN( "tsl master attribute" )

Example. Original at_tsl.cxx

The macro MASTER_ATTRIB_DEFN generates all the code necessary to define the organization attribute class. The character string is the value returned by the type_name method. After customizing .at_tsl.cxx into .at_abc.cxx, the organization class file should appear similar to the next example.

C++ Example

#include <stdio.h>
#include acis.hxx
#include dcl_kern.h
#include datamsc.hxx
#include at_abc.hxx
// Define macros for this attribute and its parent, to provide
// the information to the definition macro.
#define THIS() ATTRIB_ABC
#define THIS_LIB NONE
#define PARENT() ATTRIB
#define PARENT_LIB KERN
// 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, but must be unique
// amongst attributes derived directly from ATTRIB, across all
// application developers.
#define ATTRIB_ABC_NAME abc
MASTER_ATTRIB_DEFN( abc master attribute )

Example. Customized at_abc.cxx

[Top]