libcosim 0.9.0
C++ library for distributed co-simulation
orchestration.hpp
Go to the documentation of this file.
1
10#ifndef COSIM_ORCHESTRATION_HPP
11#define COSIM_ORCHESTRATION_HPP
12
13#include <cosim/file_cache.hpp>
16#include <cosim/slave.hpp>
17#include <cosim/uri.hpp>
18
19#include <memory>
20#include <string_view>
21#include <vector>
22
23
24namespace cosim
25{
26
27
29class model
30{
31public:
32 virtual ~model() noexcept = default;
33
36
38 virtual std::shared_ptr<slave> instantiate(std::string_view name) = 0;
39};
40
41
54{
55public:
56 virtual ~model_uri_sub_resolver() noexcept = default;
57
79 const uri& baseUri,
80 const uri& modelUriReference);
81
93 virtual std::shared_ptr<model> lookup_model(const uri& modelUri) = 0;
94};
95
96
108{
109public:
112
114 model_uri_resolver& operator=(model_uri_resolver&&) noexcept;
115
116 model_uri_resolver(const model_uri_resolver&) = delete;
117 model_uri_resolver& operator=(const model_uri_resolver&) = delete;
118
119 ~model_uri_resolver() noexcept;
120
122 void add_sub_resolver(std::shared_ptr<model_uri_sub_resolver> sr);
123
143 std::shared_ptr<model> lookup_model(
144 const uri& baseUri,
145 const uri& modelUriReference);
146
164 std::shared_ptr<model> lookup_model(const uri& modelUri);
165
166private:
167 std::vector<std::shared_ptr<model_uri_sub_resolver>> subResolvers_;
168};
169
170
173{
174public:
176
178
179 std::shared_ptr<model> lookup_model(const uri& modelUri) override;
180
181private:
183};
184
185
194 std::shared_ptr<file_cache> cache = nullptr);
195
196
197} // namespace cosim
198#endif // header guard
A resolver for file:// model URIs with .fmu file extension.
Definition: orchestration.hpp:173
std::shared_ptr< model > lookup_model(const uri &modelUri) override
Tries to resolve a model URI.
A generic model URI resolver.
Definition: orchestration.hpp:108
model_uri_resolver() noexcept
Constructs an empty URI resolver.
An interface for classes that resolve model URIs of one or more specific URI schemes.
Definition: orchestration.hpp:54
virtual std::shared_ptr< model > lookup_model(const uri &baseUri, const uri &modelUriReference)
Tries to resolve a model URI relative to some base URI.
virtual std::shared_ptr< model > lookup_model(const uri &modelUri)=0
Tries to resolve a model URI.
A model, i.e., a blueprint from which slaves can be instantiated.
Definition: orchestration.hpp:30
virtual std::shared_ptr< const model_description > description() const noexcept=0
Returns a description of this model.
virtual std::shared_ptr< slave > instantiate(std::string_view name)=0
Instantiates a slave.
An interface for classes that represent co-simulation slaves.
Definition: slave.hpp:53
A URI reference.
Definition: uri.hpp:42
FMU import functionality.
Model-descriptive types and constants.
Top-level libcosim namespace.
Definition: algorithm.hpp:27
std::shared_ptr< model_uri_resolver > default_model_uri_resolver(std::shared_ptr< file_cache > cache=nullptr)
Returns a resolver for all URI schemes supported natively by libcosim.
Slave interface.
URI parsing and handling.