Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IEnvironment

interface IEnvironment
Extends IStandard An environment is a self-contained set of settings, search paths, object caches, and other facilities. In OmniKit, we keep global state to a minimum. The job of the process object is essentially to keep track of a default environment: the environment contains all the “smarts” of the system. An OmniKit process starts life with a default environment that the OmniKit creates on process startup. This default environment is created as if by (in pseudo-Python):
A process can have any number of environments. We can get and set thread-local environments, and other facilities (e.g. IO loops) may temporarily change environments as well.

Methods

tryGetComponent()

IStandard? tryGetComponent(string name)
Get a component by name.

Parameters

name
string — Required component name

Returns

IStandard? The return value is optional and might be absent. component or nullptr if the component can’t be found

makeConfigBuilder()

IConfigBuilder* makeConfigBuilder(IConfig? oldConfig)
Make a configuration builder. A configuration builder can be used to build a new configuration for an environment.

Parameters

oldConfig
IConfig? — Optional if present, base the new config on oldConfig; if not present, the new config is empty.

Returns

IConfigBuilder* Config builder

getConfig()

IConfig* getConfig()
Get the current configuration of this environment.

Returns

IConfig* Config

trySetConfig()

bool trySetConfig(IConfig* oldConfig, IConfig* newConfig)
Install a new configuration in this environment. This method does and atomic compare-and-replace of oldConfig with newConfig. This technique allows us to atomically change environment configuration without calling external code under a lock. Configs are immutable once created. One does not “change” a configuration: one instead builds a new configuration (perhaps based on an existing configuration) and atomically installs the new configuration.

Parameters

oldConfig
IConfig* — Required the caller’s last-known old configuration
newConfig
IConfig* — Required the desired new configuration

Returns

bool True iff we atomically replaced oldConfig or false if the current configuration is not oldConfig.

clone()

IEnvironment* clone()
Clone this environment. The returned environment has a configuration independent of the calling environment but shares cached loaded components and other state present at the time of the clone.

Returns

IEnvironment* Cloned environment
Last modified on October 29, 2026