Coolquest, Inc. Home Products Support About Contact
cbold_logo_gif C++BOLD Reference Manual cbold_logo_gif

<<< Previous CBOLD Reference Home Next >>>

 

6. Registering

Section Contents

6.1. Overview
6.2. Registering Macros
6.3. Order of Registration
6.4. Registering Array Members
6.5. Additional Processing in Register()

6.1. Overview

Registering records information about a member in the containing TModPar object (i.e., the containing module, part or bundle). The recorded information may include:

a pointer to the member  
the name of the member (as a null–terminated character array)
a number associated with the member (for array members, the number is typically the index within the array)
a left and right range of the member (for bus ports)

A descendant of TCBBase which is a member of a module, part, or bundle must be registered if it is to be included in a design. Descendants of TCBBase include modules, parts, bundles, and ports.

The pointer to the member is recorded in a linked list in the containing TModPar. This linked list is essential to most of CBOLD's processing. For example, during main()'s Connect pass, CBOLD uses the linked list to call Connect() for each member of Root. If a member is not registered, then it is not in Root's linked list, and its Connect() is never called. The member is essentially invisible to the CBOLD framework. This can be beneficial, as explained in Selective Registration.

The name and optional number recorded during registration are collectively referred to as the member's designator. The CBOLD framework combines the name and number to form the member's symbolic name. For example:

class CM_MyModule : public TModule {
public:
  CP_Capacitor  Capacitor;
  CP_Resistor   Resistor[ 4 ];
  ...
  virtual void Register() {
    reg(  Capacitor );
    rega( Resistor, 4 );
    ...
  }
  ...
};

The rega() macro registers the four elements of the array with name "Resistor" and numbers 0, 1, 2, 3. The symbolic name of the four elements of the array are then Resistor0, Resistor1, Resistor2, and Resistor3. The symbolic name of the capacitor member is simply Capacitor.

The auto_reg Support Tool automates the coding of the Register() function.

 

<<< Previous CBOLD Reference Home Next >>>

Legal Copyright © 2007 by Coolquest, Inc. Contact