OGS 6.2.1-372-g67eca524a.dirty.20190919230349
Component.cpp
Go to the documentation of this file.
1 
13 #include "Component.h"
14 #include "Components/Components.h"
15 #include "Properties/Properties.h"
16 
18 {
20 {
21  // Some properties can be initialized by other default properties:
22  _properties[PropertyType::name] = std::make_unique<Constant>("no_name");
23 }
24 
25 Component::Component(std::string const& component_name,
26  std::unique_ptr<PropertyArray>&& properties)
27 {
28  // Some properties can be initialized by other default properties:
30  std::make_unique<Constant>(component_name);
31 
32  if (properties)
33  {
34  overwriteExistingProperties(_properties, *properties, this);
35  }
36 }
37 
39 {
40  return *_properties[p];
41 }
42 
43 std::string Component::name() const
44 {
45  return std::get<std::string>(_properties[PropertyType::name]->value());
46 }
47 } // namespace MaterialPropertyLib
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component *> scale_pointer)
Definition: Property.h:115
Property const & property(PropertyType const &) const
A get-function for retrieving a certain property.
Definition: Component.cpp:38
std::string name() const
Definition: Component.cpp:43
PropertyArray _properties
The property array of the component.
Definition: Component.h:72