Foundation Classes

Foundation Classes provide a variety of general-purpose services such as: Primitive types, strings and various types of quantities Automated management of heap memory Exception handling Classes for manipulating aggregates of data Math tools such as vectors, matrices and primitive geometric types Basic services for saving data in ASCII files These services are organized into the following libraries: Kernel Classes Math Utilities Basic Persistence |

## Kernel Classes

### Root Classes

Root Classes, primarily implemented in the Standard package, are the classes on which all other Open CASCADE classes are built. They provide:

- Primitive types such as Boolean, Character, Integer or Real

- A memory manager based on reference counting for optimizing the allocation and deallocation of large numbers of small C++ objects

- A base class, Standard_Transient , automating memory management through smart pointers - the Open CASCADE Handle; most of Open CASCADE classes inherit from this base class.

### Quantities

Quantitiy classes provide the following services:

- Definition of primitive types representing most of mathematical and physical quantities

- Unit conversion tools

- Resources to manage time information such as dates and time periods

- Resources to manage color definition

### Exceptions

Exception classes list all the exceptions, which can be raised by any Open CASCADE function. Syntaxes compatible with the ANSI C++ standard allow you to handle abnormal conditions.

Each exception inherits from Standard_Failure either directly or by inheriting from another exception.

### Strings

String classes provide the following services to manipulate character strings:

- Editing operations on string objects, using a built-in string manager

- Handling of dynamically-sized sequences of characters

Open CASCADE supports both ASCII character types (8-bit) and Unicode character types UTF-8 (8-bit) and utf-16 - UCS-2 (16-bit).

Memory management makes string objects easier to use than ordinary character arrays. Strings may also be manipulated by handles and therefore, can be shared.

These classes are implemented in the TCollection package and in the NCollection nocdlpack.

### Collections

Apart from strings, the TCollection package contains classes of dynamically sized aggregates of data. They include a wide range of collections such as:

- Arrays (unidimensional and bidimensional) generally used for quick access to an item. Note that an array is a fixed-sized aggregate

- Sequences and lists which are ordered collections of non-unique objects

- Maps, which provide rapid access time for member items

- Queues and stacks, which are minor structures similar to sequences but with different algorithms to explore them

The TCollection package also offers specific iterators for sequences, maps, and stacks.

It also includes Collection classes. Collection classes are generic (C++ template-like), that is, they can contain a variety of objects which do not necessarily inherit from a unique root class. When you need to use a collection of a given object type, you must instantiate the collection for this specific type. Once the code for this declaration is compiled, all functions available on the generic collection are available on your instantiated class.

If you are not using CDL in your project (CDL compilation under WOK is necessary to instantiate any generic Collection from package TCollection), then you should use the Collections defined in nocdlpack NCollection. It contains definitions of the same generic collection classes described above, but in a form of C++ templates. Therefore, to instantiate any collection type no additional support is required beyond the ANSI C++ compiler.

Most collections follow value semantics, meaning that an instantiation of a collection is the actual collection, not a handle to it.

### Collections of Standard Objects

### TCollection

The collections of standard object classes provide frequently used instantiation of generic classes from the TCollection package with objects from the Standard package, strings from the TCollection package and geometric primitives.

There exists a limitation: Open Cascade generic classes require compilation of definitions in the CDL language and therefore can only be instantiated in WOK.

### NCollection

The NCollection unit meets the requirements of Open Cascade community and all end users who do not use WOK development environment in their projects.

The NCollection provides a full replacement of all TCollection generic classes so that any Open Cascade collection could be instantiated via C++ template definitions. It is used in WOK environment (as nocdlpack development unit) or in any other configuration, since it only uses the standard capabilities of C++ language.

Earlier releases of Open Cascade offered NCollection classes in the form of macro definitions. Now it is strongly recommended to use C++ template classes instead, as they are more flexible and reliable. The old definitions based on C macros (in the header files NCollection_Define*.hxx) are kept for backward compatibility and no more supported.

## Math Utilities

### Vectors and Matrices

The Vector and Matrix classes provide commonly used mathematical algorithms which include:

- Basic calculations involving vectors and matrices

- Computation of eigenvalues and eigenvectors of a square matrix

- Solvers for a set of linear algebraic equations

- Algorithms to find the roots of a set of nonlinear equations

- Algorithms to find the minimum function of one or more independent variables

These classes also provide a data structure in order to represent any expression, relation, or function used in mathematics, including the assignment of variables.

### Primitive Geometric Types

Open CASCADE primitive geometric types are defined in the basic geometry package gp, which provides descriptions of primitive geometric shapes such as:

- Points

- Vectors

- Lines

- Circles and conicals

- Planes and elementary surfaces

These types are handled by value only, and never by reference.

gp also provides a means of positioning your shapes in space or on a plane using an axis or coordinate system, and defines the following geometric transformations available for these positioned shapes:

- Translations

- Rotations

- Symmetries

- Scaling transformations

- Composed transformations

### Common Math Algorithms

The common math algorithms provided in Open CASCADE include:

- Algorithms to solve a set of linear algebraic equations,

- Algorithms to find the minimum of a function of one or more independent variables,

- Algorithms to find roots of one or of a set of non-linear equations,

An algorithm to find the eigenvalues and eigenvectors of a square matrix.