lintel 0.2.0
Loading...
Searching...
No Matches
PropertyRepository.h
Go to the documentation of this file.
1#ifndef LOGGING_PROPERTYREPOSITORY_H
2#define LOGGING_PROPERTYREPOSITORY_H
3
4#include <memory>
5#include <vector>
6
12
13namespace lintel {
14class PropertyBase;
15
18{
19private:
21 std::shared_ptr<PropertyRepositoryEntry> m_propertyRepositoryEntry;
22
24 std::shared_ptr<PropertyRepositoryEntry> init(const std::vector<std::shared_ptr<Entry>> &entries)
25 {
26 std::shared_ptr<PropertyRepositoryEntry> propertyRepositoryEntry;
27 for (const auto &entry : entries) {
28 std::shared_ptr<PropertyRepositoryEntry> tmp = std::static_pointer_cast<PropertyRepositoryEntry>(entry);
29 if (tmp->getType() != m_type) { continue; }
31 }
33 }
34
35public:
38 PropertyRepository(PropertyRepositoryType type, const std::shared_ptr<Configuration> &configuration)
39 : m_type(std::move(type)),
40 m_propertyRepositoryEntry(init(configuration->configurationOf<PropertyRepositoryComponent>()))
41 {}
42
43 virtual ~PropertyRepository() = default;
44
48 PropertyRepositoryType getType() const { return m_type; }
49
51 bool isShadow() const
52 {
53 if (m_propertyRepositoryEntry == nullptr) { return false; }
54 return m_propertyRepositoryEntry->isShadow();
55 }
56
58 bool isEnabled() const { return m_propertyRepositoryEntry != nullptr; }
59
62
66 bool isMutable() const
67 {
68 if (m_propertyRepositoryEntry == nullptr) { return false; }
69 return m_propertyRepositoryEntry->isMutable();
70 }
71
75 virtual void save(const std::vector<std::shared_ptr<PropertyBase>> &properties) = 0;
76
80 virtual void save(std::shared_ptr<PropertyBase> property) = 0;
81
91 virtual void deleteOf(const std::vector<std::shared_ptr<PropertyBase>> &properties) {}
92
96 virtual std::vector<std::shared_ptr<PropertyBase>> awake() = 0;
97
111 virtual std::vector<std::shared_ptr<PropertyBase>> allOf(const std::string &processName = ".*",
112 const std::string &className = ".*",
113 const std::string &instanceName = ".*",
114 const std::string &name = ".*")
115 {
116 return {};
117 }
118};
119
120}// namespace lintel
121#endif// LOGGING_PROPERTYREPOSITORY_H
Definition DataStorage.h:13
Definition PropertyRepositoryComponent.h:11
Definition PropertyRepositoryType.h:11
Definition PropertyRepository.h:18
virtual void save(const std::vector< std::shared_ptr< PropertyBase > > &properties)=0
bool isEnabled() const
Definition PropertyRepository.h:58
virtual DataStorage getDataStorage()=0
virtual void save(std::shared_ptr< PropertyBase > property)=0
bool isShadow() const
Definition PropertyRepository.h:51
virtual void deleteOf(const std::vector< std::shared_ptr< PropertyBase > > &properties)
Definition PropertyRepository.h:91
PropertyRepositoryType getType() const
Definition PropertyRepository.h:48
bool isMutable() const
Definition PropertyRepository.h:66
PropertyRepository(PropertyRepositoryType type, const std::shared_ptr< Configuration > &configuration)
Definition PropertyRepository.h:38
virtual std::vector< std::shared_ptr< PropertyBase > > awake()=0
virtual std::vector< std::shared_ptr< PropertyBase > > allOf(const std::string &processName=".*", const std::string &className=".*", const std::string &instanceName=".*", const std::string &name=".*")
Definition PropertyRepository.h:111
virtual ~PropertyRepository()=default
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9