SECircuit.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 #include "circuit/SECircuitNode.h"
6 #include "circuit/SECircuitPath.h"
7 
8 #define CIRCUIT_TEMPLATE typename NodeType, typename PathType
9 #define CIRCUIT_TYPES NodeType,PathType
10 
11 template<CIRCUIT_TEMPLATE>
12 class SECircuit : public Loggable
13 {
14  friend class PBCircuit;//friend the serialization class
15 public:
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 bool HasNode(NodeType& node);
29  virtual bool HasNode(const std::string& name);
30  virtual NodeType* GetNode(const std::string& name);
31  virtual const NodeType* GetNode(const std::string& name) const;
32  virtual const std::vector<NodeType*>& GetNodes() const;
33  virtual void RemoveNode(const NodeType& node);
34  virtual void RemoveNode(const std::string& name);
35 
36  // Paths //
37  virtual void AddPath(PathType& node);
38  virtual bool HasPath(PathType& node);
39  virtual bool HasPath(const std::string& name);
40  virtual PathType* GetPath(const std::string& name);
41  virtual const PathType* GetPath(const std::string& name) const;
42  virtual const std::vector<PathType*>& GetPaths() const;
43  virtual void RemovePath(const PathType& path);
44  virtual void RemovePath(const std::string& name);
45  virtual const std::vector<PathType*>& GetValvePaths();
46  virtual const std::vector<PathType*>& GetPolarizedElementPaths();
47 
48  virtual const std::vector<PathType*>* GetTargetPaths(const NodeType& node) const;
49  virtual const std::vector<PathType*>* GetSourcePaths(const NodeType& node) const;
50  virtual const std::vector<PathType*>* GetConnectedPaths(const NodeType& node) const;
51 
52  virtual void StateChange();
53  virtual void SetNextAndCurrentFromBaselines();
54 
55 protected:
56  std::string m_Name;
57  std::stringstream m_ss;
58 
59  std::vector<NodeType*> m_Nodes;
60  std::vector<PathType*> m_Paths;
61 
62  std::map<const NodeType*, std::vector<PathType*>*> m_TargetPathMap;
63  std::map<const NodeType*, std::vector<PathType*>*> m_SourcePathMap;
64  std::map<const NodeType*, std::vector<PathType*>*> m_ConnectedPathMap;
65 
66  std::vector<PathType*> m_ValvePaths;
67  std::vector<PathType*> m_PolarizedElementPaths;
68 };
69 #include "circuit/SECircuit.inl"
virtual ~SECircuit()
virtual const std::vector< PathType * > & GetPaths() const
std::vector< PathType * > m_ValvePaths
Definition: SECircuit.h:66
std::string m_Name
Definition: SECircuit.h:56
std::vector< NodeType * > m_Nodes
Definition: SECircuit.h:59
virtual void AddNode(NodeType &node)
std::map< const NodeType *, std::vector< PathType * > * > m_TargetPathMap
Definition: SECircuit.h:62
Definition: Logger.h:61
virtual bool HasNode(NodeType &node)
std::stringstream m_ss
Definition: SECircuit.h:57
virtual void RemovePath(const PathType &path)
std::map< const NodeType *, std::vector< PathType * > * > m_SourcePathMap
Definition: SECircuit.h:63
std::vector< PathType * > m_Paths
Definition: SECircuit.h:60
virtual const std::vector< PathType * > * GetSourcePaths(const NodeType &node) const
virtual void StateChange()
Definition: Logger.h:11
virtual void SetNextAndCurrentFromBaselines()
std::map< const NodeType *, std::vector< PathType * > * > m_ConnectedPathMap
Definition: SECircuit.h:64
virtual const std::vector< PathType * > * GetTargetPaths(const NodeType &node) const
virtual const std::vector< PathType * > * GetConnectedPaths(const NodeType &node) const
virtual void RemoveNode(const NodeType &node)
virtual std::string GetName() const
virtual bool HasPath(PathType &node)
virtual PathType * GetPath(const std::string &name)
Definition: PBCircuit.h:25
virtual bool HasReferenceNode() const
virtual NodeType * GetNode(const std::string &name)
virtual const std::vector< PathType * > & GetPolarizedElementPaths()
std::vector< PathType * > m_PolarizedElementPaths
Definition: SECircuit.h:67
virtual void AddPath(PathType &node)
virtual const std::vector< NodeType * > & GetNodes() const
virtual void Clear()
SECircuit(const std::string &name, Logger *logger)
Definition: SECircuit.h:12
virtual const std::vector< PathType * > & GetValvePaths()