Senzing C++ SDK
C++ SDK for Senzing v4, patterned after the official C# SDK
Loading...
Searching...
No Matches
senzing::sdk::core::SzCoreEnvironment Class Referencefinal

Core implementation of SzEnvironment backed by the native libSz modules. More...

#include <SzCoreEnvironment.hpp>

Inheritance diagram for senzing::sdk::core::SzCoreEnvironment:
Collaboration diagram for senzing::sdk::core::SzCoreEnvironment:

Classes

class  Builder
 Fluent builder for constructing an SzCoreEnvironment. More...

Public Member Functions

 ~SzCoreEnvironment () override
 SzCoreEnvironment (const SzCoreEnvironment &)=delete
SzCoreEnvironment & operator= (const SzCoreEnvironment &)=delete
SzProduct & GetProduct () override
 Returns the env-owned SzProduct (lazily created).
SzEngine & GetEngine () override
 Returns the env-owned SzEngine (lazily created).
SzConfigManager & GetConfigManager () override
 Returns the env-owned SzConfigManager (lazily created).
SzDiagnostic & GetDiagnostic () override
 Returns the env-owned SzDiagnostic (lazily created).
int64_t GetActiveConfigID () override
 Returns the currently active configuration ID.
void Reinitialize (int64_t configID) override
 Reinitializes the engine/diagnostic with the given configuration ID.
void Destroy () override
 Destroys the environment and all owned subsystems. Idempotent.
bool IsDestroyed () override
 Returns true once Destroy() has been initiated/completed.
SzLogging & GetLogging () override
 No liveness check: logging is process-global native state that needs no engine initialization, and the 4.5.0 usage rule changes it after Destroy().
const std::string & GetInstanceName () const noexcept
const std::string & GetSettings () const noexcept
bool IsVerboseLogging () const noexcept
std::optional< int64_t > GetConfigID () const noexcept
 The explicit configuration ID this environment is pinned to, or std::nullopt to use the repository's default configuration.
void EnsureActive ()
 Locks the environment mutex and throws SzEnvironmentDestroyedException if this environment has been destroyed.
Public Member Functions inherited from senzing::sdk::SzEnvironment
virtual ~SzEnvironment ()=default

Static Public Member Functions

static Builder NewBuilder ()
 Creates a new builder.
static SzCoreEnvironment * GetActiveInstance ()
 The single active environment instance for this process, or nullptr if none is active.

Static Public Attributes

static constexpr const char * kDefaultInstanceName = "Senzing Instance"
 Default native instance name when none is supplied (mirrors C#).
static constexpr const char * kDefaultSettings = "{ }"
 Default settings when none are supplied (mirrors C#).

Detailed Description

Core implementation of SzEnvironment backed by the native libSz modules.

Constructor & Destructor Documentation

◆ ~SzCoreEnvironment()

senzing::sdk::core::SzCoreEnvironment::~SzCoreEnvironment ( )
override

◆ SzCoreEnvironment()

senzing::sdk::core::SzCoreEnvironment::SzCoreEnvironment ( const SzCoreEnvironment & )
delete

Member Function Documentation

◆ Destroy()

void senzing::sdk::core::SzCoreEnvironment::Destroy ( )
overridevirtual

Destroys the environment and all owned subsystems. Idempotent.

Implements senzing::sdk::SzEnvironment.

◆ EnsureActive()

void senzing::sdk::core::SzCoreEnvironment::EnsureActive ( )

Locks the environment mutex and throws SzEnvironmentDestroyedException if this environment has been destroyed.

Mirrors C# SzCoreEnvironment's Execute/EnsureActive liveness guard and is called at the top of every public subsystem method (SzCoreEngine/Product/ConfigManager/Diagnostic/ Config) before touching native state, so calls made after Destroy() fail cleanly instead of using a torn-down native module.

◆ GetActiveConfigID()

int64_t senzing::sdk::core::SzCoreEnvironment::GetActiveConfigID ( )
overridevirtual

Returns the currently active configuration ID.

Implements senzing::sdk::SzEnvironment.

◆ GetActiveInstance()

SzCoreEnvironment * senzing::sdk::core::SzCoreEnvironment::GetActiveInstance ( )
static

The single active environment instance for this process, or nullptr if none is active.

Mirrors C# SzCoreEnvironment.GetActiveInstance(). The environment is a per-process singleton: constructing a second instance while one is active throws std::logic_error; Destroy() clears it.

◆ GetConfigID()

std::optional< int64_t > senzing::sdk::core::SzCoreEnvironment::GetConfigID ( ) const
nodiscardnoexcept

The explicit configuration ID this environment is pinned to, or std::nullopt to use the repository's default configuration.

Mirrors C# SzCoreEnvironment.GetConfigID(). Consulted by the engine/diagnostic constructors to choose between the plain init and the initWithConfigID native path. Caller must hold monitor_ (the owned subsystems are only constructed from within a Get* that already holds it).

◆ GetConfigManager()

SzConfigManager & senzing::sdk::core::SzCoreEnvironment::GetConfigManager ( )
overridevirtual

Returns the env-owned SzConfigManager (lazily created).

Implements senzing::sdk::SzEnvironment.

◆ GetDiagnostic()

SzDiagnostic & senzing::sdk::core::SzCoreEnvironment::GetDiagnostic ( )
overridevirtual

Returns the env-owned SzDiagnostic (lazily created).

Implements senzing::sdk::SzEnvironment.

◆ GetEngine()

SzEngine & senzing::sdk::core::SzCoreEnvironment::GetEngine ( )
overridevirtual

Returns the env-owned SzEngine (lazily created).

Implements senzing::sdk::SzEnvironment.

◆ GetInstanceName()

const std::string & senzing::sdk::core::SzCoreEnvironment::GetInstanceName ( ) const
nodiscardnoexcept

◆ GetLogging()

SzLogging & senzing::sdk::core::SzCoreEnvironment::GetLogging ( )
overridevirtual

No liveness check: logging is process-global native state that needs no engine initialization, and the 4.5.0 usage rule changes it after Destroy().

Returns the process-wide SzCoreLogging instance.

Implements senzing::sdk::SzEnvironment.

◆ GetProduct()

SzProduct & senzing::sdk::core::SzCoreEnvironment::GetProduct ( )
overridevirtual

Returns the env-owned SzProduct (lazily created).

Reference valid until Destroy(). Throws SzEnvironmentDestroyedException after Destroy().

Implements senzing::sdk::SzEnvironment.

◆ GetSettings()

const std::string & senzing::sdk::core::SzCoreEnvironment::GetSettings ( ) const
nodiscardnoexcept

◆ IsDestroyed()

bool senzing::sdk::core::SzCoreEnvironment::IsDestroyed ( )
overridevirtual

Returns true once Destroy() has been initiated/completed.

Implements senzing::sdk::SzEnvironment.

◆ IsVerboseLogging()

bool senzing::sdk::core::SzCoreEnvironment::IsVerboseLogging ( ) const
nodiscardnoexcept

◆ NewBuilder()

Builder senzing::sdk::core::SzCoreEnvironment::NewBuilder ( )
static

Creates a new builder.

◆ operator=()

SzCoreEnvironment & senzing::sdk::core::SzCoreEnvironment::operator= ( const SzCoreEnvironment & )
delete

◆ Reinitialize()

void senzing::sdk::core::SzCoreEnvironment::Reinitialize ( int64_t configID)
overridevirtual

Reinitializes the engine/diagnostic with the given configuration ID.

Implements senzing::sdk::SzEnvironment.

Member Data Documentation

◆ kDefaultInstanceName

const char* senzing::sdk::core::SzCoreEnvironment::kDefaultInstanceName = "Senzing Instance"
staticconstexpr

Default native instance name when none is supplied (mirrors C#).

◆ kDefaultSettings

const char* senzing::sdk::core::SzCoreEnvironment::kDefaultSettings = "{ }"
staticconstexpr

Default settings when none are supplied (mirrors C#).


The documentation for this class was generated from the following file: