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
 
SzCoreEnvironmentoperator= (const SzCoreEnvironment &)=delete
 
SzProductGetProduct () override
 Returns the env-owned SzProduct (lazily created).
 
SzEngineGetEngine () override
 Returns the env-owned SzEngine (lazily created).
 
SzConfigManagerGetConfigManager () override
 Returns the env-owned SzConfigManager (lazily created).
 
SzDiagnosticGetDiagnostic () 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.
 
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 SzCoreEnvironmentGetActiveInstance ()
 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()

static 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
noexcept

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
noexcept

◆ 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
noexcept

◆ 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
noexcept

◆ NewBuilder()

static 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

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

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

◆ kDefaultSettings

constexpr 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: