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

Wrapper for DQCsim's internal plugin state within the context of upstream-synchronous plugin callbacks (that is, the modify_measurement callback). More...

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

Public Member Functions

 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

 UpstreamPluginState (raw::dqcs_plugin_state_t state)
 Hidden constructor, only to be used by the callback wrappers.
 

Protected Attributes

const raw::dqcs_plugin_state_t state
 The wrapped plugin state. More...
 

Friends

class CallbackEntryPoints
 

Detailed Description

Wrapper for DQCsim's internal plugin state within the context of upstream-synchronous plugin callbacks (that is, the modify_measurement callback).

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 6052 of file dqcsim.

Member Function Documentation

◆ random_f64()

double dqcsim::wrap::UpstreamPluginState::random_f64 ( )
inlinenoexcept

Generates a random floating point number using the simulator random seed.

Returns
A uniformly distributed floating-point number between 0 (inclusive) and 1 (exclusive).

Definition at line 6085 of file dqcsim.

◆ random_u64()

uint64_t dqcsim::wrap::UpstreamPluginState::random_u64 ( )
inlinenoexcept

Generates a random integer using the simulator random seed.

Returns
A uniformly distributed unsigned 64-bit integer.

Definition at line 6094 of file dqcsim.

◆ random()

template<typename T >
T dqcsim::wrap::UpstreamPluginState::random ( )
inlinenoexcept

Generates a random value using the simulator random seed.

Returns
A randomized value of the given type. All bits are randomized with a 50/50 probability.
Warning
This function is not sensible for every kind of type, but will probably "work" regardless; use with care.

Definition at line 6108 of file dqcsim.

Member Data Documentation

◆ state

const raw::dqcs_plugin_state_t dqcsim::wrap::UpstreamPluginState::state
protected

The wrapped plugin state.

This is actually a void* pointing to a Rust-managed object.

Definition at line 6059 of file dqcsim.


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