Value interfaces and value objects

The creates C++ objects that encapsulate data retrieved from a database. These value objects are created by the Object Interface for C++ by using an extensible class factory that maps server data types to C++ objects.

DataBlade® developers can create value objects that represent new Informix® data types. Developers can use the Object Interface for C++ to write client applications that operate with these new value objects. Object Interface for C++ client applications do not depend on the representation of the object in the database; if the database representation changes, the corresponding value object can be altered and the existing applications continue to run. Code for value objects can be compiled into an application or dynamically loaded into an application from shared libraries.

The value object design is compatible with the Microsoft Common Object Model (COM) in the sense that it enables objects to expose behaviors through interfaces. An interface is an abstract class that encapsulates the methods associated with a specific behavior.

For example, to indicate that an object can behave as a container, the object exposes the ITContainer interface; to indicate that an object can convert its value to a C++ base type (such as int or double), an object exposes the ITConversions interface; and other interfaces.

Interfaces are extracted from an object by calling a QueryInterface() function provided in ITEssential, which is the base class of all value interfaces. When the QueryInterface() function is called, the caller specifies the interface ID of the interface you want. If the object exposes the requested interface, then QueryInterface() returns IT_QUERYINTERFACE_SUCCESS and sets its second argument to the address of the interface you want.

The following figure illustrates the relationship of the application interface to the implementation.
Figure 1. Public interface and private implementation of value objects
begin figure description - This illustration shows three graphics on the left side representing public value interfaces and two graphics on the right side representing private implementations of the value objects. The first graphic shows the public ITValue interface "TypeOf()" connected to a private implementation class that exposes only ITValue interfaces. The second graphic shows the ITValue interface "TypeOf()" connected to the second private implementation class, which exposes only ITValue and ITSet interfaces. The third graphic shows the public ITSet interface "Fetch()" connected to the private implementation that exposes only ITValue and ITSet interfaces. - end figure description
The Object Interface for C++ defines the following value interfaces.
Interface Description See
ITContainCvt Decomposes an object into C++ base type instances. The ITContainCvt interface
ITContainer Provides access to the container members. The ITContainer interface
ITConversions Converts data to C++ base classes or strings. The ITConversions interface
ITDateTime Allows access to the fields of a database date/time object. The ITDateTime interface
ITDatum Supports the functionality of the basic value object, including access to the underlying data. The ITDatum interface
ITErrorInfo Exposes error information about objects for which invalid operations can cause server errors. The ITErrorInfo interface
ITEssential Serves as the base of the value interface classes. The ITEssential interface
ITLargeObject Manipulates a large object returned by a query. The ITLargeObject interface
ITRow Provides access to row values. The ITRow interface
ITSet Provides access to collection results. The ITSet interface
ITValue Supports the basic functionality of the value object. The ITValue interface