Operations on Data Objects

This section introduces the basic data objects supported in C++ API, including scalars, vectors, matrices, sets, dictionaries, and tables. It covers how to create, add, access, and update these data objects, along with examples.

Basic Info

  • In DolphinDB C++ API, all classes and their member functions are defined within the dolphindb namespace.
  • The Constant class is the base class for all data types (e.g. INT, STRING) and forms (e.g. Vector, Table).
  • Classes ending with the SP suffix (e.g. ConstantSP, VectorSP) are smart pointers, similar to std::shared_ptr in the C++ standard library. They will automatically deallocate unused memory.
  • A ConstantSP smart pointer can wrap all data objects. The specific data type and form can be obtained by calling the provided functions getType() and getForm().
  • When creating a new data object, native C++ data types are converted to corresponding DolphinDB data types such as INT, STRING, etc., and then an object of the appropriate DolphinDB type is constructed.
  • Retrieving data from a DolphinDB data object returns the underlying elements in their native C++ data type representation such as int, std::string.