ObjectBox C and C++ API  4.0.3
obx::BoxTypeless Class Reference

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...

#include <objectbox.hpp>

Inheritance diagram for obx::BoxTypeless:
Inheritance graph

Public Member Functions

 BoxTypeless (Store &store, obx_schema_id entityTypeId)
 
OBX_boxcPtr () const
 
uint64_t count (uint64_t limit=0)
 Return the number of objects contained by this box. More...
 
bool isEmpty ()
 Returns true if the box contains no objects. More...
 
bool contains (obx_id id)
 Checks whether this box contains an object with the given ID. More...
 
bool contains (const std::vector< obx_id > &ids)
 Checks whether this box contains all objects matching the given IDs. More...
 
bool get (CursorTx &cTx, obx_id id, const void **data, size_t *size)
 Low-level API: read an object as FlatBuffers bytes from the database. More...
 
obx_id putNoThrow (void *data, size_t size, OBXPutMode mode=OBXPutMode_PUT)
 Low-level API: puts the given FlatBuffers object. More...
 
obx_id put (void *data, size_t size, OBXPutMode mode=OBXPutMode_PUT)
 
bool remove (obx_id id)
 Remove the object with the given id. More...
 
uint64_t remove (const std::vector< obx_id > &ids)
 Removes all objects matching the given IDs. More...
 
uint64_t removeAll ()
 Removes all objects from the box. More...
 

Protected Attributes

Storestore_
 
OBX_boxcBox_
 
const obx_schema_id entityTypeId_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ BoxTypeless()

obx::BoxTypeless::BoxTypeless ( Store store,
obx_schema_id  entityTypeId 
)
inline

Member Function Documentation

◆ contains() [1/2]

bool obx::BoxTypeless::contains ( const std::vector< obx_id > &  ids)
inline

Checks whether this box contains all objects matching the given IDs.

◆ contains() [2/2]

bool obx::BoxTypeless::contains ( obx_id  id)
inline

Checks whether this box contains an object with the given ID.

◆ count()

uint64_t obx::BoxTypeless::count ( uint64_t  limit = 0)
inline

Return the number of objects contained by this box.

Parameters
limitif provided: stop counting at the given limit - useful if you need to make sure the Box has "at least" this many objects but you don't need to know the exact number.

◆ cPtr()

OBX_box* obx::BoxTypeless::cPtr ( ) const
inline

◆ get()

bool obx::BoxTypeless::get ( CursorTx &  cTx,
obx_id  id,
const void **  data,
size_t *  size 
)
inline

Low-level API: read an object as FlatBuffers bytes from the database.

Returns
true on success, false if the ID was not found, in which case outObject is untouched.

◆ isEmpty()

bool obx::BoxTypeless::isEmpty ( )
inline

Returns true if the box contains no objects.

◆ put()

obx_id obx::BoxTypeless::put ( void *  data,
size_t  size,
OBXPutMode  mode = OBXPutMode_PUT 
)

◆ putNoThrow()

obx_id obx::BoxTypeless::putNoThrow ( void *  data,
size_t  size,
OBXPutMode  mode = OBXPutMode_PUT 
)

Low-level API: puts the given FlatBuffers object.

Returns
the ID of the put object or 0 if the operation failed (no exception is thrown).

◆ remove() [1/2]

uint64_t obx::BoxTypeless::remove ( const std::vector< obx_id > &  ids)

Removes all objects matching the given IDs.

Returns
number of removed objects between 0 and ids.size() (if all IDs existed)

◆ remove() [2/2]

bool obx::BoxTypeless::remove ( obx_id  id)

Remove the object with the given id.

Returns
whether the object was removed or not (because it didn't exist)

◆ removeAll()

uint64_t obx::BoxTypeless::removeAll ( )

Removes all objects from the box.

Returns
the number of removed objects

Member Data Documentation

◆ cBox_

OBX_box* obx::BoxTypeless::cBox_
protected

◆ entityTypeId_

const obx_schema_id obx::BoxTypeless::entityTypeId_
protected

◆ store_

Store& obx::BoxTypeless::store_
protected