Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CUnitPatterns.hpp
Go to the documentation of this file.
1#ifndef LIBS_CHANNELS_CUNITPATTERNS_HPP_
2#define LIBS_CHANNELS_CUNITPATTERNS_HPP_
3
5#include "model/constants.hpp"
7
14{
15public:
25
35
36 typedef std::pair<iv::types::channelOrder, iv::types::channelOrder>
37 TChannelRange;// [start channel Id, end channel Id]
38 typedef std::map<TChannelRange, SChannelType *> TMapChannelRangeType;
39
40 CUnitPattern(iv::units::eUnitType unitType, int32_t maxWiredChannels);
41 CUnitPattern() = delete;
43 CUnitPattern(const CUnitPattern &other);
44 CUnitPattern(CUnitPattern &&other) = delete;
45 CUnitPattern &operator=(const CUnitPattern &other) = default;
47
48 static std::vector<iv::types::Range<iv::types::channelOrder>>
51 static bool isUnitIdValid(iv::units::eUnitType unitType, const iv::types::unitId &unitId);
53
54 [[nodiscard]] const TMapChannelRangeType &getWiredChannelRangeType() const;
55 [[nodiscard]] const SChannelTypeWired *getWiredChannelType(uint16_t channelId) const;
56 [[nodiscard]] const std::vector<SChannelType *> &getNonWiredChannelTypesAllowed() const;
57
58 [[nodiscard]] bool canHaveChannels() const;
59 [[nodiscard]] bool hasUnitInfo() const;
60 [[nodiscard]] bool isWiredChannelWATankChangeable(uint16_t channelId) const;
61
62private:
69 static void prvBuildPatternRMS();
71 void prvBuildPatternPMM();
73 static void prvBuildPatternSlim();
76
79 TMapChannelRangeType m_wiredChannelsType;// structure for wired channels
80
82 std::vector<SChannelType *>
83 m_nonWiredChannelTypesAllowed;// for this particular type of unit, what type of non wired channels can be added
84};
85
92{
93public:
94 static constexpr uint16_t kUnitsEmptyId = 0;
95 static constexpr uint32_t kUnitsStartId = 1;
96 static constexpr uint16_t kChannelsEmptyId = 0;
97 static constexpr uint16_t kChannelsStartId = 1;
98 static constexpr uint16_t kMaxChannelsAIM18 = 18;
99 static constexpr uint16_t kMaxChannelsDIM36 = 36;
100 static constexpr uint16_t kMaxChannelsDIOM24 = 24;
101 static constexpr uint16_t kMaxChannelsPMM = 27;
102 static constexpr uint16_t kMaxChannelsTIM28 = 32;
103 static constexpr uint16_t kMaxChannelsSLIM = 4;
104
105 static const CUnitPatterns &getInstance();
106
107 static std::pair<uint16_t, uint16_t> getEmptyUnitChannel();
108 static std::pair<uint16_t, uint16_t> getDefaultUnitChannel();
109
110 [[nodiscard]] const CUnitPattern &getPattern(iv::units::eUnitType unitType) const;
111 [[nodiscard]] const CUnitPattern::SChannelTypeWired *getWiredChannelType(iv::units::eUnitType unitType, uint16_t channelId) const;
112 [[nodiscard]] std::vector<iv::channels::eChannelSpecificType>
114
115 [[nodiscard]] bool isWiredChannelWATankChangeable(iv::units::eUnitType unitType, uint16_t channelId) const;
116
117 CUnitPatterns(const CUnitPatterns &other) = delete;
118 CUnitPatterns(CUnitPatterns &&other) = delete;
119 CUnitPatterns &operator=(const CUnitPatterns &other) = delete;
121
122private:
124 ~CUnitPatterns() = default;
125
126 static int32_t prvMaxWiredChannels(iv::units::eUnitType unitType);
127
129 std::map<iv::units::eUnitType, CUnitPattern> m_unitPatterns;
130};
131
132#endif /* LIBS_CHANNELS_CUNITPATTERNS_HPP_ */
Definition CUnitPatterns.hpp:14
static void getRangeUnitId(iv::units::eUnitType unitType, iv::types::unitId &start, iv::types::unitId &end)
Definition CUnitPatterns.cpp:205
void prvAddWiredChannelTypeRange(iv::channels::eChannelSpecificType chSpecificType, TChannelRange range, iv::channels::WiredAttributes::eIOType ioType)
Definition CUnitPatterns.cpp:414
CUnitPattern(CUnitPattern &&other)=delete
void prvBuildPatternDIOM24()
Definition CUnitPatterns.cpp:449
std::map< TChannelRange, SChannelType * > TMapChannelRangeType
Definition CUnitPatterns.hpp:38
CUnitPattern & operator=(CUnitPattern &&other)=delete
CUnitPattern & operator=(const CUnitPattern &other)=default
void prvBuildPatternAIM18()
Definition CUnitPatterns.cpp:427
void prvBuildPatternTIM28()
Definition CUnitPatterns.cpp:504
bool canHaveChannels() const
Definition CUnitPatterns.cpp:343
void prvAddCommonNonWiredChannelTypesAllowed(iv::units::eUnitType unitType)
Definition CUnitPatterns.cpp:524
CUnitPattern()=delete
const TMapChannelRangeType & getWiredChannelRangeType() const
Definition CUnitPatterns.cpp:305
const std::vector< SChannelType * > & getNonWiredChannelTypesAllowed() const
Definition CUnitPatterns.cpp:333
static iv::channels::eChannelBaseType getBaseType(iv::channels::eChannelSpecificType chSpecificType)
Definition CUnitPatterns.cpp:257
bool isWiredChannelWATankChangeable(uint16_t channelId) const
Definition CUnitPatterns.cpp:384
std::pair< iv::types::channelOrder, iv::types::channelOrder > TChannelRange
Definition CUnitPatterns.hpp:37
const SChannelTypeWired * getWiredChannelType(uint16_t channelId) const
Definition CUnitPatterns.cpp:310
~CUnitPattern()
Definition CUnitPatterns.cpp:29
static void prvBuildPatternRMS()
Definition CUnitPatterns.cpp:465
std::vector< SChannelType * > m_nonWiredChannelTypesAllowed
TODO RAG: ¿Habría que cambiar esto en un futuro a puntero inteligente?
Definition CUnitPatterns.hpp:83
TMapChannelRangeType m_wiredChannelsType
Definition CUnitPatterns.hpp:79
void prvBuildPatternLUM()
iv::units::eUnitType m_unitType
Definition CUnitPatterns.hpp:77
void prvAddNonWiredChannelTypeAllowed(iv::channels::eChannelSpecificType chSpecificType)
Definition CUnitPatterns.cpp:402
static std::vector< iv::types::Range< iv::types::channelOrder > > getRangeChannelOrder(iv::channels::eChannelSpecificType channelSpecificType, iv::units::eUnitType unitType)
Definition CUnitPatterns.cpp:89
void prvBuildPatternDIM36()
Definition CUnitPatterns.cpp:438
bool hasUnitInfo() const
Definition CUnitPatterns.cpp:354
int32_t m_maxWiredChannels
Definition CUnitPatterns.hpp:78
void prvBuildPattern(iv::units::eUnitType unitType)
Definition CUnitPatterns.cpp:541
void prvBuildPatternPMM()
Definition CUnitPatterns.cpp:469
static void prvBuildPatternSlim()
Definition CUnitPatterns.cpp:520
static bool isUnitIdValid(iv::units::eUnitType unitType, const iv::types::unitId &unitId)
Definition CUnitPatterns.cpp:250
Definition CUnitPatterns.hpp:92
CUnitPatterns(CUnitPatterns &&other)=delete
CUnitPatterns & operator=(CUnitPatterns &&other)=delete
static constexpr uint16_t kMaxChannelsPMM
Definition CUnitPatterns.hpp:101
static constexpr uint16_t kMaxChannelsDIM36
Definition CUnitPatterns.hpp:99
static std::pair< uint16_t, uint16_t > getDefaultUnitChannel()
Definition CUnitPatterns.cpp:588
static constexpr uint16_t kUnitsEmptyId
Definition CUnitPatterns.hpp:94
static const CUnitPatterns & getInstance()
Definition CUnitPatterns.cpp:576
bool isWiredChannelWATankChangeable(iv::units::eUnitType unitType, uint16_t channelId) const
Definition CUnitPatterns.cpp:633
CUnitPatterns & operator=(const CUnitPatterns &other)=delete
static constexpr uint32_t kUnitsStartId
Definition CUnitPatterns.hpp:95
static constexpr uint16_t kMaxChannelsSLIM
Definition CUnitPatterns.hpp:103
static constexpr uint16_t kMaxChannelsTIM28
Definition CUnitPatterns.hpp:102
static constexpr uint16_t kChannelsStartId
Definition CUnitPatterns.hpp:97
static constexpr uint16_t kChannelsEmptyId
Definition CUnitPatterns.hpp:96
const CUnitPattern & getPattern(iv::units::eUnitType unitType) const
Definition CUnitPatterns.cpp:593
std::map< iv::units::eUnitType, CUnitPattern > m_unitPatterns
TODO RAG: Pq esta clase no es directamente un map de eUnitType a CUnitPattern?
Definition CUnitPatterns.hpp:129
CUnitPatterns(const CUnitPatterns &other)=delete
CUnitPatterns()
Definition CUnitPatterns.cpp:638
static int32_t prvMaxWiredChannels(iv::units::eUnitType unitType)
Definition CUnitPatterns.cpp:648
~CUnitPatterns()=default
const CUnitPattern::SChannelTypeWired * getWiredChannelType(iv::units::eUnitType unitType, uint16_t channelId) const
Definition CUnitPatterns.cpp:607
static std::pair< uint16_t, uint16_t > getEmptyUnitChannel()
Definition CUnitPatterns.cpp:583
static constexpr uint16_t kMaxChannelsAIM18
Definition CUnitPatterns.hpp:98
static constexpr uint16_t kMaxChannelsDIOM24
Definition CUnitPatterns.hpp:100
std::vector< iv::channels::eChannelSpecificType > getNonWiredChannelTypesAllowed(iv::units::eUnitType unitType) const
Definition CUnitPatterns.cpp:614
eIOType
Definition WiredAttributes.hpp:15
eChannelSpecificType
Definition enums.hpp:72
eChannelBaseType
Definition enums.hpp:63
uint16_t unitId
Definition types.hpp:77
eUnitType
Definition enums.hpp:8
Definition CUnitPatterns.hpp:27
~SChannelTypeWired() override=default
iv::channels::WiredAttributes::eIOType m_ioType
Definition CUnitPatterns.hpp:33
Definition CUnitPatterns.hpp:17
iv::channels::eChannelSpecificType m_channelSpecificType
Definition CUnitPatterns.hpp:23
virtual ~SChannelType()=default
iv::channels::eChannelBaseType m_channelBaseType
Definition CUnitPatterns.hpp:22