libqasm
library for handling cQASM files
cqasm-v1-error-model.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "cqasm-v1-types.hpp"
10 #include "cqasm-v1-values.hpp"
11 
12 namespace cqasm {
13 namespace v1 {
14 
19 namespace error_model {
20 
41 class ErrorModel : public tree::Base {
42 public:
43 
47  std::string name;
48 
53 
59  ErrorModel(const std::string &name, const std::string &param_types = "");
60 
64  bool operator==(const ErrorModel& rhs) const;
65 
69  inline bool operator!=(const ErrorModel& rhs) const {
70  return !(*this == rhs);
71  }
72 
73 };
74 
79 
83 std::ostream &operator<<(std::ostream &os, const ErrorModel &model);
84 
88 std::ostream &operator<<(std::ostream &os, const ErrorModelRef &model);
89 
90 } // namespace error_model
91 
92 namespace primitives {
93 
94 template <>
95 void serialize(const error_model::ErrorModelRef &obj, ::tree::cbor::MapWriter &map);
96 template <>
97 error_model::ErrorModelRef deserialize(const ::tree::cbor::MapReader &map);
98 
99 } // namespace primitives
100 } // namespace v1
101 } // namespace cqasm
::tree::base::Base Base
Definition: cqasm-tree.hpp:20
::tree::base::Maybe< T > Maybe
Definition: cqasm-tree.hpp:23
tree::Maybe< ErrorModel > ErrorModelRef
Optional reference to an error model, used within the semantic tree.
std::string name
The name of the error model.
types::Types param_types
The vector of parameter types that this error model expects.
error_model::ErrorModelRef deserialize(const ::tree::cbor::MapReader &map)
Deserializes the given primitive object from CBOR.
Toplevel namespace with entry points for the new API.
Defines classes representing the values (collective name for constants, references, and dynamically evaluated expressions) available within cQASM&#39;s type system, as well as some utility functions.
void serialize(const error_model::ErrorModelRef &obj, ::tree::cbor::MapWriter &map)
Representation of an error model.
Namespace for the "new" cQASM 1.x API.
std::ostream & operator<<(std::ostream &os, const ErrorModel &model)
Stream << overload for error models.
tree::Any< TypeBase > Types
Zero or more cQASM types.
ErrorModel(const std::string &name, const std::string &param_types="")
Creates a new error model.
bool operator!=(const ErrorModel &rhs) const
Inequality operator.
Defines the types of values available within cQASM&#39;s type system, as well as some utility functions...
bool operator==(const ErrorModel &rhs) const
Equality operator.