libcosim  0.7.0
C++ library for distributed co-simulation
Classes | Public Types | Public Member Functions | List of all members
cosim::system_structure Class Reference

A description of the structure of a modelled system. More...

#include <cosim/system_structure.hpp>

Classes

struct  connection
 Information about a connection. More...
 
struct  entity
 Information about a simulation entity. More...
 
struct  function_io_description
 A description of a function variable, including group and variable indices. More...
 

Public Types

using entity_type = std::variant< std::shared_ptr< model >, std::shared_ptr< function_type > >
 The type of an entity. More...
 
using entity_range = boost::select_second_const_range< entity_map >
 
using connection_range = boost::transformed_range< connection_transform, const connection_map >
 

Public Member Functions

void add_entity (const entity &e)
 Adds an entity to the system. More...
 
void add_entity (std::string_view name, std::shared_ptr< cosim::model > type, duration stepSizeHint=duration::zero())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void add_entity (std::string_view name, std::shared_ptr< function_type > type, function_parameter_value_map parameters)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
entity_range entities () const noexcept
 Returns a list of the entities in the system. More...
 
const entityfind_entity (std::string_view name) const
 Returns a pointer to the named entity if it exists, null otherwise.
 
void connect_variables (const connection &c)
 Establishes a connection between two variables. More...
 
void connect_variables (const full_variable_name &source, const full_variable_name &target)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
connection_range connections () const noexcept
 Returns a list of the scalar connections in the system. More...
 
const variable_descriptionget_variable_description (const full_variable_name &v) const
 Retrieves the description of a simulator variable, given its qualified name. More...
 
const function_io_descriptionget_function_io_description (const full_variable_name &v) const
 Retrieves the description of a function variable, given its qualified name. More...
 

Detailed Description

A description of the structure of a modelled system.

The system structure description contains the list of entities in the system and the connections between them. Validation is performed on the fly by the class' mutators, and any attempt to make an invalid change will result in an exception of type cosim::error with error code cosim::errc::invalid_system_structure.

Member Typedef Documentation

◆ entity_type

The type of an entity.

This is a shared pointer to a cosim::model if the entity is a simulator, and to a cosim::function_type if the entity is a function instance.

Member Function Documentation

◆ add_entity()

void cosim::system_structure::add_entity ( const entity e)

Adds an entity to the system.

e.name must be unique in the context of the present system.

◆ connect_variables()

void cosim::system_structure::connect_variables ( const connection c)

Establishes a connection between two variables.

The same target variable may not be connected several times.

◆ connections()

connection_range cosim::system_structure::connections ( ) const
noexcept

Returns a list of the scalar connections in the system.

Returns
A range of connection objects.

◆ entities()

entity_range cosim::system_structure::entities ( ) const
noexcept

Returns a list of the entities in the system.

Returns
A range of entity objects.

◆ get_function_io_description()

const function_io_description& cosim::system_structure::get_function_io_description ( const full_variable_name v) const

Retrieves the description of a function variable, given its qualified name.

This is a convenience function that provides fast variable lookup (O(1) on average).

◆ get_variable_description()

const variable_description& cosim::system_structure::get_variable_description ( const full_variable_name v) const

Retrieves the description of a simulator variable, given its qualified name.

This is a convenience function that provides fast variable lookup (O(1) on average).


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