SECircuit.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5#include "cdm/circuit/SECircuitNode.h"
6#include "cdm/circuit/SECircuitPath.h"
7
8#define CIRCUIT_TEMPLATE typename NodeType, typename PathType
9#define CIRCUIT_TYPES NodeType,PathType
10
11template<CIRCUIT_TEMPLATE>
12class SECircuit : public Loggable
13{
14 friend class PBCircuit;//friend the serialization class
15public:
16
17 SECircuit(const std::string& name, Logger* logger);
18 virtual ~SECircuit();
19
20 virtual void Clear(); //clear memory
21
22 virtual std::string GetName() const;
23
24 virtual bool HasReferenceNode() const;
25
26 // Nodes //
27 virtual void AddNode(NodeType& node);
28 virtual void ForceAddNode(NodeType& node);// No check for node with the same name
29 virtual bool HasNode(NodeType& node);
30 virtual bool HasNode(const std::string& name);
31 virtual NodeType* GetNode(const std::string& name);
32 virtual const NodeType* GetNode(const std::string& name) const;
33 virtual const std::vector<NodeType*>& GetNodes() const;
34 virtual void RemoveNode(const NodeType& node);
35 virtual void RemoveNode(const std::string& name);
36
37 // Paths //
38 virtual void AddPath(PathType& node);
39 virtual void ForceAddPath(PathType& node);// No check for path with the same name
40 virtual bool HasPath(PathType& node);
41 virtual bool HasPath(const std::string& name);
42 virtual PathType* GetPath(const std::string& name);
43 virtual const PathType* GetPath(const std::string& name) const;
44 virtual const std::vector<PathType*>& GetPaths() const;
45 virtual void RemovePath(const PathType& path);
46 virtual void RemovePath(const std::string& name);
47 virtual const std::vector<PathType*>& GetValvePaths();
48 virtual const std::vector<PathType*>& GetPolarizedElementPaths();
49
50 virtual const std::vector<PathType*>* GetTargetPaths(const NodeType& node) const;
51 virtual const std::vector<PathType*>* GetSourcePaths(const NodeType& node) const;
52 virtual const std::vector<PathType*>* GetConnectedPaths(const NodeType& node) const;
53
54 virtual void StateChange();
55 virtual void SetNextAndCurrentFromBaselines();
56
57protected:
58 std::string m_Name;
59 std::stringstream m_ss;
60
61 std::vector<NodeType*> m_Nodes;
62 std::vector<PathType*> m_Paths;
63
64 std::map<const NodeType*, std::vector<PathType*>*> m_TargetPathMap;
65 std::map<const NodeType*, std::vector<PathType*>*> m_SourcePathMap;
66 std::map<const NodeType*, std::vector<PathType*>*> m_ConnectedPathMap;
67
68 std::vector<PathType*> m_ValvePaths;
69 std::vector<PathType*> m_PolarizedElementPaths;
70};
71
72#include "cdm/circuit/SECircuit.hxx"
Definition: Logger.h:23
Definition: Logger.h:71
Definition: PBCircuit.h:26
Definition: SECircuit.h:13
virtual const std::vector< PathType * > & GetValvePaths()
Definition: SECircuit.cpp:307
virtual const std::vector< PathType * > * GetSourcePaths(const NodeType &node) const
Returns all source paths for a node.
Definition: SECircuit.cpp:354
virtual void RemoveNode(const NodeType &node)
Definition: SECircuit.cpp:204
std::map< const NodeType *, std::vector< PathType * > * > m_ConnectedPathMap
Definition: SECircuit.h:66
std::vector< NodeType * > m_Nodes
Definition: SECircuit.h:61
virtual std::string GetName() const
Definition: SECircuit.cpp:139
virtual void RemovePath(const PathType &path)
Definition: SECircuit.cpp:279
virtual void AddPath(PathType &node)
Definition: SECircuit.cpp:233
virtual const std::vector< PathType * > * GetTargetPaths(const NodeType &node) const
Returns all target paths for a node.
Definition: SECircuit.cpp:330
virtual bool HasPath(PathType &node)
Definition: SECircuit.cpp:244
virtual void AddNode(NodeType &node)
Definition: SECircuit.cpp:158
virtual const std::vector< PathType * > * GetConnectedPaths(const NodeType &node) const
Returns all source paths for a node.
Definition: SECircuit.cpp:378
virtual ~SECircuit()
Definition: SECircuit.cpp:16
std::vector< PathType * > m_ValvePaths
Definition: SECircuit.h:68
SECircuit(const std::string &name, Logger *logger)
Definition: SECircuit.cpp:11
virtual NodeType * GetNode(const std::string &name)
Definition: SECircuit.cpp:179
virtual void ForceAddNode(NodeType &node)
Definition: SECircuit.cpp:164
std::map< const NodeType *, std::vector< PathType * > * > m_SourcePathMap
Definition: SECircuit.h:65
virtual void ForceAddPath(PathType &node)
Definition: SECircuit.cpp:239
virtual void SetNextAndCurrentFromBaselines()
Set all Current and Next values to the Baseline values for all Elements.
Definition: SECircuit.cpp:394
virtual bool HasNode(NodeType &node)
Definition: SECircuit.cpp:169
std::stringstream m_ss
Definition: SECircuit.h:59
virtual bool HasReferenceNode() const
Definition: SECircuit.cpp:145
std::vector< PathType * > m_Paths
Definition: SECircuit.h:62
virtual const std::vector< NodeType * > & GetNodes() const
Definition: SECircuit.cpp:199
virtual const std::vector< PathType * > & GetPaths() const
Definition: SECircuit.cpp:274
virtual void Clear()
Definition: SECircuit.cpp:22
std::vector< PathType * > m_PolarizedElementPaths
Definition: SECircuit.h:69
virtual PathType * GetPath(const std::string &name)
Definition: SECircuit.cpp:254
virtual void StateChange()
Definition: SECircuit.cpp:40
std::string m_Name
Definition: SECircuit.h:58
virtual const std::vector< PathType * > & GetPolarizedElementPaths()
Definition: SECircuit.cpp:312
std::map< const NodeType *, std::vector< PathType * > * > m_TargetPathMap
Definition: SECircuit.h:64

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.