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

Plugin definition class. More...

Inheritance diagram for dqcsim::wrap::Plugin:
dqcsim::wrap::Handle

Public Member Functions

 Plugin (HandleIndex handle) noexcept
 Wraps the given plugin definition handle. More...
 
 Plugin (PluginType type, const std::string &name, const std::string &author, const std::string &version)
 Constructs a new plugin definition object. More...
 
 Plugin (const Plugin &)=delete
 
void operator= (const Plugin &)=delete
 
 Plugin (Plugin &&)=default
 Default move constructor.
 
Pluginoperator= (Plugin &&)=default
 Default move assignment.
 
PluginType get_type () const
 Returns the plugin type described by this object. More...
 
std::string get_name () const
 Returns the name of the described plugin. More...
 
std::string get_author () const
 Returns the author of the described plugin. More...
 
std::string get_version () const
 Returns the version of the described plugin. More...
 
Plugin && with_initialize (const callback::Initialize &cb)
 Assigns the initialize callback function from a pre-existing callback::Initialize object by copy. More...
 
Plugin && with_initialize (callback::Initialize &&cb)
 Assigns the initialize callback function from a pre-existing callback::Initialize object by move. More...
 
template<typename... Args>
Plugin && with_initialize (Args... args)
 Assigns the initialize callback function by constructing the callback object implicitly. More...
 
Plugin && with_drop (const callback::Drop &cb)
 Assigns the drop callback function from a pre-existing callback::Drop object by copy. More...
 
Plugin && with_drop (callback::Drop &&cb)
 Assigns the drop callback function from a pre-existing callback::Drop object by move. More...
 
template<typename... Args>
Plugin && with_drop (Args... args)
 Assigns the drop callback function by constructing the callback object implicitly. More...
 
Plugin && with_run (const callback::Run &cb)
 Assigns the run callback function from a pre-existing callback::Run object by copy. More...
 
Plugin && with_run (callback::Run &&cb)
 Assigns the run callback function from a pre-existing callback::Run object by move. More...
 
template<typename... Args>
Plugin && with_run (Args... args)
 Assigns the run callback function by constructing the callback object implicitly. More...
 
Plugin && with_allocate (const callback::Allocate &cb)
 Assigns the allocate callback function from a pre-existing callback::Allocate object by copy. More...
 
Plugin && with_allocate (callback::Allocate &&cb)
 Assigns the allocate callback function from a pre-existing callback::Allocate object by move. More...
 
template<typename... Args>
Plugin && with_allocate (Args... args)
 Assigns the allocate callback function by constructing the callback object implicitly. More...
 
Plugin && with_free (const callback::Free &cb)
 Assigns the free callback function from a pre-existing callback::Free object by copy. More...
 
Plugin && with_free (callback::Free &&cb)
 Assigns the free callback function from a pre-existing callback::Free object by move. More...
 
template<typename... Args>
Plugin && with_free (Args... args)
 Assigns the free callback function by constructing the callback object implicitly. More...
 
Plugin && with_gate (const callback::Gate &cb)
 Assigns the gate callback function from a pre-existing callback::Gate object by copy. More...
 
Plugin && with_gate (callback::Gate &&cb)
 Assigns the gate callback function from a pre-existing callback::Gate object by move. More...
 
template<typename... Args>
Plugin && with_gate (Args... args)
 Assigns the gate callback function by constructing the callback object implicitly. More...
 
Plugin && with_modify_measurement (const callback::ModifyMeasurement &cb)
 Assigns the modify-measurement callback function from a pre-existing callback::ModifyMeasurement object by copy. More...
 
Plugin && with_modify_measurement (callback::ModifyMeasurement &&cb)
 Assigns the modify-measurement callback function from a pre-existing callback::ModifyMeasurement object by move. More...
 
template<typename... Args>
Plugin && with_modify_measurement (Args... args)
 Assigns the modify-measurement callback function by constructing the callback object implicitly. More...
 
Plugin && with_advance (const callback::Advance &cb)
 Assigns the advance callback function from a pre-existing callback::Advance object by copy. More...
 
Plugin && with_advance (callback::Advance &&cb)
 Assigns the advance callback function from a pre-existing callback::Advance object by move. More...
 
template<typename... Args>
Plugin && with_advance (Args... args)
 Assigns the advance callback function by constructing the callback object implicitly. More...
 
Plugin && with_upstream_arb (const callback::Arb &cb)
 Assigns the upstream-arb callback function from a pre-existing callback::Arb object by copy. More...
 
Plugin && with_upstream_arb (callback::Arb &&cb)
 Assigns the upstream-arb callback function from a pre-existing callback::Arb object by move. More...
 
template<typename... Args>
Plugin && with_upstream_arb (Args... args)
 Assigns the upstream-arb callback function by constructing the callback object implicitly. More...
 
Plugin && with_host_arb (const callback::Arb &cb)
 Assigns the host-arb callback function from a pre-existing callback::Arb object by copy. More...
 
Plugin && with_host_arb (callback::Arb &&cb)
 Assigns the host-arb callback function from a pre-existing callback::Arb object by move. More...
 
template<typename... Args>
Plugin && with_host_arb (Args... args)
 Assigns the host-arb callback function by constructing the callback object implicitly. More...
 
void run (const char *simulator)
 Runs the defined plugin in the current thread with the given simulator connection descriptor string. More...
 
int run (int argc, char *argv[]) noexcept
 Runs the defined plugin in the current thread with the given command line. More...
 
PluginJoinHandle start (const char *simulator)
 Starts the defined plugin in the current thread. 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...
 

Static Public Member Functions

static Plugin Frontend (const std::string &name, const std::string &author, const std::string &version)
 Shorthand for constructing a new frontend plugin. More...
 
static Plugin Operator (const std::string &name, const std::string &author, const std::string &version)
 Shorthand for constructing a new operator plugin. More...
 
static Plugin Backend (const std::string &name, const std::string &author, const std::string &version)
 Shorthand for constructing a new backend plugin. More...
 

Additional Inherited Members

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

Detailed Description

Plugin definition class.

To make a DQCsim plugin in C++, you must construct one of these objects, assign callback functions that define your plugin's functionality, and then call run or start. Having done so, you can point the dqcsim command line or a host program to your plugin's executable.

DQCsim supports three kinds of plugins: frontends, operators, and backends:

Each plugin type supports a different set of callback functions to define the plugin's functionality, but many of the callback functions are shared. The following matrix shows which functions are required (x), optional (o), and not applicable (-):

Callback Frontend Operator Backend
initialize o o o
drop o o o
run x - -
allocate - o o
free - o o
gate - o x
modify_measurement - o -
advance - o o
upstream_arb - o o
host_arb o o o

These callbacks perform the following functions.

Initialize

The initialize callback is to be used by plugins to initialize their internal state, if any. All plugin types support it. It is always called before any of the other callbacks are run, but after the downstream plugins have been initialized. That means it's legal to execute downstream commands here already, such as pre-allocating a number of qubits, preparing their state, querying the capabilities of downstream plugins through ArbCmds, etc.

Besides the common arguments, the callback receives a queue of ArbCmds containing user-defined initialization commands. These can be thought of as parameters or command-line arguments affecting the behavior of the plugin. Note that plugins should not use the actual command line arguments for their own purposes, as they cannot be set with DQCsim. Rather, the command-line arguments of the plugin are used by DQCsim to pass a connection endpoint string used to let the plugin connect to DQCsim's main process. There is one exception to this baked into DQCsim intended to make running quantum algorithm files more intuitive: if such a script is passed to DQCsim, DQCsim will search for a plugin based on the file extension of the script, and pass the filename of the script to the plugin using the second command-line argument. The search algorithm is described in DQCsim's command-line help, among other places.

If this callback is not supplied, the default behavior is no-op.

Drop

The drop callback can be used to do the inverse operation of the initialize callback. It is called when a plugin is gracefully terminated, and is supported by all plugin types. Note that graceful termination does not mean there was no error; it just means that things didn't crash hard enough for DQCsim to lose the ability to send the drop command.

It is not recommended to execute any downstream instructions at this time, as any errors caused at this time will crash DQCsim. However, it will work in case this is really necessary.

If this callback is not supplied, the default behavior is no-op.

Run

This is the primary callback for frontend plugins, in which all the magic should happen. It must therefore be defined. The other plugin types don't support it.

It is called in response to a start() host API call. It can therefore be called multiple times, though for most simulations it's only called once. The start() function takes an ArbData object, which is passed to the callback as an argument. The return value is also an ArbData, which is returned to the host through its wait() API call.

Allocate

The allocate callback is called when the upstream plugin requests that a number of qubits be allocated. DQCsim will allocate the qubit indices automatically, which are passed to the function in the form of a QubitSet, but of course it is up to the plugin to allocate its own data structures to track the state of the qubits.

The upstream plugin can also specify an ArbCmdQueue to supply additional information for the qubit, for instance to request that a specific error model be used. Plugins are free to ignore this, as per the semantics of the ArbCmd interface and operation identifiers.

The default behavior for operator plugins is to pass the allocation command on to the backend without modification. For backends it is no-op. Frontends do not support this callback.

Note
If an operator changes the allocation scheme, for instance to allocate 9 downstream qubits for each upstream qubit with the intent of applying surface-9 error correction, the upstream and downstream qubit indices will diverge. It is up to the operator to track the mapping between these qubits, and virtual the free, gate, and modify-measurement callbacks accordingly to translate between them.

Free

The free callback is called when the upstream plugin requests that a number of qubits be freed. After this call, DQCsim will ensure that the qubit indices are never used again. Plugins may use this to collapse any remaining superposition state in a random way, free up memory, or reuse the memory already allocated for these qubits for new qubits allocated later.

The default behavior for operator plugins is to pass the command on to the backend without modification. For backends it is no-op. Frontends do not support this callback.

Gate

The gate callback is called when the upstream plugin requests that a gate be executed. The semantics of this are documented in in the Gate class.

Backend plugins must return a measurement result set containing exactly those qubits specified in the measurement set. For operators, however, the story is more complicated. Let's say we want to make a silly operator that inverts all measurements. The trivial way to do this would be to forward the gate, query all the measurement results using PluginState::get_measurement(), invert them, stick them in a measurement result set, and return that result set. However, this approach would not be very efficient, because PluginState::get_measurement() has to wait for all downstream plugins to finish executing the gate, forcing the OS to switch threads, etc. Instead, operators are allowed to return only a subset (or none) of the measured qubits, as long as they return exactly the remaining measurements as they arrive through the modify-measurement callback.

The default implementation for this callback for operators is to pass the gate through to the downstream plugin and return an empty set of measurements. Combined with the default implementation of modify-measurement, this behavior is correct. Backends must virtual this callback, and frontends do not support it.

Note that for our silly example operator, the default behavior for this function is actually sufficient; you'd only have to virtual the modify-measurement callback in that case.

Modify-measurement

This callback is called for every measurement result received from the downstream plugin, and returns the measurements that should be reported to the upstream plugin.

Note that while this function is called for only a single measurement at a time, it is allowed to produce a set of measurements. This allows you to cancel propagation of the measurement by returning an empty vector, to just modify the measurement data itself, or to generate additional measurements from a single measurement. However, if you need to modify the qubit references for operators that remap qubits, take care to only send measurement data upstream when these were explicitly requested through the associated upstream gate function's measured list. It is up to you to keep the stream of measurements returned upstream consistent with the gates it sent to your plugin.

Note
The results from our plugin's PluginState::get_measurement() and friends are consistent with the results received from downstream. That is, they are not affected by this function. Only the measurement retrieval functions in the upstream plugin are.
This callback is somewhat special in that it is not allowed to call any plugin command other than logging and the pseudorandom number generator functions. This is because this function is called asynchronously with respect to the downstream functions, making the timing of these calls non-deterministic based on operating system scheduling.

Advance

This callback is called when the upstream plugin calls advance to advance the simulation time by a number of cycles. Operators and backends can use this to update their error models. The default behavior for an operator is to pass the request on to the downstream plugin, while the default for backends is to ignore it. Frontends don't support it.

Upstream-arb

This callback is called when the upstream plugin calls arb. It receives the ArbCmd as an argument, and must return an ArbData, which is in turn returned through the upstream plugin's arb function.

The default behavior for operators is to forward the command to the downstream plugin. Even if you virtual this callback, you should maintain this behavior for any interface identifiers unknown to you. The default for backends is to ignore it. Frontends don't support it.

Host-arb

This callback is called when the host sends an ArbCmd to the plugin. It receives the ArbCmd as an argument, and must return an ArbData, which is in turn returned to the host.

All plugins support this callback. The default behavior is no-op.

Definition at line 7594 of file dqcsim.

Constructor & Destructor Documentation

◆ Plugin() [1/2]

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

Wraps the given plugin definition handle.

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

Definition at line 7605 of file dqcsim.

◆ Plugin() [2/2]

dqcsim::wrap::Plugin::Plugin ( PluginType  type,
const std::string &  name,
const std::string &  author,
const std::string &  version 
)
inline

Constructs a new plugin definition object.

Parameters
typeThe type of the plugin being defined.
nameName with which the plugin class can be identified, not to be confused with the instance name later.
authorName of the plugin author.
versionVersion information for the plugin.
Exceptions
std::runtime_errorWhen plugin definition handle construction fails.

Definition at line 7619 of file dqcsim.

Member Function Documentation

◆ Frontend()

static Plugin dqcsim::wrap::Plugin::Frontend ( const std::string &  name,
const std::string &  author,
const std::string &  version 
)
inlinestatic

Shorthand for constructing a new frontend plugin.

Parameters
nameName with which the plugin class can be identified, not to be confused with the instance name later.
authorName of the plugin author.
versionVersion information for the plugin.
Returns
The constructed plugin definition object.
Exceptions
std::runtime_errorWhen plugin definition handle construction fails.

Definition at line 7640 of file dqcsim.

◆ Operator()

static Plugin dqcsim::wrap::Plugin::Operator ( const std::string &  name,
const std::string &  author,
const std::string &  version 
)
inlinestatic

Shorthand for constructing a new operator plugin.

Parameters
nameName with which the plugin class can be identified, not to be confused with the instance name later.
authorName of the plugin author.
versionVersion information for the plugin.
Returns
The constructed plugin definition object.
Exceptions
std::runtime_errorWhen plugin definition handle construction fails.

Definition at line 7659 of file dqcsim.

◆ Backend()

static Plugin dqcsim::wrap::Plugin::Backend ( const std::string &  name,
const std::string &  author,
const std::string &  version 
)
inlinestatic

Shorthand for constructing a new backend plugin.

Parameters
nameName with which the plugin class can be identified, not to be confused with the instance name later.
authorName of the plugin author.
versionVersion information for the plugin.
Returns
The constructed plugin definition object.
Exceptions
std::runtime_errorWhen plugin definition handle construction fails.

Definition at line 7678 of file dqcsim.

◆ get_type()

PluginType dqcsim::wrap::Plugin::get_type ( ) const
inline

Returns the plugin type described by this object.

Returns
The plugin type described by this object.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 7706 of file dqcsim.

◆ get_name()

std::string dqcsim::wrap::Plugin::get_name ( ) const
inline

Returns the name of the described plugin.

Returns
The name of the described plugin class.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 7716 of file dqcsim.

◆ get_author()

std::string dqcsim::wrap::Plugin::get_author ( ) const
inline

Returns the author of the described plugin.

Returns
The author of the described plugin.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 7729 of file dqcsim.

◆ get_version()

std::string dqcsim::wrap::Plugin::get_version ( ) const
inline

Returns the version of the described plugin.

Returns
The version of the described plugin.
Exceptions
std::runtime_errorWhen the plugin definition handle is invalid.

Definition at line 7742 of file dqcsim.

◆ with_initialize() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_initialize ( const callback::Initialize cb)
inline

Assigns the initialize callback function from a pre-existing callback::Initialize object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 7866 of file dqcsim.

◆ with_initialize() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_initialize ( callback::Initialize &&  cb)
inline

Assigns the initialize callback function from a pre-existing callback::Initialize object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 7880 of file dqcsim.

◆ with_initialize() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_initialize ( Args...  args)
inline

Assigns the initialize callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 7894 of file dqcsim.

◆ with_drop() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_drop ( const callback::Drop cb)
inline

Assigns the drop callback function from a pre-existing callback::Drop object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 7930 of file dqcsim.

◆ with_drop() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_drop ( callback::Drop &&  cb)
inline

Assigns the drop callback function from a pre-existing callback::Drop object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 7944 of file dqcsim.

◆ with_drop() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_drop ( Args...  args)
inline

Assigns the drop callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 7958 of file dqcsim.

◆ with_run() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_run ( const callback::Run cb)
inline

Assigns the run callback function from a pre-existing callback::Run object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 7994 of file dqcsim.

◆ with_run() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_run ( callback::Run &&  cb)
inline

Assigns the run callback function from a pre-existing callback::Run object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8008 of file dqcsim.

◆ with_run() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_run ( Args...  args)
inline

Assigns the run callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8022 of file dqcsim.

◆ with_allocate() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_allocate ( const callback::Allocate cb)
inline

Assigns the allocate callback function from a pre-existing callback::Allocate object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8058 of file dqcsim.

◆ with_allocate() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_allocate ( callback::Allocate &&  cb)
inline

Assigns the allocate callback function from a pre-existing callback::Allocate object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8072 of file dqcsim.

◆ with_allocate() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_allocate ( Args...  args)
inline

Assigns the allocate callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8086 of file dqcsim.

◆ with_free() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_free ( const callback::Free cb)
inline

Assigns the free callback function from a pre-existing callback::Free object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8122 of file dqcsim.

◆ with_free() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_free ( callback::Free &&  cb)
inline

Assigns the free callback function from a pre-existing callback::Free object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8136 of file dqcsim.

◆ with_free() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_free ( Args...  args)
inline

Assigns the free callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8150 of file dqcsim.

◆ with_gate() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_gate ( const callback::Gate cb)
inline

Assigns the gate callback function from a pre-existing callback::Gate object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8186 of file dqcsim.

◆ with_gate() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_gate ( callback::Gate &&  cb)
inline

Assigns the gate callback function from a pre-existing callback::Gate object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8200 of file dqcsim.

◆ with_gate() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_gate ( Args...  args)
inline

Assigns the gate callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8214 of file dqcsim.

◆ with_modify_measurement() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_modify_measurement ( const callback::ModifyMeasurement cb)
inline

Assigns the modify-measurement callback function from a pre-existing callback::ModifyMeasurement object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8250 of file dqcsim.

◆ with_modify_measurement() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_modify_measurement ( callback::ModifyMeasurement &&  cb)
inline

Assigns the modify-measurement callback function from a pre-existing callback::ModifyMeasurement object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8264 of file dqcsim.

◆ with_modify_measurement() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_modify_measurement ( Args...  args)
inline

Assigns the modify-measurement callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8278 of file dqcsim.

◆ with_advance() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_advance ( const callback::Advance cb)
inline

Assigns the advance callback function from a pre-existing callback::Advance object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8314 of file dqcsim.

◆ with_advance() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_advance ( callback::Advance &&  cb)
inline

Assigns the advance callback function from a pre-existing callback::Advance object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8328 of file dqcsim.

◆ with_advance() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_advance ( Args...  args)
inline

Assigns the advance callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8342 of file dqcsim.

◆ with_upstream_arb() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_upstream_arb ( const callback::Arb cb)
inline

Assigns the upstream-arb callback function from a pre-existing callback::Arb object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8378 of file dqcsim.

◆ with_upstream_arb() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_upstream_arb ( callback::Arb &&  cb)
inline

Assigns the upstream-arb callback function from a pre-existing callback::Arb object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8392 of file dqcsim.

◆ with_upstream_arb() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_upstream_arb ( Args...  args)
inline

Assigns the upstream-arb callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8406 of file dqcsim.

◆ with_host_arb() [1/3]

Plugin&& dqcsim::wrap::Plugin::with_host_arb ( const callback::Arb cb)
inline

Assigns the host-arb callback function from a pre-existing callback::Arb object by copy.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8442 of file dqcsim.

◆ with_host_arb() [2/3]

Plugin&& dqcsim::wrap::Plugin::with_host_arb ( callback::Arb &&  cb)
inline

Assigns the host-arb callback function from a pre-existing callback::Arb object by move.

Parameters
cbThe callback object.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8456 of file dqcsim.

◆ with_host_arb() [3/3]

template<typename... Args>
Plugin&& dqcsim::wrap::Plugin::with_host_arb ( Args...  args)
inline

Assigns the host-arb callback function by constructing the callback object implicitly.

Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the current handle is invalid or of an unsupported plugin type, or when the callback object is invalid.

Definition at line 8470 of file dqcsim.

◆ run() [1/2]

void dqcsim::wrap::Plugin::run ( const char *  simulator)
inline

Runs the defined plugin in the current thread with the given simulator connection descriptor string.

Parameters
simulatorSimulator connection descriptor. This should come from the first (for normal plugins) or second (for script-interpreting plugins) command-line argument of the plugin executable (in the latter case, the first argument is the script filename).
Exceptions
std::runtime_errorWhen plugin execution fails.

Definition at line 8487 of file dqcsim.

◆ run() [2/2]

int dqcsim::wrap::Plugin::run ( int  argc,
char *  argv[] 
)
inlinenoexcept

Runs the defined plugin in the current thread with the given command line.

This is normally the end of the only statement in your plugin executable's main().

Parameters
argcThe argc parameter from your plugin executable's main().
argvThe argv parameter from your plugin executable's main().
Returns
The proper exit code for the plugin.

Definition at line 8503 of file dqcsim.

◆ start()

PluginJoinHandle dqcsim::wrap::Plugin::start ( const char *  simulator)
inline

Starts the defined plugin in the current thread.

Parameters
simulatorSimulator connection descriptor. This should come from the first (for normal plugins) or second (for script-interpreting plugins) command-line argument of the plugin executable (in the latter case, the first argument is the script filename).
Returns
A PluginJoinHandle object that allows the plugin to be waited on.
Exceptions
std::runtime_errorWhen the plugin could not be started.

Definition at line 8531 of file dqcsim.


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