SECircuitManager.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
14
15#define CIRCUIT_LEDGER_TEMPLATE typename NodeType, typename PathType, typename CircuitType
16#define CIRCUIT_LEDGER_TYPES NodeType,PathType,CircuitType
17
18template<CIRCUIT_LEDGER_TEMPLATE>
20{
21 friend class PBCircuit;//friend the serialization class
22 friend class SECircuitManager;
23protected:
25public:
26 virtual ~SECircuitLedger() { Clear(); };
27 void Clear();
28 std::map<std::string, NodeType*> nodes;
29 std::map<std::string, PathType*> paths;
30 std::map<std::string, CircuitType*> circuits;
31};
32
33#define ELECTRICAL_LEDGER_TYPES SEElectricalCircuitNode,SEElectricalCircuitPath,SEElectricalCircuit
34#define FLUID_LEDGER_TYPES SEFluidCircuitNode,SEFluidCircuitPath,SEFluidCircuit
35#define THERMAL_LEDGER_TYPES SEThermalCircuitNode,SEThermalCircuitPath,SEThermalCircuit
36
37class CDM_DECL SECircuitManager : public Loggable
38{
39 friend class PBCircuit;//friend the serialization class
40public:
41 SECircuitManager(Logger* logger);
42 virtual ~SECircuitManager();
43
44 virtual void Clear(); //clear memory
45
46 virtual void StateChange() { };
47
48 void SetReadOnly(bool b);
49protected:
50
51public:
52 virtual SEElectricalCircuitNode& CreateElectricalNode(const std::string& name);
53 virtual void DeleteElectricalNode(const std::string& name);
54 virtual bool HasElectricalNode(const std::string& name) const;
55 virtual SEElectricalCircuitNode* GetElectricalNode(const std::string& name);
56 virtual const SEElectricalCircuitNode* GetElectricalNode(const std::string& name) const;
57 virtual SEElectricalCircuitPath& CreateElectricalPath(SEElectricalCircuitNode& src, SEElectricalCircuitNode& tgt, const std::string& name);
58 virtual void DeleteElectricalPath(const std::string& name);
59 virtual bool HasElectricalPath(const std::string& name) const;
60 virtual SEElectricalCircuitPath* GetElectricalPath(const std::string& name);
61 virtual const SEElectricalCircuitPath* GetElectricalPath(const std::string& name) const;
62 virtual SEElectricalCircuit& CreateElectricalCircuit(const std::string& name);
63 virtual void DeleteElectricalCircuit(const std::string& name);
64 virtual bool HasElectricalCircuit(const std::string& name) const;
65 virtual SEElectricalCircuit* GetElectricalCircuit(const std::string& name);
66 virtual const SEElectricalCircuit* GetElectricalCircuit(const std::string& name) const;
67 virtual void SetReadOnlyElectrical(bool b);
68protected:
70
71public:
72 virtual SEFluidCircuitNode& CreateFluidNode(const std::string& name);
73 virtual void DeleteFluidNode(const std::string& name);
74 virtual bool HasFluidNode(const std::string& name) const;
75 virtual SEFluidCircuitNode* GetFluidNode(const std::string& name);
76 virtual const SEFluidCircuitNode* GetFluidNode(const std::string& name) const;
77 virtual SEFluidCircuitPath& CreateFluidPath(SEFluidCircuitNode& src, SEFluidCircuitNode& tgt, const std::string& name);
78 virtual void DeleteFluidPath(const std::string& name);
79 virtual bool HasFluidPath(const std::string& name) const;
80 virtual SEFluidCircuitPath* GetFluidPath(const std::string& name);
81 virtual const SEFluidCircuitPath* GetFluidPath(const std::string& name) const;
82 virtual SEFluidCircuit& CreateFluidCircuit(const std::string& name);
83 virtual void DeleteFluidCircuit(const std::string& name);
84 virtual bool HasFluidCircuit(const std::string& name) const;
85 virtual SEFluidCircuit* GetFluidCircuit(const std::string& name);
86 virtual const SEFluidCircuit* GetFluidCircuit(const std::string& name) const;
87 virtual void SetReadOnlyFluid(bool b);
88protected:
90
91public:
92 virtual SEThermalCircuitNode& CreateThermalNode(const std::string& name);
93 virtual void DeleteThermalNode(const std::string& name);
94 virtual bool HasThermalNode(const std::string& name) const;
95 virtual SEThermalCircuitNode* GetThermalNode(const std::string& name);
96 virtual const SEThermalCircuitNode* GetThermalNode(const std::string& name) const;
97 virtual SEThermalCircuitPath& CreateThermalPath(SEThermalCircuitNode& src, SEThermalCircuitNode& tgt, const std::string& name);
98 virtual void DeleteThermalPath(const std::string& name);
99 virtual bool HasThermalPath(const std::string& name) const;
100 virtual SEThermalCircuitPath* GetThermalPath(const std::string& name);
101 virtual const SEThermalCircuitPath* GetThermalPath(const std::string& name) const;
102 virtual SEThermalCircuit& CreateThermalCircuit(const std::string& name);
103 virtual void DeleteThermalCircuit(const std::string& name);
104 virtual bool HasThermalCircuit(const std::string& name) const;
105 virtual SEThermalCircuit* GetThermalCircuit(const std::string& name);
106 virtual const SEThermalCircuit* GetThermalCircuit(const std::string& name) const;
107 virtual void SetReadOnlyThermal(bool b); ;
108protected:
110
111
112protected:
113 template<CIRCUIT_LEDGER_TEMPLATE> NodeType& CreateNode(const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
114 template<CIRCUIT_LEDGER_TEMPLATE> void DeleteNode(const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
115 template<CIRCUIT_LEDGER_TEMPLATE> bool HasNode(const std::string& name, const SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger) const;
116 template<CIRCUIT_LEDGER_TEMPLATE> NodeType* GetNode(const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
117 template<CIRCUIT_LEDGER_TEMPLATE> const NodeType* GetNode(const std::string& name, const SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger) const;
118 template<CIRCUIT_LEDGER_TEMPLATE> PathType& CreatePath(NodeType& src, NodeType& tgt, const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
119 template<CIRCUIT_LEDGER_TEMPLATE> void DeletePath(const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
120 template<CIRCUIT_LEDGER_TEMPLATE> bool HasPath(const std::string& name, const SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger) const;
121 template<CIRCUIT_LEDGER_TEMPLATE> PathType* GetPath(const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
122 template<CIRCUIT_LEDGER_TEMPLATE> const PathType* GetPath(const std::string& name, const SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger) const;
123 template<CIRCUIT_LEDGER_TEMPLATE> CircuitType& CreateCircuit(const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
124 template<CIRCUIT_LEDGER_TEMPLATE> void DeleteCircuit(const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
125 template<CIRCUIT_LEDGER_TEMPLATE> bool HasCircuit(const std::string& name, const SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger) const;
126 template<CIRCUIT_LEDGER_TEMPLATE> CircuitType* GetCircuit(const std::string& name, SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger);
127 template<CIRCUIT_LEDGER_TEMPLATE> const CircuitType* GetCircuit(const std::string& name, const SECircuitLedger<CIRCUIT_LEDGER_TYPES>& ledger) const;
128};
129
130
131#include "cdm/circuit/SECircuitManager.hxx"
Definition: Logger.h:23
Definition: Logger.h:71
Definition: PBCircuit.h:26
Definition: SECircuitManager.h:20
void Clear()
Definition: SECircuitManager.hxx:18
std::map< std::string, PathType * > paths
Definition: SECircuitManager.h:29
std::map< std::string, NodeType * > nodes
Definition: SECircuitManager.h:28
std::map< std::string, CircuitType * > circuits
Definition: SECircuitManager.h:30
virtual ~SECircuitLedger()
Definition: SECircuitManager.h:26
SECircuitLedger()
Definition: SECircuitManager.h:24
Definition: SECircuitManager.h:38
virtual void StateChange()
Definition: SECircuitManager.h:46
SECircuitLedger< SEFluidCircuitNode, SEFluidCircuitPath, SEFluidCircuit > m_FluidLedger
Definition: SECircuitManager.h:89
SECircuitLedger< SEElectricalCircuitNode, SEElectricalCircuitPath, SEElectricalCircuit > m_ElectricalLedger
Definition: SECircuitManager.h:69
SECircuitLedger< SEThermalCircuitNode, SEThermalCircuitPath, SEThermalCircuit > m_ThermalLedger
Definition: SECircuitManager.h:109
Definition: SEElectricalCircuit.h:12
Definition: SEElectricalCircuitNode.h:10
Definition: SEElectricalCircuitPath.h:9
Definition: SEFluidCircuit.h:12
Definition: SEFluidCircuitNode.h:10
Definition: SEFluidCircuitPath.h:9
Definition: SEThermalCircuit.h:12
Definition: SEThermalCircuitNode.h:10
Definition: SEThermalCircuitPath.h:9

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.