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

Builder class used to construct plugin configurations. More...

Public Member Functions

 PluginConfigurationBuilder (PluginType type) noexcept
 Constructs a plugin configuration builder for the given plugin type. More...
 
PluginConfigurationBuilder && with_name (const std::string &name) noexcept
 Builder function for naming the plugin instance. More...
 
PluginProcessConfiguration with_spec (const std::string &spec)
 Builds a plugin process configuration object from a "sugared" plugin specification string, using the same syntax that the dqcsim command line interface uses. More...
 
PluginProcessConfiguration with_executable (const std::string &executable, const std::string &script="")
 Builds a plugin process configuration object from a path to a plugin executable and an optional path to a script for it to run. More...
 
PluginThreadConfiguration with_callbacks (Plugin &&plugin)
 Builds a plugin thread configuration object from a plugin definition object, containing a bunch of callback functions. More...
 
PluginThreadConfiguration with_spawner (const callback::SpawnPlugin &data)
 Builds a plugin thread configuration object using a single callback that spawns the entire plugin. More...
 
PluginThreadConfiguration with_spawner (callback::SpawnPlugin &&data)
 Builds a plugin thread configuration object using a single callback that spawns the entire plugin. More...
 
template<typename... Args>
PluginThreadConfiguration with_spawner (Args... args)
 Builds a plugin thread configuration object using a single callback that spawns the entire plugin. More...
 

Detailed Description

Builder class used to construct plugin configurations.

Definition at line 9241 of file dqcsim.

Constructor & Destructor Documentation

◆ PluginConfigurationBuilder()

dqcsim::wrap::PluginConfigurationBuilder::PluginConfigurationBuilder ( PluginType  type)
inlinenoexcept

Constructs a plugin configuration builder for the given plugin type.

You can use the dqcsim::wrap::Frontend(), dqcsim::wrap::Operator(), and dqcsim::wrap::Backend() functions as shorthands for this constructor.

Parameters
typeThe type of the to-be-configured plugin.

Definition at line 9256 of file dqcsim.

Member Function Documentation

◆ with_name()

PluginConfigurationBuilder&& dqcsim::wrap::PluginConfigurationBuilder::with_name ( const std::string &  name)
inlinenoexcept

Builder function for naming the plugin instance.

The name must be unique within the simulation. It is used, among other things, by the logging system.

If this is not called or is called with an empty string, auto-naming will be performed: "front" for the frontend, "oper[i]" for the operators (indices starting at 1 from frontend to backend), and "back" for the backend.

Parameters
nameThe name for the plugin.
Returns
&self, to continue building.

Definition at line 9272 of file dqcsim.

◆ with_spec()

PluginProcessConfiguration dqcsim::wrap::PluginConfigurationBuilder::with_spec ( const std::string &  spec)
inline

Builds a plugin process configuration object from a "sugared" plugin specification string, using the same syntax that the dqcsim command line interface uses.

Parameters
specThe command-line interface specification string for the desired plugin.
Returns
A PluginProcessConfiguration object to continue building.
Exceptions
std::runtime_errorWhen the specified plugin could not be found, or construction of the configuration handle fails for some reason.

Definition at line 9288 of file dqcsim.

◆ with_executable()

PluginProcessConfiguration dqcsim::wrap::PluginConfigurationBuilder::with_executable ( const std::string &  executable,
const std::string &  script = "" 
)
inline

Builds a plugin process configuration object from a path to a plugin executable and an optional path to a script for it to run.

Note that not all plugins will use the optional script parameter.

Parameters
executableThe path to the plugin executable to load.
scriptThe optional first command-line argument passed to the plugin executable.
Returns
A PluginProcessConfiguration object to continue building.
Exceptions
std::runtime_errorWhen the specified plugin could not be found, or construction of the configuration handle fails for some reason.

Definition at line 9307 of file dqcsim.

◆ with_callbacks()

PluginThreadConfiguration dqcsim::wrap::PluginConfigurationBuilder::with_callbacks ( Plugin &&  plugin)
inline

Builds a plugin thread configuration object from a plugin definition object, containing a bunch of callback functions.

Parameters
pluginThe plugin definition object to wrap. Note that this must be std::move()d in if it is not constructed in-place.
Returns
A PluginThreadConfiguration object to continue building.
Exceptions
std::runtime_errorWhen the specified plugin could not be found, or construction of the configuration handle fails for some reason.

Definition at line 9323 of file dqcsim.

◆ with_spawner() [1/3]

PluginThreadConfiguration dqcsim::wrap::PluginConfigurationBuilder::with_spawner ( const callback::SpawnPlugin data)
inline

Builds a plugin thread configuration object using a single callback that spawns the entire plugin.

This version takes a pre-existing callback object by copy. The callback is called by DQCsim from a dedicated thread when DQCsim wants to start the plugin. The callback must then in some way spawn a plugin process that connects to the provided simulator string. The callback should return only when the process terminates.

Parameters
dataThe wrapper object for the plugin spawning callback.
Returns
A PluginThreadConfiguration object to continue building.
Exceptions
std::runtime_errorWhen construction of the configuration handle fails for some reason.

Definition at line 9376 of file dqcsim.

◆ with_spawner() [2/3]

PluginThreadConfiguration dqcsim::wrap::PluginConfigurationBuilder::with_spawner ( callback::SpawnPlugin &&  data)
inline

Builds a plugin thread configuration object using a single callback that spawns the entire plugin.

This version takes a pre-existing callback object by move. The callback is called by DQCsim from a dedicated thread when DQCsim wants to start the plugin. The callback must then in some way spawn a plugin process that connects to the provided simulator string. The callback should return only when the process terminates.

Parameters
dataThe wrapper object for the plugin spawning callback.
Returns
A PluginThreadConfiguration object to continue building.
Exceptions
std::runtime_errorWhen construction of the configuration handle fails for some reason.

Definition at line 9395 of file dqcsim.

◆ with_spawner() [3/3]

template<typename... Args>
PluginThreadConfiguration dqcsim::wrap::PluginConfigurationBuilder::with_spawner ( Args...  args)
inline

Builds a plugin thread configuration object using a single callback that spawns the entire plugin.

This version allows the callback object to be (copy-)constructed in-place. The callback is called by DQCsim from a dedicated thread when DQCsim wants to start the plugin. The callback must then in some way spawn a plugin process that connects to the provided simulator string. The callback should return only when the process terminates.

Parameters
argsAny legal set of arguments for one of callback::SpawnPlugin's constructors.
Returns
A PluginThreadConfiguration object to continue building.
Exceptions
std::runtime_errorWhen construction of the configuration handle fails for some reason.

Definition at line 9416 of file dqcsim.


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