lintel 0.2.0
Loading...
Searching...
No Matches
SharedMemorySegmentComponent.h
Go to the documentation of this file.
1#ifndef LINTEL_SHAREDMEMORYSEGMENTCOMPONENT_H
2#define LINTEL_SHAREDMEMORYSEGMENTCOMPONENT_H
3
4#include <cstddef>
5#include <filesystem>
6#include <memory>
7#include <vector>
8
11
12namespace tinyxml2 {
13class XMLElement;
14}
15
16namespace lintel {
19{
20private:
22 std::shared_ptr<EnvironmentConfiguration> m_environmentConfiguration;
23
25 static const struct Shapes
26 {
27 const char *const CONFIG_ROOT = "SharedMemorySegments";
28 const char *const SHM_SEGMENT_ROOT = "SharedMemorySegment";
29 const char *const SHM_SEGMENT_NAME = "name";
30 const char *const SHM_SEGMENT_SIZE = "size";
31 const char *const SHM_SEGMENT_AUTO_EXTEND_SIZE = "auto_extend_size";
32 const char *const SHM_SEGMENT_MAX_SIZE = "max_size";
33 const char *const PATH_ROOT = "Path";
34 const char *const PATH_PATH = "path";
35 } m_shape;
36
38 struct SegmentTemp
39 {
40 bool m_autoExtend = false;
41 std::string m_name;
42 std::size_t m_size = 0;
43 std::size_t m_maxSize = 0;
44 std::size_t m_autoExtendSize = 0;
45 };
46
51 void processPathElement(tinyxml2::XMLElement *shmElement, int32_t lineNumber, std::filesystem::path &path);
52
57 void processSegmentElement(tinyxml2::XMLElement *shmElement, int32_t lineNumber, std::vector<SegmentTemp> &segments);
58
62 void validateAndCreatePath(const std::filesystem::path &path, int32_t lineOffset);
63
68 static std::vector<std::shared_ptr<Entry>> buildEntries(const std::filesystem::path &path,
69 const std::vector<SegmentTemp> &segments);
70
71public:
74 explicit SharedMemorySegmentComponent(std::shared_ptr<EnvironmentConfiguration> environmentConfiguration);
75
81 std::vector<std::shared_ptr<Entry>>
82 parse(const std::string &content, int32_t lineOffset, const std::string &fileName) override;
83};
84
85}// namespace lintel
86#endif// LINTEL_SHAREDMEMORYSEGMENTCOMPONENT_H
Definition Component.h:13
Definition SharedMemorySegmentComponent.h:19
SharedMemorySegmentComponent(std::shared_ptr< EnvironmentConfiguration > environmentConfiguration)
std::vector< std::shared_ptr< Entry > > parse(const std::string &content, int32_t lineOffset, const std::string &fileName) override
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9
Definition DatabaseConnectionComponent.h:8