10 #ifndef CORAL_MODEL_HPP    11 #define CORAL_MODEL_HPP    20 #include <boost/range/adaptor/map.hpp>    21 #include <boost/variant.hpp>    23 #include <coral/config.h>    75     INTEGER_DATATYPE    = 1 << 1,
    76     BOOLEAN_DATATYPE    = 1 << 2,
    77     STRING_DATATYPE     = 1 << 3,
    84     PARAMETER_CAUSALITY             = 1,
    85     CALCULATED_PARAMETER_CAUSALITY  = 1 << 1,
    86     INPUT_CAUSALITY                 = 1 << 2,
    87     OUTPUT_CAUSALITY                = 1 << 3,
    88     LOCAL_CAUSALITY                 = 1 << 4,
    95     CONSTANT_VARIABILITY    = 1,
    96     FIXED_VARIABILITY       = 1 << 1,
    97     TUNABLE_VARIABILITY     = 1 << 2,
    98     DISCRETE_VARIABILITY    = 1 << 3,
    99     CONTINUOUS_VARIABILITY  = 1 << 4,
   153     typedef boost::select_second_const_range<VariablesMap>
   159     template<typename VariableDescriptionRange>
   161         const 
std::
string& name,
   162         const 
std::
string& uuid,
   163         const 
std::
string& description,
   164         const 
std::
string& author,
   165         const 
std::
string& version,
   166         const VariableDescriptionRange& variables);
   176         m_name, m_uuid, m_description, m_author, m_version, m_variables)
   179     const 
std::
string& 
Name() const;
   182     const 
std::
string& UUID() const;
   185     const 
std::
string& Description() const;
   188     const 
std::
string& Author() const;
   191     const 
std::
string& Version() const;
   207     std::
string m_description;
   208     std::
string m_author;
   209     std::
string m_version;
   210     VariablesMap m_variables;
   219     explicit SlaveDescription(
   220         SlaveID 
id = INVALID_SLAVE_ID,
   222         const SlaveTypeDescription& typeDescription = SlaveTypeDescription());
   224     ~SlaveDescription() = 
default;
   227     SlaveDescription(
const SlaveDescription&) = 
default;
   228     SlaveDescription& operator=(
const SlaveDescription&) = 
default;
   231     CORAL_DEFINE_DEFAULT_MOVE(SlaveDescription, m_id, m_name, m_typeDescription)
   237     void SetID(SlaveID value);
   246     const SlaveTypeDescription& TypeDescription() 
const;
   249     void SetTypeDescription(
const SlaveTypeDescription& value);
   254     SlaveTypeDescription m_typeDescription;
   259 typedef boost::variant<double, int, bool, std::string> 
ScalarValue;
   273     explicit Variable(SlaveID slave = INVALID_SLAVE_ID, VariableID 
id = 0)
   274         : m_slave(slave), m_id(
id) { }
   308         const ScalarValue& value);
   332         const ScalarValue& value,
   336     VariableID 
Variable() 
const CORAL_NOEXCEPT;
   339     bool HasValue() 
const CORAL_NOEXCEPT;
   345     const ScalarValue& Value() 
const;
   348     bool IsConnectionChange() 
const CORAL_NOEXCEPT;
   357     VariableID m_variable;
   360     bool m_isConnectionChange;
   378 template<
typename VariableDescriptionRange>
   379 SlaveTypeDescription::SlaveTypeDescription(
   385     const VariableDescriptionRange& variables)
   388       m_description(description),
   392     for (
const auto& v : variables) {
   399 #endif  // header guard DataType DataTypeOf(const ScalarValue &v)
Returns the type of data stored in the given ScalarValue. 
An object that identifies a variable in a simulation, and which consists of a slave ID and a variable...
Definition: model.hpp:270
boost::select_second_const_range< VariablesMap > ConstVariablesRange
The return type of the Variables() function. 
Definition: model.hpp:154
coral::model::VariableID ID() const 
An identifier which uniquely refers to this variable in the context of a single slave type...
boost::variant< double, int, bool, std::string > ScalarValue
An algebraic type that can hold values of all supported data types. 
Definition: model.hpp:259
coral::model::Variability Variability() const 
The variable's variability. 
std::int32_t StepID
A number that uniquely identifies a time step in an execution. 
Definition: model.hpp:34
A description of a slave type. 
Definition: model.hpp:148
std::uint16_t SlaveID
Unsigned integer type used for slave identifiers. 
Definition: model.hpp:60
const StepID INVALID_STEP_ID
A number which will never be used for an actual time step ID. 
Definition: model.hpp:38
Definition: variable_io.hpp:28
bool IsValidSlaveName(const std::string &s)
Returns whether s contains a valid slave name. 
Causality
Variable causalities. These correspond to FMI causality definitions. 
Definition: model.hpp:82
coral::model::DataType DataType() const 
The variable's data type. 
double TimeDuration
The type used to specify (simulation) time durations. 
Definition: model.hpp:56
const TimePoint ETERNITY
A special TimePoint value that lies infinitely far in the future. 
Definition: model.hpp:46
std::uint32_t VariableID
Unsigned integer type used for variable identifiers. 
Definition: model.hpp:68
Variability
Variable variabilities. These correspond to FMI variability definitions. 
Definition: model.hpp:93
A description of a specific slave. 
Definition: model.hpp:215
const std::string & Name() const 
A human-readable name for the variable. 
DataType
Variable data types. 
Definition: model.hpp:72
bool operator==(const Variable &a, const Variable &b)
Equality comparison for Variable objects. 
bool operator!=(const Variable &a, const Variable &b)
Inequality comparison for Variable objects, defined as !(a==b). 
const SlaveID INVALID_SLAVE_ID
An invalid slave identifier. 
Definition: model.hpp:64
A description of a single variable. 
Definition: model.hpp:104
double TimePoint
The type used to specify (simulation) time points. 
Definition: model.hpp:42
An object which represents the action of assigning an initial value to a variable, or to connect it to another variable. 
Definition: model.hpp:302
coral::model::Causality Causality() const 
The variable's causality.