DQCsim
Public Member Functions | Protected Member Functions | Friends | List of all members
dqcsim::wrap::RunningPluginState Class Reference

Wrapper for DQCsim's internal plugin state within the context of the run callback in a frontend. More...

Inheritance diagram for dqcsim::wrap::RunningPluginState:
dqcsim::wrap::PluginState dqcsim::wrap::UpstreamPluginState

Public Member Functions

 RunningPluginState (const RunningPluginState &)=delete
 
void operator= (const RunningPluginState &)=delete
 
 RunningPluginState (RunningPluginState &&)=delete
 
RunningPluginStateoperator= (RunningPluginState &&)=delete
 
void send (ArbData &&message)
 Sends a message to the host. More...
 
void send (const ArbData &message)
 Sends a message to the host. More...
 
ArbData recv ()
 Receives a message from the host. More...
 
- Public Member Functions inherited from dqcsim::wrap::PluginState
 PluginState (const PluginState &)=delete
 
void operator= (const PluginState &)=delete
 
 PluginState (PluginState &&)=delete
 
PluginStateoperator= (PluginState &&)=delete
 
QubitSet allocate (size_t num_qubits, ArbCmdQueue &&cmds)
 Allocates a number of downstream qubits, copying in the given command queue as arbitrary additional data for the qubits. More...
 
QubitSet allocate (size_t num_qubits, ArbCmdQueue &cmds)
 Allocates a number of downstream qubits, moving in the given command queue as arbitrary additional data for the qubits. More...
 
QubitSet allocate (size_t num_qubits)
 Allocates a number of default downstream qubits. More...
 
QubitRef allocate (ArbCmdQueue &&cmds)
 Allocates a single downstream qubit, copying in the given command queue as arbitrary additional data for the qubits. More...
 
QubitRef allocate (ArbCmdQueue &cmds)
 Allocates a single downstream qubit, moving in the given command queue as arbitrary additional data for the qubits. More...
 
QubitRef allocate ()
 Allocates a single downstream qubit. More...
 
void free (QubitSet &&qubits)
 Frees the given downstream qubits. More...
 
void free (const QubitSet &qubits)
 Frees the given downstream qubits. More...
 
void free (const QubitRef &qubit)
 Frees the given downstream qubit. More...
 
void gate (Gate &&gate)
 Sends a gate to the downstream plugin. More...
 
void gate (const Matrix &matrix, const QubitRef &q)
 Shorthand for sending a single-qubit gate to the downstream plugin. More...
 
void gate (const Matrix &matrix, const QubitRef &qa, const QubitRef &qb)
 Shorthand for sending a two-qubit gate to the downstream plugin. More...
 
void gate (const Matrix &matrix, const QubitRef &qa, const QubitRef &qb, const QubitRef &qc)
 Shorthand for sending a three-qubit gate to the downstream plugin. More...
 
void measure_x (const QubitRef &q)
 Shorthand for sending a single-qubit X-axis measurement to the downstream plugin. More...
 
void measure_x (const QubitSet &qs)
 Shorthand for sending a multi-qubit X-axis measurement to the downstream plugin. More...
 
void measure_y (const QubitRef &q)
 Shorthand for sending a single-qubit Y-axis measurement to the downstream plugin. More...
 
void measure_y (const QubitSet &qs)
 Shorthand for sending a multi-qubit Y-axis measurement to the downstream plugin. More...
 
void measure_z (const QubitRef &q)
 Shorthand for sending a single-qubit Z-axis measurement to the downstream plugin. More...
 
void measure_z (QubitSet &&qs)
 Shorthand for sending a multi-qubit Z-axis measurement to the downstream plugin. More...
 
void measure_z (const QubitSet &qs)
 Shorthand for sending a multi-qubit Z-axis measurement to the downstream plugin. More...
 
Cycle advance (Cycle cycles)
 Tells the downstream plugin to run for the specified number of cycles. More...
 
ArbData arb (ArbCmd &&cmd)
 Sends an arbitrary command downstream. More...
 
ArbData arb (const ArbCmd &cmd)
 Sends an arbitrary command downstream. More...
 
Measurement get_measurement (const QubitRef &qubit)
 Returns the latest measurement of the given downstream qubit. More...
 
Cycle get_cycles_since_measure (const QubitRef &qubit)
 Returns the number of downstream cycles since the latest measurement of the given downstream qubit. More...
 
Cycle get_cycles_between_measures (const QubitRef &qubit)
 Returns the number of downstream cycles between the last two measurements of the given downstream qubit. More...
 
Cycle get_cycle ()
 Returns the current value of the downstream cycle counter. More...
 
- Public Member Functions inherited from dqcsim::wrap::UpstreamPluginState
 UpstreamPluginState (const UpstreamPluginState &)=delete
 
void operator= (const UpstreamPluginState &)=delete
 
 UpstreamPluginState (UpstreamPluginState &&)=delete
 
UpstreamPluginStateoperator= (UpstreamPluginState &&)=delete
 
double random_f64 () noexcept
 Generates a random floating point number using the simulator random seed. More...
 
uint64_t random_u64 () noexcept
 Generates a random integer using the simulator random seed. More...
 
template<typename T >
random () noexcept
 Generates a random value using the simulator random seed. More...
 

Protected Member Functions

 RunningPluginState (raw::dqcs_plugin_state_t state)
 Hidden constructor, only to be used by the callback wrappers.
 
- Protected Member Functions inherited from dqcsim::wrap::PluginState
 PluginState (raw::dqcs_plugin_state_t state)
 Hidden constructor, only to be used by the callback wrappers.
 
- Protected Member Functions inherited from dqcsim::wrap::UpstreamPluginState
 UpstreamPluginState (raw::dqcs_plugin_state_t state)
 Hidden constructor, only to be used by the callback wrappers.
 

Friends

class CallbackEntryPoints
 

Additional Inherited Members

- Protected Attributes inherited from dqcsim::wrap::UpstreamPluginState
const raw::dqcs_plugin_state_t state
 The wrapped plugin state. More...
 

Detailed Description

Wrapper for DQCsim's internal plugin state within the context of the run callback in a frontend.

Cannot be moved or copied, as it must stay in scope of the plugin callbacks. Can also not be constructed except for by the callback wrapper classes.

Definition at line 6675 of file dqcsim.

Member Function Documentation

◆ send() [1/2]

void dqcsim::wrap::RunningPluginState::send ( ArbData &&  message)
inline

Sends a message to the host.

The host must do an accompanying recv() call, which returns the data sent here. Failure to do so will result in a deadlock error to the host.

Parameters
messageThe message to send.
Exceptions
std::runtime_errorWhen the message handle is invalid or delivery fails for some reason.

Definition at line 6706 of file dqcsim.

◆ send() [2/2]

void dqcsim::wrap::RunningPluginState::send ( const ArbData message)
inline

Sends a message to the host.

The host must do an accompanying recv() call, which returns the data sent here. Failure to do so will result in a deadlock error to the host.

Parameters
messageThe message to send.
Exceptions
std::runtime_errorWhen the message handle is invalid or delivery fails for some reason.

Definition at line 6721 of file dqcsim.

◆ recv()

ArbData dqcsim::wrap::RunningPluginState::recv ( )
inline

Receives a message from the host.

The host must do an accompanying send() call. The data passed to this call is returned by this function. Failure to do so will result in a deadlock error to the host.

Returns
The message sent by the host.
Exceptions
std::runtime_errorWhen no handle could be constructed for the message or reception fails for some reason.

Definition at line 6736 of file dqcsim.


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