Skip to content

Commit 8c0b447

Browse files
committed
0.9.2
1 parent f22d0b2 commit 8c0b447

File tree

7 files changed

+108
-18
lines changed

7 files changed

+108
-18
lines changed

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
0.9.2 (2020-06-30)
2+
------------------
3+
* Rename obx_cursor_ts_limits() to obx_cursor_ts_min_max()
4+
* Add C++ APIs for query links and TS min/max
5+
16
0.9.1 (2020-06-23)
27
------------------
38
* C++ interface improvements:
4-
* "Box::getOptional()" overloads returning std::optional
5-
* "Box::put()" overloads taking vectors of std::unique_ptr and std::optional
9+
* Box::getOptional() overloads returning std::optional
10+
* Box::put() overloads taking vectors of std::unique_ptr and std::optional
611
* Query methods: find(), findIds(), count(), remove(), ...
712
* Ensure double-free can't happen (added explicit copy & move constructors)
813
* Fixed Windows exported symbols - recently added APIs were missing
9-
* New "obx_cursor_put_object4()" overload taking PutMode as an argument
14+
* New obx_cursor_put_object4() to allow passing a PutMode
1015
* Make *_close() functions consistently accept nullptr
1116

1217
0.9.0 (2020-06-18)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ObjectBox C and C++ APIs
33
[ObjectBox](https://objectbox.io) is a superfast database for objects.
44
This is the **ObjectBox runtime library** to run ObjectBox as an embedded database in your C or C++ application.
55

6-
**Latest version: 0.9.1** (2020-06-23). See [changelog](CHANGELOG.md) for more details.
6+
**Latest version: 0.9.2** (2020-06-30). See [changelog](CHANGELOG.md) for more details.
77

88
In most cases you want to use the C and C++ APIs in combination with the **companion project [ObjectBox Generator](https://github.com/objectbox/objectbox-generator)**.
99
Like this, you get a convenient API which requires minimal code on your side to work with the database.

download.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tty -s || quiet=true
3939

4040
# Note: optional arguments like "--quiet" shifts argument positions in the case block above
4141

42-
version=${1:-0.9.1}
42+
version=${1:-0.9.2}
4343
repoType=${2:-testing}
4444
os=${3:-$(uname)}
4545
arch=${4:-$(uname -m)}

doxygen/Changelog.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@
33
ObjectBox C API Changelog
44
=========================
55

6+
0.9.2 (2020-06-30)
7+
------------------
8+
* Rename obx_cursor_ts_limits() to obx_cursor_ts_min_max()
9+
* Add C++ APIs for query links and TS min/max
10+
611
0.9.1 (2020-06-23)
712
------------------
813
* C++ interface improvements:
9-
* "Box::getOptional()" overloads returning std::optional
10-
* "Box::put()" overloads taking vectors of std::unique_ptr and std::optional
14+
* Box::getOptional() overloads returning std::optional
15+
* Box::put() overloads taking vectors of std::unique_ptr and std::optional
1116
* Query methods: find(), findIds(), count(), remove(), ...
1217
* Ensure double-free can't happen (added explicit copy & move constructors)
1318
* Fixed Windows exported symbols - recently added APIs were missing
14-
* New "obx_cursor_put_object4()"
19+
* New obx_cursor_put_object4() to allow passing a PutMode
1520
* Make *_close() functions consistently accept nullptr
1621

1722
0.9.0 (2020-06-18)

doxygen/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "ObjectBox C API"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = "0.9.1"
41+
PROJECT_NUMBER = "0.9.2"
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

include/objectbox-cpp.h

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,55 @@ class QueryBuilder {
315315

316316
OBX_query_builder* cPtr() const { return cQueryBuilder_; }
317317

318+
/// Links the (time series) entity type to another entity space using a time point or range defined in the given
319+
/// linked entity type and properties.
320+
/// Note: time series functionality (ObjectBox TS) must be available to use this.
321+
/// @param linkedEntityId Entity type that defines a time point or range
322+
/// @param beginPropertyId Property of the linked entity defining a time point or the begin of a time range.
323+
/// Must be a date type (e.g. PropertyType_Date or PropertyType_DateNano).
324+
/// @param endPropertyId Optional property of the linked entity defining the end of a time range.
325+
/// Pass zero to only define a time point (begin_property_id).
326+
/// Must be a date type (e.g. PropertyType_Date or PropertyType_DateNano).
327+
template <typename ENTITY_LINKED>
328+
QueryBuilder<ENTITY_LINKED> linkTime(obx_schema_id linkedEntityId, obx_schema_id beginPropertyId,
329+
obx_schema_id endPropertyId = 0) {
330+
OBX_query_builder* cQB = obx_qb_link_time(cPtr(), linkedEntityId, beginPropertyId, endPropertyId);
331+
checkPtrOrThrow(cQB, "can't build a query link");
332+
return QueryBuilder<ENTITY_LINKED>(store_, cQB);
333+
}
334+
335+
/// Create a link based on a property-relation (many-to-one)
336+
template <typename ENTITY_LINKED>
337+
QueryBuilder<ENTITY_LINKED> linkRelationProperty(obx_schema_id relationPropertyId) {
338+
OBX_query_builder* cQB = obx_qb_link_property(cPtr(), relationPropertyId);
339+
checkPtrOrThrow(cQB, "can't build a query link");
340+
return QueryBuilder<ENTITY_LINKED>(store_, cQB);
341+
}
342+
343+
/// Create a backlink based on a property-relation used in reverse (one-to-many)
344+
template <typename ENTITY_LINKED>
345+
QueryBuilder<ENTITY_LINKED> backlinkRelationProperty(obx_schema_id sourceEntityId, obx_schema_id sourcePropertyId) {
346+
OBX_query_builder* cQB = obx_qb_backlink_property(cPtr(), sourceEntityId, sourcePropertyId);
347+
checkPtrOrThrow(cQB, "can't build a query link");
348+
return QueryBuilder<ENTITY_LINKED>(store_, cQB);
349+
}
350+
351+
/// Create a link based on a standalone relation (many-to-many)
352+
template <typename ENTITY_LINKED>
353+
QueryBuilder<ENTITY_LINKED> linkRelationStandalone(obx_schema_id relationId) {
354+
OBX_query_builder* cQB = obx_qb_link_standalone(cPtr(), relationId);
355+
checkPtrOrThrow(cQB, "can't build a query link");
356+
return QueryBuilder<ENTITY_LINKED>(store_, cQB);
357+
}
358+
359+
/// Create a backlink based on a standalone relation (many-to-many, reverse direction)
360+
template <typename ENTITY_LINKED>
361+
QueryBuilder<ENTITY_LINKED> backlinkRelationStandalone(obx_schema_id relationId) {
362+
OBX_query_builder* cQB = obx_qb_backlink_standalone(cPtr(), relationId);
363+
checkPtrOrThrow(cQB, "can't build a query link");
364+
return QueryBuilder<ENTITY_LINKED>(store_, cQB);
365+
}
366+
318367
Query<EntityT> build();
319368
};
320369

@@ -700,11 +749,36 @@ class Box {
700749
/// @param relationId ID of a standalone relation, whose source type matches this Box
701750
/// @param objectId object ID of the relation target type (typically from another Box)
702751
/// @returns resulting IDs representing objects in this Box
703-
/// @todo improve docs by providing an example with a clear distinction between source and target type
704752
std::vector<obx_id> standaloneRelBacklinkIds(obx_schema_id relationId, obx_id objectId) {
705753
return idVectorOrThrow(obx_box_rel_get_backlink_ids(cBox_, relationId, objectId));
706754
}
707755

756+
/// Time series: get the limits (min/max time values) over all objects
757+
/// @param outMinId pointer to receive an output (may be nullptr)
758+
/// @param outMinValue pointer to receive an output (may be nullptr)
759+
/// @param outMaxId pointer to receive an output (may be nullptr)
760+
/// @param outMaxValue pointer to receive an output (may be nullptr)
761+
/// @returns true if objects were found (IDs/values are available)
762+
bool timeSeriesMinMax(obx_id* outMinId, int64_t* outMinValue, obx_id* outMaxId, int64_t* outMaxValue) {
763+
CursorTx cursorTx(TxMode::READ, store_, EntityBinding::entityId());
764+
obx_err err = obx_cursor_ts_min_max(cursorTx.cPtr(), outMinId, outMinValue, outMaxId, outMaxValue);
765+
if (err == OBX_SUCCESS) return true;
766+
if (err == OBX_NOT_FOUND) return false;
767+
throwLastError();
768+
}
769+
770+
/// Time series: get the limits (min/max time values) over objects within the given time range
771+
/// @returns true if objects were found in the given range (IDs/values are available)
772+
bool timeSeriesMinMax(int64_t rangeBegin, int64_t rangeEnd, obx_id* outMinId, int64_t* outMinValue,
773+
obx_id* outMaxId, int64_t* outMaxValue) {
774+
CursorTx cursorTx(TxMode::READ, store_, EntityBinding::entityId());
775+
obx_err err = obx_cursor_ts_min_max_range(cursorTx.cPtr(), rangeBegin, rangeEnd, outMinId, outMinValue,
776+
outMaxId, outMaxValue);
777+
if (err == OBX_SUCCESS) return true;
778+
if (err == OBX_NOT_FOUND) return false;
779+
throwLastError();
780+
}
781+
708782
private:
709783
template <typename Vector>
710784
void putMany(Vector& objects, std::vector<obx_id>* outIds, OBXPutMode mode) {

include/objectbox.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ extern "C" {
4242
/// obx_version() or obx_version_is_at_least().
4343
#define OBX_VERSION_MAJOR 0
4444
#define OBX_VERSION_MINOR 9
45-
#define OBX_VERSION_PATCH 1 // values >= 100 are reserved for dev releases leading to the next minor/major increase
45+
#define OBX_VERSION_PATCH 2 // values >= 100 are reserved for dev releases leading to the next minor/major increase
4646

4747
//----------------------------------------------
4848
// Common types
@@ -616,19 +616,25 @@ OBX_id_array* obx_cursor_rel_ids(OBX_cursor* cursor, obx_schema_id relation_id,
616616
// Time series
617617
//----------------------------------------------
618618

619-
// TODO box based functions
620-
// TODO is there a better name than "limit"? Maybe something about min/max or first/last (as in C++ API)?
621-
// Split in obx_cursor_ts_min() and obx_cursor_ts_max()?
619+
// TODO box based functions? (already available in C++ obx::Box)
622620

623621
/// Time series: get the limits (min/max time values) over all objects
622+
/// @param out_min_id pointer to receive an output (may be NULL)
623+
/// @param out_min_value pointer to receive an output (may be NULL)
624+
/// @param out_max_id pointer to receive an output (may be NULL)
625+
/// @param out_max_value pointer to receive an output (may be NULL)
624626
/// @returns OBX_NOT_FOUND if no objects are stored
625-
obx_err obx_cursor_ts_limits(OBX_cursor* cursor, obx_id* out_begin_id, int64_t* out_begin_value, obx_id* out_end_id,
626-
int64_t* out_end_value);
627+
obx_err obx_cursor_ts_min_max(OBX_cursor* cursor, obx_id* out_min_id, int64_t* out_min_value, obx_id* out_max_id,
628+
int64_t* out_max_value);
627629

628630
/// Time series: get the limits (min/max time values) over objects within the given time range
631+
/// @param out_min_id pointer to receive an output (may be NULL)
632+
/// @param out_min_value pointer to receive an output (may be NULL)
633+
/// @param out_max_id pointer to receive an output (may be NULL)
634+
/// @param out_max_value pointer to receive an output (may be NULL)
629635
/// @returns OBX_NOT_FOUND if no objects are stored in the given range
630-
obx_err obx_cursor_ts_limits_range(OBX_cursor* cursor, int64_t range_begin, int64_t range_end, obx_id* out_begin_id,
631-
int64_t* out_begin_value, obx_id* out_end_id, int64_t* out_end_value);
636+
obx_err obx_cursor_ts_min_max_range(OBX_cursor* cursor, int64_t range_begin, int64_t range_end, obx_id* out_min_id,
637+
int64_t* out_min_value, obx_id* out_max_id, int64_t* out_max_value);
632638

633639
//----------------------------------------------
634640
// Box

0 commit comments

Comments
 (0)