A C++ SDK for Senzing v4, patterned 1:1 after the official C# SDK. Type names, method names, flag/constant names, and the exception hierarchy match the C# SDK character-for-character (PascalCase); the underlying types are the natural C++ equivalents (std::string, int64_t, std::optional, STL containers).
Two-layer design
| Namespace | Role |
| senzing::sdk | Abstract interfaces, flags, exception types, constants — no implementation. |
| senzing::sdk::core | Native-backed implementation that calls the Senzing native library (libSz). |
Consumers program against the senzing::sdk abstractions; only senzing::sdk::core touches the native library.
Core types
- SzEnvironment — factory + lifecycle; hands out the subsystems below.
- SzEngine — records, entities, queries, export.
- SzConfigManager — persisted configurations and the default-config registry.
- SzConfig — in-memory configuration document.
- SzProduct — license and version.
- SzDiagnostic — repository diagnostics.
- SzLogging — native log callbacks, levels, formats and the default output (SzEnvironment::GetLogging(), Senzing >= 4.5.0). This API leads the C# SDK, which has no logging API yet; the design follows the Rust SDK v4.5.0.
Getting started
The environment is constructed via a fluent builder and torn down with Destroy():
.InstanceName("my-app")
.Settings(settings)
.VerboseLogging(false)
.Build();
std::string info = engine.
AddRecord(
"CUSTOMERS",
"1001", recordJson);
env->Destroy();
The core Senzing entity-resolution engine.
Definition SzEngine.hpp:28
virtual std::string AddRecord(const std::string &dataSourceCode, const std::string &recordID, const std::string &recordDefinition, SzFlags flags=SzAddRecordDefaultFlags)=0
static Builder NewBuilder()
Creates a new builder.
Definition SzCoreConfig.hpp:20
- Note
- Bind subsystem accessors by reference. GetEngine(), GetProduct(), GetConfigManager(), and GetDiagnostic() return references to abstract interface types, so auto engine = env->GetEngine(); or SzEngine engine = env->GetEngine(); fails to compile (abstract, non-copyable). Always bind with auto& / SzEngine&. The environment owns these objects; the reference is valid only until Destroy() — calling through it afterward throws SzEnvironmentDestroyedException. (In C# the natural SzEngine engine = env.GetEngine(); works because the type is a reference type; in C++ it must be SzEngine& engine = env->GetEngine();.)
-
The environment is a per-process singleton, and an internal:// (in-memory) store does not outlive it. Only one SzCoreEnvironment may be active at a time — building a second while one is live throws — and Destroy() fully tears down the environment and its subsystems. For an in-memory internal:// repository this also discards the store, so a "load →
`Destroy()` → build a fresh environment → still see the data" pattern finds an empty store. This is by design (and matches the C# SDK). Persistence/reload tests must use a file-backed repository (e.g. the SQLite SzTestRepo fixture), whose data lives on disk independently of the environment lifetime. Reinitialize() re-inits the engine/diagnostic against a config id; it is not a full environment rebuild.
See the examples/ directory for runnable, per-subsystem programs.
Exceptions
All engine errors derive from SzException. SzEnvironmentDestroyedException is deliberately outside that tree (it extends std::logic_error), signalling misuse of an environment after Destroy() rather than an engine error.