DQCsim
Public Member Functions | List of all members
dqcsim::wrap::PluginProcessConfiguration Class Reference

Wrapper class for plugin process configurations. More...

Inheritance diagram for dqcsim::wrap::PluginProcessConfiguration:
dqcsim::wrap::PluginConfiguration dqcsim::wrap::Handle

Public Member Functions

 PluginProcessConfiguration (HandleIndex handle) noexcept
 Wraps the given plugin process configuration handle. More...
 
 PluginProcessConfiguration (const PluginProcessConfiguration &)=delete
 
void operator= (const PluginProcessConfiguration &)=delete
 
 PluginProcessConfiguration (PluginProcessConfiguration &&)=default
 Default move constructor.
 
PluginProcessConfigurationoperator= (PluginProcessConfiguration &&)=default
 Default move assignment.
 
PluginType get_plugin_type () const override
 Returns the plugin type. More...
 
std::string get_name () const override
 Returns the name given to the plugin. More...
 
std::string get_executable () const
 Returns the configured executable path for the plugin. More...
 
std::string get_script () const
 Returns the configured script path for the plugin. More...
 
void add_init_cmd (ArbCmd &&cmd) override
 Attaches an arbitrary initialization command to the plugin. More...
 
PluginProcessConfiguration && with_init_cmd (ArbCmd &&cmd)
 Attaches an arbitrary initialization command to the plugin (builder pattern). More...
 
void set_env_var (const std::string &key, const std::string &value)
 Overrides an environment variable for the plugin process. More...
 
PluginProcessConfiguration && with_env_var (const std::string &key, const std::string &value)
 Overrides an environment variable for the plugin process (builder pattern). More...
 
void unset_env_var (const std::string &key)
 Removes/unsets an environment variable for the plugin process. More...
 
PluginProcessConfiguration && without_env_var (const std::string &key)
 Removes/unsets an environment variable for the plugin process (builder pattern). More...
 
void set_work_dir (const std::string &dir)
 Overrides the working directory for the plugin process. More...
 
PluginProcessConfiguration && with_work_dir (const std::string &dir)
 Overrides the working directory for the plugin process (builder pattern). More...
 
std::string get_work_dir () const
 Returns the configured working directory for the given plugin process. More...
 
void set_verbosity (Loglevel level) override
 Sets the logging verbosity level of the plugin. More...
 
PluginProcessConfiguration && with_verbosity (Loglevel level)
 Sets the logging verbosity level of the plugin (builder pattern). More...
 
Loglevel get_verbosity () const override
 Returns the current logging verbosity level of the plugin. More...
 
void log_tee (Loglevel verbosity, const std::string &filename) override
 Configures a plugin thread to also output its log messages to a file. More...
 
PluginProcessConfiguration && with_log_tee (Loglevel verbosity, const std::string &filename)
 Configures a plugin thread to also output its log messages to a file (builder pattern). More...
 
void set_stdout_loglevel (Loglevel level)
 Configures the capture mode for the stdout stream of the specified plugin process. More...
 
PluginProcessConfiguration && with_stdout_loglevel (Loglevel level)
 Configures the capture mode for the stdout stream of the specified plugin process (builder pattern). More...
 
Loglevel get_stdout_loglevel () const
 Returns the configured stdout capture mode for the specified plugin process. More...
 
void set_stderr_loglevel (Loglevel level)
 Configures the capture mode for the stderr stream of the specified plugin process. More...
 
PluginProcessConfiguration && with_stderr_loglevel (Loglevel level)
 Configures the capture mode for the stderr stream of the specified plugin process (builder pattern). More...
 
Loglevel get_stderr_loglevel () const
 Returns the configured stderr capture mode for the specified plugin process. More...
 
void set_accept_timeout (double timeout)
 Configures the timeout for the plugin process to connect to DQCsim. More...
 
PluginProcessConfiguration && with_accept_timeout (double timeout)
 Configures the timeout for the plugin process to connect to DQCsim (builder pattern). More...
 
PluginProcessConfiguration && without_accept_timeout ()
 Disables the timeout for the plugin process to connect to DQCsim (builder pattern). More...
 
double get_accept_timeout () const
 Returns the configured timeout for the plugin process to connect to DQCsim. More...
 
void set_shutdown_timeout (double timeout)
 Configures the timeout for the plugin process to shut down gracefully. More...
 
PluginProcessConfiguration && with_shutdown_timeout (double timeout)
 Configures the timeout for the plugin process to shut down gracefully (builder pattern). More...
 
PluginProcessConfiguration && without_shutdown_timeout ()
 Disables the timeout for the plugin process to shut down gracefully (builder pattern). More...
 
double get_shutdown_timeout () const
 Returns the configured timeout for the plugin process to shut down gracefully. More...
 
- Public Member Functions inherited from dqcsim::wrap::PluginConfiguration
 PluginConfiguration (HandleIndex handle) noexcept
 Wraps the given plugin process or thread configuration handle. More...
 
 PluginConfiguration (const PluginConfiguration &)=delete
 
void operator= (const PluginConfiguration &)=delete
 
 PluginConfiguration (PluginConfiguration &&)=default
 Default move constructor.
 
PluginConfigurationoperator= (PluginConfiguration &&)=default
 Default move assignment.
 
void add_init_cmd (const ArbCmd &cmd)
 Attaches an arbitrary initialization command to the plugin. More...
 
- Public Member Functions inherited from dqcsim::wrap::Handle
 Handle () noexcept
 Constructs an empty wrapper. More...
 
 Handle (HandleIndex handle) noexcept
 Wraps the given raw handle. More...
 
virtual ~Handle () noexcept
 Delete the handle and its wrapper.
 
void free ()
 Explicitly delete the handle, allowing errors to be caught. More...
 
bool is_valid () const noexcept
 Returns whether this wrapper (still) contains a valid handle. More...
 
HandleIndex get_handle () const noexcept
 Returns the raw handle without relinquishing ownership. More...
 
HandleIndex take_handle () noexcept
 Returns the raw handle and relinquishes ownership. More...
 
 Handle (const Handle &)=delete
 
void operator= (const Handle &)=delete
 
 Handle (Handle &&src)
 Move constructor; simply moves ownership of the handle from the source object to the constructed object. More...
 
Handleoperator= (Handle &&src)
 Move constructor; simply moves ownership of the handle from the source object to the assignment target. More...
 
std::string dump () const
 Returns a string containing a debug dump of the handle. More...
 
HandleType type () const
 Returns the type of this handle. More...
 

Additional Inherited Members

- Protected Attributes inherited from dqcsim::wrap::Handle
HandleIndex handle
 The wrapped handle.
 

Detailed Description

Wrapper class for plugin process configurations.

Definition at line 8640 of file dqcsim.

Constructor & Destructor Documentation

◆ PluginProcessConfiguration()

dqcsim::wrap::PluginProcessConfiguration::PluginProcessConfiguration ( HandleIndex  handle)
inlinenoexcept

Wraps the given plugin process configuration handle.

Note
This constructor does not verify that the handle is actually valid.
Parameters
handleThe raw handle to wrap.

Definition at line 8651 of file dqcsim.

Member Function Documentation

◆ get_plugin_type()

PluginType dqcsim::wrap::PluginProcessConfiguration::get_plugin_type ( ) const
inlineoverridevirtual

Returns the plugin type.

Returns
The plugin type.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Implements dqcsim::wrap::PluginConfiguration.

Definition at line 8674 of file dqcsim.

◆ get_name()

std::string dqcsim::wrap::PluginProcessConfiguration::get_name ( ) const
inlineoverridevirtual

Returns the name given to the plugin.

Note
This returns the instance name, not the class name. The latter can only be queried once the plugin thread or process has been started.
Returns
the name given to the plugin instance.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Implements dqcsim::wrap::PluginConfiguration.

Definition at line 8687 of file dqcsim.

◆ get_executable()

std::string dqcsim::wrap::PluginProcessConfiguration::get_executable ( ) const
inline

Returns the configured executable path for the plugin.

Returns
The configured executable path for the plugin.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8700 of file dqcsim.

◆ get_script()

std::string dqcsim::wrap::PluginProcessConfiguration::get_script ( ) const
inline

Returns the configured script path for the plugin.

Returns
The configured script path for the plugin.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8713 of file dqcsim.

◆ add_init_cmd()

void dqcsim::wrap::PluginProcessConfiguration::add_init_cmd ( ArbCmd &&  cmd)
inlineoverridevirtual

Attaches an arbitrary initialization command to the plugin.

Parameters
cmdThe initialization command to attach.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Implements dqcsim::wrap::PluginConfiguration.

Definition at line 8727 of file dqcsim.

◆ with_init_cmd()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_init_cmd ( ArbCmd &&  cmd)
inline

Attaches an arbitrary initialization command to the plugin (builder pattern).

Parameters
cmdThe initialization command to attach.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Definition at line 8740 of file dqcsim.

◆ set_env_var()

void dqcsim::wrap::PluginProcessConfiguration::set_env_var ( const std::string &  key,
const std::string &  value 
)
inline

Overrides an environment variable for the plugin process.

The environment variable key is set to value regardless of whether it exists in the parent environment variable scope.

Parameters
keyThe environment variable to set.
valueThe value to set it to.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Definition at line 8756 of file dqcsim.

◆ with_env_var()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_env_var ( const std::string &  key,
const std::string &  value 
)
inline

Overrides an environment variable for the plugin process (builder pattern).

The environment variable key is set to value regardless of whether it exists in the parent environment variable scope.

Parameters
keyThe environment variable to set.
valueThe value to set it to.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Definition at line 8773 of file dqcsim.

◆ unset_env_var()

void dqcsim::wrap::PluginProcessConfiguration::unset_env_var ( const std::string &  key)
inline

Removes/unsets an environment variable for the plugin process.

The environment variable key is unset regardless of whether it exists in the parent environment variable scope.

Parameters
keyThe environment variable to unset.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Definition at line 8788 of file dqcsim.

◆ without_env_var()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::without_env_var ( const std::string &  key)
inline

Removes/unsets an environment variable for the plugin process (builder pattern).

The environment variable key is unset regardless of whether it exists in the parent environment variable scope.

Parameters
keyThe environment variable to unset.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Definition at line 8804 of file dqcsim.

◆ set_work_dir()

void dqcsim::wrap::PluginProcessConfiguration::set_work_dir ( const std::string &  dir)
inline

Overrides the working directory for the plugin process.

Parameters
dirThe working directory for the plugin process.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Definition at line 8816 of file dqcsim.

◆ with_work_dir()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_work_dir ( const std::string &  dir)
inline

Overrides the working directory for the plugin process (builder pattern).

Parameters
dirThe working directory for the plugin process.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Definition at line 8829 of file dqcsim.

◆ get_work_dir()

std::string dqcsim::wrap::PluginProcessConfiguration::get_work_dir ( ) const
inline

Returns the configured working directory for the given plugin process.

Returns
Tthe configured working directory for the given plugin process.
Exceptions
std::runtime_errorWhen the plugin definition or command handle is invalid.

Definition at line 8841 of file dqcsim.

◆ set_verbosity()

void dqcsim::wrap::PluginProcessConfiguration::set_verbosity ( Loglevel  level)
inlineoverridevirtual

Sets the logging verbosity level of the plugin.

Parameters
levelThe desired logging verbosity for the plugin instance.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Implements dqcsim::wrap::PluginConfiguration.

Definition at line 8854 of file dqcsim.

◆ with_verbosity()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_verbosity ( Loglevel  level)
inline

Sets the logging verbosity level of the plugin (builder pattern).

Parameters
levelThe desired logging verbosity for the plugin instance.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8865 of file dqcsim.

◆ get_verbosity()

Loglevel dqcsim::wrap::PluginProcessConfiguration::get_verbosity ( ) const
inlineoverridevirtual

Returns the current logging verbosity level of the plugin.

Returns
The current logging verbosity level of the plugin.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Implements dqcsim::wrap::PluginConfiguration.

Definition at line 8876 of file dqcsim.

◆ log_tee()

void dqcsim::wrap::PluginProcessConfiguration::log_tee ( Loglevel  verbosity,
const std::string &  filename 
)
inlineoverridevirtual

Configures a plugin thread to also output its log messages to a file.

Parameters
verbosityConfigures the verbosity level for the tee'd output file only.
filenameThe path to the file to tee log messages to.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Implements dqcsim::wrap::PluginConfiguration.

Definition at line 8888 of file dqcsim.

◆ with_log_tee()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_log_tee ( Loglevel  verbosity,
const std::string &  filename 
)
inline

Configures a plugin thread to also output its log messages to a file (builder pattern).

Parameters
verbosityConfigures the verbosity level for the tee'd output file only.
filenameThe path to the file to tee log messages to.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8902 of file dqcsim.

◆ set_stdout_loglevel()

void dqcsim::wrap::PluginProcessConfiguration::set_stdout_loglevel ( Loglevel  level)
inline

Configures the capture mode for the stdout stream of the specified plugin process.

Parameters
levelThe loglevel with which stdout is captured. Loglevel::Pass instructs the logging thread to not capture stdout at all.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8916 of file dqcsim.

◆ with_stdout_loglevel()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_stdout_loglevel ( Loglevel  level)
inline

Configures the capture mode for the stdout stream of the specified plugin process (builder pattern).

Parameters
levelThe loglevel with which stdout is captured. Loglevel::Pass instructs the logging thread to not capture stdout at all.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8930 of file dqcsim.

◆ get_stdout_loglevel()

Loglevel dqcsim::wrap::PluginProcessConfiguration::get_stdout_loglevel ( ) const
inline

Returns the configured stdout capture mode for the specified plugin process.

Returns
The configured stdout capture mode.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8942 of file dqcsim.

◆ set_stderr_loglevel()

void dqcsim::wrap::PluginProcessConfiguration::set_stderr_loglevel ( Loglevel  level)
inline

Configures the capture mode for the stderr stream of the specified plugin process.

Parameters
levelThe loglevel with which stderr is captured. Loglevel::Pass instructs the logging thread to not capture stderr at all.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8955 of file dqcsim.

◆ with_stderr_loglevel()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_stderr_loglevel ( Loglevel  level)
inline

Configures the capture mode for the stderr stream of the specified plugin process (builder pattern).

Parameters
levelThe loglevel with which stderr is captured. Loglevel::Pass instructs the logging thread to not capture stderr at all.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8969 of file dqcsim.

◆ get_stderr_loglevel()

Loglevel dqcsim::wrap::PluginProcessConfiguration::get_stderr_loglevel ( ) const
inline

Returns the configured stderr capture mode for the specified plugin process.

Returns
The configured stderr capture mode.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8981 of file dqcsim.

◆ set_accept_timeout()

void dqcsim::wrap::PluginProcessConfiguration::set_accept_timeout ( double  timeout)
inline

Configures the timeout for the plugin process to connect to DQCsim.

The default is 5 seconds, so you should normally be able to leave this alone.

Parameters
timeoutThe timeout in seconds. You can use IEEE positive infinity from <limits> to specify an infinite timeout.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 8995 of file dqcsim.

◆ with_accept_timeout()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_accept_timeout ( double  timeout)
inline

Configures the timeout for the plugin process to connect to DQCsim (builder pattern).

The default is 5 seconds, so you should normally be able to leave this alone.

Parameters
timeoutThe timeout in seconds. You can use IEEE positive infinity from <limits> to specify an infinite timeout.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 9011 of file dqcsim.

◆ without_accept_timeout()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::without_accept_timeout ( )
inline

Disables the timeout for the plugin process to connect to DQCsim (builder pattern).

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 9023 of file dqcsim.

◆ get_accept_timeout()

double dqcsim::wrap::PluginProcessConfiguration::get_accept_timeout ( ) const
inline

Returns the configured timeout for the plugin process to connect to DQCsim.

Returns
The configured timeout in seconds.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 9035 of file dqcsim.

◆ set_shutdown_timeout()

void dqcsim::wrap::PluginProcessConfiguration::set_shutdown_timeout ( double  timeout)
inline

Configures the timeout for the plugin process to shut down gracefully.

The default is 5 seconds, so you should normally be able to leave this alone.

Parameters
timeoutThe timeout in seconds. You can use IEEE positive infinity from <limits> to specify an infinite timeout.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 9049 of file dqcsim.

◆ with_shutdown_timeout()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::with_shutdown_timeout ( double  timeout)
inline

Configures the timeout for the plugin process to shut down gracefully (builder pattern).

The default is 5 seconds, so you should normally be able to leave this alone.

Parameters
timeoutThe timeout in seconds. You can use IEEE positive infinity from <limits> to specify an infinite timeout.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 9065 of file dqcsim.

◆ without_shutdown_timeout()

PluginProcessConfiguration&& dqcsim::wrap::PluginProcessConfiguration::without_shutdown_timeout ( )
inline

Disables the timeout for the plugin process to shut down gracefully (builder pattern).

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 9077 of file dqcsim.

◆ get_shutdown_timeout()

double dqcsim::wrap::PluginProcessConfiguration::get_shutdown_timeout ( ) const
inline

Returns the configured timeout for the plugin process to shut down gracefully.

Returns
The configured timeout in seconds.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 9089 of file dqcsim.


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