ChimeraTK-ApplicationCore 04.08.00
Loading...
Searching...
No Matches
ConnectionMaker.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
5#include "FanOut.h"
6#include "Model.h"
8
9#include <list>
10
11namespace ChimeraTK {
12 class Application;
13 class TriggerFanOut;
14
15 /********************************************************************************************************************/
16
18 public:
19 explicit NetworkVisitor(Application& app) : _app(app) {}
20
29
30 protected:
33
35 // Variables related to the current network
37 std::map<std::string, boost::shared_ptr<TriggerFanOut>> triggerImpl;
38 std::list<VariableNetworkNode> consumers;
39 const std::type_info* valueType{&typeid(AnyType)};
40 size_t valueLength{0};
41 std::string description;
42 std::string unit;
46 bool useExternalTrigger{false};
47 bool useReverseRecovery{false};
48 };
49 std::set<std::string> _triggerNetworks{};
50 std::map<std::string, NetworkInformation> _networks{};
51
52 NetworkInformation checkNetwork(Model::ProcessVariableProxy& proxy);
53 void finaliseNetwork(NetworkInformation& net);
55
56 template<typename UserType>
57 void createProcessVariable(const VariableNetworkNode& node, size_t length, const std::string& unit,
58 const std::string& description, AccessModeFlags flags);
59
60 template<typename... Args>
61 void debug(Args&&...);
62
63 // Map of control system PVs with decorator
64 template<typename UserType>
65 using AccessorMap = std::map<std::string, boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>>>;
66 mutable ChimeraTK::TemplateUserTypeMap<AccessorMap> _decoratedPvImpls;
67
69 };
70
71 /********************************************************************************************************************/
72
74 public:
76
83 void finalise();
84
88 void optimiseUnmappedVariables(const std::set<std::string>& names);
89
95 void connect();
96
97 private:
98 std::set<Model::ProcessVariableProxy, ProcessVariableComperator> _triggers;
99
100 void connectNetwork(Model::ProcessVariableProxy& proxy);
101
102 void makeDirectConnectionForFeederWithImplementation(NetworkInformation& net);
103 void makeFanOutConnectionForFeederWithImplementation(
104 NetworkInformation& net, const Model::DeviceModuleProxy& device, const Model::ProcessVariableProxy& trigger);
105 void makeConnectionForFeederWithoutImplementation(NetworkInformation& net);
106 void makeConnectionForConstantFeeder(NetworkInformation& net);
107
108 template<typename UserType>
109 boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> getProcessVariable(const VariableNetworkNode& node);
110
111 template<typename UserType>
112 boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> createDeviceVariable(VariableNetworkNode const& node);
113
114 template<typename UserType>
115 ConsumerImplementationPairs<UserType> setConsumerImplementations(NetworkInformation& net);
116
117 template<typename UserType>
118 std::pair<boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>>,
119 boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>>>
120 createApplicationVariable(VariableNetworkNode const& node, VariableNetworkNode const& consumer = {});
121 };
122
123 /********************************************************************************************************************/
124
125} // namespace ChimeraTK
Pseudo type to identify nodes which can have arbitrary types.
void finalise()
Finalise the model and register all PVs with the control system adapter.
ConnectionMaker(Application &app)
void connect()
Realise connections.
void optimiseUnmappedVariables(const std::set< std::string > &names)
Execute the optimisation request from the control system adapter (remove unused variables)
std::string getFullyQualifiedPath() const
Return the fully qualified path.
Definition Model.cc:25
std::map< std::string, boost::shared_ptr< ChimeraTK::NDRegisterAccessor< UserType > > > AccessorMap
void debug(Args &&...)
ChimeraTK::TemplateUserTypeMap< AccessorMap > _decoratedPvImpls
std::set< std::string > _triggerNetworks
NetworkInformation checkAndFinaliseNetwork(Model::ProcessVariableProxy &proxy)
void createProcessVariable(const VariableNetworkNode &node, size_t length, const std::string &unit, const std::string &description, AccessModeFlags flags)
NetworkVisitor(Application &app)
void finaliseNetwork(NetworkInformation &net)
std::map< std::string, NetworkInformation > _networks
NetworkInformation checkNetwork(Model::ProcessVariableProxy &proxy)
Class describing a node of a variable network.
InvalidityTracer application module.
std::list< std::pair< boost::shared_ptr< ChimeraTK::NDRegisterAccessor< UserType > >, VariableNetworkNode > > ConsumerImplementationPairs
Definition FanOut.h:18
const Model::ProcessVariableProxy * proxy
std::map< std::string, boost::shared_ptr< TriggerFanOut > > triggerImpl
std::list< VariableNetworkNode > consumers
NetworkInformation(const Model::ProcessVariableProxy *p)
Helper predicate to put ProcessVariableProxies into std::set.
bool operator()(const Model::ProcessVariableProxy &a, const Model::ProcessVariableProxy &b) const