GlobalObjects project file
This file is used by the GloDeveloper to manage GlobalObjects projects.
################################################################################
[Project]
Description=This is my first GlobalObjects project.
################################################################################
[Schema.FirstGloBase]
Schemapath=D:/Projekte/GlobalObects xx.xx/GloExamples/Bases/
Headerpath=D:/Projekte/GlobalObects xx.xx/GloExamples/include/
Sourcepath=D:/Projekte/GlobalObects xx.xx/GloExamples/source/
################################################################################
GlobalObjects schema file (Ini)
GlobalObjects needs a schema for each object database to be able to build C++ objects from object files and object files from C++ objects. An object database is defined by this schema (is a simple text file). For example, if the schema file is stored in a directory "D:/Projects/GlobalObects xx.xx/GloExamples/Bases", the object files are stored in a subdirectory there; the name subdirectory is defined in the schema file. The name of the schema is the name of the object database.
################################################################################
[BaseInfo]
# Database ID to distinguish classes with same class ID.
ID=0
# The version is the creation time as C++ Type time_t.
# Used to compare server schema to client schema.
Version=1610967417
Description=
# The data is located in this subdirectory in the schema directory.
DataPath=FirstGloBase
################################################################################
[Class.glo::Persistent]
ClassID=1
SuperClassID=0|
ClassFileName=GloPersistent.h
[glo::Persistent.Attribute.m_ObjID]
Table=FirstGloBase
FieldPos=0
Field=ObjID
AccessControl=private:
Type=glo::ObjId
TypeInfo=
Description=
[glo::Persistent.Attribute.m_dtCreateDate]
Table=FirstGloBase
FieldPos=1
Field=CreateDate
AccessControl=private:
Type=std::time_t
TypeInfo=
Description=
[glo::Persistent.Attribute.m_dtLastChange]
Table=FirstGloBase
FieldPos=2
Field=LastChange
AccessControl=private:
Type=std::time_t
TypeInfo=
Description=
################################################################################
[Class.FirstClass]
ClassID=2
SuperClassID=1|
SuperClassInfo= |
ClassFileName=FirstClass.h
[FirstClass.Attribute.m_ObjID]
Table=FirstClass
FieldPos=0
Field=ObjID
AccessControl=private:
Type=glo::ObjId
TypeInfo=
Description=
[FirstClass.Attribute.FirstAttribute]
Table=FirstClass
FieldPos=1
Field=FirstAttribute
AccessControl=private:
Type=int
TypeInfo=
Description=
################################################################################
GlobalObjects schema basic information
Two key-value pairs under the section [BaseInfo] are mandatory.
The key Version has as value a number which represents the creation time as C++ type time_t. This is required to ensure a comparison between client and server and that both work with the same GlobalObjects schema.
The value of the key DataPath is the name of the subdirectory that contains the GlobalObjects object files.
The schema can have a ID, which is taken as object database ID in glo::ObjID::m_ulBaseID. This allows you to work simultaneously with several object databases that manage objects with the same class IDs. However, this ID must be globally unique.
Example:
[BaseInfo]
ID=1
Version=1461586766
DataPath=FirstGloBase
GlobalObjects schema class definition
Classes are displayed in sections.
For a class FirstClass a section [Class.FirstClass] would be created as such. A class section is always in square brackets and the class name is preceded by a Class..
The following key/value pairs are mandatory:
-
ClassID The class ID as integer value must be unique in the schema. The base class glo::Persistent, which must be listed in every schema, always has the class ID 1.
-
SuperClassID The class ID of the direct superclass ends with '|'. For multiple inheritance, the value can be "1|3|", for example.
The following key-value pairs are optional:
-
SuperClassInfo In order to guarantee a so-called diamond inheritance, the value virtual can be entered here for an inheritance, for example.
-
FileDescription A file description can be stored here. Line breaks must be marked with '\n'. Is used by the GloDeveloper to describe the header file e.g. in the doxygen standard.
-
ClassDescription A class description can be stored here. Line breaks must be marked with '\n'. Is used by the GloDeveloper to describe the class in the header file, for example, in the doxygen standard.
Example:
[Class.FirstClass]
ClassID=2
SuperClassID=1|
SuperClassInfo= |
FileDescription=Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
ClassDescription=Aenean commodo ligula eget dolor.
GlobalObjects schema attribute definition
Attributes are displayed in sections, which must be placed exclusively under the respective class definition. An attribute definition of one class may not be placed under a class definition of another class. The order of the attribute definitions under the class definition is optional.
For an attribute FirstAttribute of the class FirstClass a section would be created as such under its class definition as [FirstClass.Attribute.FirstAttribute]. An attribute section is always enclosed in square brackets and the attribute description is followed by the respective class description with a '.' and the label Attribute. in front of it.
The following key/value pairs are mandatory:
-
Table The table name in which the value of this attribute is stored.
- Attention
- It is assumed that the table name is the same for all attributes of a class.
-
FieldPos The value of this attribute is stored in the table at the specified column position (start at 0).
-
Field The table field name may differ from the attribute name.
-
Type This is the supported attribute type. See also glo::SchemaTypeString.
The following key-value pairs are optional:
-
TypeInfo Depending on the supported attribute type an information. See also glo::EnDataTypeGroup.
-
Description An attribute description can be stored here. Line breaks must be marked with '\n'. Is used by the GloDeveloper to describe the attribute in the header file, e.g. in the doxygen standard.
-
AccessControl Here you can specify the access to the attribute (private:, protected: or public:). Is used by the GloDeveloper to mark the attribute with the access keyword in the header file.
- Attention
- The access keyword must always be specified with a closing colon.
Example:
[FirstClass.Attribute.FirstAttribute]
Table=FirstClass
FieldPos=1
Field=FirstAttribute
AccessControl=private:
Type=int
TypeInfo=
Description=Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
GlobalObjects schema index definition
To be able to search for objects in tables quickly using an index, an index section can be created. An index can consist of several attributes (for example, last name and first name).
An index is always structured as follows: "ClassName.AttributeName[20]|"
The class name must always be that of the class or superclass of the class to be indexed. The attribute name is the attribute that is used in the index with the number of characters specified in square brackets.
Supported index attribute types:
-
char
-
unsigned char
-
short
-
unsigned short
-
int
-
unsigned int
-
long
-
unsigned long
-
long long
-
unsigned long long
-
float
-
double
-
long double
-
glo::ObjID
-
time_t
-
std::string
Attribute types that can be used as a path to an index attribute:
-
Embedded persistent objects
-
Pointer referenced persistent objects
-
With std::shared_ptr referenced persistent objects
The following key-value pairs are mandatory:
-
Index The structure of the index as described above.
-
CaseSensitive If 1, the index is not case-sensitive ("Jones" is equal to "JOnEs" ). If 0, the system differentiates between upper and lower case in the index ("Jones" is unequal to "JOnEs").
The following key-value pairs are optional:
-
Type Can be set to unique.
-
Language Can be set to a country code. For example, the umlauts and the 'ß' for 'de' are then converted according to DIN 5007 variant 2.
-
Description An index description can be stored here Line breaks must be marked with '\n'. Is used by the GloDeveloper.
-
Delimiter If the index is composed of several attributes, the index values can be stored in the index either simply (Delimiter=0) or separated by a character (Delimiter=1). For further information see GlobalObjects Indices.
Example:
[FirstClass.Index.FirstIndex]
Index=FirstClass.FirstAttribute[20]|
Type=unique
Language=de
CaseSensitive=0
Delimiter=0
Description=
A commented example schema file can be viewed here.
Schema file (ini) with all supported attributes
A commented sample schema file where the class ExampleClass has all supported attribute types.
################################################################################
[BaseInfo]
# Database ID to distinguish classes with same class ID.
ID=2
# The version is the creation time as C++ Type time_t.
# Used to compare server schema to client schema.
Version=1553076866
Description=
# The data is located in this subdirectory in the schema directory.
DataPath=SchemaExampleData
################################################################################
[Class.GloPersistent]
ClassID=1
SuperClassID=0|
ClassFileName=GloPersistent.h
[GloPersistent.Attribute.m_ObjID]
Table=SchemaExample
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
[GloPersistent.Attribute.m_dtCreateDate]
Table=SchemaExample
FieldPos=1
Field=CreateDate
AccessControl=private:
Type=std::time_t
TypeInfo=
Description=
[GloPersistent.Attribute.m_dtLastChange]
Table=SchemaExample
FieldPos=2
Field=LastChange
AccessControl=private:
Type=std::time_t
TypeInfo=
Description=
################################################################################
[Class.ExampleClass]
ClassID=2
SuperClassID=1|
SuperClassInfo= |
ClassFileName=ExampleClass.h
FileDescription=\brief Header for @KlassenName\nGenerated by GloDeveloper: @CurrentDate - @CurrentTime\n\copyright © @UserGroupName\n\autor @UserName
ClassDescription=An example class with all supported attribute types.\n\copyright © @UserGroupName\n\autor @UserName
ClassModifier=__GLO_EXPORT_DLL
[ExampleClass.Attribute.m_ObjID]
Table=ExampleClass
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=The object ID is the unique identification number of a persistent object, is the\nmain index in every object file.
[ExampleClass.Attribute.m_MyBlob]
Table=ExampleClass
FieldPos=1
Field=m_MyBlob
AccessControl=private:
Type=EuBlob
TypeInfo=
Description=A blob is saved as a file. The generated file name is stored in the\nobject database.
[ExampleClass.Attribute.m_MyBool]
Table=ExampleClass
FieldPos=2
Field=m_MyBool
AccessControl=public:
Type=bool
TypeInfo=
Description=1 character in the object database (true => 1, false => 0).
[ExampleClass.Attribute.m_MyChar]
Table=ExampleClass
FieldPos=3
Field=m_MyChar
AccessControl=private:
Type=char
TypeInfo=
Description=Is stored as a decimal number with a maximum of three digits.
[ExampleClass.Attribute.m_MyDateTime]
Table=ExampleClass
FieldPos=19
Field=m_MyDateTime
AccessControl=private:
Type=std::time_t
TypeInfo=
Description=Is stored as unsigned long long.
[ExampleClass.Attribute.m_MyDouble]
Table=ExampleClass
FieldPos=13
Field=m_MyDouble
AccessControl=private:
Type=double
TypeInfo=
Description=Is saved as 'scientific' (e.g. 1.233600e+001 for 12.336).
[ExampleClass.Attribute.m_MyDouble_2]
Table=ExampleClass
FieldPos=14
Field=m_MyDouble_2
AccessControl=private:
Type=double
TypeInfo=2
Description=Is saved with two decimal places because of TypeInfo = 2 (e.g. 12.34 for 12.336).
[ExampleClass.Attribute.m_MyEmbedded]
Table=ExampleClass
FieldPos=20
Field=m_MyEmbedded
AccessControl=private:
Type=embedded<ExampleEmbeddedClass>
TypeInfo=
Description=The embedded persistent object stores the GloObjID.
[ExampleClass.Attribute.m_MyInteger]
Table=ExampleClass
FieldPos=7
Field=m_MyInteger
AccessControl=private:
Type=int
TypeInfo=
Description=Stored as such with sign.
[ExampleClass.Attribute.m_MyUnsignedInteger]
Table=ExampleClass
FieldPos=8
Field=m_MyUnsignedInteger
AccessControl=private:
Type=int
TypeInfo=unsigned
Description=Is saved as such without a sign.
[ExampleClass.Attribute.m_MyDoubleList]
Table=ExampleClass
FieldPos=21
Field=m_MyDoubleList
AccessControl=private:
Type=std::list<double>
TypeInfo=
Description=The double values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyIntegerList]
Table=ExampleClass
FieldPos=22
Field=m_MyIntegerList
AccessControl=private:
Type=std::list<int>
TypeInfo=
Description=The integer values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyStringList]
Table=ExampleClass
FieldPos=23
Field=m_MyStringList
AccessControl=private:
Type=std::list<std::string>
TypeInfo=
Description=The string values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyLongInteger]
Table=ExampleClass
FieldPos=9
Field=m_MyLongInteger
AccessControl=private:
Type=long
TypeInfo=
Description=Stored as such with sign.
[ExampleClass.Attribute.m_MyUnsignedLongInteger]
Table=ExampleClass
FieldPos=10
Field=m_MyUnsignedLongInteger
AccessControl=private:
Type=long
TypeInfo=unsigned
Description=Is saved as such without a sign.
[ExampleClass.Attribute.m_MyOndemandReference]
Table=ExampleClass
FieldPos=24
Field=m_MyOndemandReference
AccessControl=private:
Type=GloTOndemand<ExampleReferenceClass>
TypeInfo=
Description=The GloObjID of the 'referenced on demand' persistent object is stored.
[ExampleClass.Attribute.m_MyOndemandDependReference]
Table=ExampleClass
FieldPos=25
Field=m_MyOndemandDependReference
AccessControl=private:
Type=GloTOndemand<ExampleReferenceClass>
TypeInfo=dependent
Description=The GloObjID of the 'referenced on demand' persistent object is stored. With the type info 'dependent', the referenced object is usually stored together with the referencing object, deleted, locked, etc.
[ExampleClass.Attribute.m_MyPointerReference]
Table=ExampleClass
FieldPos=26
Field=m_MyPointerReference
AccessControl=private:
Type=pointer<ExampleReferenceClass>
TypeInfo=
Description=The GloObjID of the 'directly referenced with pointer' persistent object is stored.
[ExampleClass.Attribute.m_MyPointerDependReference]
Table=ExampleClass
FieldPos=27
Field=m_MyPointerDependReference
AccessControl=private:
Type=pointer<ExampleReferenceClass>
TypeInfo=dependent
Description=The GloObjID of the 'directly referenced with pointer' persistent object is stored. With the TypeInfo 'dependent' the referenced object is usually stored together with the referencing object, deleted, locked, etc.
[ExampleClass.Attribute.m_MyOndemandRefSet]
Table=ExampleClass
FieldPos=28
Field=m_MyOndemandRefSet
AccessControl=private:
Type=GloTOndemandSet<ExampleReferenceClass>
TypeInfo=
Description=The GloObjID's of the 'on demand referenced' persistent objects are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyOndemandDependRefSet]
Table=ExampleClass
FieldPos=29
Field=m_MyOndemandDependRefSet
AccessControl=private:
Type=GloTOndemandSet<ExampleReferenceClass>
TypeInfo=dependent
Description=The GloObjID's of the 'on demand referenced' persistent objects are stored in a file. The generated file name is stored in the object database. With the type info 'dependent' the referenced objects are usually saved with the referencing object, deleted, locked, etc..
[ExampleClass.Attribute.m_MyStdSharedPointer]
Table=ExampleClass
FieldPos=30
Field=m_MyStdSharedPointer
AccessControl=private:
Type=std::shared_ptr<ExampleReferenceClass>
TypeInfo=
Description=The GloObjID of the persistent object 'directly referenced with shared pointers' is stored.
[ExampleClass.Attribute.m_MyStdSharedDependPointer]
Table=ExampleClass
FieldPos=31
Field=m_MyStdSharedDependPointer
AccessControl=private:
Type=std::shared_ptr<ExampleReferenceClass>
TypeInfo=dependent
Description=The GloObjID of the persistent object 'directly referenced with shared pointers' is stored. With the type info 'dependent', the referenced object is usually stored together with the referencing object, deleted, locked, etc..
[ExampleClass.Attribute.m_MyPointerRefSet]
Table=ExampleClass
FieldPos=32
Field=m_MyPointerRefSet
AccessControl=private:
Type=GloTPointerSet<ExampleReferenceClass>
TypeInfo=
Description=The GloObjID's of the 'directly referenced with pointers' persistent objects are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyPointerDependeRefSet]
Table=ExampleClass
FieldPos=33
Field=m_MyPointerDependeRefSet
AccessControl=private:
Type=GloTPointerSet<ExampleReferenceClass>
TypeInfo=dependent
Description=The GloObjID's of the 'directly referenced with pointers' persistent objects are stored in a file. The generated file name is stored in the object database. With the TypeInfo 'dependent' the referenced objects are usually saved with the referencing object, deleted, locked, etc..
[ExampleClass.Attribute.m_MyDoubleSet]
Table=ExampleClass
FieldPos=34
Field=m_MyDoubleSet
AccessControl=private:
Type=std::set<double>
TypeInfo=
Description=The double values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyIntegerSet]
Table=ExampleClass
FieldPos=35
Field=m_MyIntegerSet
AccessControl=private:
Type=std::set<int>
TypeInfo=
Description=The integer values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyStringSet]
Table=ExampleClass
FieldPos=36
Field=m_MyStringSet
AccessControl=private:
Type=std::set<std::string>
TypeInfo=
Description=The string values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyShortInteger]
Table=ExampleClass
FieldPos=5
Field=m_MyShortInteger
AccessControl=private:
Type=short
TypeInfo=
Description=Stored as such with sign.
[ExampleClass.Attribute.m_MyUnsignedShortInteger]
Table=ExampleClass
FieldPos=6
Field=m_MyUnsignedShortInteger
AccessControl=private:
Type=short
TypeInfo=unsigned
Description=Is saved as such without a sign.
[ExampleClass.Attribute.m_MyString]
Table=ExampleClass
FieldPos=17
Field=m_MyString
AccessControl=private:
Type=std::string
TypeInfo=
Description=A character string with the maximum system-specific number of characters is stored directly in the object database, if possible. If too long, the string value is stored in a file whose generated file name is then stored in the object database.
[ExampleClass.Attribute.m_MyString20]
Table=ExampleClass
FieldPos=18
Field=m_MyString20
AccessControl=private:
Type=std::string
TypeInfo=20
Description=A character string with the maximum number of 20 characters is stored directly in the object database, if possible. If too long, the string value is stored in a file whose generated file name is then stored in the object database.
[ExampleClass.Attribute.m_MyDoubleVector]
Table=ExampleClass
FieldPos=37
Field=m_MyDoubleVector
AccessControl=private:
Type=std::vector<double>
TypeInfo=
Description=The double values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyIntegerVector]
Table=ExampleClass
FieldPos=38
Field=m_MyIntegerVector
AccessControl=private:
Type=std::vector<int>
TypeInfo=
Description=The integer values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyStringVector]
Table=ExampleClass
FieldPos=39
Field=m_MyStringVector
AccessControl=private:
Type=std::vector<std::string>
TypeInfo=
Description=The string values are stored in a file. The generated file name is stored in the object database.
[ExampleClass.Attribute.m_MyGloObjID]
Table=ExampleClass
FieldPos=40
Field=m_MyGloObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
[ExampleClass.Attribute.m_MyLongLong]
Table=ExampleClass
FieldPos=11
Field=m_MyLongLong
AccessControl=private:
Type=long long
TypeInfo=
Description=
[ExampleClass.Attribute.m_MyUnsignedLongLong]
Table=ExampleClass
FieldPos=12
Field=m_MyUnsignedLongLong
AccessControl=private:
Type=long long
TypeInfo=unsigned
Description=
[ExampleClass.Attribute.m_MyUnsignedChar]
Table=ExampleClass
FieldPos=4
Field=m_MyUnsignedChar
AccessControl=private:
Type=char
TypeInfo=unsigned
Description=
[ExampleClass.Attribute.m_MyLongDouble]
Table=ExampleClass
FieldPos=15
Field=m_MyLongDouble
AccessControl=private:
Type=long double
TypeInfo=
Description=
[ExampleClass.Attribute.m_MyLongDouble_2]
Table=ExampleClass
FieldPos=16
Field=m_MyLongDouble_2
AccessControl=private:
Type=long double
TypeInfo=2
Description=
[ExampleClass.Attribute.m_MyFloat]
Table=ExampleClass
FieldPos=41
Field=m_MyFloat
AccessControl=private:
Type=float
TypeInfo=0
Description=
[ExampleClass.Index.FirstIndex]
Index=ExampleClass.m_MyString[10]|ExampleClass.m_MyString20[20]|
Type=
Language=2
CaseSensitive=0
Delimiter=0
Description=Description=Index with two attributes which are simply combined into one index string.
################################################################################
[Class.ExampleEmbeddedClass]
ClassID=3
SuperClassID=1|
SuperClassInfo= |
ClassFileName=ExampleEmbeddedClass.h
FileDescription=\brief Header for @KlassenName\nGenerated by GloDeveloper: @CurrentDate - @CurrentTime\n\copyright © @UserGroupName\n\autor @UserName
ClassDescription=\copyright © @UserGroupName\n\autor @UserName
[ExampleEmbeddedClass.Attribute.m_ObjID]
Table=ExampleEmbedetClass
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
[ExampleEmbeddedClass.Attribute.m_MyValue]
Table=ExampleEmbedetClass
FieldPos=1
Field=m_MyValue
AccessControl=private:
Type=int
TypeInfo=
Description=
################################################################################
[Class.ExampleReferenceClass]
ClassID=4
SuperClassID=1|
SuperClassInfo= |
ClassFileName=ExampleReferenceClass.h
FileDescription=\brief Header for @KlassenName\nGenerated by GloDeveloper: @CurrentDate - @CurrentTime\n\copyright © @UserGroupName\n\autor @UserName
ClassDescription=\copyright © @UserGroupName\n\autor @UserName
[ExampleReferenceClass.Attribute.m_ObjID]
Table=ExampleReferenceClass
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
[ExampleReferenceClass.Attribute.m_MyValue]
Table=ExampleReferenceClass
FieldPos=1
Field=m_MyValue
AccessControl=private:
Type=int
TypeInfo=
Description=
################################################################################
[Class.ExampleBaseClass]
ClassID=5
SuperClassID=1|
SuperClassInfo=virtual|
ClassFileName=ExampleBaseClass.h
FileDescription=\brief Header for @KlassenName\nGenerated by GloDeveloper: @CurrentDate - @CurrentTime\n\copyright © @UserGroupName\n\autor @UserName
ClassDescription=\copyright © @UserGroupName\n\autor @UserName
[ExampleBaseClass.Attribute.m_ObjID]
Table=ExampleBaseClass
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
[ExampleBaseClass.Attribute.m_iBaseValue]
Table=ExampleBaseClass
FieldPos=1
Field=m_iBaseValue
AccessControl=private:
Type=int
TypeInfo=
Description=
[ExampleBaseClass.Index.IDX]
Index=ExampleBaseClass.m_iBaseValue[11]|
Type=
Language=0
CaseSensitive=0
Delimiter=0
Description=
################################################################################
[Class.ExampleSubClass_1]
ClassID=6
SuperClassID=5|
SuperClassInfo= |
ClassFileName=ExampleSubClass_1.h
FileDescription=\brief Header for @KlassenName\nGenerated by GloDeveloper: @CurrentDate - @CurrentTime\n\copyright © @UserGroupName\n\autor @UserName
ClassDescription=\copyright © @UserGroupName\n\autor @UserName
[ExampleSubClass_1.Attribute.m_ObjID]
Table=ExampleSubClass_1
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
[ExampleSubClass_1.Attribute.m_iSub1Value]
Table=ExampleSubClass_1
FieldPos=1
Field=m_iSub1Value
AccessControl=private:
Type=int
TypeInfo=
Description=
################################################################################
[Class.ExampleSubClass_2]
ClassID=7
SuperClassID=5|
SuperClassInfo=virtual|
ClassFileName=ExampleSubClass_2.h
FileDescription=\brief Header for @KlassenName\nGenerated by GloDeveloper: @CurrentDate - @CurrentTime\n\copyright © @UserGroupName\n\autor @UserName
ClassDescription=\copyright © @UserGroupName\n\autor @UserName
[ExampleSubClass_2.Attribute.m_ObjID]
Table=ExampleSubClass_2
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
[ExampleSubClass_2.Attribute.m_iSub2Value]
Table=ExampleSubClass_2
FieldPos=1
Field=m_iSub2Value
AccessControl=private:
Type=int
TypeInfo=
Description=
################################################################################
[Class.ExampleMSubClass]
ClassID=8
SuperClassID=6|7|
SuperClassInfo= | |
FileDescription=\brief Header for @KlassenName\nGenerated by GloDeveloper: @CurrentDate - @CurrentTime\n\copyright © @UserGroupName\n\autor @UserName
ClassDescription=\copyright © @UserGroupName\n\autor @UserName
[ExampleMSubClass.Attribute.m_ObjID]
Table=ExampleMSubClass
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
[ExampleMSubClass.Attribute.m_iMSubValue]
Table=ExampleMSubClass
FieldPos=1
Field=m_iMSubValue
AccessControl=private:
Type=int
TypeInfo=
Description=
################################################################################
[Class.ExampleIndexSubClass]
ClassID=9
SuperClassID=2|
SuperClassInfo= |
[ExampleIndexSubClass.Attribute.m_ObjID]
Table=ExampleIndexSubClass
FieldPos=0
Field=ObjID
AccessControl=private:
Type=GloObjId
TypeInfo=
Description=
################################################################################
DB.ini
So that an application that uses GlobalObjects knows where to find the object databases, a "DB.ini"
with the following structure must be stored in the application directory:
[Server]
KnownBases=FirstBase
BasePath=D:/Projekte/GlobalObects xx.xx/GloExamples/Bases
Two key-value pairs under the [Server] section are mandatory.
The KnownBases key has as its value the name of the GlobalObjects schema file.
The value of the BasePath key is the name of the directory where the GlobalObjects schema file and its associated database directory are located.
If the GloServer is used, a "DB.ini"
with the following structure must be stored in its directory:
[Server]
Port=4000
TcpPackageSize=4096
TimeOutSec=5
KnownBases=FirstBase
BasePath=D:/Projekte/GlobalObects xx.xx/GloExamples/Bases
Key-value pairs Port, TcpPackageSize and TimeOutSec should be adopted.
Object creator
To enable GlobalObjects to create objects from the object database, an object creator class is required for each object database, which knows which objects correspond to a class ID and can instantiate them. The object creator file generated by the GloDeveloper (e.g. "FirstBaseObjCreator.h"
) is integrated into the own project and should not be edited by the user. The object creator includes all persistent classes of the respective object database.
#ifndef INC_FIRSTGLOBASEOBJCREATOR_H
#define INC_FIRSTGLOBASEOBJCREATOR_H
#include <EuException.h>
#include <GloTypes.h>
#include <GloObjCreator.h>
#include <GloTAllSet.h>
#include "FirstClass.h"
class FirstGloBaseObjCreator : public glo::ObjCreator
{
public:
const unsigned long ClassID_AllClasses = 0;
const unsigned long ClassID_glo__Persistent = 1;
const unsigned long ClassID_FirstClass = 2;
inline FirstGloBaseObjCreator();
inline virtual ~FirstGloBaseObjCreator();
inline virtual std::string getBaseName() const;
inline virtual bool isKnownClassID( unsigned long ulClassID ) const;
inline virtual int getPersObject( glo::Persistent *& prNewObject, unsigned long ulClassID ) const;
inline virtual unsigned long getClassID( glo::BaseAllSet * pAllSet ) const;
inline virtual ObjCreator * getCopy() const;
};
#define SUPER ObjCreator
FirstGloBaseObjCreator::FirstGloBaseObjCreator()
: SUPER()
{
}
FirstGloBaseObjCreator::~FirstGloBaseObjCreator()
{
}
inline std::string FirstGloBaseObjCreator::getBaseName() const
{
return "FirstGloBase";
}
inline bool FirstGloBaseObjCreator::isKnownClassID( unsigned long ulClassID ) const
{
if (
ulClassID ==1
||
ulClassID ==2
)
{
return true;
}
return false;
}
inline int FirstGloBaseObjCreator::getPersObject( glo::Persistent *& prNewObject, unsigned long ulClassID ) const
{
int t_iErr = 0;
glo::ObjID t_NewObjID( ulClassID, 0, 0 );
switch ( ulClassID )
{
case 1:
{
prNewObject = new glo::Persistent();
break;
}
case 2:
{
prNewObject = new FirstClass();
break;
}
default:
{
t_iErr = glo::ERR_UNKNOWN_CLASSID;
break;
}
}
if ( prNewObject )
{
prNewObject->setGloAttribute( "glo::Persistent.m_ObjID", & t_NewObjID );
}
return t_iErr;
}
inline unsigned long FirstGloBaseObjCreator::getClassID( glo::BaseAllSet * pAllSet ) const
{
unsigned long t_ulRetVal = 0;
glo::TAllSet<glo::Persistent> * t_pCastgloPersistent = dynamic_cast<glo::TAllSet<glo::Persistent>*>(pAllSet);
glo::TAllSet<FirstClass> * t_pCastFirstClass = dynamic_cast<glo::TAllSet<FirstClass>*>(pAllSet);
if ( t_pCastgloPersistent ) t_ulRetVal = 1;
if ( t_pCastFirstClass ) t_ulRetVal = 2;
if ( ! t_ulRetVal )
{
throw eut::ErrorNException( "FirstGloBaseObjCreator::getClassID( BaseAllSet * pAllSet ) const", glo::ERR_UNKNOWN_OBJECT_TYPE, __FILE__, __LINE__ );
}
return t_ulRetVal;
}
inline glo::ObjCreator * FirstGloBaseObjCreator::getCopy() const
{
return new FirstGloBaseObjCreator;
}
#undef SUPER
#endif
FirstClass (Header)
The header files of the persistent classes generated by GloDeveloper can be changed and extended by the user as far as possible. The only area needed by GloDeveloper is the one between the entries "private persistent:" and "private transient:". If the comments starting with "//@@glo" are removed, GloDeveloper will not update these areas. It is recommended not to remove these comments.
The user can insert additional transient attributes and methods (like the Set and Get method in the example). This area is not "touched" by GloDeveloper when changes are made.
#ifndef INC_FIRSTCLASS_H
#define INC_FIRSTCLASS_H
namespace glo
{
class Base;
}
#include <GloPersistent.h>
class FirstClass : public glo::Persistent
{
private persistent:
GLO_OBJECT( FirstClass:glo::Persistent );
private:
int FirstAttribute;
private transient:
public:
void setFirstAttribute( int i )
{
FirstAttribute = i;
}
int getFirstAttribute() const
{
return FirstAttribute;
}
};
#endif
FirstClass (Glo-Source)
A source file generated by the GloDeveloper (e.g. "glo_FirstClass.cpp"
) of the persistent class FirstClass must be included in the software project. It contains instructions for GlobalObjects and should not be edited by the user.
Methods of the class FirstClass should be implemented either 'inline' or in another source file (usually "FirstClass.cpp"
).
#include "FirstClass.h"
#include "EuException.h"
#include <GloBase.h>
unsigned long FirstClass::getGloClassID() const
{
return 2;
}
int FirstClass::setGloAttribute( const glo::AttributeID & rAttributeID, void * pPara )
{
int t_iErr = 0;
if ( rAttributeID == glo::AttributeID( 2, 1 ) )
{
FirstClass::FirstAttribute = * ( static_cast<int*>( pPara ) );
}
else
{
t_iErr = glo::Persistent::setGloAttribute( rAttributeID, pPara );
}
return t_iErr;
}
int FirstClass::setGloAttribute( const std::string & rstrAttributeName, void * pPara )
{
int t_iErr = 0;
if ( rstrAttributeName == "FirstClass.FirstAttribute" )
{
FirstClass::FirstAttribute = * ( static_cast<int*>( pPara ) );
}
else
{
t_iErr = glo::Persistent::setGloAttribute( rstrAttributeName, pPara );
}
return t_iErr;
}
void * FirstClass::getGloAttribute( const glo::AttributeID & rAttributeID )
{
void * t_pRetVal = 0;
if ( rAttributeID == glo::AttributeID( 2, 1 ) )
{
return & (FirstClass::FirstAttribute);
}
else
{
t_pRetVal = glo::Persistent::getGloAttribute( rAttributeID );
}
return t_pRetVal;
}
void * FirstClass::getGloAttribute( const std::string & rstrAttributeName )
{
void * t_pRetVal = 0;
if ( rstrAttributeName == "FirstClass.FirstAttribute" )
{
return & (FirstClass::FirstAttribute);
}
else
{
t_pRetVal = glo::Persistent::getGloAttribute( rstrAttributeName );
}
return t_pRetVal;
}
void FirstClass::postAssign( glo::Base & rBase )
{
glo::Persistent::postAssign( rBase );
}
Main.cpp
For the first impression, a commented Main.cpp, in which persistent objects are read from an object database and a new persistent object is saved. Instead of raw pointers std::shared_ptr
are used:
#include <iostream>
#include <GloBase.h>
#include "FirstGloBaseObjCreator.h"
int main( int argc, char* argv[] )
{
int t_iErr = 0;
FirstGloBaseObjCreator t_ObjCreator;
glo::Base t_Base( "LOCAL", "TestClient", t_ObjCreator );
t_iErr = t_Base.openBaseComfortably();
std::cout << "openBaseComfortably -> Err:" << t_iErr << "\n";
if ( ! t_iErr )
{
std::shared_ptr<FirstClass> t_spNewPersObject( new FirstClass(), glo::Forgeter<FirstClass>() );
int t_iValue( 0 );
std::cout << "Please enter a number" << "\n";
std::cin >> t_iValue;
t_spNewPersObject->setFirstAttribute( t_iValue );
t_iErr = t_spNewPersObject->assign( t_Base );
if ( ! t_iErr )
{
std::cout << "Object assigned ->ObjId: " << t_spNewPersObject->getObjID().toString() << "\n";
t_iErr = t_spNewPersObject->store();
if ( ! t_iErr )
{
std::cout << "Object stored ->ObjId: " << t_spNewPersObject->getObjID().toString() << "\n";
}
}
if ( ! t_iErr )
{
std::shared_ptr<FirstClass> t_spShowPersObject;
glo::TAllSet<FirstClass> t_AllSet( t_Base );
std::cout << "Objects in AllSet: " << t_AllSet.size() << "\n" ;
t_iErr = t_AllSet.get( t_spShowPersObject, glo::START );
if ( ! t_iErr )
{
std::cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
do
{
std::cout << "From AllSet ObjId: "
<< t_spShowPersObject->getObjID().toString()
<< " FirstClass::FirstAttribute = "
<< t_spShowPersObject->getFirstAttribute()
<< "\n" ;
t_iErr = t_AllSet.get( t_spShowPersObject, glo::NEXT );
} while ( ! t_iErr );
std::cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
}
}
t_iErr = ( t_iErr == glo::ERR_RANGE ? 0 : t_iErr );
t_iErr = t_Base.closeBase();
std::cout << "closeBase -> Err:" << t_iErr << "\n";
}
char key = 0;
std::cout << "To finish please press a key and [Enter]." << "\n";
std::cin >> key;
return t_iErr;
}
If you do not want to work with std::shared_ptr, here is an alternative Main.cpp.
#include <iostream>
#include <GloBase.h>
#include "FirstGloBaseObjCreator.h"
int main( int argc, char* argv[] )
{
int t_iErr = 0;
FirstGloBaseObjCreator t_ObjCreator;
glo::Base t_Base( "LOCAL", "TestClient", t_ObjCreator );
t_iErr = t_Base.openBaseComfortably();
std::cout << "openBaseComfortably -> Err:" << t_iErr << "\n";
if ( ! t_iErr )
{
FirstClass * t_pNewPersObject = new FirstClass();
int t_iValue( 0 );
std::cout << "Please enter a number" << "\n";
std::cin >> t_iValue;
t_pNewPersObject->setFirstAttribute( t_iValue );
t_iErr = t_pNewPersObject->assign( t_Base );
if ( ! t_iErr )
{
std::cout << "Object assigned ->ObjId: " << t_pNewPersObject->getObjID().toString() << "\n";
t_iErr = t_pNewPersObject->store();
if ( ! t_iErr )
{
std::cout << "Object stored ->ObjId: " << t_pNewPersObject->getObjID().toString() << "\n";
}
}
t_pNewPersObject->forget();
if ( ! t_iErr )
{
FirstClass * t_pShowPersObject = 0;
glo::TAllSet<FirstClass> t_AllSet( t_Base );
std::cout << "Objects in AllSet: " << t_AllSet.size() << "\n" ;
t_iErr = t_AllSet.get( t_pShowPersObject, glo::START );
if ( ! t_iErr )
{
std::cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
do
{
std::cout << "From AllSet ObjId: "
<< t_pShowPersObject->getObjID().toString()
<< " FirstClass::FirstAttribute = "
<< t_pShowPersObject->getFirstAttribute()
<< "\n" ;
t_pShowPersObject->forget();
t_iErr = t_AllSet.get( t_pShowPersObject, glo::NEXT );
} while ( ! t_iErr );
std::cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
}
}
t_iErr = ( t_iErr == glo::ERR_RANGE ? 0 : t_iErr );
t_iErr = t_Base.closeBase();
std::cout << "closeBase -> Err:" << t_iErr << "\n";
}
char key = 0;
std::cout << "To finish please press a key and [Enter]." << "\n";
std::cin >> key;
return t_iErr;
}
Persistent class with all supported attributes (Header)
As an example a persistent class ExampleClass with all supported attribute types.
#ifndef INC_EXAMPLECLASS_H
#define INC_EXAMPLECLASS_H
namespace glo
{
class Base;
}
class ExampleEmbeddedClass;
class ExampleReferenceClass;
#include <GloPersistent.h>
#include <EuBlob.h>
#include <list>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "ExampleEmbeddedClass.h"
#include "ExampleReferenceClass.h"
class ExampleClass : public glo::Persistent
{
private persistent:
GLO_OBJECT( ExampleClass:glo::Persistent );
GLO_INDEX( FirstIndex, ExampleClass.m_String[10] & ExampleClass.m_String20[20], USE_DELIMITER | DEU-2 );
private:
eut::Blob m_Blob;
bool m_Bool;
char m_Char;
std::time_t m_DateTime;
double m_Double1;
double m_Double2;
double m_Double3;
std::list<double> m_DoubleList;
std::set<double> m_DoubleSet;
std::vector<double> m_DoubleVector;
float m_Float1;
float m_Float2;
float m_Float3;
int m_Integer;
std::list<int> m_IntegerList;
std::set<int> m_IntegerSet;
std::vector<int> m_IntegerVector;
long m_LongInteger;
long double m_LongDouble1;
long double m_LongDouble2;
long double m_LongDouble3;
long long m_LongLong;
glo::ObjID m_GloObjID;
glo::TOndemand< ExampleReferenceClass > m_OndemandReference;
glo::TOndemand< ExampleReferenceClass > m_OndemandDependReference;
glo::TOndemandSet< ExampleReferenceClass > m_OndemandRefSet;
glo::TOndemandSet< ExampleReferenceClass > m_OndemandDependRefSet;
glo::TPointerSet< ExampleReferenceClass > m_PointerRefSet;
glo::TPointerSet< ExampleReferenceClass > m_PointerDependeRefSet;
short m_ShortInteger;
std::shared_ptr<ExampleReferenceClass> m_StdSharedPointer;
std::shared_ptr<ExampleReferenceClass> m_StdSharedDependPointer;
std::string m_String;
std::string m_String20;
std::list<std::string> m_StringList;
std::set<std::string> m_StringSet;
std::vector<std::string> m_StringVector;
unsigned char m_UnsignedChar;
unsigned int m_UnsignedInteger;
unsigned long m_UnsignedLongInteger;
unsigned long long m_UnsignedLongLong;
unsigned short m_UnsignedShortInteger;
ExampleReferenceClass* m_PointerReference;
ExampleReferenceClass* m_PointerDependReference;
ExampleEmbeddedClass m_Embedded;
private transient:
};
#endif
IndexCallBack derived from glo::CallBack
An example of how to be informed about the opening of an GlobalObjects object database and the reindexing of an GlobalObjects object database.
class IndexCallBack : public glo::CallBack
{
private:
IndexCallBack( const IndexCallBack & rTr );
public:
IndexCallBack(){};
virtual ~IndexCallBack(){};
public:
virtual void notify( glo::NotifyNote & rNote )
{
if ( rNote.m_ulNotifyMode == glo::WNM_INDEX_READ || rNote.m_ulNotifyMode == glo::WNM_INDEX_WRITE )
{
if ( rNote.m_ulNotifyMode == glo::WNM_INDEX_READ ) std::cout << "Read ";
else if ( rNote.m_ulNotifyMode == glo::WNM_INDEX_WRITE ) std::cout << "Write ";
std::cout << "Index:" << rNote.m_strInfo << " ClassID:" << rNote.m_ObjID.getClassID() << " %:" << rNote.m_uiInfo << "\n";
}
else if ( rNote.m_ulNotifyMode == glo::WNM_INDEX_REINDEX )
{
std::cout << "Reindex Index:" << rNote.m_strInfo << " ObjID:" << rNote.m_ObjID.toString() << " Count:" << rNote.m_uiInfo << "\n";
}
};
private:
IndexCallBack & operator= ( const IndexCallBack & );
};
Further information on the topic Watch / Notify Glo Objects.
An object file
Object files are usually text files whose data fields are separated by a "special character". Object files can be read in e.g. by LibreOffice Calc.
ObjID|CreateDate|LastChange|
2.0.1| 1553163903| 0|
Blobs and longer text fields are swapped out to separate files; the file name is then entered in the data field.