DQCsim
|
Represents a set of measurements. More...
Public Member Functions | |
MeasurementSet (HandleIndex handle) noexcept | |
Wraps the given measurement set handle. More... | |
MeasurementSet () | |
Constructs an empty measurement set. | |
void | set (Measurement &&measurement) |
Moves the given measurement object into the set. More... | |
void | set (const Measurement &measurement) |
Copies the given measurement object into the set. More... | |
MeasurementSet && | with (Measurement &&measurement) |
Moves the given measurement object into the set (builder pattern). More... | |
MeasurementSet && | with (const Measurement &measurement) |
Copies the given measurement object into the set (builder pattern). More... | |
Measurement | get (const QubitRef &qubit) const |
Returns a copy of the measurement object for the given qubit. More... | |
Measurement | take (const QubitRef &qubit) |
Moves the measurement object for the given qubit out of the set. More... | |
Measurement | take_any () |
Moves any measurement object out of the set. More... | |
void | remove (const QubitRef &qubit) |
Removes the measurement object for the given qubit from the set. More... | |
size_t | size () const |
Returns the number of measurements in the set. More... | |
bool | contains (const QubitRef &qubit) const |
Returns whether the set contains measurement data for the given qubit. More... | |
std::vector< Measurement > | drain_into_vector () |
Drains the measurement set into a vector. More... | |
std::vector< Measurement > | copy_into_vector () |
Copies the qubit set into a vector. More... | |
MeasurementSet (MeasurementSet &src) | |
Copy-constructs a measurement set object. More... | |
MeasurementSet & | operator= (MeasurementSet &src) |
Copy-assigns a measurement set object. More... | |
MeasurementSet (MeasurementSet &&handle)=default | |
Default move constructor. | |
MeasurementSet & | operator= (MeasurementSet &&)=default |
Default move assignment. | |
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 | |
template<class T > | |
static MeasurementSet | from_iter (const T &measurements) |
Constructs a measurement set object from an iterable of measurements. More... | |
Additional Inherited Members | |
Protected Attributes inherited from dqcsim::wrap::Handle | |
HandleIndex | handle |
The wrapped handle. | |
Represents a set of measurements.
Measurement sets contain Measurement
data for zero or more qubits.
|
inlinenoexcept |
|
inline |
Copy-constructs a measurement set object.
src | The object to be copied. |
std::runtime_error | When the src handle is invalid or construction of the new measurement set object fails for some reason. |
|
inlinestatic |
Constructs a measurement set object from an iterable of measurements.
measurements | An object that can be iterated over, capable of yielding const Measurement& s. |
std::runtime_error | When construction of the measurement set (handle) failed for some reason or any measurement handle within the measurements iterable is invalid. |
|
inline |
Moves the given measurement object into the set.
If the set already contained measurement data for the qubit associated with the measurement object, the previous measurement data is overwritten.
measurement | The measurement object to move into the set. |
std::runtime_error | When the measurement handle or the current handle is invalid. |
|
inline |
Copies the given measurement object into the set.
If the set already contained measurement data for the qubit associated with the measurement object, the previous measurement data is overwritten.
measurement | The measurement object to copy into the set. |
std::runtime_error | When the measurement handle or the current handle is invalid. |
|
inline |
Moves the given measurement object into the set (builder pattern).
If the set already contained measurement data for the qubit associated with the measurement object, the previous measurement data is overwritten.
measurement | The measurement object to move into the set. |
&self
, to continue building. std::runtime_error | When the measurement handle or the current handle is invalid. |
|
inline |
Copies the given measurement object into the set (builder pattern).
If the set already contained measurement data for the qubit associated with the measurement object, the previous measurement data is overwritten.
measurement | The measurement object to copy into the set. |
&self
, to continue building. std::runtime_error | When the measurement handle or the current handle is invalid. |
|
inline |
Returns a copy of the measurement object for the given qubit.
qubit | A reference to the qubit to query the measurement result for. |
std::runtime_error | When the current handle is invalid, construction of the new measurement handle failed, or no measurement data is available for the requested qubit. |
|
inline |
Moves the measurement object for the given qubit out of the set.
An exception is thrown if no data is available for this qubit.
qubit | A reference to the qubit to query the measurement result for. |
std::runtime_error | When the current handle is invalid, construction of the new measurement handle failed, or no measurement data is available for the requested qubit. |
|
inline |
Moves any measurement object out of the set.
An exception is thrown if the set is empty.
std::runtime_error | When the current handle is invalid, it is empty, or construction of the new measurement handle failed. |
|
inline |
Removes the measurement object for the given qubit from the set.
qubit | A reference to the qubit to query the measurement result for. |
std::runtime_error | When the current handle is invalid, or no measurement data was available for the requested qubit. |
|
inline |
|
inline |
Returns whether the set contains measurement data for the given qubit.
qubit | A reference to the qubit to query the measurement result for. |
std::runtime_error | When the current handle is invalid. |
|
inline |
Drains the measurement set into a vector.
That is, the measurement set object remains valid, but is emptied after this call.
std::vector
containing the individual measurement objects in arbitrary order. std::runtime_error | When the current handle is invalid or construction of any of the individual measurement objects fails for some reason. |
|
inline |
Copies the qubit set into a vector.
std::vector
containing the individual measurement objects in arbitrary order. std::runtime_error | When the current handle is invalid or construction of any of the individual measurement objects fails for some reason. |
|
inline |
Copy-assigns a measurement set object.
src | The object to be copied. |
std::runtime_error | When the src handle or the current handle is invalid. |