ObjectBox C and C++ API  0.21.0
ObjectBox C++ API

Classes

class  obx::Exception
 Base class for ObjectBox related exceptions. Note that there are currently 3 main sub types: IllegalArgumentException, IllegalStateException, and, for all other error types, DbException. More...
 
class  obx::IllegalArgumentException
 Thrown when the passed arguments are illegal. More...
 
class  obx::IllegalStateException
 Thrown when a request does not make sense in the current state. For example, doing actions on a closed object. More...
 
class  obx::MaxDataSizeExceededException
 Thrown when a transaction is about to commit but it would exceed the user-defined data size limit. See obx_opt_max_data_size_in_kb() for details. More...
 
class  obx::ShuttingDownException
 The operation on a resource (typically a Store) failed because the resources is in process of being shut down or already has shutdown. For example, calling methods on the Store will throw this exception after Store::close(). More...
 
class  obx::DbException
 Database related exception, containing a error code to differentiate between various errors. Note: what() typically contains a specific text about the error condition (sometimes helpful to resolve the issue). More...
 
class  obx::BytesLazy
 Bytes, which must be resolved "lazily" via get() and released via this object (destructor). Unlike void* style bytes, this may represent allocated resources and/or bytes that are only produced on demand. More...
 
class  obx::Box< EntityT >
 A Box offers database operations for objects of a specific type. More...
 
class  obx::AsyncBox< EntityT >
 AsyncBox provides asynchronous ("happening on the background") database manipulation. More...
 
class  obx::Closable
 
class  obx::Options
 Options provide a way to configure Store when opening it. Options functions can be chained, e.g. options.directory("mypath/objectbox").maxDbSizeInKb(2048); Note: Options objects can be used only once to create a store as they are "consumed" during Store creation. Thus, you need to create a new Option object for each Store that is created. More...
 
class  obx::Store
 A ObjectBox store represents a database storing data in a given directory on a local file system. More...
 
class  obx::Transaction
 Provides RAII wrapper for an active database transaction on the current thread (do not use across threads). A Transaction object is considered a "top level transaction" if it is the first one on the call stack in the thread. If the thread already has an ongoing Transaction, additional Transaction instances are considered "inner transactions". More...
 
class  obx::PropertyTypeless
 Typeless property used as a base class for other types - sharing common conditions. More...
 
class  obx::Property< EntityT, ValueT >
 Carries property information when used in the entity-meta ("underscore") class. More...
 
class  obx::Property< EntityT, OBXPropertyType_String >
 Carries property information when used in the entity-meta ("underscore") class. More...
 
class  obx::Property< EntityT, OBXPropertyType_ByteVector >
 Carries property information when used in the entity-meta ("underscore") class. More...
 
class  obx::Property< EntityT, OBXPropertyType_StringVector >
 Carries property information when used in the entity-meta ("underscore") class. More...
 
class  obx::RelationProperty< SourceEntityT, TargetEntityT >
 Carries property-based to-one relation information when used in the entity-meta ("underscore") class. More...
 
class  obx::RelationStandalone< SourceEntityT, TargetEntityT >
 Carries to-many relation information when used in the entity-meta ("underscore") class. More...
 
class  obx::Query< EntityT >
 Query allows to find data matching user defined criteria for a entity type. Created by QueryBuilder and typically used with supplying a Cursor. More...
 
class  obx::QueryBuilderBase
 A QueryBuilderBase is used to create database queries using an API (no string based query language). Building the queries involves calling functions to add conditions for the query. In the end a Query object is build, which then can be used to actually run the query (potentially multiple times). For generated code, you can also use the templated subclass QueryBuilder instead to have type safety at compile time. More...
 
class  obx::QueryBuilder< EntityT >
 See QueryBuilderBase for general information on query builders; this templated class allows to work with generated entity types conveniently. To specify actual conditions, use obx_qb_*() methods with queryBuilder.cPtr() as the first argument. More...
 
class  obx::QueryBase
 Query allows to find data matching user defined criteria for a entity type. Created by QueryBuilder and typically used with supplying a Cursor. More...
 
class  obx::BoxTypeless
 Like Box, but without template type. Serves as the basis for Box, but can also be used as "lower-level" box with some restrictions on the functionality. More...
 
class  obx::ExpiredObjects
 Removal of expired objects; see OBXPropertyFlags_EXPIRATION_TIME. More...
 
class  obx::TreeOptions
 Structural/behavioral options for a tree passed during tree creation. More...
 
struct  obx::AsyncTreePutResult
 Parameter to AsyncTreePutCallback, which is passed to Tree::putAsync(). More...
 
class  obx::Tree
 Top level tree API representing a tree structure/schema associated with a store. More...
 
class  obx::LeavesInfo
 Information about a set of leaf nodes that is returned by TreeCursor::getLeavesInfo(). Contains meta data about (data) leaves: full path in the tree, ID, and property type. More...
 
class  obx::TreeCursor
 Primary tree interface against the database. Offers tree path based get/put functionality. Not-thread safe: use a TreeCursor instance from one thread only; i.e. the underlying transaction is bound to a thread. More...
 

Macros

#define OBX_VERIFY_ARGUMENT(c)    ((c) ? (void) (0) : obx::internal::throwIllegalArgumentException("Argument validation failed: ", #c))
 
#define OBX_VERIFY_STATE(c)    ((c) ? (void) (0) : obx::internal::throwIllegalStateException("State condition failed: ", #c))
 

Typedefs

using obx::ObxLogCallback = std::function< void(OBXLogLevel logLevel, const char *text, size_t textSize)>
 
using obx::AsyncStatusCallback = std::function< void(obx_err err)>
 
using obx::AsyncTreePutCallback = std::function< void(const AsyncTreePutResult &result)>
 

Enumerations

enum class  obx::TxMode { obx::READ , obx::WRITE }
 Transactions can be started in read (only) or write mode. More...
 
enum class  obx::TreePutResult { obx::Undefined , obx::Success , obx::PathNotFound , obx::DidNotPut }
 Regular results in the sense of "not throwing an exception" for put operations via TreeCursor. More...
 

Functions

Query< EntityT > obx::QueryBuilder< EntityT >::build ()
 Once all conditions have been applied, build the query using this method to actually run it. More...
 

Detailed Description

Macro Definition Documentation

◆ OBX_VERIFY_ARGUMENT

#define OBX_VERIFY_ARGUMENT (   c)     ((c) ? (void) (0) : obx::internal::throwIllegalArgumentException("Argument validation failed: ", #c))

◆ OBX_VERIFY_STATE

#define OBX_VERIFY_STATE (   c)     ((c) ? (void) (0) : obx::internal::throwIllegalStateException("State condition failed: ", #c))

Typedef Documentation

◆ AsyncStatusCallback

using obx::AsyncStatusCallback = typedef std::function<void(obx_err err)>

◆ AsyncTreePutCallback

using obx::AsyncTreePutCallback = typedef std::function<void(const AsyncTreePutResult& result)>

◆ ObxLogCallback

using obx::ObxLogCallback = typedef std::function<void(OBXLogLevel logLevel, const char* text, size_t textSize)>

Enumeration Type Documentation

◆ TreePutResult

enum obx::TreePutResult
strong

Regular results in the sense of "not throwing an exception" for put operations via TreeCursor.

Enumerator
Undefined 

Not an actual result, will never be returned from a synchronous put operation; when used in AsyncTreePutResult, however, this indicates an exceptional result.

Success 

OK.

PathNotFound 

Given path did not exist (no meta leaf object given to create it)

DidNotPut 

According to the given put mode, no put was performed, e.g. "insert but already existed".

◆ TxMode

enum obx::TxMode
strong

Transactions can be started in read (only) or write mode.

Enumerator
READ 
WRITE 

Function Documentation

◆ build()

template<typename EntityT >
Query< EntityT > obx::QueryBuilder< EntityT >::build
inline

Once all conditions have been applied, build the query using this method to actually run it.