Integrating tom_som_cpp_v0
tom_som_cpp_v0 is the typed TomSpecs object-model facade for C++. It depends on tom_som_cpp_runtime. Both are versioned to the TomSpecs
model version (currently 1.3.2) — pin to that version so your document reads and writes match the model the facade was generated from.
Quick start
Build and install tom_som_cpp_v0 (and tom_som_cpp_runtime), then compile against it with
pkg-config:
#include "tom_som_cpp_v0.hpp"
#include <iostream>
int main() {
// A typed Solution Blueprint over a fresh document. The constructor also runs
// the instantiation-time model-version check (an empty stamp is editable).
// RAII: the document is a value that must outlive every facade bound to it;
// getters return std::string by value, so there is nothing to free.
som::SpecDocument doc;
tom_som_v0::D00SolutionBlueprint bp(doc);
bp.setContent("A platform that unifies our fragmented order systems.");
tom_som_v0::CurrentLandscape cl = bp.currentLandscape();
cl.setContent("Three legacy systems with no shared customer record.");
std::cout << bp.content() << "\n";
return 0;
}
Dependency routes
pkg-config (installed)
C++ has no universal package registry. Install the facade and the runtime (runtime first — the facade links against it), then let
pkg-config supply the compile and link flags:
make -C ../tom_som_cpp_runtime install
make install
c++ myapp.cpp $(pkg-config --cflags --libs tom_som_cpp_v0) -o myapp
The facade .pc declares Requires: tom_som_cpp_runtime, so a single pkg-config tom_som_cpp_v0
pulls in the runtime flags too. Both .pc files report Version 1.3.2.
Source tarball (vendored)
Produce versioned source tarballs and vendor them into your build:
make -C ../tom_som_cpp_runtime dist # tom_som_cpp_runtime-1.3.2.tar.gz
make dist # tom_som_cpp_v0-1.3.2.tar.gz
Unpack both alongside your project and add each include/ to your include path plus the built libraries to your link line.
In-tree (monorepo)
When the SOM projects sit alongside your code, build the facade in place; its Makefile builds the runtime on demand through a relative
RUNTIME_DIR:
make # builds runtime + facade libs
c++ myapp.cpp -Iinclude -I../tom_som_cpp_runtime/include \
build/libtom_som_cpp_v0.a ../tom_som_cpp_runtime/build/libtom_som_cpp_runtime.a \
-o myapp
Pinning the version
Both tom_som_cpp_runtime and tom_som_cpp_v0 carry version 1.3.2, taken from the TomSpecs model version. When you upgrade the model, regenerate and move to the new matching version so the facade and your stored documents stay in step.
Building from source
Regenerate the facade, then build and package both projects from the workspace (runtime first — the facade builds it on demand through its relative
RUNTIME_DIR):
dart run tom_specs_clitool/bin/generate_som.dart
cd tom_som_cpp_runtime && make && make dist
cd ../tom_som_cpp_v0 && make && make dist
Each make builds the static + shared library and the pkg-config file; each make dist
writes build/<name>-<version>.tar.gz.
Further documentation
| Document | Covers |
|---|---|
| README.md | What this package is, its document roots, and how to use them. |
| doc/tutorial.md |
A C++ walkthrough end to end — install, open a document, read and edit a section, validate it, and serialize to
*.docspecs.yaml
and Markdown.
|
| examples/README.md | The runnable samples. |
| tom_specs_model/doc/som_multiplatform_spec_model.md |
The SOM authority: the model, the formats, and
SOM §17
— the packaging rules this guide implements.
|
| tom_specs_model/doc/index.md | The catalogue of every TomSpecs subject-matter document. |
| tom_som_cpp_runtime | The generic runtime this facade depends on. |