lintel 0.2.0
Loading...
Searching...
No Matches
PropertyRegistration.h
Go to the documentation of this file.
1#ifndef PROPERTYREGISTRATION_H
2#define PROPERTYREGISTRATION_H
3
4#include <cstdint>
5#include <filesystem>
6
10
11namespace lintel {
13template<class T> class PropertyRegistration : public AbstractService<T>
14{
15protected:
25 template<class type>
26 std::shared_ptr<Property<type>> registerProperty(std::string name,
27 type defaultValue,
28 std::string description,
29 bool runtime,
30 const std::string &fileName,
32 {
33 std::shared_ptr<Property<type>> property = std::make_shared<Property<type>>(name,
34 this->getInstanceName(),
35 std::string(this->getClassName()),
36 this->getProcessName(),
39 runtime);
40 LOG_INFO("Property<{}> {} = {}", type_name<type>(), name, property->toString());
41 const std::filesystem::path &path(fileName);
42
43 property->setDataStorage(
44 DataStorage(PropertyRepositoryType::DEFAULT, path.filename().generic_string() + ":" + std::to_string(position)));
45 this->m_properties.push_back(property);
46 return property;
47 }
48
49public:
51};
52
53}// namespace lintel
54#endif// PROPERTYREGISTRATION_H
#define LOG_INFO(message,...)
Definition LoggerService.h:124
Definition AbstractService.h:58
std::vector< std::shared_ptr< PropertyBase > > m_properties
Definition AbstractService.h:66
const std::string & getProcessName() const override
Definition AbstractService.h:95
const std::string & getInstanceName() const override
Definition AbstractService.h:99
std::string_view getClassName() const override
Definition AbstractService.h:103
Definition DataStorage.h:13
Definition PropertyRegistration.h:14
std::shared_ptr< Property< type > > registerProperty(std::string name, type defaultValue, std::string description, bool runtime, const std::string &fileName, int32_t position)
Definition PropertyRegistration.h:26
@ DEFAULT
Definition PropertyRepositoryType.h:16
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9