ODMG C++ Persistence Engine • Linux & Windows Native

Native Object-Oriented Database
Engineered for Raw Speed.

A lightweight simulation of an ODMG-style Object-Oriented Database Management System (OODBMS) featuring direct pointer-overloaded graph navigation, custom vacancy bitmap recycling, and binary persistence.

0
External Dependencies
< 15 KB
Core Engine Footprint
O(1)
Vacancy Bitmap Allocation
100%
Linux & Windows Parity

Why DataStore Redefines Persistence

By bypassing relational impedance mismatch and storing C++ structs directly as binary extents, DataStore delivers blazing query speed and expressive syntax.

ODMG Standard Simulation

Implements the canonical Object Data Management Group trifecta: ODL (Object Definition Language), OCL (Object Creation Language), and OML (Object Manipulation Language).

ODL • OCL • OML

Pointer Overloaded Navigation

Traverse deep entity graphs without SQL JOINs. Navigate associations seamlessly using native C++ pointer syntax: pcur.dept->loc->addr->city.

operator->() Traversal

Bitmap Vacancy Management

Maintains .v.dat vacancy files using compact bitfield tracking. Deleted records are instantly freed and recycled in O(1) time without fragmentation.

Zero-Frag Bitfield

Clean Extent Partitioning

Every entity has an isolated binary extent directory under ./DataStore/. Paired with o.dat offset indices and v.dat vacancy records.

./DataStore/ Directory

Collection Templates: Bag & Set

Built-in bag<S> and set<S> template containers manage 1-to-N relationships, membership checks, insertion, and memory caching out of the box.

set<T> & bag<T>

True Cross-Platform Engine

Seamlessly compiles and runs on both modern Linux (GCC / POSIX filesystem APIs) and Windows (MSVC / Visual Studio 2022 / Win32 console).

Linux & Windows MSVC

Interactive Terminal & Engine Simulator

Experience DataStore in action right in your browser. Trigger creation, relationship linking, pointer navigation queries, and watch binary records & vacancy bitmaps update in real-time.

host: DataStore-Core (x86_64-engine) [./DataStore/ Storage Mode]
Live Terminal Console
Visual Object Graph
Vacancy Bitfield Inspector (.v.dat)
Vacant ('0' - Free for Instant Reuse)
Occupied ('1' - Active In-Use Extent Slot)

* Click on any block to inspect its allocation slot and status in personv.dat / deptmv.dat.

ODMG Layered Architecture

An elegant four-layer design that cleanly separates object definitions, relationship manipulation, container logic, and binary persistence.

Layer 1
Application Layer
Client executables and console interfaces
OCL.exe Interactive Object Creator
OML.exe Relationship Linker & Queries
CLR / Win32 clrscr(), getch() Console Helpers
Layer 2
ODMG Schema (ODL)
Object Definition Language specifications
person extent: "person" (384B)
department extent: "deptm" (336B)
location extent: "locat" (336B)
address extent: "addr" (144B)
Layer 3
Persistence Core
C++ Template engine and relationship containers
database<T> Persistence Wrapper
set<S> Unique Associated Entities
bag<S> Multi-element Collection
operator->() Pointer Overloading Bridge
Layer 4
Storage Engine
Binary file serialization & block allocation
./DataStore/<ext> Raw Binary Struct Records
<ext>v.dat Vacancy Bitfield (100 Slots)
<ext>o.dat Object Offset / Index Table

Production C++ Source Code

Examine the actual implementations of ODL schemas, OCL creation, OML queries, and the core template database engine.

// OML.CPP - Object Manipulation Language & Pointer Graph Navigation
#include "DATABASE.CPP"
#include "ODL.CPP"

int main()
{
    clrscr();
    
    // 1. Load persisted records from binary extents
    database<address>    acur(2); acur.movefirst();
    database<location>   lcur(2); lcur.movefirst();
    database<department> dcur(2); dcur.movefirst();
    database<person>     pcur(2); pcur.movefirst();

    // 2. Link object relationships (Location -> Address)
    lcur.addr.addlink(&acur);
    lcur.updateit();

    // 3. Link Department -> Location
    dcur.loc.addlink(&lcur);
    dcur.updateit();

    // 4. Link Person -> Department
    pcur.dept.addlink(&dcur);
    pcur.updateit();

    // 5. Pointer-overloaded deep traversal query!
    if (pcur.dept.operator->() && pcur.dept->loc.operator->())
    {
        cout << "Navigated Location: " << pcur.dept->loc->name << endl;
    }
    
    cout << "\nQuery finished. Press any key..." << endl;
    getch();
    return 0;
}
// OCL.CPP - Object Creation Language & Binary Extent Allocation
#include "DATABASE.CPP"
#include "ODL.CPP"

int main()
{
    clrscr();

    // Mode 1 indicates new persistent object instantiation
    database<person> perm(1);
    perm.add();  // Interactively takes name, employee # and commits

    database<department> dept(1);
    dept.add();

    database<location> loc(1);
    loc.add();

    database<address> addr(1);
    addr.add();

    cout << "\nRecords added successfully to ./DataStore/. Press any key...\n";
    getch();
    return 0;
}
// ODL.CPP - Object Definition Language (ODMG Schemas)
#pragma once
#include "DATABASE.CPP"

class department;
class location;
class address;

class person : public Persistance
{
public:
    char name[30];
    set<department> dept;  // ODMG 1-to-N Relationship

    person() {
        strcpy(extent, "person");
        strcpy(name, " ");		
    }

    void add() {
        cout << "Employ Name:";
        safe_read_line(name, sizeof(name));        
    }

    friend class database<person>;
};

class department : public Persistance
{
public:
    char name[20];
    set<location> loc;

    department() {
        strcpy(extent, "deptm");
        strcpy(name, " ");        
    }
    /* ... add() and methods ... */
};
// DATABASE.CPP - Core Engine Template & Vacancy Bitmap Allocation
template <class S>
S *set<S>::operator->()
{
    this->link = new S;
    if (this->pos >= this->itemcount) {
        delete this->link;
        return nullptr;
    }

    database<S> temp(2);
    if (this->contents[this->pos] == 0) {
        delete this->link;
        return nullptr;
    }

    // Load target entity directly by OID offset
    temp.load(this->contents[this->pos]);
    *(this->link) = (S)temp;
    ptrArray[p_count++] = this->link;
    return this->link;
}

// Cross-Platform Directory Initialization
void addfullpath()
{
#ifdef _WIN32
    CreateDirectoryA("DataStore", NULL);
#else
    mkdir("DataStore", 0777);
#endif
    snprintf(fullclassname, sizeof(fullclassname), "./DataStore/%s", ext);
    snprintf(file_o, sizeof(file_o), "./DataStore/%so.dat", ext);
    snprintf(file_v, sizeof(file_v), "./DataStore/%sv.dat", ext);
}

Build & Run Instructions

Tested and optimized for both Linux environments (GCC / Clang / POSIX) and Windows (Visual Studio 2022 / MSVC / CMake).

Linux (POSIX)

GCC 9+ / Clang 10+ / Ubuntu, Debian, Fedora, Arch

  • Native POSIX file permissions via mkdir("DataStore", 0777)
  • Zero runtime daemon or external shared libraries needed
  • Fast compilation with -O3 optimization
# Compile OCL (Creation Language) g++ -std=c++17 -O3 OCL.CPP -o OCL # Compile OML (Manipulation Language) g++ -std=c++17 -O3 OML.CPP -o OML # Run OCL to persist records ./OCL # Run OML to query object graph ./OML

Windows (Win32 / MSVC)

Visual Studio 2022 / MSVC v143 / CMake / Windows 10 & 11

  • Full Visual Studio Solution OODBMS.sln with OCL & OML projects
  • One-click batch build script build.bat for MSBuild
  • Visual Studio CMake "Open Folder" mode support
# Method 1: One-click Command-Line Build .\build.bat # Method 2: Visual Studio 2022 Double-click OODBMS.sln Set 'OCL' as Startup Project -> Ctrl + F5 Set 'OML' as Startup Project -> Ctrl + F5 # Binaries are emitted to bin\Release\ .\bin\Release\OCL.exe .\bin\Release\OML.exe

Designed & Developed by Meray Systems

Specializing in high-performance algorithm engineering, systems software, and bespoke database architectures in C, C++, C#, Java, JavaScript, and Python.