You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-13Lines changed: 20 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,14 @@
1
-
ObjectBox C/C++ API
2
-
===================
1
+
ObjectBox C and C++ APIs
2
+
========================
3
3
[ObjectBox](https://objectbox.io) is a superfast database for objects.
4
-
This is the **ObjectBox runtime library** to run ObjectBox as an embedded database in your C/C++ application.
4
+
This is the **ObjectBox runtime library** to run ObjectBox as an embedded database in your C or C++ application.
5
5
6
6
**Latest version: 0.9.1** (2020-06-23). See [changelog](CHANGELOG.md) for more details.
7
7
8
-
In most cases you want to use the C/C++ API in combination with the **companion project [ObjectBox Generator](https://github.com/objectbox/objectbox-generator)**.
9
-
The Generator generates boiler plate code and maintains some metadata around the data model.
8
+
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)**.
10
9
Like this, you get a convenient API which requires minimal code on your side to work with the database.
11
10
12
-
Here's a code example that inserts a `Task` data object into the database:
11
+
Here's a C++ code example that inserts a `Task` data object into the database:
13
12
14
13
obx::Box<Task> box(store);
15
14
box.put({.text = "Buy milk"});
@@ -18,20 +17,26 @@ Note: `Task` is a `struct` representing a user defined data model - see [ObjectB
18
17
19
18
Some features
20
19
-------------
21
-
* ACID compliant object storage based on [FlatBuffers](https://google.github.io/flatbuffers/)
20
+
* ACID compliant object storage ("object" as in class/struct instances)
21
+
* Direct support for [FlatBuffers](https://google.github.io/flatbuffers/) data objects (aka "flatbuffers table")
22
22
* Lightweight for smart devices; its binary size is only around 1 MB
23
23
(special feature reduced versions with 1/3 - 1/2 size are available on request)
24
-
* Zero-copy reads
24
+
* Zero-copy reads for highest possible performance; access tens of millions of objects on commodity hardware
25
25
* Secondary indexes based on object properties
26
-
* Simple get/put API
27
26
* Async API for asynchronous puts, inserts, updates, removes
28
27
* Automatic model migration (no schema upgrade scripts etc.)
29
28
* Powerful queries
30
29
* Relations to other objects (1:N and M:N)
30
+
* Optimized Time series types (TS edition only)
31
+
* Data synchronization across the network (sync edition only)
31
32
32
33
Usage and Installation
33
34
----------------------
34
-
The C API comes as a single header in the [include/objectbox.h](include/objectbox.h) file.
35
+
The APIs come as single header file for C and C++:
36
+
37
+
* C: [include/objectbox.h](include/objectbox.h)
38
+
* C++: [include/objectbox-cpp.h](include/objectbox-cpp.h) (depends on objectbox.h)
39
+
35
40
Compile your code against it and use the binary library (.so, .dylib, .dll depending on the platform) to link against.
36
41
37
42
There are a couple of ways to get the library:
@@ -53,9 +58,11 @@ Details on the download.sh script:
53
58
54
59
C++ API
55
60
-------
56
-
The C++ API builds on top of the C API and comes as another single header in the [include/objectbox-cpp.h](include/objectbox-cpp.h) file.
57
-
58
-
Please check the [ObjectBox Generator](https://github.com/objectbox/objectbox-generator) project for a sample.
61
+
The C++ API is built on top of the C API exposed by the library (e.g. you still need objectbox.h).
62
+
You can also use both APIs from your code if need be.
63
+
For example, you use the C++ `obx::Box` class for most database operations, but "break out" into the C API for a special function you need.
64
+
Note that to use the `obx::Box` class, you also need the [ObjectBox Generator](https://github.com/objectbox/objectbox-generator) to generate binding code.
65
+
In short, it generates "boiler plate" source code and maintains some metadata around the data model.
0 commit comments