Ceda sample programs

Sample CEDA based programs are available for download. See the file with a name matching ceda-samples-x.y.z.zip in the downloads page.

Project Description
exCedaScript A simple console application which demonstrates use of the cxCedaScript library, which implements the CedaScript scripting language
exLss A simple console application which demonstrates use of the cxLss library (the CEDA Log Structured Store) which is a high performance low level storage engine.
exObject A simple console application which demonstrates use of the cxObject library, which provides basic support for CSpaces, garbage collection, reflection and the DGS.
exPersistStore A simple console application which demonstrates use of the cxPersistStore library, which provides object persistence (for an OODB).
exOperation A simple console application which demonstrates use of the cxOperation library, which supports replication and synchronisation using Operational Transformation. This contains the Airline reservation example
exPython and exPython2 Simple console applications which demonstrate use of the cxPython library, which allows for interoperability between C++ and Python.
exRmi A simple console application which demonstrates use of the cxRmi library, which provides Remote Method Invocation over TCP/IP.
exThread A simple console application which demonstrates use of the cxThread library, which provides an implementation of a thread pool.
Pizza A more involved example featuring multiple libraries, and generation of a python package, under the folder 'MyCompany'

Folder structure

These sample projects are organised with the following folder structure:

(root)
├── CedaExamples
│   ├── exCedaScript
│   ├── exLss
│   ├── exObject
│   ├── exOperation
│   ├── exPersistStore
│   ├── exPython
│   ├── exPython2
│   ├── exRmi
│   ├── exThread
│   ├── lxOperation
│   ├── lxPersistStore
│   └── CMakeLists.txt
├── MyCompany
│   ├── CedaAndroidExample
│   ├── ConsoleTest
│   ├── DateTime
│   ├── Java
│   ├── Pizza
│   ├── Shapes
│   ├── cmake
│   ├── python
│   ├── CMakeLists.txt
│   └── JniFiles.cmake
├── Test
│   ├── CMakeLists.txt
│   ├── doctest.h
│   ├── test1.cpp
│   ├── test2.cpp
│   └── test_main.cpp
├── CMakeLists.txt
├── CMakeSettings.json
├── README.md
├── linux-build-samples.sh
├── linux-setup-dev-machine.sh
├── rasberrypi3-build-samples.sh
├── rasberrypi3-setup-dev-machine.sh
├── run_ctest.bat
├── run_java_test.bat
├── windows_build_samples.bat
├── windows_run_examples.bat
└── windows_run_python_scripts.bat

The root node is intended to corrrespond to the root node of the virtual tree.

cedaTarget function in the CMakeLists.txt file

These targets are written in the Xc++ language, which is an extension to C++ to support reflected data types, persistence, replication, synchronisation etc.

For that reason a special cmake function called cedaTarget is used to define these targets in the CMakeLists.txt file.

For example, the following code appears in CedaExamples/CMakeLists.txt and illustrates defining two targets. The target lxOperation is a library, and the target exPersistStore is an executable:


# CMakeLists.txt

find_package(Ceda REQUIRED)
cedaSetSourceRoot("${CMAKE_CURRENT_SOURCE_DIR}/..")

cedaTarget(XCPP PROJPATH CedaExamples/lxOperation)
target_link_libraries(lxOperation 
    PUBLIC Ceda::cxUtils 
           Ceda::cxObject 
           Ceda::cxPersistStore)

cedaTarget(EXE XCPP PROJPATH CedaExamples/exPersistStore)
target_link_libraries(exPersistStore
    PUBLIC Ceda::cxUtils 
           Ceda::cxThread 
           Ceda::cxObject 
           Ceda::cxLss 
           Ceda::cxPersistStore 
           lxPersistStore)

The symbol EXE passed to cedaTarget indicates that the target is an executable (otherwise it is assumed to be a library).

The symbol XCPP passed to cedaTarget indicates that these targets are written in Xc++. This ensures the Xcpp compiler is used to compile the Xc++ code into normal C++ code, which is then compiled using a straight C++ compiler.

Virtual tree

It is assumed the CedaExamples and MyCompany folders appear under the root node of the virtual tree:

  (root)
    ├── CedaExamples
    └── MyCompany

In a given CMakeLists.txt file, a single call to cedaSetSourceRoot should be made before any calls to cedaTarget.

cedaSetSourceRoot should be passed the path to the root of the source tree (which corresponds to the root of the virtual tree).

It is usually best to express this relative to ${CMAKE_CURRENT_SOURCE_DIR} which represents the path to the folder containing the current CMakeLists.txt file.

For CedaExamples/CMakeLists.txt we step up one level by appending /..


cedaSetSourceRoot("${CMAKE_CURRENT_SOURCE_DIR}/..")

Instructions

  1. Download and install the CEDA SDK. For example use the Windows installer
  2. Download and unzip the CEDA samples (see the file with a name matching ceda-samples-x.y.z.zip in the downloads page)
  3. Run a version of Microsoft Visual Studio that supports cmake (for example Visual Studio 2019). Select File | Open | Folder to open the top level folder containing the CMakeLists.txt.

The sample programs exLss, exPersistStore, exOperation and exPython2 create CEDA database files on your file system. You can specify the folder for where they are created by setting the environment variable CEDA_TEST_DIR

Setting the PATH environment variable

Note that to run the generated console applications, the path to the relevant CEDA binaries must be in the path.

For example, If you build the configuration Win64-Debug-dll, then you probably need C:\Program Files\Ceda\Windows-x64\debug\bin in the path.

Batch file to build the samples

The windows batch file windows_build_samples.bat can be used to build all the samples from the command line.

This uses a batch file named windows_build_ceda_projects.bat which is installed as part of the Windows CEDA SDK. This file is typically installed with path C:\Program Files\Ceda\scripts\windows_build_ceda_projects.bat.

Files in the sample programs

CedaExamples
├── exCedaScript
│   └── src
│       ├── ParseDataSource.cpp
│       ├── ParseLiteralsTest.cpp
│       ├── ParseRunnables.cpp
│       ├── exCedaScript.cpp
│       └── exCedaScript.xcpj
├── exLss
│   └── src
│       ├── Demo1.cpp
│       ├── Demo2.cpp
│       ├── Demo3.cpp
│       ├── exLss.cpp
│       └── exLss.xcpj
├── exObject
│   └── src
│       ├── Adt.cpp
│       ├── AsyncDepGraph.cpp
│       ├── CSpaceObjectCreation.cpp
│       ├── CSpaceObjectEviction.cpp
│       ├── CacheSize.cpp
│       ├── Classes.cpp
│       ├── ClassesWithModels.cpp
│       ├── DepGraph.cpp
│       ├── DepGraph2.cpp
│       ├── DepGraphEviction.cpp
│       ├── DynamicDispatch.cpp
│       ├── Enum.cpp
│       ├── ExampleUtils.h
│       ├── Functors.cpp
│       ├── Interfaces.cpp
│       ├── Macros.cpp
│       ├── Metadata.cpp
│       ├── Mixins.cpp
│       ├── OpenVariants.cpp
│       ├── PureModels.cpp
│       ├── Reflect.cpp
│       ├── ReflectedMemberFunctions.cpp
│       ├── Serialise.cpp
│       ├── Shape.cpp
│       ├── ValidateSerialisation.h
│       ├── Variables.cpp
│       ├── Variant.cpp
│       ├── Vectors.cpp
│       ├── exObject.cpp
│       └── exObject.xcpj
├── exOperation
│   └── src
│       ├── AirlineReservation.cpp
│       ├── DeleteTest.cpp
│       ├── NongracefulShutdownTest.cpp
│       ├── ReplicateOnDemandExample.cpp
│       ├── RodPerformance.cpp
│       ├── TwoWorkingSets.cpp
│       ├── WithoutSockets.cpp
│       ├── exOperation.cpp
│       └── exOperation.xcpj
├── exPersistStore
│   └── src
│       ├── AsyncIOEx.cpp
│       ├── BPlusTreeEx.cpp
│       ├── DataSources.cpp
│       ├── DeleteObjects.cpp
│       ├── EagerSchemaEvolution.cpp
│       ├── ModifyPO.cpp
│       ├── MultiPSpaceTxn.cpp
│       ├── OpenMode.cpp
│       ├── OpenPersistStore.cpp
│       ├── PDequeEx.cpp
│       ├── SingleObjectWithSerialiseFunction.cpp
│       ├── Store.h
│       ├── TransferObjects.cpp
│       ├── TypeOpsEx.cpp
│       ├── Variant.cpp
│       ├── exPersistStore.cpp
│       ├── exPersistStore.xcpj
│       └── xset.cpp
├── exPython
│   └── src
│       ├── Adt.cpp
│       ├── ClassMemberVariables.cpp
│       ├── ClassMethods.cpp
│       ├── Comparisons.cpp
│       ├── Creation.cpp
│       ├── Exceptions.cpp
│       ├── GlobalFunctions.cpp
│       ├── GlobalVariables.cpp
│       ├── Int64.cpp
│       ├── InterfaceMethods.cpp
│       ├── Maps.cpp
│       ├── Marshall.cpp
│       ├── Models.cpp
│       ├── Pointers.cpp
│       ├── Reflection.cpp
│       ├── Strings.cpp
│       ├── Variants.cpp
│       ├── Vectors.cpp
│       ├── exPython.cpp
│       └── exPython.xcpj
├── exPython2
│   └── src
│       ├── Models.cpp
│       ├── Pizza.cpp
│       ├── PythonUtilityFunctions.h
│       ├── Shapes.cpp
│       ├── Vectors.cpp
│       ├── exPython2.cpp
│       └── exPython2.xcpj
├── exRmi
│   └── src
│       ├── RmiBounce.cpp
│       ├── RmiExample.cpp
│       ├── RmiTwoClients.cpp
│       ├── RmiTwoClients2.cpp
│       ├── exRmi.cpp
│       └── exRmi.xcpj
├── exThread
│   └── src
│       ├── CalcTan.cpp
│       ├── exThread.cpp
│       └── exThread.xcpj
├── lxOperation
│   ├── src
│   │   ├── lxOperation.cpp
│   │   └── lxOperation.xcpj
│   ├── DateTime.h
│   ├── DrillHoles.h
│   ├── Jigsaw.h
│   ├── PizzaDeliveries.h
│   ├── Shapes.h
│   └── lxOperation.h
├── lxPersistStore
│   ├── src
│   │   ├── BinaryNode.cpp
│   │   ├── PsTreeNode.cpp
│   │   ├── PsTreeNodeWriter.cpp
│   │   ├── lxPersistStore.cpp
│   │   └── lxPersistStore.xcpj
│   ├── BinaryNode.h
│   ├── PsTreeNode.h
│   ├── PsTreeNodeWriter.h
│   └── lxPersistStore.h
└── CMakeLists.txt