Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CLogicsAllowed.hpp
Go to the documentation of this file.
1#ifndef LIBS_LOGIC_CLOGICSALLOWED_HPP_
2#define LIBS_LOGIC_CLOGICSALLOWED_HPP_
3
4#include "logic/defines.hpp"
5#include "logic/structs.hpp"
6
7#include <bits/stdint-uintn.h>
8#include <map>
9#include <set>
10#include <string>
11
22{
23public:
24 struct SBlockData;
25 typedef std::map<iv::logic::ParamId, std::string> TMapDBBlockParamNStr;
26 typedef std::map<iv::logic::eDBBlockParamType, uint8_t>
27 TMapDBBlockParamSize;// map of <block param type, param size in bytes>
28 typedef std::map<uint32_t, std::string> TMapBlockTypeDescription;
29 typedef std::map<iv::logic::LogicBlockId, SBlockData> TMapBlockSubTypeData;
30
32 {
33 std::string m_name {};
34 uint8_t m_size {};
35 uint8_t m_extraSize {};
36 TMapDBBlockParamNStr m_mapBlockParamDesc {};// <block param, description>
37 };
38
39 static iv::logic::eDBBlockParamType enumDBBlockParamType(std::string_view strType);
40 static std::string_view strDBBlockParamType(iv::logic::eDBBlockParamType type);
41 static std::string getDefaultParameterValue(iv::logic::eDBBlockParamType paramType);
42 static std::optional<std::string> getSpecificDefaultParameterValue(iv::logic::LogicBlockId blockId,
43 iv::logic::ParamId paramId);
44
48
50
51 [[nodiscard]] uint8_t blockExtraSize(uint32_t blockType, uint32_t blockSubType) const;
52 [[nodiscard]] std::string blockName(uint32_t blockType, uint32_t blockSubType) const;
53 [[nodiscard]] TMapDBBlockParamNStr blockParamsDesc(uint32_t blockType, uint32_t blockSubType) const;
54 [[nodiscard]] uint8_t blockSize(uint32_t blockType, uint32_t blockSubType) const;
55 [[nodiscard]] std::string dbVersion() const;
56 bool loadData();
57 bool isAllowedSubtypeInLOM(uint32_t idLOM, uint32_t idSubtype);
58 bool isEmpty() const;
59
60 [[nodiscard]] TMapBlockSubTypeData getBlockSubTypes() const;
61 [[nodiscard]] TMapBlockTypeDescription getBlockTypesDesc() const;
62 [[nodiscard]] const std::string &getErrorText() const;
63 [[nodiscard]] const TMapDBBlockParamSize &getParamSizes() const;
64
65 [[nodiscard]] bool isDataLoadedOk() const;
66 void eraseSubType(iv::logic::LogicBlockId pairTypeSubType);
68
69 virtual ~CLogicsAllowed() = default;
71
72private:
74 {
75 SPrvDBVersion() = default;
76 ~SPrvDBVersion() = default;
77 SPrvDBVersion(const SPrvDBVersion &other) = default;
78 SPrvDBVersion(SPrvDBVersion &&other) = delete;
79 SPrvDBVersion &operator=(const SPrvDBVersion &other) = default;
81
82 bool operator<(const SPrvDBVersion &other) const;
83
84 std::string m_version {}; //ejemplo: 1.2
85 std::string m_revision {};//ejemplo: 3
86 std::string m_date {}; //ejemplo: 13/11/17 00:00:00
87 };
88
89 //CLogicsAllowed(const CLogicsAllowed &other) = delete;
90 //CLogicsAllowed(CLogicsAllowed &&other) = delete;
91 //CLogicsAllowed &operator=(const CLogicsAllowed &other) = delete;
92 //CLogicsAllowed &operator=(CLogicsAllowed &&other) = delete;
93
94 // general database methods
95 void prvReadTable(const std::string &tableName);// method to DEBUG table description
96
97 // methods to extract specific information from the database
100 void prvExtractBlockSubTypeParams(uint32_t blockType, uint32_t blockSubType);
103 void prvExtractVersion();
105 // methods to calculate internal data
108
110 std::string m_errorText {};
111
112 // data obtained from the source file
116 TMapBlockSubTypeData m_mapBlockSubTypesData {};// <<type, subType>, SBlockData>
117 std::set<std::pair<uint32_t, uint32_t>> m_setIdTypeLOMIdSubtype {};
118};
119
120#endif /* LIBS_LOGIC_CLOGICSALLOWED_HPP_ */
Definition CLogicsAllowed.hpp:22
void prvExtractBlockParamsSize()
Definition CLogicsAllowed.cpp:689
bool m_isDataLoadedOk
Definition CLogicsAllowed.hpp:109
std::set< std::pair< uint32_t, uint32_t > > m_setIdTypeLOMIdSubtype
Definition CLogicsAllowed.hpp:117
void prvReadTable(const std::string &tableName)
Definition CLogicsAllowed.cpp:637
std::string m_errorText
Definition CLogicsAllowed.hpp:110
static std::optional< std::string > getSpecificDefaultParameterValue(iv::logic::LogicBlockId blockId, iv::logic::ParamId paramId)
Definition CLogicsAllowed.cpp:205
void eraseSubType(iv::logic::LogicBlockId pairTypeSubType)
Definition CLogicsAllowed.cpp:315
static bool isEditableDBBlockParam(iv::logic::eDBBlockParamType type)
Definition CLogicsAllowed.cpp:242
TMapBlockSubTypeData getBlockSubTypes() const
Definition CLogicsAllowed.cpp:466
static iv::logic::eDBBlockParamType enumDBBlockParamType(std::string_view strType)
Definition CLogicsAllowed.cpp:130
TMapBlockSubTypeData m_mapBlockSubTypesData
Definition CLogicsAllowed.hpp:116
std::map< iv::logic::eDBBlockParamType, uint8_t > TMapDBBlockParamSize
Definition CLogicsAllowed.hpp:27
CLogicsAllowed()
Definition CLogicsAllowed.cpp:501
static CLogicsAllowed & getInstance()
Definition CLogicsAllowed.cpp:308
std::map< iv::logic::ParamId, std::string > TMapDBBlockParamNStr
Definition CLogicsAllowed.hpp:25
void prvExtractBlockAllowedSubTypes()
Definition CLogicsAllowed.cpp:891
TMapBlockTypeDescription m_mapBlockTypesDesc
Definition CLogicsAllowed.hpp:115
static bool allowsExternalDescriptionDBBlockParam(iv::logic::eDBBlockParamType type)
Definition CLogicsAllowed.cpp:264
void collapseTreeStructure()
Definition CLogicsAllowed.cpp:320
std::string dbVersion() const
Definition CLogicsAllowed.cpp:419
static std::string_view strDBBlockParamType(iv::logic::eDBBlockParamType type)
Definition CLogicsAllowed.cpp:151
const std::string & getErrorText() const
Definition CLogicsAllowed.cpp:480
SPrvDBVersion m_dbVersion
Definition CLogicsAllowed.hpp:113
std::map< uint32_t, std::string > TMapBlockTypeDescription
Definition CLogicsAllowed.hpp:28
static std::string getDefaultParameterValue(iv::logic::eDBBlockParamType paramType)
Definition CLogicsAllowed.cpp:172
void prvCalculateAndStoreBlocksSize()
Definition CLogicsAllowed.cpp:1043
uint8_t blockSize(uint32_t blockType, uint32_t blockSubType) const
Definition CLogicsAllowed.cpp:403
bool isAllowedSubtypeInLOM(uint32_t idLOM, uint32_t idSubtype)
Definition CLogicsAllowed.cpp:509
void prvExtractBlockTypes()
Definition CLogicsAllowed.cpp:951
TMapDBBlockParamNStr blockParamsDesc(uint32_t blockType, uint32_t blockSubType) const
Definition CLogicsAllowed.cpp:387
std::string blockName(uint32_t blockType, uint32_t blockSubType) const
Definition CLogicsAllowed.cpp:367
TMapDBBlockParamSize m_mapBlockParamSize
Definition CLogicsAllowed.hpp:114
bool isEmpty() const
Definition CLogicsAllowed.cpp:515
void prvCalculateAndStoreData()
Definition CLogicsAllowed.cpp:1068
virtual ~CLogicsAllowed()=default
void prvExtractBlockParams()
Definition CLogicsAllowed.cpp:679
void prvExtractBlockSubTypeParams(uint32_t blockType, uint32_t blockSubType)
Definition CLogicsAllowed.cpp:744
std::map< iv::logic::LogicBlockId, SBlockData > TMapBlockSubTypeData
Definition CLogicsAllowed.hpp:29
TMapBlockTypeDescription getBlockTypesDesc() const
Definition CLogicsAllowed.cpp:473
void prvExtractBlockSubTypes()
Definition CLogicsAllowed.cpp:822
bool isDataLoadedOk() const
Definition CLogicsAllowed.cpp:494
const TMapDBBlockParamSize & getParamSizes() const
Definition CLogicsAllowed.cpp:487
bool loadData()
Definition CLogicsAllowed.cpp:430
uint8_t blockExtraSize(uint32_t blockType, uint32_t blockSubType) const
Definition CLogicsAllowed.cpp:351
void prvExtractVersion()
Definition CLogicsAllowed.cpp:988
static bool allowsParameterOnlineDBBlockParam(iv::logic::eDBBlockParamType type)
Definition CLogicsAllowed.cpp:286
eDBBlockParamType
Definition defines.hpp:20
Definition CLogicsAllowed.hpp:32
uint8_t m_extraSize
Definition CLogicsAllowed.hpp:35
uint8_t m_size
Definition CLogicsAllowed.hpp:34
TMapDBBlockParamNStr m_mapBlockParamDesc
Definition CLogicsAllowed.hpp:36
std::string m_name
Definition CLogicsAllowed.hpp:33
Definition CLogicsAllowed.hpp:74
SPrvDBVersion & operator=(SPrvDBVersion &&other)=delete
SPrvDBVersion(const SPrvDBVersion &other)=default
bool operator<(const SPrvDBVersion &other) const
Definition CLogicsAllowed.cpp:79
SPrvDBVersion & operator=(const SPrvDBVersion &other)=default
SPrvDBVersion(SPrvDBVersion &&other)=delete
std::string m_date
Definition CLogicsAllowed.hpp:86
std::string m_version
Definition CLogicsAllowed.hpp:84
std::string m_revision
Definition CLogicsAllowed.hpp:85
Definition structs.hpp:31
Definition structs.hpp:19