SECompartment.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5class SEElectricCompartment;
10class SESubstance;
12
13class CDM_DECL SECompartment : public Loggable
14{
15 friend class PBCompartment;//friend the serialization class
16protected:
17 SECompartment(const std::string& name, Logger* logger);
18public:
19 virtual ~SECompartment();
20
21 virtual void Clear();
22
23 virtual std::string GetName() const;
24
25 virtual const SEScalar* GetScalar(const std::string& name) = 0;
26
27 virtual bool HasChildren() const = 0; // Compartments with children contain 'read only' scalars
28
29 virtual void StateChange() = 0;
30
31protected:
32 std::string m_Name;
33
34public:
35
36 template<typename CompartmentType>
37 static void FindLeaves(CompartmentType& cmpt, std::vector<CompartmentType*>& leaves)
38 {
39 for (CompartmentType* child : cmpt.GetChildren())
40 {
41 if (!child->HasChildren())
42 leaves.push_back(child);
43 else
44 FindLeaves(*child, leaves);
45 }
46 }
47};
Definition: Logger.h:23
Definition: Logger.h:71
Definition: PBCompartment.h:28
Definition: SECircuitManager.h:38
Definition: SECompartment.h:14
static void FindLeaves(CompartmentType &cmpt, std::vector< CompartmentType * > &leaves)
Definition: SECompartment.h:37
std::string m_Name
Definition: SECompartment.h:32
virtual const SEScalar * GetScalar(const std::string &name)=0
virtual void StateChange()=0
virtual bool HasChildren() const =0
Definition: SEGasCompartment.h:14
Definition: SELiquidCompartment.h:12
Definition: SEScalar.h:19
Definition: SESubstance.h:15
Definition: SEThermalCompartment.h:12
Definition: SETissueCompartment.h:9

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.