DQCsim
|
Represents any kind of gate with qubits bound to it. More...
Public Member Functions | |
Gate (HandleIndex handle) noexcept | |
Wraps the given Gate handle. More... | |
Gate (const Gate &)=delete | |
void | operator= (const Gate &)=delete |
Gate (Gate &&)=default | |
Default move constructor. | |
Gate & | operator= (Gate &&)=default |
Default move assignment. | |
GateType | get_type () const |
Returns the type of this gate. More... | |
QubitSet | get_targets () const |
Returns a new qubit reference set with the target qubits for this gate. More... | |
bool | has_targets () const |
Returns whether this gate has target qubits. More... | |
QubitSet | get_controls () const |
Returns a new qubit reference set with the control qubits for this gate. More... | |
bool | has_controls () const |
Returns whether this gate has control qubits. More... | |
QubitSet | get_measures () const |
Returns a new qubit reference set with the measurement qubits for this gate. More... | |
bool | has_measures () const |
Returns whether this gate has measurement qubits. More... | |
Matrix | get_matrix () const |
Returns the matrix that belongs to this gate. More... | |
bool | has_matrix () const |
Returns whether this gate has a matrix. More... | |
std::string | get_name () const |
Returns the name of a custom gate. More... | |
bool | has_name () const |
Returns whether this gate has a name. More... | |
Gate & | with_json_string (const std::string &json) |
Sets the arbitrary JSON data to the given serialized JSON string (builder pattern). More... | |
Gate & | with_cbor_string (const std::string &cbor) |
Sets the arbitrary JSON data to the given serialized CBOR string (builder pattern). More... | |
template<class JSON > | |
Gate & | with_json (const JSON &json) |
Sets the arbitrary JSON data to the given JSON object from nlohmann::json (builder pattern). More... | |
Gate & | with_arg_string (const std::string &data) |
Pushes a (binary) string to the back of the arbitrary argument list (builder pattern). More... | |
template<typename T > | |
Gate & | with_arg (const T &data) |
Pushes a value of type T to the back of the arbitrary argument list (builder pattern). More... | |
Public Member Functions inherited from dqcsim::wrap::Arb | |
Arb (HandleIndex handle) noexcept | |
Wraps the given arb handle. More... | |
std::string | get_arb_json_string () const |
Returns the current arbitrary JSON data as a serialized JSON string. More... | |
void | set_arb_json_string (const std::string &json) |
Sets the arbitrary JSON data to the given serialized JSON string. More... | |
std::string | get_arb_cbor_string () const |
Returns the current arbitrary JSON data as a serialized CBOR string. More... | |
void | set_arb_cbor_string (const std::string &cbor) |
Sets the arbitrary JSON data to the given serialized CBOR string. More... | |
template<class JSON > | |
JSON | get_arb_json () const |
Returns the current arbitrary JSON data as a JSON object from nlohmann::json . More... | |
template<class JSON > | |
void | set_arb_json (const JSON &json) |
Sets the arbitrary JSON data to the given JSON object from nlohmann::json . More... | |
std::string | get_arb_arg_string (ssize_t index) const |
Returns the arbitrary argument at the given index as a (binary) string. More... | |
template<typename T > | |
T | get_arb_arg_as (ssize_t index) const |
Returns the arbitrary argument at the given index as the given type. More... | |
template<typename T > | |
void | set_arb_arg_strings (const T &strings) |
Sets the arbitrary argument list to the given iterable of std::string s. More... | |
void | set_arb_arg_string (ssize_t index, const std::string &data) |
Sets the arbitrary argument at the given index to a (binary) string. More... | |
template<typename T > | |
void | set_arb_arg (ssize_t index, const T &data) |
Sets the arbitrary argument at the given index to a value of type T . More... | |
void | push_arb_arg_string (const std::string &data) |
Pushes a (binary) string to the back of the arbitrary argument list. More... | |
template<typename T > | |
void | push_arb_arg (const T &data) |
Pushes a value of type T to the back of the arbitrary argument list. More... | |
std::string | pop_arb_arg_string () |
Pops from the back of the arbitrary argument list as a (binary) string. More... | |
template<typename T > | |
T | pop_arb_arg_as () const |
Pops from the back of the arbitrary argument list as a value of type T . More... | |
void | insert_arb_arg_string (ssize_t index, const std::string &data) |
Inserts an arbitrary argument at the given index using a (binary) string. More... | |
template<typename T > | |
void | insert_arb_arg (ssize_t index, const T &data) |
Inserts an arbitrary argument at the given index using a value of type T . More... | |
void | remove_arb_arg (ssize_t index) |
Removes the arbitrary argument at the given index. More... | |
size_t | get_arb_arg_count () const |
Returns the number of arbitrary arguments. More... | |
void | clear_arb_args () |
Clears the arbitrary argument list. More... | |
void | set_arb (const Arb &src) |
Assigns all arb data from the given arb to this one. 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... | |
Handle & | operator= (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 Gate | predefined (PredefinedGate gate, QubitSet &&qubits, ArbData &¶meters) |
Constructs a new predefined gate. More... | |
static Gate | predefined (PredefinedGate gate, const QubitSet &qubits, const ArbData ¶meters) |
Constructs a new predefined gate. More... | |
static Gate | predefined (PredefinedGate gate, QubitSet &&qubits) |
Constructs a new non-parameterized predefined gate. More... | |
static Gate | predefined (PredefinedGate gate, const QubitSet &qubits) |
Constructs a new non-parameterized predefined gate. More... | |
static Gate | unitary (QubitSet &&targets, const Matrix &matrix) |
Constructs a new custom unitary gate. More... | |
static Gate | unitary (const QubitSet &targets, const Matrix &matrix) |
Constructs a new custom unitary gate. More... | |
static Gate | unitary (QubitSet &&targets, QubitSet &&controls, const Matrix &matrix) |
Constructs a new custom unitary gate with control qubits. More... | |
static Gate | unitary (const QubitSet &targets, const QubitSet &controls, const Matrix &matrix) |
Constructs a new custom unitary gate with control qubits. More... | |
static Gate | measure (QubitSet &&measures) |
Constructs a new Z-axis measurement gate. More... | |
static Gate | measure (const QubitSet &measures) |
Constructs a new Z-axis measurement gate. More... | |
static Gate | measure (QubitSet &&measures, PauliBasis basis) |
Constructs a new measurement gate, measuring in the given Pauli basis. More... | |
static Gate | measure (const QubitSet &measures, PauliBasis basis) |
Constructs a new measurement gate, measuring in the given Pauli basis. More... | |
static Gate | measure (QubitSet &&measures, Matrix &&basis) |
Constructs a new measurement gate, measuring in the given custom basis. More... | |
static Gate | measure (const QubitSet &measures, const Matrix &basis) |
Constructs a new measurement gate, measuring in the given custom basis. More... | |
static Gate | prep (QubitSet &&targets) |
Constructs a new Z-axis prep gate, putting the qubits in the |0> state. More... | |
static Gate | prep (const QubitSet &targets) |
Constructs a new Z-axis prep gate, putting the qubits in the |0> state. More... | |
static Gate | prep (QubitSet &&targets, PauliBasis basis) |
Constructs a new prep gate, putting the qubits in the base state for the given Pauli basis. More... | |
static Gate | prep (const QubitSet &targets, PauliBasis basis) |
Constructs a new prep gate, putting the qubits in the base state for the given Pauli basis. More... | |
static Gate | prep (QubitSet &&targets, Matrix &&basis) |
Constructs a new prep gate for a custom initial state. More... | |
static Gate | prep (const QubitSet &targets, const Matrix &basis) |
Constructs a new prep gate for a custom initial state. More... | |
static Gate | custom (const std::string &name, QubitSet &&targets, QubitSet &&controls, QubitSet &&measures, const Matrix &matrix) |
Constructs a new custom gate with target qubits, control qubits, measured qubits, and a matrix. More... | |
static Gate | custom (const std::string &name, const QubitSet &targets, const QubitSet &controls, const QubitSet &measures, const Matrix &matrix) |
Constructs a new custom gate with target qubits, control qubits, measured qubits, and a matrix. More... | |
static Gate | custom (const std::string &name, QubitSet &&targets, QubitSet &&controls, QubitSet &&measures) |
Constructs a new custom gate with target qubits, control qubits, and measured qubits. More... | |
static Gate | custom (const std::string &name, const QubitSet &targets, const QubitSet &controls, const QubitSet &measures) |
Constructs a new custom gate with target qubits, control qubits, and measured qubits. More... | |
static Gate | custom (const std::string &name, QubitSet &&targets, QubitSet &&controls, const Matrix &matrix) |
Constructs a new custom gate with target qubits, control qubits, and a matrix. More... | |
static Gate | custom (const std::string &name, const QubitSet &targets, const QubitSet &controls, const Matrix &matrix) |
Constructs a new custom gate with target qubits, control qubits, and a matrix. More... | |
static Gate | custom (const std::string &name, QubitSet &&targets, QubitSet &&controls) |
Constructs a new custom gate with target qubits and control qubits. More... | |
static Gate | custom (const std::string &name, const QubitSet &targets, const QubitSet &controls) |
Constructs a new custom gate with target qubits and control qubits. More... | |
static Gate | custom (const std::string &name, QubitSet &&targets, const Matrix &matrix) |
Constructs a new custom gate with target qubits and a matrix. More... | |
static Gate | custom (const std::string &name, const QubitSet &targets, const Matrix &matrix) |
Constructs a new custom gate with target qubits and a matrix. More... | |
static Gate | custom (const std::string &name, QubitSet &&targets) |
Constructs a new custom gate with only target qubits. More... | |
static Gate | custom (const std::string &name, const QubitSet &targets) |
Constructs a new custom gate with only target qubits. More... | |
static Gate | custom (const std::string &name) |
Constructs a new custom gate without qubit operands. More... | |
Additional Inherited Members | |
Protected Attributes inherited from dqcsim::wrap::Handle | |
HandleIndex | handle |
The wrapped handle. | |
Represents any kind of gate with qubits bound to it.
DQCsim currently knows three kinds of gates: unitary gates, Z-axis measurement gates, and custom gates. These are constructed with the unitary
, measurement
, and custom
constructors respectively. Briefly put:
Refer to the constructor overloads for more information.
Gates may have arbitrary data attached to them. This is particularly useful for custom gates, but non-custom gates can also have such data to augment their behavior. The difference in that case is that custom gates must be rejected by downstream plugins that don't support them, while the arbitrary dats for augmented unitary and measurement gates may be ignored. To construct a gate with arbitrary data, use one of the constructor overloads followed by the ArbData
builder pattern functions, for instance:
|
inlinenoexcept |
|
inlinestatic |
Constructs a new predefined gate.
gate | The type of gate to construct. |
qubits | The qubits that the gate should operate on. This should be at least the number of qubits required by the gate type; any additional qubits added on the left-hand side will serve as control qubits for a controlled gate using the specified gate matrix as its non-controlled submatrix. |
parameters | An ArbData object containing the parameterization data for the predefined gate, if it requires parameters. Refer to the docs for PredefinedGate for more info. Any additional data in the ArbData object will be added to the gate's ArbData attachment. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new predefined gate.
gate | The type of gate to construct. |
qubits | The qubits that the gate should operate on. This should be at least the number of qubits required by the gate type; any additional qubits added on the left-hand side will serve as control qubits for a controlled gate using the specified gate matrix as its non-controlled submatrix. |
parameters | An ArbData object containing the parameterization data for the predefined gate, if it requires parameters. Refer to the docs for PredefinedGate for more info. Any additional data in the ArbData object will be added to the gate's ArbData attachment. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new non-parameterized predefined gate.
gate | The type of gate to construct. |
qubits | The qubits that the gate should operate on. This should be at least the number of qubits required by the gate type; any additional qubits added on the left-hand side will serve as control qubits for a controlled gate using the specified gate matrix as its non-controlled submatrix. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new non-parameterized predefined gate.
gate | The type of gate to construct. |
qubits | The qubits that the gate should operate on. This should be at least the number of qubits required by the gate type; any additional qubits added on the left-hand side will serve as control qubits for a controlled gate using the specified gate matrix as its non-controlled submatrix. |
std::runtime_error | When construction of the new handle failed for some reason. |
Constructs a new custom unitary gate.
targets | A qubit reference set with the target qubits. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom unitary gate.
targets | A qubit reference set with the target qubits, passed by copy. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom unitary gate with control qubits.
targets | A qubit reference set with the target qubits. |
controls | A qubit reference set with the target qubits. The control qubits are not represented in the matrix; the backend will supplement it as needed. The targets and controls qubit sets must be disjoint. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom unitary gate with control qubits.
targets | A qubit reference set with the target qubits, passed by copy. |
controls | A qubit reference set with the target qubits, passed by copy. The control qubits are not represented in the matrix; the backend will supplement it as needed. The targets and controls qubit sets must be disjoint. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
Constructs a new Z-axis measurement gate.
measures | A qubit reference set with the to-be-measured qubits. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
std::runtime_error | When construction of the new handle failed for some reason. |
Constructs a new Z-axis measurement gate.
measures | A qubit reference set with the to-be-measured qubits, passed by copy. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new measurement gate, measuring in the given Pauli basis.
measures | A qubit reference set with the to-be-measured qubits. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
basis | The measurement basis. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new measurement gate, measuring in the given Pauli basis.
measures | A qubit reference set with the to-be-measured qubits, passed by copy. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
basis | The measurement basis. |
std::runtime_error | When construction of the new handle failed for some reason. |
Constructs a new measurement gate, measuring in the given custom basis.
measures | A qubit reference set with the to-be-measured qubits. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
basis | The measurement basis, represented as a 2x2 matrix defining the rotation from the Z basis to the desired basis. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new measurement gate, measuring in the given custom basis.
measures | A qubit reference set with the to-be-measured qubits, passed by copy. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
basis | The measurement basis, represented as a 2x2 matrix defining the rotation from the Z basis to the desired basis. |
std::runtime_error | When construction of the new handle failed for some reason. |
Constructs a new Z-axis prep gate, putting the qubits in the |0> state.
targets | A qubit reference set with the to-be-prepared qubits. |
std::runtime_error | When construction of the new handle failed for some reason. |
Constructs a new Z-axis prep gate, putting the qubits in the |0> state.
targets | A qubit reference set with the to-be-prepared qubits. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new prep gate, putting the qubits in the base state for the given Pauli basis.
targets | A qubit reference set with the to-be-prepared qubits. |
basis | The basis. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new prep gate, putting the qubits in the base state for the given Pauli basis.
targets | A qubit reference set with the to-be-prepared qubits. |
basis | The basis. |
std::runtime_error | When construction of the new handle failed for some reason. |
Constructs a new prep gate for a custom initial state.
targets | A qubit reference set with the to-be-prepared qubits. |
basis | The basis, represented as a 2x2 matrix defining the rotation to be applied after initializing the qubits to |0>. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new prep gate for a custom initial state.
targets | A qubit reference set with the to-be-prepared qubits. |
basis | The basis, represented as a 2x2 matrix defining the rotation to be applied after initializing the qubits to |0>. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits, control qubits, measured qubits, and a matrix.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits. |
controls | A qubit reference set with the target qubits. The control qubits are not represented in the matrix; the backend will supplement it as needed. The targets and controls qubit sets must be disjoint. |
measures | A qubit reference set with to-be-measured qubits. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits, control qubits, measured qubits, and a matrix.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits, passed by copy. |
controls | A qubit reference set with the target qubits, passed by copy. The control qubits are not represented in the matrix; the backend will supplement it as needed. The targets and controls qubit sets must be disjoint. |
measures | A qubit reference set with to-be-measured qubits, passed by copy. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits, control qubits, and measured qubits.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits. |
controls | A qubit reference set with the target qubits. The targets and controls qubit sets must be disjoint. |
measures | A qubit reference set with to-be-measured qubits. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits, control qubits, and measured qubits.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits, passed by copy. |
controls | A qubit reference set with the target qubits, passed by copy. The targets and controls qubit sets must be disjoint. |
measures | A qubit reference set with to-be-measured qubits, passed by copy. The measurement results can be queried from PluginState after the gate is executed. Any previous measurement results for those qubits will be overridden. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits, control qubits, and a matrix.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits. |
controls | A qubit reference set with the target qubits. The control qubits are not represented in the matrix; the backend will supplement it as needed. The targets and controls qubit sets must be disjoint. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits, control qubits, and a matrix.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits, passed by copy. |
controls | A qubit reference set with the target qubits, passed by copy. The control qubits are not represented in the matrix; the backend will supplement it as needed. The targets and controls qubit sets must be disjoint. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits and control qubits.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits. |
controls | A qubit reference set with the target qubits. The targets and controls qubit sets must be disjoint. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits and control qubits.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits, passed by copy. |
controls | A qubit reference set with the target qubits, passed by copy. The targets and controls qubit sets must be disjoint. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits and a matrix.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with target qubits and a matrix.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits, passed by copy. |
matrix | The matrix to be applied to the target qubits. It must be appropriately sized for the number of target qubits (2^n by 2^n). |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with only target qubits.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate with only target qubits.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
targets | A qubit reference set with the target qubits, passed by copy. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inlinestatic |
Constructs a new custom gate without qubit operands.
name | A name identifying the custom gate. Which gates are available is determined by the backend. |
std::runtime_error | When construction of the new handle failed for some reason. |
|
inline |
|
inline |
Returns a new qubit reference set with the target qubits for this gate.
std::runtime_error | When construction of the new qubit set (handle) failed for some reason or the current handle is invalid. |
|
inline |
|
inline |
Returns a new qubit reference set with the control qubits for this gate.
std::runtime_error | When construction of the new qubit set (handle) failed for some reason or the current handle is invalid. |
|
inline |
|
inline |
Returns a new qubit reference set with the measurement qubits for this gate.
std::runtime_error | When construction of the new qubit set (handle) failed for some reason or the current handle is invalid. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets the arbitrary JSON data to the given serialized JSON string (builder pattern).
json | A string representation of a JSON dictionary object to assign. |
&self
, to continue building. std::runtime_error | When the string representation is invalid, or when the current handle is invalid. |
|
inline |
Sets the arbitrary JSON data to the given serialized CBOR string (builder pattern).
cbor | A JSON object represented as a CBOR binary string. |
&self
, to continue building. std::runtime_error | When the CBOR string is invalid, or when the current handle is invalid. |
|
inline |
Sets the arbitrary JSON data to the given JSON object from nlohmann::json
(builder pattern).
Since that is a header-only library that isn't usually installed system-wide and be using a specific version in your project already, you need to specify the nlohmann::json
type as a generic to this function.
json | The C++ JSON object representation of the object to set. |
&self
, to continue building. std::runtime_error | When the current handle is invalid. |
|
inline |
Pushes a (binary) string to the back of the arbitrary argument list (builder pattern).
data | The data for the new argument, represented as a (binary) string. |
&self
, to continue building. std::runtime_error | When the current handle is invalid. |
|
inline |
Pushes a value of type T
to the back of the arbitrary argument list (builder pattern).
T
must be a primitive value (like an int
) or a struct thereof, without pointers or any other "complicated" constructs. DQCsim just copies the bytes over. It is up to you to ensure that that's what you want to happen; unfortunately C++11 does not provide a way to statically ensure that this is the case.data | The data for the new argument, represented as some C object. |
&self
, to continue building. std::runtime_error | When the current handle is invalid. |