Using C++ with Caché
Reference for Simple Datatype Classes
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Caché uses a set of special classes for literal datatypes (containing simple data such as strings or numbers). See Data Types in Using Caché Objects for information about how datatype classes differ from standard object classes.

Every Caché data type is mapped to an appropriate C++ object, such as d_int or d_string. If a literal type instance is not null, it is possible to convert it to a standard C++ type: d_int can be converted to int, d_string to std::string or std::wstring, d_time, d_date, and d_timestamp to tm. The C++ object that represents a Caché datatype is determined via the CLIENTDATATYPE keyword value of the datatype class.
All simple types have:
The following datatypes are supported:
Numeric Classes
These are simple numbers.
Class InterSystems::d_int
A d_int can be converted to int and be assigned an int. It doesn't have other overloaded operators. The intended usage is to get the int value and assign a changed value back to the object if the object should be changed. For example,
   d_int t = 2;
   d_int q = int(t) + 2;
in many cases like this one the conversion is implicit, so the second line can be just
   d_int q = t + 2;
but there are cases where it is necessary.
Binary Classes
These are classes containing variable-length binary data.
Class InterSystems::d_binary
A d_binary holds binary data. d_oid is a typedef of d_binary that represents a complete Object ID.
Member list
Class InterSystems::d_status
A d_status encapsulates %Library.Status. It should be used only for interpreting a status from the server.
Member list
Class InterSystems::d_string
A d_string holds string data. It differs from d_binary in that it automatically converts data when necessary and also provides conversion methods.
Member list
Class InterSystems::d_list
A d_list object is a C++ implementation of the $list structure in Caché. In addition to its standard methods, the d_list class has a set of static methods that allow you to extract data from a buffer containing a $list without copying it into a d_list object.
d_list methods
A d_list object is essentially a forward iterator, but it also provides methods for inserting, deleting and replacing an element at the current position, as well as other methods that work with $list as a whole. A d_list position is 0 based. Since $list is stored in contiguous memory, any operation that changes a $list element may cause a dynamic memory reallocation or copying, which may be expensive.
Member list
d_list static member functions
The static member functions allow you to extract data from a buffer that is a $list without copying it into a d_list object. The interface deals with the $list element specified by the buffer. The next element starts at buffer + d_list::get_elem_size(buffer).
Member list
Time and Date Classes
Objects of these types can be converted to a tm structure object with all irrelevant values set to -1. They can also be assigned a tm object. The irrelevant values from the tm structure will be ignored. Interfaces of these classes differ only in constructors and assignment operators.
Class InterSystems::d_time
Member list
Class InterSystems::d_date
Member list
Class InterSystems::d_timestamp
Member list