SECompartmentGraph.h
1 /**************************************************************************************
2 Copyright 2015 Applied Research Associates, Inc.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the License
5 at:
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software distributed under
8 the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9 CONDITIONS OF ANY KIND, either express or implied. See the License for the
10 specific language governing permissions and limitations under the License.
11 **************************************************************************************/
12 
13 #pragma once
14 #include <string>
15 #include <vector>
16 
17 namespace biogears {
18 
19 class Logger;
20 
21 #define COMPARTMENT_GRAPH_TEMPLATE typename CompartmentType, typename CompartmentLinkType
22 #define COMPARTMENT_GRAPH_TYPES CompartmentType, CompartmentLinkType
23 
24 template <COMPARTMENT_GRAPH_TEMPLATE>
25 class SECompartmentGraph : public Loggable {
26 protected:
27  SECompartmentGraph(const std::string& name, Logger* logger);
28  SECompartmentGraph(const char* name, Logger* logger);
29 
30 public:
31  virtual ~SECompartmentGraph();
32 
33  virtual void Clear();
34 
35 public:
36  virtual std::string GetName() const;
37  virtual const char* GetName_cStr() const;
38 
39  virtual void AddCompartment(CompartmentType& cmpt);
40  virtual CompartmentType* GetCompartment(const char* name);
41  virtual CompartmentType* GetCompartment(const std::string& name);
42  virtual const CompartmentType* GetCompartment(const char* name) const;
43  virtual const CompartmentType* GetCompartment(const std::string& name) const;
44  virtual const std::vector<CompartmentType*>& GetCompartments() const;
45  virtual void RemoveCompartment(const CompartmentType& cmpt);
46  virtual void RemoveCompartment(const char* name);
47  virtual void RemoveCompartment(const std::string& name);
48 
49  virtual CompartmentLinkType* GetLink(const char* name);
50  virtual void AddLink(CompartmentLinkType& link);
51  virtual CompartmentLinkType* GetLink(const std::string& name);
52  virtual const CompartmentLinkType* GetLink(const char* name) const;
53  virtual const CompartmentLinkType* GetLink(const std::string& name) const;
54  virtual const std::vector<CompartmentLinkType*>& GetLinks() const;
55  virtual void RemoveLink(const CompartmentLinkType& link);
56  virtual void RemoveLink(const char* name);
57  virtual void RemoveLink(const std::string& name);
58 
59 protected:
60  std::string m_Name;
61  std::vector<CompartmentType*> m_Compartments;
62  std::vector<CompartmentLinkType*> m_CompartmentLinks;
63 };
64 }
virtual void AddLink(CompartmentLinkType &link)
virtual CompartmentLinkType * GetLink(const char *name)
virtual void AddCompartment(CompartmentType &cmpt)
virtual void RemoveCompartment(const CompartmentType &cmpt)
Definition: Logger.h:27
Definition: Logger.h:75
virtual const std::vector< CompartmentType * > & GetCompartments() const
virtual const char * GetName_cStr() const
Definition: SECompartmentGraph.h:25
virtual CompartmentType * GetCompartment(const char *name)
virtual std::string GetName() const
std::string m_Name
Definition: SECompartmentGraph.h:60
Definition: SEElectricalCircuit.h:18
SECompartmentGraph(const std::string &name, Logger *logger)
virtual const std::vector< CompartmentLinkType * > & GetLinks() const
std::vector< CompartmentType * > m_Compartments
Definition: SECompartmentGraph.h:61
std::vector< CompartmentLinkType * > m_CompartmentLinks
Definition: SECompartmentGraph.h:62
virtual void RemoveLink(const CompartmentLinkType &link)