GlobalObjects
Loading...
Searching...
No Matches
GlobalObjects 1.1.2

Introduction

GlobalObjects is a C++ object-oriented database (OODB, ODBMS, NoSQL) for maintaining C++ objects persistence. Single and multi-user operation via a server is possible.

C++ objects can be saved, loaded and deleted easily. This can also be done in transactions, which can be confirmed (actions are executed) or cancelled (actions are not executed). The ACID principle is consistently adhered to.

GlobalObjects understands C++ class declarations with support for encapsulation, inheritance, polymorphism, object identity, and object references.

There is an extensive locking mechanism to protect stored objects.

In order to "notice" changes to the object inventory, a simple notification system, implemented by passing a callback function, can be used.

The main focus is on the easy saving and loading of even complex C++ objects with their references and the updating of loaded objects in memory when they are changed in the database.

The name GlobalObjects was chosen because it helps the developer to automatically synchronize objects across multiple clients. The application developed with GlobalObjects still works without any changes in single-user operation.

GlobalObjects is therefore not a speed-optimized database. Each class has its table (a simple text file) with at least one object ID index. Objects of a class with many superclasses are "assembled" by reading in the respective data records or "broken down" when saved. Complex objects with references to other objects that must also be saved or deleted can therefore have a negative impact on the timing. Indexes are read from the file system into objects of the type std::map<T> or written back to the file system when the application is closed.

Microsoft Visual Studio (from version 2010) and MinGW (from version 5.3.0) are currently supported on Windows and gcc (from version 4.8.3) and Clang (from version 6.0.0) on Linux. For example, you can install a GloServer on a supported operating system and access it from all supported operating systems with a client application.

Alternatives for saving C++ objects

To be able to persistently store C++ objects from the memory of the computer, there are roughly three possibilities:

  • Serialize on a data carrier such as a hard disk or SSD.
  • Convert to a relational model and store it in a conventional relational database.
  • Save directly to an object database.

Concept of GlobalObjects

GlobalObjects goes the way, that the C++ objects are stored like in an object database, but the storage is done in the file system of a disk. In a later stage it is planned to store the objects in a SQL database such as SQLite.

A database design does not have to be made for GlobalObjects.

Features

Here a short outline of the possibilities of GlobalObjects:

Store, load and delete

With GlobalObjects a direct saving, loading and deleting of C++ objects in an object database is possible. Both single and multiple inheritance of C++ is supported. An AllSet (the set of all stored objects of the class) is available for each class. When loading an object from an AllSet the real object is instantiated, which may be derived if necessary (loading an object from the AllSet of the "Animals" instantiates the respective objects e.g. of the type "Fish" and "Bird" etc.).

It can be set whether referenced objects should be loaded, saved or deleted with.


Example:

...
#include <GloBase.h>
// The persistent classes are included by the object creator.
#include "FirstBaseObjCreator.h"
...
MyFirstBaseObjCreator t_ObjCreator;
glo::Base t_Base( "LOCAL", "ClientName", "FirstBase", t_ObjCreator ); // without server
// glo::Base t_Base( "HOSTNAME", "ClientName", "FirstBase", t_ObjCreator ); // with server (HOSTNAME)
...
if ( t_Base.openBase() == 0 )
{
int t_iErr = 0;
// new object of type FirstPersClass; glo::Forgeter<FirstPersClass>()is passed too
std::shared_ptr<FirstPersClass> t_NewPersObject( new FirstPersClass(), glo::Forgeter<FirstPersClass>() );
// Register the object with the object database, the object gets a valid object ID (see glo::ObjID) and...
if ( t_NewPersObject->assign( t_Base ) == 0 )
{
// ...simply save it. If no error is the complete object in the object database.
t_iErr = t_NewPersObject->store();
}
...
std::shared_ptr<FirstPersClass> t_PersObject;
glo::TAllSet<MyFirstClass> t_AllSet( t_Base );
t_iErr = t_AllSet.get( t_PersObject, glo::START ); // gets first object from the AllSet in t_PersObject
// do something with t_PersObject...
...
// ... and save it again
t_iErr = t_PersObject->store();
...
// ... respectively delete it in the object database
t_iErr = t_PersObject->deleteInBase();
...
t_Base.closeBase()
}
Definition GloBase.h:263
AllSet, which returns objects from the database.
Definition GloTAllSet.h:192
@ START
Definition GloTypes.h:184

References

References such as pointers, also in containers, to other objects in the object database are offered for reference navigation. You can specify whether the referenced objects are loaded (instantiated) with the object or only when they are accessed (see also glo::TOndemand, glo::TOndemandList and glo::TOndemandSet). You can also set a dependency (dependent) so that referenced objects are saved or deleted at the same time. More...

Locking procedure

To ensure multi-user access, a locking mechanism is implemented down to the object level. Both sets of objects and individual objects can be locked in many ways. More...

Transactions

In order to guarantee that several object database actions can be carried out in a closed manner, transactions are made available. Nested transactions are supported. More...

Watch and notify

An easy-to-use notification system is provided so that changes to objects in the object database can be noticed by an application, e.g. to keep the objects in memory consistent. More...

Indices

To find objects using attribute values, it is possible to index objects using their attributes. It is possible to index objects using your own attributes, attributes of superclasses, and attributes of referenced or embedded classes. You can combine attributes such as "last name" and "first name" as one index attribute. More...

Supported data types

Most standard types are supported as embedded attributes. Currently, these data types are provided for persistent objects.

GlobalObjects error codes

In order to better classify any errors that occur, they are organized by areas.


Error range = -10001 bis -10200
For the socket errors (all from -10004 to -11004) descriptions can be found on the Internet.
For Windows Sockets e.g. under: https://msdn.microsoft.com/de-de/library/windows/desktop/ms740668%28v=vs.85%29.aspx
or generally also under: https://gist.github.com/gabrielfalcao/4216897
This list is not complete!


Error range = -13001 bis -13200


Error range = -14201 bis -14300


Error range = -15001 bis -15100


Error range = -15501 bis -15600