next up previous contents
Next: Bank Names Up: Components Previous: Fixed Size Types

Common Features

The remaining Trybos components of interest are C++ classes meant for general use. Nearly all Trybos components have similar means to perform operations like initialization and tests. This section describes some of these operations in general, with specifics left to the description of the components themselves.

Nearly all classes in Trybos make publicly accessible a default constructor (initialization without arguments), a copy constructor (initialization with object of same class as argument), an assignment operator (closely tied to the copy constructor in its operation), and a destructor. Since nearly all components in Trybos require some initial information before use, default constructors usually put objects into an ``invalid'' state, unless otherwise noted. The subsequent use of the invalid objects will result in errors unless a valid value is assigned to them with an assign() method. Constructors taking other arguments are often provided, and are almost always qualified as explicit, even if this qualification is superfluous.

Where possible, all user-visible methods are built from a number of ``primitive'' methods which are also available to the user. These primitive methods are inspired by the Standard Template Library. They insure that relationships between common class methods, such as the copy constructor and the assignment operator =(), are maintained. For instance, each default constructor uses an init() method to perform the actual default initialization. The init() method insures that all data members are in a well-defined state, but not that the object is in an abstractly valid state. Each non-default constructor uses an assign() method or an assign_ref() method to perform its function. These assign() methods can be used to revise the state of an object after declaration. Each destructor uses a destroy() method. Each comparison uses a compare() method. Each indexed access uses an at() method. Each iteration method uses a first() or a next() method for its implementation.

Each class has the methods is_valid() and is_invalid() to test whether the object is in a valid, usable state. Each class also provides an equality and inequality comparison operator.

No general means of value access is defined for Trybos components. Some components support multiple representations or logical views of their internal state, such as string and integer. These componenets provide a means of accessing each representation with methods labelled by their return type, for instance as_string() and as_integer(). In the future, output redirection operators and/or print() methods will be defined for all classes as well.


next up previous contents
Next: Bank Names Up: Components Previous: Fixed Size Types

Robert Kennedy
Mon Jul 28 13:23:28 CDT 1997