AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
isobus_virtual_terminal_objects.cpp
Go to the documentation of this file.
1//================================================================================================
8//================================================================================================
10
11namespace isobus
12{
14 {
15 // The table can be altered at runtime. Init here to VT standard
16 colourTable[0] = VTColourVector(0.0f, 0.0f, 0.0f); // Black
17 colourTable[1] = VTColourVector(1.0f, 1.0f, 1.0f); // White
18 colourTable[2] = VTColourVector(0.0f, (153.0f / 255.0f), 0.0f); // Green
19 colourTable[3] = VTColourVector(0.0f, (153.0f / 255.0f), (153.0f / 255.0f)); // Teal
20 colourTable[4] = VTColourVector((153.0f / 255.0f), 0.0f, 0.0f); // Maroon
21 colourTable[5] = VTColourVector((153.0f / 255.0f), 0.0f, (153.0f / 255.0f)); // Purple
22 colourTable[6] = VTColourVector((153.0f / 255.0f), (153.0f / 255.0f), 0.0f); // Olive
23 colourTable[7] = VTColourVector((204.0f / 255.0f), (204.0f / 255.0f), (204.0f / 255.0f)); // Silver
24 colourTable[8] = VTColourVector((153.0f / 255.0f), (153.0f / 255.0f), (153.0f / 255.0f)); // Grey
25 colourTable[9] = VTColourVector(0.0f, 0.0f, 1.0f); // Blue
26 colourTable[10] = VTColourVector(0.0f, 1.0f, 0.0f); // Lime
27 colourTable[11] = VTColourVector(0.0f, 1.0f, 1.0f); // Cyan
28 colourTable[12] = VTColourVector(1.0f, 0.0f, 0.0f); // Red
29 colourTable[13] = VTColourVector(1.0f, 0.0f, 1.0f); // Magenta
30 colourTable[14] = VTColourVector(1.0f, 1.0f, 0.0f); // Yellow
31 colourTable[15] = VTColourVector(0.0f, 0.0f, (153.0f / 255.0f)); // Navy
32
33 // This section of the table increases with a pattern
34 for (std::uint8_t i = 16; i <= 231; i++)
35 {
36 std::uint8_t index = i - 16;
37
38 std::uint32_t redCounter = (index / 36);
39 std::uint32_t greenCounter = ((index / 6) % 6);
40 std::uint32_t blueCounter = (index % 6);
41
42 colourTable[i] = VTColourVector((51.0f * (redCounter) / 255.0f), ((51.0f * (greenCounter)) / 255.0f), ((51.0f * blueCounter) / 255.0f));
43 }
44
45 // The rest are proprietary. Init to white for now.
46 for (std::uint16_t i = 232; i < VT_COLOUR_TABLE_SIZE; i++)
47 {
48 colourTable[i] = VTColourVector(1.0f, 1.0f, 1.0f);
49 }
50 }
51
52 VTColourVector VTColourTable::get_colour(std::uint8_t colourIndex) const
53 {
54 return colourTable.at(colourIndex);
55 }
56
57 void VTColourTable::set_colour(std::uint8_t colourIndex, VTColourVector newColour)
58 {
59 colourTable.at(colourIndex) = newColour;
60 }
61
62 std::uint16_t VTObject::get_id() const
63 {
64 return objectID;
65 }
66
67 void VTObject::set_id(std::uint16_t value)
68 {
69 objectID = value;
70 }
71
72 std::uint16_t VTObject::get_width() const
73 {
74 return width;
75 }
76
77 void VTObject::set_width(std::uint16_t value)
78 {
79 width = value;
80 }
81
82 std::uint16_t VTObject::get_height() const
83 {
84 return height;
85 }
86
87 void VTObject::set_height(std::uint16_t value)
88 {
89 height = value;
90 }
91
92 std::uint8_t VTObject::get_background_color() const
93 {
94 return backgroundColor;
95 }
96
97 void VTObject::set_background_color(std::uint8_t value)
98 {
99 backgroundColor = value;
100 }
101
102 std::uint16_t VTObject::get_number_children() const
103 {
104 return static_cast<std::uint16_t>(children.size());
105 }
106
107 void VTObject::add_child(std::uint16_t objectID, std::int16_t relativeXLocation, std::int16_t relativeYLocation)
108 {
109 children.push_back(ChildObjectData(objectID, relativeXLocation, relativeYLocation));
110 }
111
112 std::uint16_t VTObject::get_child_id(std::uint16_t index) const
113 {
114 std::uint16_t retVal = NULL_OBJECT_ID;
115
116 if (index < children.size())
117 {
118 retVal = children[index].id;
119 }
120 return retVal;
121 }
122
123 std::int16_t VTObject::get_child_x(std::uint16_t index) const
124 {
125 std::int16_t retVal = 0;
126
127 if (index < children.size())
128 {
129 retVal = children[index].xLocation;
130 }
131 return retVal;
132 }
133
134 std::int16_t VTObject::get_child_y(std::uint16_t index) const
135 {
136 std::int16_t retVal = 0;
137
138 if (index < children.size())
139 {
140 retVal = children[index].yLocation;
141 }
142 return retVal;
143 }
144
145 void VTObject::set_child_x(std::uint16_t index, std::int16_t xOffset)
146 {
147 if (index < children.size())
148 {
149 children.at(index).xLocation = xOffset;
150 }
151 }
152
153 void VTObject::set_child_y(std::uint16_t index, std::int16_t yOffset)
154 {
155 if (index < children.size())
156 {
157 children.at(index).yLocation = yOffset;
158 }
159 }
160
161 bool VTObject::offset_all_children_with_id(std::uint16_t childObjectID, std::int8_t xOffset, std::int8_t yOffset)
162 {
163 bool retVal = false;
164
165 for (auto &child : children)
166 {
167 if (child.id == childObjectID)
168 {
169 child.xLocation += xOffset;
170 child.yLocation += yOffset;
171 }
172 }
173 return retVal;
174 }
175
176 void VTObject::remove_child(std::uint16_t objectIDToRemove, std::int16_t relativeXLocation, std::int16_t relativeYLocation)
177 {
178 for (auto child = children.begin(); child != children.end(); child++)
179 {
180 if ((child->id == objectIDToRemove) && (child->xLocation == relativeXLocation) && (child->yLocation == relativeYLocation))
181 {
182 children.erase(child);
183 break;
184 }
185 }
186 }
187
189 {
190 if (!children.empty())
191 {
192 children.pop_back();
193 }
194 }
195
196 std::uint8_t VTObject::get_number_macros() const
197 {
198 return static_cast<std::uint8_t>(macros.size());
199 }
200
202 {
203 macros.push_back(macroToAdd);
204 }
205
206 MacroMetadata VTObject::get_macro(std::uint8_t index) const
207 {
208 if (index < macros.size())
209 {
210 return macros[index];
211 }
212 else
213 {
215 }
216 }
217
218 std::shared_ptr<VTObject> VTObject::get_object_by_id(std::uint16_t objectID, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool)
219 {
220 std::shared_ptr<VTObject> retVal = nullptr;
221
222 if ((NULL_OBJECT_ID != objectID) && (objectPool.find(objectID) != objectPool.end()))
223 {
224 auto object = objectPool.at(objectID);
225 if (nullptr != object)
226 {
227 retVal = object;
228 }
229 }
230 return retVal;
231 }
232
234 std::int16_t x,
235 std::int16_t y) :
236 id(objectId),
237 xLocation(x),
238 yLocation(y)
239 {
240 }
241
246
248 {
249 return MIN_OBJECT_LENGTH;
250 }
251
252 bool WorkingSet::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
253 {
254 bool anyWrongChildType = false;
255
256 for (const auto &child : children)
257 {
258 auto childObject = get_object_by_id(child.id, objectPool);
259 if (nullptr != childObject)
260 {
261 switch (childObject->get_object_type())
262 {
277 {
278 // Valid Objects
279 }
280 break;
281
282 default:
283 {
284 anyWrongChildType = true;
285 }
286 break;
287 }
288 }
289 }
290 return ((!anyWrongChildType) &&
292 }
293
294 bool WorkingSet::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
295 {
296 bool retVal = false;
297
298 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
299 {
300 switch (static_cast<AttributeName>(attributeID))
301 {
302 case AttributeName::BackgroundColour:
303 {
304 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
305 retVal = true;
306 }
307 break;
308
309 case AttributeName::Selectable:
310 {
311 set_selectable(0 != rawAttributeData);
312 retVal = true;
313 }
314 break;
315
316 case AttributeName::ActiveMask:
317 {
318 set_active_mask(static_cast<std::uint16_t>(rawAttributeData));
319 retVal = true;
320 }
321 break;
322
323 default:
324 {
325 returnedError = AttributeError::InvalidAttributeID;
326 }
327 break;
328 }
329 }
330 else
331 {
332 returnedError = AttributeError::InvalidAttributeID;
333 }
334 return retVal;
335 }
336
337 bool WorkingSet::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
338 {
339 bool retVal = false;
340
341 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
342 {
343 switch (attributeID)
344 {
345 case static_cast<std::uint8_t>(AttributeName::Type):
346 {
347 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
348 retVal = true;
349 }
350 break;
351
352 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
353 {
354 returnedAttributeData = get_background_color();
355 retVal = true;
356 }
357 break;
358
359 case static_cast<std::uint8_t>(AttributeName::Selectable):
360 {
361 returnedAttributeData = get_selectable();
362 retVal = true;
363 }
364 break;
365
366 case static_cast<std::uint8_t>(AttributeName::ActiveMask):
367 {
368 returnedAttributeData = get_active_mask();
369 retVal = true;
370 }
371 break;
372
373 default:
374 {
375 // Do nothing, return false
376 }
377 break;
378 }
379 }
380 return retVal;
381 }
382
384 {
385 return selectable;
386 }
387
389 {
390 selectable = value;
391 }
392
393 std::uint16_t WorkingSet::get_active_mask() const
394 {
395 return activeMask;
396 }
397
398 void WorkingSet::set_active_mask(std::uint16_t value)
399 {
400 activeMask = value;
401 }
402
407
409 {
410 return MIN_OBJECT_LENGTH;
411 }
412
413 bool DataMask::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
414 {
415 bool anyWrongChildType = false;
416 std::uint8_t numberOfSoftKeyMasks = 0;
417
418 for (auto &child : children)
419 {
420 auto childObject = get_object_by_id(child.id, objectPool);
421 if (nullptr != childObject)
422 {
423 switch (childObject->get_object_type())
424 {
450 {
451 // Valid Objects
452 }
453 break;
454
456 {
457 // Valid Objects
458 numberOfSoftKeyMasks++;
459 }
460 break;
461
462 default:
463 {
464 anyWrongChildType = true;
465 }
466 break;
467 }
468
469 if (numberOfSoftKeyMasks > 1)
470 {
471 anyWrongChildType = true;
472 }
473 }
474 }
475
476 return ((!anyWrongChildType) &&
478 }
479
480 bool DataMask::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
481 {
482 bool retVal = false;
483
484 if (attributeID < static_cast<std::uint8_t>(DataMask::AttributeName::NumberOfAttributes))
485 {
486 switch (static_cast<DataMask::AttributeName>(attributeID))
487 {
488 case DataMask::AttributeName::BackgroundColour:
489 {
490 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
491 retVal = true;
492 }
493 break;
494
495 case DataMask::AttributeName::SoftKeyMask:
496 {
497 returnedError = AttributeError::InvalidAttributeID;
498 retVal = change_soft_key_mask(static_cast<std::uint16_t>(rawAttributeData), objectPool);
499 }
500 break;
501
502 default:
503 {
504 returnedError = AttributeError::InvalidAttributeID;
505 }
506 break;
507 }
508 }
509 else
510 {
511 returnedError = AttributeError::InvalidAttributeID;
512 }
513 return retVal;
514 }
515
516 bool DataMask::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
517 {
518 bool retVal = false;
519
520 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
521 {
522 switch (attributeID)
523 {
524 case static_cast<std::uint8_t>(AttributeName::Type):
525 {
526 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
527 retVal = true;
528 }
529 break;
530
531 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
532 {
533 returnedAttributeData = get_background_color();
534 retVal = true;
535 }
536 break;
537
538 case static_cast<std::uint8_t>(AttributeName::SoftKeyMask):
539 {
540 returnedAttributeData = get_soft_key_mask();
541 retVal = true;
542 }
543 break;
544
545 default:
546 {
547 // Do nothing, return false
548 }
549 break;
550 }
551 }
552 return retVal;
553 }
554
555 bool DataMask::change_soft_key_mask(std::uint16_t newMaskID, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool)
556 {
557 bool retVal = false;
558
559 if (NULL_OBJECT_ID == newMaskID)
560 {
561 set_soft_key_mask(newMaskID);
562 retVal = true;
563 }
564 else if ((objectPool.end() != objectPool.find(newMaskID)) &&
565 (nullptr != objectPool.at(newMaskID)) &&
566 (VirtualTerminalObjectType::SoftKeyMask == objectPool.at(newMaskID)->get_object_type()))
567 {
568 set_soft_key_mask(newMaskID);
569 retVal = true;
570 }
571 return retVal;
572 }
573
574 void DataMask::set_soft_key_mask(std::uint16_t newMaskID)
575 {
576 softKeyMaskObjectID = newMaskID;
577 }
578
579 std::uint16_t DataMask::get_soft_key_mask() const
580 {
581 return softKeyMaskObjectID;
582 }
583
588
590 {
591 return MIN_OBJECT_LENGTH;
592 }
593
594 bool AlarmMask::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
595 {
596 bool anyWrongChildType = false;
597
598 for (auto &child : children)
599 {
600 auto childObject = get_object_by_id(child.id, objectPool);
601 if (nullptr != childObject)
602 {
603 switch (childObject->get_object_type())
604 {
631 {
632 // Valid Objects
633 }
634 break;
635
636 default:
637 {
638 anyWrongChildType = true;
639 }
640 break;
641 }
642 }
643 }
644 return ((!anyWrongChildType) &&
646 }
647
648 bool AlarmMask::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
649 {
650 bool retVal = false;
651
652 if (attributeID < static_cast<std::uint8_t>(AlarmMask::AttributeName::NumberOfAttributes))
653 {
654 switch (static_cast<AlarmMask::AttributeName>(attributeID))
655 {
656 case AlarmMask::AttributeName::BackgroundColour:
657 {
658 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
659 retVal = true;
660 }
661 break;
662
663 case AlarmMask::AttributeName::SoftKeyMask:
664 {
665 returnedError = AttributeError::AnyOtherError;
666 retVal = change_soft_key_mask(static_cast<std::uint16_t>(rawAttributeData), objectPool);
667 }
668 break;
669
670 case AlarmMask::AttributeName::Priority:
671 {
672 if (rawAttributeData <= static_cast<std::uint8_t>(AlarmMask::Priority::Low))
673 {
674 set_mask_priority(static_cast<AlarmMask::Priority>(rawAttributeData));
675 retVal = true;
676 }
677 else
678 {
679 returnedError = AttributeError::AnyOtherError;
680 }
681 }
682 break;
683
684 case AlarmMask::AttributeName::AcousticSignal:
685 {
686 if (rawAttributeData <= static_cast<std::uint8_t>(AlarmMask::AcousticSignal::None))
687 {
688 set_signal_priority(static_cast<AlarmMask::AcousticSignal>(rawAttributeData));
689 retVal = true;
690 }
691 else
692 {
693 returnedError = AttributeError::AnyOtherError;
694 }
695 }
696 break;
697
698 default:
699 {
700 returnedError = AttributeError::InvalidAttributeID;
701 }
702 break;
703 }
704 }
705 else
706 {
707 returnedError = AttributeError::InvalidAttributeID;
708 }
709 return retVal;
710 }
711
712 bool AlarmMask::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
713 {
714 bool retVal = false;
715
716 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
717 {
718 switch (attributeID)
719 {
720 case static_cast<std::uint8_t>(AttributeName::Type):
721 {
722 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
723 retVal = true;
724 }
725 break;
726
727 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
728 {
729 returnedAttributeData = get_background_color();
730 retVal = true;
731 }
732 break;
733
734 case static_cast<std::uint8_t>(AttributeName::SoftKeyMask):
735 {
736 returnedAttributeData = get_soft_key_mask();
737 retVal = true;
738 }
739 break;
740
741 case static_cast<std::uint8_t>(AttributeName::Priority):
742 {
743 returnedAttributeData = static_cast<std::uint8_t>(get_mask_priority());
744 retVal = true;
745 }
746 break;
747
748 case static_cast<std::uint8_t>(AttributeName::AcousticSignal):
749 {
750 returnedAttributeData = static_cast<std::uint8_t>(get_signal_priority());
751 retVal = true;
752 }
753 break;
754
755 default:
756 {
757 // Do nothing, return false
758 }
759 break;
760 }
761 }
762 return retVal;
763 }
764
766 {
767 return maskPriority;
768 }
769
771 {
772 maskPriority = value;
773 }
774
776 {
777 return signalPriority;
778 }
779
781 {
782 signalPriority = value;
783 }
784
785 bool AlarmMask::change_soft_key_mask(std::uint16_t newMaskID, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool)
786 {
787 bool retVal = false;
788
789 if (NULL_OBJECT_ID == newMaskID)
790 {
791 set_soft_key_mask(newMaskID);
792 retVal = true;
793 }
794 else if ((nullptr != objectPool.at(newMaskID)) &&
795 (VirtualTerminalObjectType::SoftKeyMask == objectPool.at(newMaskID)->get_object_type()))
796 {
797 set_soft_key_mask(newMaskID);
798 retVal = true;
799 }
800 return retVal;
801 }
802
803 void AlarmMask::set_soft_key_mask(std::uint16_t newMaskID)
804 {
805 softKeyMask = newMaskID;
806 }
807
808 std::uint16_t AlarmMask::get_soft_key_mask() const
809 {
810 return softKeyMask;
811 }
812
817
819 {
820 return MIN_OBJECT_LENGTH;
821 }
822
823 bool Container::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
824 {
825 bool anyWrongChildType = false;
826
827 for (auto &child : children)
828 {
829 auto childObject = get_object_by_id(child.id, objectPool);
830 if (nullptr != childObject)
831 {
832 switch (childObject->get_object_type())
833 {
860 {
861 // Valid Child Object
862 }
863 break;
864
865 default:
866 {
867 anyWrongChildType = true;
868 }
869 break;
870 }
871 }
872 }
873 return ((!anyWrongChildType) &&
875 }
876
877 bool Container::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
878 {
879 // All attributes are read only
880 returnedError = AttributeError::InvalidAttributeID;
881 return false;
882 }
883
884 bool Container::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
885 {
886 bool retVal = false;
887
888 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
889 {
890 switch (attributeID)
891 {
892 case static_cast<std::uint8_t>(AttributeName::Type):
893 {
894 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
895 retVal = true;
896 }
897 break;
898
899 case static_cast<std::uint8_t>(AttributeName::Width):
900 {
901 returnedAttributeData = get_width();
902 retVal = true;
903 }
904 break;
905
906 case static_cast<std::uint8_t>(AttributeName::Height):
907 {
908 returnedAttributeData = get_height();
909 retVal = true;
910 }
911 break;
912
913 case static_cast<std::uint8_t>(AttributeName::Hidden):
914 {
915 returnedAttributeData = get_hidden();
916 retVal = true;
917 }
918 break;
919
920 default:
921 {
922 // Do nothing, return false
923 }
924 break;
925 }
926 }
927 return retVal;
928 }
929
931 {
932 return hidden;
933 }
934
935 void Container::set_hidden(bool value)
936 {
937 hidden = value;
938 }
939
944
946 {
947 return MIN_OBJECT_LENGTH;
948 }
949
950 bool SoftKeyMask::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
951 {
952 bool anyWrongChildType = false;
953
954 for (auto &child : children)
955 {
956 auto childObject = get_object_by_id(child.id, objectPool);
957 if (nullptr != childObject)
958 {
959 switch (childObject->get_object_type())
960 {
965 {
966 // Valid Child Object
967 }
968 break;
969
970 default:
971 {
972 anyWrongChildType = true;
973 }
974 break;
975 }
976 }
977 }
978 return ((!anyWrongChildType) &&
980 }
981
982 bool SoftKeyMask::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
983 {
984 bool retVal = false;
985
986 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
987 {
988 switch (static_cast<AttributeName>(attributeID))
989 {
990 case AttributeName::BackgroundColour:
991 {
992 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
993 retVal = true;
994 }
995 break;
996
997 default:
998 {
999 returnedError = AttributeError::InvalidAttributeID;
1000 }
1001 break;
1002 }
1003 }
1004 else
1005 {
1006 returnedError = AttributeError::InvalidAttributeID;
1007 }
1008 return retVal;
1009 }
1010
1011 bool SoftKeyMask::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
1012 {
1013 bool retVal = false;
1014
1015 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1016 {
1017 switch (attributeID)
1018 {
1019 case static_cast<std::uint8_t>(AttributeName::Type):
1020 {
1021 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
1022 retVal = true;
1023 }
1024 break;
1025
1026 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
1027 {
1028 returnedAttributeData = get_background_color();
1029 retVal = true;
1030 }
1031 break;
1032
1033 default:
1034 {
1035 // Do nothing, return false
1036 }
1037 break;
1038 }
1039 }
1040 return retVal;
1041 }
1042
1047
1049 {
1050 return MIN_OBJECT_LENGTH;
1051 }
1052
1053 bool Key::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
1054 {
1055 bool anyWrongChildType = false;
1056
1057 for (auto &child : children)
1058 {
1059 auto childObject = get_object_by_id(child.id, objectPool);
1060 if (nullptr != childObject)
1061 {
1062 switch (childObject->get_object_type())
1063 {
1082 {
1083 // Valid Child Object
1084 }
1085 break;
1086
1087 default:
1088 {
1089 anyWrongChildType = true;
1090 }
1091 break;
1092 }
1093 }
1094 }
1095 return ((!anyWrongChildType) &&
1097 }
1098
1099 bool Key::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
1100 {
1101 bool retVal = false;
1102
1103 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1104 {
1105 switch (static_cast<AttributeName>(attributeID))
1106 {
1107 case AttributeName::BackgroundColour:
1108 {
1109 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
1110 retVal = true;
1111 }
1112 break;
1113
1114 case AttributeName::KeyCode:
1115 {
1116 set_key_code(static_cast<std::uint8_t>(rawAttributeData));
1117 retVal = true;
1118 }
1119 break;
1120
1121 default:
1122 {
1123 returnedError = AttributeError::InvalidAttributeID;
1124 }
1125 break;
1126 }
1127 }
1128 else
1129 {
1130 returnedError = AttributeError::InvalidAttributeID;
1131 }
1132 return retVal;
1133 }
1134
1135 bool Key::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
1136 {
1137 bool retVal = false;
1138
1139 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1140 {
1141 switch (attributeID)
1142 {
1143 case static_cast<std::uint8_t>(AttributeName::Type):
1144 {
1145 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
1146 retVal = true;
1147 }
1148 break;
1149
1150 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
1151 {
1152 returnedAttributeData = get_background_color();
1153 retVal = true;
1154 }
1155 break;
1156
1157 case static_cast<std::uint8_t>(AttributeName::KeyCode):
1158 {
1159 returnedAttributeData = get_key_code();
1160 retVal = true;
1161 }
1162 break;
1163
1164 default:
1165 {
1166 // Do nothing, return false
1167 }
1168 break;
1169 }
1170 }
1171 return retVal;
1172 }
1173
1174 std::uint8_t Key::get_key_code() const
1175 {
1176 return keyCode;
1177 }
1178
1179 void Key::set_key_code(std::uint8_t value)
1180 {
1181 keyCode = value;
1182 }
1183
1188
1190 {
1191 return MIN_OBJECT_LENGTH;
1192 }
1193
1194 bool KeyGroup::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
1195 {
1196 bool anyWrongChildType = false;
1197
1198 if (NULL_OBJECT_ID != get_name_object_id())
1199 {
1200 for (auto &child : children)
1201 {
1202 auto childObject = get_object_by_id(child.id, objectPool);
1203 if (nullptr != childObject)
1204 {
1205 switch (childObject->get_object_type())
1206 {
1209 {
1210 // Key and macro are always valid
1211 }
1212 break;
1213
1215 {
1216 auto objectPointer = std::static_pointer_cast<ObjectPointer>(childObject);
1217
1218 if (NULL_OBJECT_ID != objectPointer->get_value())
1219 {
1220 if ((nullptr != get_object_by_id(objectPointer->get_value(), objectPool)) &&
1221 (VirtualTerminalObjectType::Key == get_object_by_id(objectPointer->get_value(), objectPool)->get_object_type()))
1222 {
1223 // Valid Child Object
1224 }
1225 else
1226 {
1227 anyWrongChildType = true;
1228 }
1229 }
1230 else
1231 {
1232 // If there's no children, then it's valid
1233 }
1234 }
1235 break;
1236
1237 default:
1238 {
1239 anyWrongChildType = true;
1240 }
1241 break;
1242 }
1243 }
1244 }
1245
1246 if (!validate_name(nameID, objectPool))
1247 {
1248 anyWrongChildType = true;
1249 }
1250 }
1251 else
1252 {
1253 anyWrongChildType = true;
1254 }
1255 return ((!anyWrongChildType) &&
1257 }
1258
1259 bool KeyGroup::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
1260 {
1261 bool retVal = false;
1262
1263 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1264 {
1265 switch (static_cast<AttributeName>(attributeID))
1266 {
1267 case AttributeName::Options:
1268 {
1269 set_options(static_cast<std::uint8_t>(rawAttributeData));
1270 retVal = true;
1271 }
1272 break;
1273
1274 case AttributeName::Name:
1275 {
1276 returnedError = AttributeError::InvalidValue;
1277
1278 if (objectPool.find(objectID) != objectPool.end())
1279 {
1280 auto newName = static_cast<std::uint16_t>(rawAttributeData);
1281 auto newNameObject = objectPool.at(newName);
1282
1283 if (validate_name(newName, objectPool))
1284 {
1285 nameID = newName;
1286 retVal = true;
1287 }
1288 }
1289 }
1290 break;
1291
1292 default:
1293 {
1294 returnedError = AttributeError::InvalidAttributeID;
1295 }
1296 break;
1297 }
1298 }
1299 else
1300 {
1301 returnedError = AttributeError::InvalidAttributeID;
1302 }
1303 return retVal;
1304 }
1305
1306 bool KeyGroup::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
1307 {
1308 bool retVal = false;
1309
1310 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1311 {
1312 switch (attributeID)
1313 {
1314 case static_cast<std::uint8_t>(AttributeName::Type):
1315 {
1316 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
1317 retVal = true;
1318 }
1319 break;
1320
1321 case static_cast<std::uint8_t>(AttributeName::Options):
1322 {
1323 returnedAttributeData = optionsBitfield;
1324 retVal = true;
1325 }
1326 break;
1327
1328 case static_cast<std::uint8_t>(AttributeName::Name):
1329 {
1330 returnedAttributeData = get_name_object_id();
1331 retVal = true;
1332 }
1333 break;
1334
1335 default:
1336 {
1337 // Do nothing, return false
1338 }
1339 break;
1340 }
1341 }
1342 return retVal;
1343 }
1344
1345 std::uint16_t KeyGroup::get_key_group_icon() const
1346 {
1347 return keyGroupIcon;
1348 }
1349
1350 void KeyGroup::set_key_group_icon(std::uint16_t value)
1351 {
1352 keyGroupIcon = value;
1353 }
1354
1356 {
1357 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
1358 }
1359
1360 void KeyGroup::set_options(std::uint8_t value)
1361 {
1362 optionsBitfield = value;
1363 }
1364
1365 void KeyGroup::set_option(Options option, bool value)
1366 {
1367 if (value)
1368 {
1369 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
1370 }
1371 else
1372 {
1373 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
1374 }
1375 }
1376
1377 std::uint16_t KeyGroup::get_name_object_id() const
1378 {
1379 return nameID;
1380 }
1381
1382 void KeyGroup::set_name_object_id(std::uint16_t value)
1383 {
1384 // This value cannot be NULL_OBJECT_ID after it has been set!
1385 if (NULL_OBJECT_ID != value)
1386 {
1387 nameID = value;
1388 }
1389 }
1390
1391 bool KeyGroup::validate_name(std::uint16_t nameIDToValidate, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
1392 {
1393 auto newNameObject = objectPool.at(nameIDToValidate);
1394 bool retVal = false;
1395
1396 if ((NULL_OBJECT_ID != nameIDToValidate) &&
1397 (nullptr != newNameObject) &&
1398 ((VirtualTerminalObjectType::OutputString == newNameObject->get_object_type()) ||
1399 (VirtualTerminalObjectType::ObjectPointer == newNameObject->get_object_type())))
1400 {
1401 if (VirtualTerminalObjectType::ObjectPointer == newNameObject->get_object_type())
1402 {
1403 if (newNameObject->get_number_children() > 0)
1404 {
1405 auto label = objectPool.at(std::static_pointer_cast<ObjectPointer>(newNameObject)->get_child_id(0));
1406
1407 if ((nullptr != label) &&
1408 (VirtualTerminalObjectType::OutputString == label->get_object_type()))
1409 {
1410 retVal = true;
1411 }
1412 }
1413 }
1414 else
1415 {
1416 retVal = true;
1417 }
1418 }
1419 return retVal;
1420 }
1421
1426
1428 {
1429 return MIN_OBJECT_LENGTH;
1430 }
1431
1432 bool Button::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
1433 {
1434 bool anyWrongChildType = false;
1435
1436 for (auto &child : children)
1437 {
1438 auto childObject = get_object_by_id(child.id, objectPool);
1439 if (nullptr != childObject)
1440 {
1441 switch (childObject->get_object_type())
1442 {
1460 {
1461 // Valid Child Object
1462 }
1463 break;
1464
1465 default:
1466 {
1467 anyWrongChildType = true;
1468 }
1469 break;
1470 }
1471 }
1472 }
1473 return ((!anyWrongChildType) &&
1475 }
1476
1477 bool Button::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
1478 {
1479 bool retVal = false;
1480
1481 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1482 {
1483 switch (static_cast<AttributeName>(attributeID))
1484 {
1485 case AttributeName::Width:
1486 {
1487 set_width(static_cast<std::uint16_t>(rawAttributeData));
1488 retVal = true;
1489 }
1490 break;
1491
1492 case AttributeName::Height:
1493 {
1494 set_height(static_cast<std::uint16_t>(rawAttributeData));
1495 retVal = true;
1496 }
1497 break;
1498
1499 case AttributeName::BackgroundColour:
1500 {
1501 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
1502 retVal = true;
1503 }
1504 break;
1505
1506 case AttributeName::BorderColour:
1507 {
1508 set_border_colour(static_cast<std::uint8_t>(rawAttributeData));
1509 retVal = true;
1510 }
1511 break;
1512
1513 case AttributeName::KeyCode:
1514 {
1515 set_key_code(static_cast<std::uint8_t>(rawAttributeData));
1516 retVal = true;
1517 }
1518 break;
1519
1520 case AttributeName::Options:
1521 {
1522 set_options(static_cast<std::uint8_t>(rawAttributeData));
1523 retVal = true;
1524 }
1525 break;
1526
1527 default:
1528 {
1529 returnedError = AttributeError::InvalidAttributeID;
1530 }
1531 break;
1532 }
1533 }
1534 else
1535 {
1536 returnedError = AttributeError::InvalidAttributeID;
1537 }
1538 return retVal;
1539 }
1540
1541 bool Button::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
1542 {
1543 bool retVal = false;
1544
1545 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1546 {
1547 switch (attributeID)
1548 {
1549 case static_cast<std::uint8_t>(AttributeName::Type):
1550 {
1551 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
1552 retVal = true;
1553 }
1554 break;
1555
1556 case static_cast<std::uint8_t>(AttributeName::Width):
1557 {
1558 returnedAttributeData = get_width();
1559 retVal = true;
1560 }
1561 break;
1562
1563 case static_cast<std::uint8_t>(AttributeName::Height):
1564 {
1565 returnedAttributeData = get_height();
1566 retVal = true;
1567 }
1568 break;
1569
1570 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
1571 {
1572 returnedAttributeData = get_background_color();
1573 retVal = true;
1574 }
1575 break;
1576
1577 case static_cast<std::uint8_t>(AttributeName::BorderColour):
1578 {
1579 returnedAttributeData = get_border_colour();
1580 retVal = true;
1581 }
1582 break;
1583
1584 case static_cast<std::uint8_t>(AttributeName::KeyCode):
1585 {
1586 returnedAttributeData = get_key_code();
1587 retVal = true;
1588 }
1589 break;
1590
1591 case static_cast<std::uint8_t>(AttributeName::Options):
1592 {
1593 returnedAttributeData = optionsBitfield;
1594 retVal = true;
1595 }
1596 break;
1597
1598 default:
1599 {
1600 // Do nothing, return false
1601 }
1602 break;
1603 }
1604 }
1605 return retVal;
1606 }
1607
1608 std::uint8_t Button::get_key_code() const
1609 {
1610 return keyCode;
1611 }
1612
1613 void Button::set_key_code(std::uint8_t value)
1614 {
1615 keyCode = value;
1616 }
1617
1618 std::uint8_t Button::get_border_colour() const
1619 {
1620 return borderColour;
1621 }
1622
1623 void Button::set_border_colour(std::uint8_t value)
1624 {
1625 borderColour = value;
1626 }
1627
1628 bool Button::get_option(Options option) const
1629 {
1630 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
1631 }
1632
1633 void Button::set_options(std::uint8_t value)
1634 {
1635 optionsBitfield = value;
1636 }
1637
1638 void Button::set_option(Options option, bool value)
1639 {
1640 if (value)
1641 {
1642 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
1643 }
1644 else
1645 {
1646 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
1647 }
1648 }
1649
1654
1656 {
1657 return MIN_OBJECT_LENGTH;
1658 }
1659
1660 bool InputBoolean::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
1661 {
1662 bool anyWrongChildType = false;
1663
1664 // Verify the variable reference is a number variable or NULL_OBJECT_ID
1665 if (NULL_OBJECT_ID != get_variable_reference())
1666 {
1667 auto variableReference = get_object_by_id(get_variable_reference(), objectPool);
1668
1669 if (nullptr != variableReference)
1670 {
1671 if (VirtualTerminalObjectType::NumberVariable != variableReference->get_object_type())
1672 {
1673 anyWrongChildType = true;
1674 }
1675 }
1676 else
1677 {
1678 anyWrongChildType = true;
1679 }
1680 }
1681
1682 // Verify that the foreground colour is a font attribute or NULL_OBJECT_ID
1683 if (NULL_OBJECT_ID != get_foreground_colour_object_id())
1684 {
1685 auto foregroundColour = get_object_by_id(get_foreground_colour_object_id(), objectPool);
1686
1687 if (nullptr != foregroundColour)
1688 {
1689 if (VirtualTerminalObjectType::FontAttributes != foregroundColour->get_object_type())
1690 {
1691 anyWrongChildType = true;
1692 }
1693 }
1694 else
1695 {
1696 anyWrongChildType = true;
1697 }
1698 }
1699
1700 for (const auto &child : children)
1701 {
1702 auto childObject = get_object_by_id(child.id, objectPool);
1703
1704 if ((nullptr == childObject) ||
1705 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
1706 {
1707 anyWrongChildType = true;
1708 break;
1709 }
1710 }
1711 return (!anyWrongChildType);
1712 }
1713
1714 bool InputBoolean::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
1715 {
1716 bool retVal = false;
1717
1718 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1719 {
1720 switch (static_cast<AttributeName>(attributeID))
1721 {
1722 case AttributeName::BackgroundColour:
1723 {
1724 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
1725 retVal = true;
1726 }
1727 break;
1728
1729 case AttributeName::Width:
1730 {
1731 set_width(static_cast<std::uint16_t>(rawAttributeData));
1732 retVal = true;
1733 }
1734 break;
1735
1736 case AttributeName::ForegroundColour:
1737 {
1738 returnedError = AttributeError::AnyOtherError;
1739
1740 if (NULL_OBJECT_ID == rawAttributeData)
1741 {
1742 set_foreground_colour_object_id(static_cast<std::uint16_t>(rawAttributeData));
1743 retVal = true;
1744 }
1745 else if (objectPool.find(static_cast<std::uint16_t>(rawAttributeData)) != objectPool.end())
1746 {
1747 if (nullptr != objectPool.at(static_cast<std::uint16_t>(rawAttributeData)) &&
1748 (VirtualTerminalObjectType::FontAttributes == objectPool.at(static_cast<std::uint16_t>(rawAttributeData))->get_object_type()))
1749 {
1750 set_foreground_colour_object_id(static_cast<std::uint16_t>(rawAttributeData));
1751 retVal = true;
1752 }
1753 else
1754 {
1755 returnedError = AttributeError::InvalidValue;
1756 }
1757 }
1758 }
1759 break;
1760
1761 case AttributeName::VariableReference:
1762 {
1763 returnedError = AttributeError::AnyOtherError;
1764
1765 if (NULL_OBJECT_ID == rawAttributeData)
1766 {
1767 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
1768 retVal = true;
1769 }
1770 else if (objectPool.find(static_cast<std::uint16_t>(rawAttributeData)) != objectPool.end())
1771 {
1772 if (nullptr != objectPool.at(static_cast<std::uint16_t>(rawAttributeData)) &&
1773 (VirtualTerminalObjectType::NumberVariable == objectPool.at(static_cast<std::uint16_t>(rawAttributeData))->get_object_type()))
1774 {
1775 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
1776 retVal = true;
1777 }
1778 else
1779 {
1780 returnedError = AttributeError::InvalidValue;
1781 }
1782 }
1783 }
1784 break;
1785
1786 case AttributeName::Value:
1787 {
1788 set_value(static_cast<std::uint8_t>(rawAttributeData));
1789 retVal = true;
1790 }
1791 break;
1792
1793 case AttributeName::Enabled:
1794 {
1795 set_enabled(0 != rawAttributeData);
1796 retVal = true;
1797 }
1798 break;
1799
1800 default:
1801 {
1802 returnedError = AttributeError::InvalidAttributeID;
1803 }
1804 break;
1805 }
1806 }
1807 else
1808 {
1809 returnedError = AttributeError::InvalidAttributeID;
1810 }
1811 return retVal;
1812 }
1813
1814 bool InputBoolean::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
1815 {
1816 bool retVal = false;
1817
1818 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
1819 {
1820 switch (attributeID)
1821 {
1822 case static_cast<std::uint8_t>(AttributeName::Type):
1823 {
1824 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
1825 retVal = true;
1826 }
1827 break;
1828
1829 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
1830 {
1831 returnedAttributeData = get_background_color();
1832 retVal = true;
1833 }
1834 break;
1835
1836 case static_cast<std::uint8_t>(AttributeName::Width):
1837 {
1838 returnedAttributeData = get_width();
1839 retVal = true;
1840 }
1841 break;
1842
1843 case static_cast<std::uint8_t>(AttributeName::ForegroundColour):
1844 {
1845 returnedAttributeData = get_foreground_colour_object_id();
1846 retVal = true;
1847 }
1848 break;
1849
1850 case static_cast<std::uint8_t>(AttributeName::VariableReference):
1851 {
1852 returnedAttributeData = get_variable_reference();
1853 retVal = true;
1854 }
1855 break;
1856
1857 case static_cast<std::uint8_t>(AttributeName::Value):
1858 {
1859 returnedAttributeData = get_value();
1860 retVal = true;
1861 }
1862 break;
1863
1864 case static_cast<std::uint8_t>(AttributeName::Enabled):
1865 {
1866 returnedAttributeData = get_enabled();
1867 retVal = true;
1868 }
1869 break;
1870
1871 default:
1872 {
1873 // Do nothing, return false
1874 }
1875 break;
1876 }
1877 }
1878 return retVal;
1879 }
1880
1881 std::uint8_t InputBoolean::get_value() const
1882 {
1883 return value;
1884 }
1885
1886 void InputBoolean::set_value(std::uint8_t inputValue)
1887 {
1888 value = inputValue;
1889 }
1890
1892 {
1893 return enabled;
1894 }
1895
1896 void InputBoolean::set_enabled(bool isEnabled)
1897 {
1898 enabled = isEnabled;
1899 }
1900
1902 {
1903 return foregroundColourObjectID;
1904 }
1905
1906 void InputBoolean::set_foreground_colour_object_id(std::uint16_t fontAttributeValue)
1907 {
1908 foregroundColourObjectID = fontAttributeValue;
1909 }
1910
1912 {
1913 return variableReference;
1914 }
1915
1916 void InputBoolean::set_variable_reference(std::uint16_t numberVariableValue)
1917 {
1918 variableReference = numberVariableValue;
1919 }
1920
1925
1927 {
1928 return MIN_OBJECT_LENGTH;
1929 }
1930
1931 bool InputString::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
1932 {
1933 bool anyWrongChildType = false;
1934
1935 if (NULL_OBJECT_ID != get_variable_reference())
1936 {
1937 auto objectToCheck = get_object_by_id(get_variable_reference(), objectPool);
1938
1939 if (nullptr != objectToCheck)
1940 {
1941 if (VirtualTerminalObjectType::StringVariable != objectToCheck->get_object_type())
1942 {
1943 anyWrongChildType = true;
1944 }
1945 }
1946 else
1947 {
1948 anyWrongChildType = true;
1949 }
1950 }
1951
1952 if (NULL_OBJECT_ID != get_input_attributes())
1953 {
1954 auto objectToCheck = get_object_by_id(get_input_attributes(), objectPool);
1955
1956 if (nullptr != objectToCheck)
1957 {
1958 if (VirtualTerminalObjectType::InputAttributes != objectToCheck->get_object_type())
1959 {
1960 anyWrongChildType = true;
1961 }
1962 }
1963 else
1964 {
1965 anyWrongChildType = true;
1966 }
1967 }
1968
1969 if (NULL_OBJECT_ID != get_font_attributes())
1970 {
1971 auto objectToCheck = get_object_by_id(get_font_attributes(), objectPool);
1972
1973 if (nullptr != objectToCheck)
1974 {
1975 if (VirtualTerminalObjectType::FontAttributes != objectToCheck->get_object_type())
1976 {
1977 anyWrongChildType = true;
1978 }
1979 }
1980 else
1981 {
1982 anyWrongChildType = true;
1983 }
1984 }
1985
1986 for (const auto &child : children)
1987 {
1988 auto childObject = get_object_by_id(child.id, objectPool);
1989
1990 if ((nullptr == childObject) ||
1991 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
1992 {
1993 anyWrongChildType = true;
1994 break;
1995 }
1996 }
1997 return (!anyWrongChildType);
1998 }
1999
2000 bool InputString::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
2001 {
2002 bool retVal = false;
2003
2004 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
2005 {
2006 switch (static_cast<AttributeName>(attributeID))
2007 {
2008 case AttributeName::Width:
2009 {
2010 set_width(static_cast<std::uint16_t>(rawAttributeData));
2011 retVal = true;
2012 }
2013 break;
2014
2015 case AttributeName::Height:
2016 {
2017 set_height(static_cast<std::uint16_t>(rawAttributeData));
2018 retVal = true;
2019 }
2020 break;
2021
2022 case AttributeName::BackgroundColour:
2023 {
2024 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
2025 retVal = true;
2026 }
2027 break;
2028
2029 case AttributeName::FontAttributes:
2030 {
2031 auto fontAttributesObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
2032
2033 if ((NULL_OBJECT_ID == rawAttributeData) ||
2034 ((nullptr != fontAttributesObject) &&
2035 (VirtualTerminalObjectType::FontAttributes == fontAttributesObject->get_object_type())))
2036 {
2037 set_font_attributes(static_cast<std::uint16_t>(rawAttributeData));
2038 retVal = true;
2039 }
2040 else
2041 {
2042 returnedError = AttributeError::InvalidValue;
2043 }
2044 }
2045 break;
2046
2047 case AttributeName::InputAttributes:
2048 {
2049 auto inputAttributesObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
2050
2051 if ((NULL_OBJECT_ID == rawAttributeData) ||
2052 ((nullptr != inputAttributesObject) &&
2053 (VirtualTerminalObjectType::InputAttributes == inputAttributesObject->get_object_type())))
2054 {
2055 set_input_attributes(static_cast<std::uint16_t>(rawAttributeData));
2056 retVal = true;
2057 }
2058 else
2059 {
2060 returnedError = AttributeError::InvalidValue;
2061 }
2062 }
2063 break;
2064
2065 case AttributeName::Options:
2066 {
2067 set_options(static_cast<std::uint8_t>(rawAttributeData));
2068 retVal = true;
2069 }
2070 break;
2071
2072 case AttributeName::VariableReference:
2073 {
2074 auto variableReferenceObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
2075
2076 if ((NULL_OBJECT_ID == rawAttributeData) ||
2077 ((nullptr != variableReferenceObject) &&
2078 (VirtualTerminalObjectType::StringVariable == variableReferenceObject->get_object_type())))
2079 {
2080 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
2081 retVal = true;
2082 }
2083 else
2084 {
2085 returnedError = AttributeError::InvalidValue;
2086 }
2087 }
2088 break;
2089
2090 case AttributeName::Justification:
2091 {
2092 set_justification_bitfield(static_cast<std::uint8_t>(rawAttributeData));
2093 retVal = true;
2094 }
2095 break;
2096
2097 case AttributeName::Enabled:
2098 {
2099 set_enabled(0 != rawAttributeData);
2100 retVal = true;
2101 }
2102 break;
2103
2104 default:
2105 {
2106 returnedError = AttributeError::InvalidAttributeID;
2107 }
2108 break;
2109 }
2110 }
2111 else
2112 {
2113 returnedError = AttributeError::InvalidAttributeID;
2114 }
2115 return retVal;
2116 }
2117
2118 bool InputString::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
2119 {
2120 bool retVal = false;
2121
2122 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
2123 {
2124 switch (attributeID)
2125 {
2126 case static_cast<std::uint8_t>(AttributeName::Type):
2127 {
2128 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
2129 retVal = true;
2130 }
2131 break;
2132
2133 case static_cast<std::uint8_t>(AttributeName::Width):
2134 {
2135 returnedAttributeData = get_width();
2136 retVal = true;
2137 }
2138 break;
2139
2140 case static_cast<std::uint8_t>(AttributeName::Height):
2141 {
2142 returnedAttributeData = get_height();
2143 retVal = true;
2144 }
2145 break;
2146
2147 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
2148 {
2149 returnedAttributeData = get_background_color();
2150 retVal = true;
2151 }
2152 break;
2153
2154 case static_cast<std::uint8_t>(AttributeName::FontAttributes):
2155 {
2156 returnedAttributeData = get_font_attributes();
2157 retVal = true;
2158 }
2159 break;
2160
2161 case static_cast<std::uint8_t>(AttributeName::InputAttributes):
2162 {
2163 returnedAttributeData = get_input_attributes();
2164 retVal = true;
2165 }
2166 break;
2167
2168 case static_cast<std::uint8_t>(AttributeName::Options):
2169 {
2170 returnedAttributeData = optionsBitfield;
2171 retVal = true;
2172 }
2173 break;
2174
2175 case static_cast<std::uint8_t>(AttributeName::VariableReference):
2176 {
2177 returnedAttributeData = get_variable_reference();
2178 retVal = true;
2179 }
2180 break;
2181
2182 case static_cast<std::uint8_t>(AttributeName::Justification):
2183 {
2184 returnedAttributeData = justificationBitfield;
2185 retVal = true;
2186 }
2187 break;
2188
2189 case static_cast<std::uint8_t>(AttributeName::Enabled):
2190 {
2191 returnedAttributeData = get_enabled();
2192 retVal = true;
2193 }
2194 break;
2195
2196 default:
2197 {
2198 // Do nothing, return false
2199 }
2200 break;
2201 }
2202 }
2203 return retVal;
2204 }
2205
2207 {
2208 return enabled;
2209 }
2210
2212 {
2213 enabled = value;
2214 }
2215
2217 {
2218 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
2219 }
2220
2221 void InputString::set_options(std::uint8_t value)
2222 {
2223 optionsBitfield = value;
2224 }
2225
2226 void InputString::set_option(Options option, bool value)
2227 {
2228 if (value)
2229 {
2230 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
2231 }
2232 else
2233 {
2234 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
2235 }
2236 }
2237
2239 {
2240 return static_cast<HorizontalJustification>(justificationBitfield & 0x03);
2241 }
2242
2244 {
2245 return static_cast<VerticalJustification>((justificationBitfield >> 2) & 0x03);
2246 }
2247
2249 {
2250 justificationBitfield = value;
2251 }
2252
2253 std::string InputString::get_value() const
2254 {
2255 return stringValue;
2256 }
2257
2258 void InputString::set_value(const std::string &value)
2259 {
2260 stringValue = value;
2261 }
2262
2264 {
2265 return fontAttributes;
2266 }
2267
2268 void InputString::set_font_attributes(std::uint16_t fontAttributesValue)
2269 {
2270 fontAttributes = fontAttributesValue;
2271 }
2272
2274 {
2275 return variableReference;
2276 }
2277
2278 void InputString::set_variable_reference(std::uint16_t variableReferenceValue)
2279 {
2280 variableReference = variableReferenceValue;
2281 }
2282
2284 {
2285 return inputAttributes;
2286 }
2287
2288 void InputString::set_input_attributes(std::uint16_t inputAttributesValue)
2289 {
2290 inputAttributes = inputAttributesValue;
2291 }
2292
2297
2299 {
2300 return MIN_OBJECT_LENGTH;
2301 }
2302
2303 bool InputNumber::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
2304 {
2305 bool anyWrongChildType = false;
2306
2307 // Verify the variable reference is a number variable or NULL_OBJECT_ID
2308 if (NULL_OBJECT_ID != get_variable_reference())
2309 {
2310 auto variableReference = get_object_by_id(get_variable_reference(), objectPool);
2311
2312 if (nullptr != variableReference)
2313 {
2314 if (VirtualTerminalObjectType::NumberVariable != variableReference->get_object_type())
2315 {
2316 anyWrongChildType = true;
2317 }
2318 }
2319 else
2320 {
2321 anyWrongChildType = true;
2322 }
2323 }
2324
2325 // Verify that the font attributes is a font attribute or NULL_OBJECT_ID
2326 if (NULL_OBJECT_ID != get_font_attributes())
2327 {
2328 auto fontAttributes = get_object_by_id(get_font_attributes(), objectPool);
2329
2330 if (nullptr != fontAttributes)
2331 {
2332 if (VirtualTerminalObjectType::FontAttributes != fontAttributes->get_object_type())
2333 {
2334 anyWrongChildType = true;
2335 }
2336 }
2337 else
2338 {
2339 anyWrongChildType = true;
2340 }
2341 }
2342
2343 for (const auto &child : children)
2344 {
2345 auto childObject = get_object_by_id(child.id, objectPool);
2346
2347 if ((nullptr == childObject) ||
2348 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
2349 {
2350 anyWrongChildType = true;
2351 break;
2352 }
2353 }
2354 return (!anyWrongChildType);
2355 }
2356
2357 bool InputNumber::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
2358 {
2359 bool retVal = false;
2360
2361 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
2362 {
2363 switch (static_cast<AttributeName>(attributeID))
2364 {
2365 case AttributeName::Width:
2366 {
2367 set_width(static_cast<std::uint16_t>(rawAttributeData));
2368 retVal = true;
2369 }
2370 break;
2371
2372 case AttributeName::Height:
2373 {
2374 set_height(static_cast<std::uint16_t>(rawAttributeData));
2375 retVal = true;
2376 }
2377 break;
2378
2379 case AttributeName::BackgroundColour:
2380 {
2381 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
2382 retVal = true;
2383 }
2384 break;
2385
2386 case AttributeName::FontAttributes:
2387 {
2388 auto fontAttributesObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
2389
2390 if ((NULL_OBJECT_ID == rawAttributeData) ||
2391 ((nullptr != fontAttributesObject) &&
2392 (VirtualTerminalObjectType::FontAttributes == fontAttributesObject->get_object_type())))
2393 {
2394 set_font_attributes(static_cast<std::uint16_t>(rawAttributeData));
2395 retVal = true;
2396 }
2397 else
2398 {
2399 returnedError = AttributeError::InvalidValue;
2400 }
2401 }
2402 break;
2403
2404 case AttributeName::Options:
2405 {
2406 set_options(static_cast<std::uint8_t>(rawAttributeData));
2407 retVal = true;
2408 }
2409 break;
2410
2411 case AttributeName::VariableReference:
2412 {
2413 auto variableObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
2414
2415 if ((NULL_OBJECT_ID == rawAttributeData) ||
2416 ((nullptr != variableObject) &&
2417 (VirtualTerminalObjectType::NumberVariable == variableObject->get_object_type())))
2418 {
2419 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
2420 retVal = true;
2421 }
2422 else
2423 {
2424 returnedError = AttributeError::InvalidValue;
2425 }
2426 }
2427 break;
2428
2429 case AttributeName::MinValue:
2430 {
2431 set_minimum_value(rawAttributeData);
2432 retVal = true;
2433 }
2434 break;
2435
2436 case AttributeName::MaxValue:
2437 {
2438 set_maximum_value(rawAttributeData);
2439 retVal = true;
2440 }
2441 break;
2442
2443 case AttributeName::Offset:
2444 {
2445 auto temp = reinterpret_cast<std::int32_t *>(&rawAttributeData);
2446 set_offset(*temp);
2447 retVal = true;
2448 }
2449 break;
2450
2451 case AttributeName::Scale:
2452 {
2453 auto temp = reinterpret_cast<float *>(&rawAttributeData);
2454 set_scale(*temp);
2455 retVal = true;
2456 }
2457 break;
2458
2459 case AttributeName::NumberOfDecimals:
2460 {
2461 set_number_of_decimals(static_cast<std::uint8_t>(rawAttributeData));
2462 retVal = true;
2463 }
2464 break;
2465
2466 case AttributeName::Format:
2467 {
2468 set_format(0 != rawAttributeData);
2469 retVal = true;
2470 }
2471 break;
2472
2473 case AttributeName::Justification:
2474 {
2475 set_justification_bitfield(static_cast<std::uint8_t>(rawAttributeData));
2476 retVal = true;
2477 }
2478 break;
2479
2480 default:
2481 {
2482 returnedError = AttributeError::InvalidAttributeID;
2483 }
2484 break;
2485 }
2486 }
2487 else
2488 {
2489 returnedError = AttributeError::InvalidAttributeID;
2490 }
2491 return retVal;
2492 }
2493
2494 bool InputNumber::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
2495 {
2496 bool retVal = false;
2497
2498 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
2499 {
2500 switch (attributeID)
2501 {
2502 case static_cast<std::uint8_t>(AttributeName::Type):
2503 {
2504 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
2505 retVal = true;
2506 }
2507 break;
2508
2509 case static_cast<std::uint8_t>(AttributeName::Width):
2510 {
2511 returnedAttributeData = get_width();
2512 retVal = true;
2513 }
2514 break;
2515
2516 case static_cast<std::uint8_t>(AttributeName::Height):
2517 {
2518 returnedAttributeData = get_height();
2519 retVal = true;
2520 }
2521 break;
2522
2523 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
2524 {
2525 returnedAttributeData = get_background_color();
2526 retVal = true;
2527 }
2528 break;
2529
2530 case static_cast<std::uint8_t>(AttributeName::FontAttributes):
2531 {
2532 returnedAttributeData = get_font_attributes();
2533 retVal = true;
2534 }
2535 break;
2536
2537 case static_cast<std::uint8_t>(AttributeName::Options):
2538 {
2539 returnedAttributeData = options;
2540 retVal = true;
2541 }
2542 break;
2543
2544 case static_cast<std::uint8_t>(AttributeName::VariableReference):
2545 {
2546 returnedAttributeData = get_variable_reference();
2547 retVal = true;
2548 }
2549 break;
2550
2551 case static_cast<std::uint8_t>(AttributeName::MinValue):
2552 {
2553 returnedAttributeData = get_minimum_value();
2554 retVal = true;
2555 }
2556 break;
2557
2558 case static_cast<std::uint8_t>(AttributeName::MaxValue):
2559 {
2560 returnedAttributeData = get_maximum_value();
2561 retVal = true;
2562 }
2563 break;
2564
2565 case static_cast<std::uint8_t>(AttributeName::Offset):
2566 {
2567 auto temp = reinterpret_cast<const std::uint32_t *>(&offset);
2568 returnedAttributeData = *temp;
2569 retVal = true;
2570 }
2571 break;
2572
2573 case static_cast<std::uint8_t>(AttributeName::Scale):
2574 {
2575 auto temp = reinterpret_cast<const std::uint32_t *>(&scale);
2576 returnedAttributeData = *temp;
2577 retVal = true;
2578 }
2579 break;
2580
2581 case static_cast<std::uint8_t>(AttributeName::NumberOfDecimals):
2582 {
2583 returnedAttributeData = get_number_of_decimals();
2584 retVal = true;
2585 }
2586 break;
2587
2588 case static_cast<std::uint8_t>(AttributeName::Format):
2589 {
2590 returnedAttributeData = get_format();
2591 retVal = true;
2592 }
2593 break;
2594
2595 case static_cast<std::uint8_t>(AttributeName::Justification):
2596 {
2597 returnedAttributeData = justificationBitfield;
2598 retVal = true;
2599 }
2600 break;
2601
2602 case static_cast<std::uint8_t>(AttributeName::Value):
2603 {
2604 returnedAttributeData = value;
2605 retVal = true;
2606 }
2607 break;
2608
2609 case static_cast<std::uint8_t>(AttributeName::Options2):
2610 {
2611 returnedAttributeData = options2;
2612 retVal = true;
2613 }
2614 break;
2615
2616 default:
2617 {
2618 // Do nothing, return false
2619 }
2620 break;
2621 }
2622 }
2623 return retVal;
2624 }
2625
2627 {
2628 return static_cast<HorizontalJustification>(justificationBitfield & 0x03);
2629 }
2630
2632 {
2633 return static_cast<VerticalJustification>((justificationBitfield >> 2) & 0x03);
2634 }
2635
2636 void InputNumber::set_justification_bitfield(std::uint8_t newJustification)
2637 {
2638 justificationBitfield = newJustification;
2639 }
2640
2642 {
2643 return scale;
2644 }
2645
2646 void InputNumber::set_scale(float newScale)
2647 {
2648 scale = newScale;
2649 }
2650
2652 {
2653 return maximumValue;
2654 }
2655
2656 void InputNumber::set_maximum_value(std::uint32_t newMax)
2657 {
2658 maximumValue = newMax;
2659 }
2660
2662 {
2663 return minimumValue;
2664 }
2665
2666 void InputNumber::set_minimum_value(std::uint32_t newMin)
2667 {
2668 minimumValue = newMin;
2669 }
2670
2671 std::int32_t InputNumber::get_offset() const
2672 {
2673 return offset;
2674 }
2675
2676 void InputNumber::set_offset(std::int32_t newOffset)
2677 {
2678 offset = newOffset;
2679 }
2680
2682 {
2683 return numberOfDecimals;
2684 }
2685
2686 void InputNumber::set_number_of_decimals(std::uint8_t numDecimals)
2687 {
2688 numberOfDecimals = numDecimals;
2689 }
2690
2692 {
2693 return format;
2694 }
2695
2696 void InputNumber::set_format(bool newFormat)
2697 {
2698 format = newFormat;
2699 }
2700
2701 bool InputNumber::get_option(Options newOption) const
2702 {
2703 return (0 != ((1 << static_cast<std::uint8_t>(newOption)) & options));
2704 }
2705
2706 void InputNumber::set_options(std::uint8_t newOptions)
2707 {
2708 options = newOptions;
2709 }
2710
2711 void InputNumber::set_option(Options option, bool optionValue)
2712 {
2713 if (optionValue)
2714 {
2715 options |= (1 << static_cast<std::uint8_t>(option));
2716 }
2717 else
2718 {
2719 options &= ~(1 << static_cast<std::uint8_t>(option));
2720 }
2721 }
2722
2724 {
2725 return (0 != ((1 << static_cast<std::uint8_t>(newOption)) & options2));
2726 }
2727
2728 void InputNumber::set_options2(std::uint8_t newOptions)
2729 {
2730 options2 = newOptions;
2731 }
2732
2733 void InputNumber::set_option2(Options2 option, bool newOption)
2734 {
2735 if (newOption)
2736 {
2737 options2 |= (1 << static_cast<std::uint8_t>(option));
2738 }
2739 else
2740 {
2741 options2 &= ~(1 << static_cast<std::uint8_t>(option));
2742 }
2743 }
2744
2745 std::uint32_t InputNumber::get_value() const
2746 {
2747 return value;
2748 }
2749
2750 void InputNumber::set_value(std::uint32_t inputValue)
2751 {
2752 value = inputValue;
2753 }
2754
2756 {
2757 return fontAttributes;
2758 }
2759
2760 void InputNumber::set_font_attributes(std::uint16_t fontAttributesValue)
2761 {
2762 fontAttributes = fontAttributesValue;
2763 }
2764
2766 {
2767 return variableReference;
2768 }
2769
2770 void InputNumber::set_variable_reference(std::uint16_t variableReferenceValue)
2771 {
2772 variableReference = variableReferenceValue;
2773 }
2774
2779
2781 {
2782 return MIN_OBJECT_LENGTH;
2783 }
2784
2785 bool InputList::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
2786 {
2787 bool anyWrongChildType = false;
2788
2789 for (const auto &child : children)
2790 {
2791 auto childObject = get_object_by_id(child.id, objectPool);
2792 if (nullptr != childObject)
2793 {
2794 switch (childObject->get_object_type())
2795 {
2813 {
2814 // Valid Child Object
2815 }
2816 break;
2817
2818 default:
2819 {
2820 anyWrongChildType = true;
2821 }
2822 break;
2823 }
2824 }
2825 }
2826 return ((!anyWrongChildType) &&
2828 }
2829
2830 bool InputList::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
2831 {
2832 bool retVal = false;
2833
2834 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
2835 {
2836 switch (static_cast<AttributeName>(attributeID))
2837 {
2838 case AttributeName::Width:
2839 {
2840 set_width(static_cast<std::uint16_t>(rawAttributeData));
2841 retVal = true;
2842 }
2843 break;
2844
2845 case AttributeName::Height:
2846 {
2847 set_height(static_cast<std::uint16_t>(rawAttributeData));
2848 retVal = true;
2849 }
2850 break;
2851
2852 case AttributeName::VariableReference:
2853 {
2854 auto variableObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
2855
2856 if ((NULL_OBJECT_ID == rawAttributeData) ||
2857 ((nullptr != variableObject) &&
2858 (VirtualTerminalObjectType::NumberVariable == variableObject->get_object_type())))
2859 {
2860 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
2861 retVal = true;
2862 }
2863 else
2864 {
2865 returnedError = AttributeError::InvalidValue;
2866 }
2867 }
2868 break;
2869
2870 case AttributeName::Value:
2871 {
2872 set_value(rawAttributeData);
2873 retVal = true;
2874 }
2875 break;
2876
2877 case AttributeName::Options:
2878 {
2879 set_options(static_cast<std::uint8_t>(rawAttributeData));
2880 retVal = true;
2881 }
2882 break;
2883
2884 default:
2885 {
2886 returnedError = AttributeError::InvalidAttributeID;
2887 }
2888 break;
2889 }
2890 }
2891 else
2892 {
2893 returnedError = AttributeError::InvalidAttributeID;
2894 }
2895 return retVal;
2896 }
2897
2898 bool InputList::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
2899 {
2900 bool retVal = false;
2901
2902 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
2903 {
2904 switch (attributeID)
2905 {
2906 case static_cast<std::uint8_t>(AttributeName::Type):
2907 {
2908 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
2909 retVal = true;
2910 }
2911 break;
2912
2913 case static_cast<std::uint8_t>(AttributeName::Width):
2914 {
2915 returnedAttributeData = get_width();
2916 retVal = true;
2917 }
2918 break;
2919
2920 case static_cast<std::uint8_t>(AttributeName::Height):
2921 {
2922 returnedAttributeData = get_height();
2923 retVal = true;
2924 }
2925 break;
2926
2927 case static_cast<std::uint8_t>(AttributeName::VariableReference):
2928 {
2929 returnedAttributeData = get_variable_reference();
2930 retVal = true;
2931 }
2932 break;
2933
2934 case static_cast<std::uint8_t>(AttributeName::Value):
2935 {
2936 returnedAttributeData = get_value();
2937 retVal = true;
2938 }
2939 break;
2940
2941 case static_cast<std::uint8_t>(AttributeName::Options):
2942 {
2943 returnedAttributeData = optionsBitfield;
2944 retVal = true;
2945 }
2946 break;
2947
2948 default:
2949 {
2950 // Do nothing, return false
2951 }
2952 break;
2953 }
2954 }
2955 return retVal;
2956 }
2957
2959 {
2960 return (0 != (optionsBitfield & (1 << static_cast<std::uint8_t>(option))));
2961 }
2962
2963 void InputList::set_options(std::uint8_t options)
2964 {
2965 optionsBitfield = options;
2966 }
2967
2968 void InputList::set_option(Options option, bool optionValue)
2969 {
2970 if (optionValue)
2971 {
2972 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
2973 }
2974 else
2975 {
2976 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
2977 }
2978 }
2979
2980 std::uint8_t InputList::get_value() const
2981 {
2982 return value;
2983 }
2984
2985 void InputList::set_value(std::uint8_t inputValue)
2986 {
2987 value = inputValue;
2988 }
2989
2990 bool InputList::change_list_item(std::uint8_t index, std::uint16_t newListItem, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool)
2991 {
2992 bool retVal = false;
2993
2994 if ((index < children.size()) &&
2995 ((NULL_OBJECT_ID == newListItem) ||
2996 (nullptr != get_object_by_id(newListItem, objectPool))))
2997 {
2998 if (nullptr != get_object_by_id(newListItem, objectPool))
2999 {
3000 switch (get_object_by_id(newListItem, objectPool)->get_object_type())
3001 {
3019 {
3020 children.at(index).id = newListItem;
3021 retVal = true;
3022 }
3023 break;
3024
3025 default:
3026 {
3027 // Invalid child object type
3028 }
3029 break;
3030 }
3031 }
3032 else
3033 {
3034 children.at(index).id = newListItem;
3035 retVal = true;
3036 }
3037 }
3038 return retVal;
3039 }
3040
3041 void InputList::set_variable_reference(std::uint16_t referencedObjectID)
3042 {
3043 variableReference = referencedObjectID;
3044 }
3045
3047 {
3048 return variableReference;
3049 }
3050
3052 {
3053 return numberOfListItems;
3054 }
3055
3057 {
3058 numberOfListItems = value;
3059 }
3060
3065
3067 {
3068 return MIN_OBJECT_LENGTH;
3069 }
3070
3071 bool OutputString::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
3072 {
3073 bool anyWrongChildType = false;
3074
3075 // Verify the variable reference is a number variable or NULL_OBJECT_ID
3076 if (NULL_OBJECT_ID != get_variable_reference())
3077 {
3078 auto variableReference = get_object_by_id(get_variable_reference(), objectPool);
3079
3080 if (nullptr != variableReference)
3081 {
3082 if (VirtualTerminalObjectType::StringVariable != variableReference->get_object_type())
3083 {
3084 anyWrongChildType = true;
3085 }
3086 }
3087 else
3088 {
3089 anyWrongChildType = true;
3090 }
3091 }
3092
3093 // Verify that the font attributes is a font attribute or NULL_OBJECT_ID
3094 if (NULL_OBJECT_ID != get_font_attributes())
3095 {
3096 auto fontAttributes = get_object_by_id(get_font_attributes(), objectPool);
3097
3098 if (nullptr != fontAttributes)
3099 {
3100 if (VirtualTerminalObjectType::FontAttributes != fontAttributes->get_object_type())
3101 {
3102 anyWrongChildType = true;
3103 }
3104 }
3105 else
3106 {
3107 anyWrongChildType = true;
3108 }
3109 }
3110
3111 for (const auto &child : children)
3112 {
3113 auto childObject = get_object_by_id(child.id, objectPool);
3114
3115 if ((nullptr == childObject) ||
3116 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
3117 {
3118 anyWrongChildType = true;
3119 break;
3120 }
3121 }
3122 return (!anyWrongChildType);
3123 }
3124
3125 bool OutputString::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
3126 {
3127 bool retVal = false;
3128
3129 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
3130 {
3131 switch (static_cast<AttributeName>(attributeID))
3132 {
3133 case AttributeName::Width:
3134 {
3135 set_width(static_cast<std::uint16_t>(rawAttributeData));
3136 retVal = true;
3137 }
3138 break;
3139
3140 case AttributeName::Height:
3141 {
3142 set_height(static_cast<std::uint16_t>(rawAttributeData));
3143 retVal = true;
3144 }
3145 break;
3146
3147 case AttributeName::BackgroundColour:
3148 {
3149 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
3150 retVal = true;
3151 }
3152 break;
3153
3154 case AttributeName::FontAttributes:
3155 {
3156 auto fontAttributesObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
3157
3158 if ((NULL_OBJECT_ID == rawAttributeData) ||
3159 ((nullptr != fontAttributesObject) &&
3160 (VirtualTerminalObjectType::FontAttributes == fontAttributesObject->get_object_type())))
3161 {
3162 set_font_attributes(static_cast<std::uint16_t>(rawAttributeData));
3163 retVal = true;
3164 }
3165 else
3166 {
3167 returnedError = AttributeError::InvalidValue;
3168 }
3169 }
3170 break;
3171
3172 case AttributeName::Options:
3173 {
3174 set_options(static_cast<std::uint8_t>(rawAttributeData));
3175 retVal = true;
3176 }
3177 break;
3178
3179 case AttributeName::VariableReference:
3180 {
3181 auto variableObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
3182
3183 if ((NULL_OBJECT_ID == rawAttributeData) ||
3184 ((nullptr != variableObject) &&
3185 (VirtualTerminalObjectType::StringVariable == variableObject->get_object_type())))
3186 {
3187 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
3188 retVal = true;
3189 }
3190 else
3191 {
3192 returnedError = AttributeError::InvalidValue;
3193 }
3194 }
3195 break;
3196
3197 case AttributeName::Justification:
3198 {
3199 set_justification_bitfield(static_cast<std::uint8_t>(rawAttributeData));
3200 retVal = true;
3201 }
3202 break;
3203
3204 default:
3205 {
3206 returnedError = AttributeError::InvalidAttributeID;
3207 }
3208 break;
3209 }
3210 }
3211 else
3212 {
3213 returnedError = AttributeError::InvalidAttributeID;
3214 }
3215 return retVal;
3216 }
3217
3218 bool OutputString::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
3219 {
3220 bool retVal = false;
3221
3222 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
3223 {
3224 switch (attributeID)
3225 {
3226 case static_cast<std::uint8_t>(AttributeName::Type):
3227 {
3228 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
3229 retVal = true;
3230 }
3231 break;
3232
3233 case static_cast<std::uint8_t>(AttributeName::Width):
3234 {
3235 returnedAttributeData = get_width();
3236 retVal = true;
3237 }
3238 break;
3239
3240 case static_cast<std::uint8_t>(AttributeName::Height):
3241 {
3242 returnedAttributeData = get_height();
3243 retVal = true;
3244 }
3245 break;
3246
3247 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
3248 {
3249 returnedAttributeData = get_background_color();
3250 retVal = true;
3251 }
3252 break;
3253
3254 case static_cast<std::uint8_t>(AttributeName::FontAttributes):
3255 {
3256 returnedAttributeData = get_font_attributes();
3257 retVal = true;
3258 }
3259 break;
3260
3261 case static_cast<std::uint8_t>(AttributeName::Options):
3262 {
3263 returnedAttributeData = optionsBitfield;
3264 retVal = true;
3265 }
3266 break;
3267
3268 case static_cast<std::uint8_t>(AttributeName::VariableReference):
3269 {
3270 returnedAttributeData = get_variable_reference();
3271 retVal = true;
3272 }
3273 break;
3274
3275 case static_cast<std::uint8_t>(AttributeName::Justification):
3276 {
3277 returnedAttributeData = justificationBitfield;
3278 retVal = true;
3279 }
3280 break;
3281
3282 default:
3283 {
3284 // Do nothing, return false
3285 }
3286 break;
3287 }
3288 }
3289 return retVal;
3290 }
3291
3293 {
3294 return (0 != (optionsBitfield & (1 << static_cast<std::uint8_t>(option))));
3295 }
3296
3297 void OutputString::set_options(std::uint8_t value)
3298 {
3299 optionsBitfield = value;
3300 }
3301
3302 void OutputString::set_option(Options option, bool value)
3303 {
3304 if (value)
3305 {
3306 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
3307 }
3308 else
3309 {
3310 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
3311 }
3312 }
3313
3315 {
3316 return static_cast<HorizontalJustification>(justificationBitfield & 0x03);
3317 }
3318
3320 {
3321 return static_cast<VerticalJustification>((justificationBitfield >> 2) & 0x03);
3322 }
3323
3325 {
3326 justificationBitfield = value;
3327 }
3328
3329 std::string OutputString::get_value() const
3330 {
3331 return stringValue;
3332 }
3333
3334 void OutputString::set_value(const std::string &value)
3335 {
3336 stringValue = value;
3337 }
3338
3340 {
3341 return fontAttributes;
3342 }
3343
3344 void OutputString::set_font_attributes(std::uint16_t fontAttributesValue)
3345 {
3346 fontAttributes = fontAttributesValue;
3347 }
3348
3350 {
3351 return variableReference;
3352 }
3353
3354 void OutputString::set_variable_reference(std::uint16_t variableReferenceValue)
3355 {
3356 variableReference = variableReferenceValue;
3357 }
3358
3363
3365 {
3366 return MIN_OBJECT_LENGTH;
3367 }
3368
3369 bool OutputNumber::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
3370 {
3371 bool anyWrongChildType = false;
3372
3373 // Verify the variable reference is a number variable or NULL_OBJECT_ID
3374 if (NULL_OBJECT_ID != get_variable_reference())
3375 {
3376 auto variableReference = get_object_by_id(get_variable_reference(), objectPool);
3377
3378 if (nullptr != variableReference)
3379 {
3380 if (VirtualTerminalObjectType::NumberVariable != variableReference->get_object_type())
3381 {
3382 anyWrongChildType = true;
3383 }
3384 }
3385 else
3386 {
3387 anyWrongChildType = true;
3388 }
3389 }
3390
3391 // Verify that the font attributes is a font attribute or NULL_OBJECT_ID
3392 if (NULL_OBJECT_ID != get_font_attributes())
3393 {
3394 auto fontAttributes = get_object_by_id(get_font_attributes(), objectPool);
3395
3396 if (nullptr != fontAttributes)
3397 {
3398 if (VirtualTerminalObjectType::FontAttributes != fontAttributes->get_object_type())
3399 {
3400 anyWrongChildType = true;
3401 }
3402 }
3403 else
3404 {
3405 anyWrongChildType = true;
3406 }
3407 }
3408
3409 for (const auto &child : children)
3410 {
3411 auto childObject = get_object_by_id(child.id, objectPool);
3412
3413 if ((nullptr == childObject) ||
3414 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
3415 {
3416 anyWrongChildType = true;
3417 break;
3418 }
3419 }
3420 return (!anyWrongChildType);
3421 }
3422
3423 bool OutputNumber::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
3424 {
3425 bool retVal = false;
3426
3427 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
3428 {
3429 switch (static_cast<AttributeName>(attributeID))
3430 {
3431 case AttributeName::Width:
3432 {
3433 set_width(static_cast<std::uint16_t>(rawAttributeData));
3434 retVal = true;
3435 }
3436 break;
3437
3438 case AttributeName::Height:
3439 {
3440 set_height(static_cast<std::uint16_t>(rawAttributeData));
3441 retVal = true;
3442 }
3443 break;
3444
3445 case AttributeName::BackgroundColour:
3446 {
3447 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
3448 retVal = true;
3449 }
3450 break;
3451
3452 case AttributeName::FontAttributes:
3453 {
3454 auto fontAttributesObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
3455
3456 if ((NULL_OBJECT_ID == rawAttributeData) ||
3457 ((nullptr != fontAttributesObject) &&
3458 (VirtualTerminalObjectType::FontAttributes == fontAttributesObject->get_object_type())))
3459 {
3460 set_font_attributes(static_cast<std::uint16_t>(rawAttributeData));
3461 retVal = true;
3462 }
3463 else
3464 {
3465 returnedError = AttributeError::InvalidValue;
3466 }
3467 }
3468 break;
3469
3470 case AttributeName::Options:
3471 {
3472 set_options(static_cast<std::uint8_t>(rawAttributeData));
3473 retVal = true;
3474 }
3475 break;
3476
3477 case AttributeName::VariableReference:
3478 {
3479 auto variableObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
3480
3481 if ((NULL_OBJECT_ID == rawAttributeData) ||
3482 ((nullptr != variableObject) &&
3483 (VirtualTerminalObjectType::NumberVariable == variableObject->get_object_type())))
3484 {
3485 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
3486 retVal = true;
3487 }
3488 else
3489 {
3490 returnedError = AttributeError::InvalidValue;
3491 }
3492 }
3493 break;
3494
3495 case AttributeName::Offset:
3496 {
3497 auto temp = reinterpret_cast<std::int32_t *>(&rawAttributeData);
3498 set_offset(*temp);
3499 retVal = true;
3500 }
3501 break;
3502
3503 case AttributeName::Scale:
3504 {
3505 auto temp = reinterpret_cast<float *>(&rawAttributeData);
3506 set_scale(*temp);
3507 retVal = true;
3508 }
3509 break;
3510
3511 case AttributeName::NumberOfDecimals:
3512 {
3513 set_number_of_decimals(static_cast<std::uint8_t>(rawAttributeData));
3514 retVal = true;
3515 }
3516 break;
3517
3518 case AttributeName::Format:
3519 {
3520 set_format(0 != rawAttributeData);
3521 retVal = true;
3522 }
3523 break;
3524
3525 case AttributeName::Justification:
3526 {
3527 set_justification_bitfield(static_cast<std::uint8_t>(rawAttributeData));
3528 retVal = true;
3529 }
3530 break;
3531
3532 default:
3533 {
3534 returnedError = AttributeError::InvalidAttributeID;
3535 }
3536 break;
3537 }
3538 }
3539 else
3540 {
3541 returnedError = AttributeError::InvalidAttributeID;
3542 }
3543 return retVal;
3544 }
3545
3546 bool OutputNumber::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
3547 {
3548 bool retVal = false;
3549
3550 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
3551 {
3552 switch (attributeID)
3553 {
3554 case static_cast<std::uint8_t>(AttributeName::Type):
3555 {
3556 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
3557 retVal = true;
3558 }
3559 break;
3560
3561 case static_cast<std::uint8_t>(AttributeName::Width):
3562 {
3563 returnedAttributeData = get_width();
3564 retVal = true;
3565 }
3566 break;
3567
3568 case static_cast<std::uint8_t>(AttributeName::Height):
3569 {
3570 returnedAttributeData = get_height();
3571 retVal = true;
3572 }
3573 break;
3574
3575 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
3576 {
3577 returnedAttributeData = get_background_color();
3578 retVal = true;
3579 }
3580 break;
3581
3582 case static_cast<std::uint8_t>(AttributeName::FontAttributes):
3583 {
3584 returnedAttributeData = get_font_attributes();
3585 retVal = true;
3586 }
3587 break;
3588
3589 case static_cast<std::uint8_t>(AttributeName::Options):
3590 {
3591 returnedAttributeData = optionsBitfield;
3592 retVal = true;
3593 }
3594 break;
3595
3596 case static_cast<std::uint8_t>(AttributeName::VariableReference):
3597 {
3598 returnedAttributeData = get_variable_reference();
3599 retVal = true;
3600 }
3601 break;
3602
3603 case static_cast<std::uint8_t>(AttributeName::Offset):
3604 {
3605 auto temp = reinterpret_cast<const std::uint32_t *>(&offset);
3606 returnedAttributeData = *temp;
3607 retVal = true;
3608 }
3609 break;
3610
3611 case static_cast<std::uint8_t>(AttributeName::Scale):
3612 {
3613 auto temp = reinterpret_cast<const std::uint32_t *>(&scale);
3614 returnedAttributeData = *temp;
3615 retVal = true;
3616 }
3617 break;
3618
3619 case static_cast<std::uint8_t>(AttributeName::NumberOfDecimals):
3620 {
3621 returnedAttributeData = get_number_of_decimals();
3622 retVal = true;
3623 }
3624 break;
3625
3626 case static_cast<std::uint8_t>(AttributeName::Format):
3627 {
3628 returnedAttributeData = get_format();
3629 retVal = true;
3630 }
3631 break;
3632
3633 case static_cast<std::uint8_t>(AttributeName::Justification):
3634 {
3635 returnedAttributeData = justificationBitfield;
3636 retVal = true;
3637 }
3638 break;
3639
3640 default:
3641 {
3642 // Do nothing, return false
3643 }
3644 break;
3645 }
3646 }
3647 return retVal;
3648 }
3649
3651 {
3652 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
3653 }
3654
3655 void OutputNumber::set_options(std::uint8_t value)
3656 {
3657 optionsBitfield = value;
3658 }
3659
3660 void OutputNumber::set_option(Options option, bool value)
3661 {
3662 if (value)
3663 {
3664 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
3665 }
3666 else
3667 {
3668 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
3669 }
3670 }
3671
3673 {
3674 return static_cast<HorizontalJustification>(justificationBitfield & 0x03);
3675 }
3676
3678 {
3679 return static_cast<VerticalJustification>((justificationBitfield >> 2) & 0x03);
3680 }
3681
3683 {
3684 justificationBitfield = value;
3685 }
3686
3688 {
3689 return scale;
3690 }
3691
3692 void OutputNumber::set_scale(float scaleValue)
3693 {
3694 scale = scaleValue;
3695 }
3696
3697 std::int32_t OutputNumber::get_offset() const
3698 {
3699 return offset;
3700 }
3701
3702 void OutputNumber::set_offset(std::int32_t offsetValue)
3703 {
3704 offset = offsetValue;
3705 }
3706
3708 {
3709 return numberOfDecimals;
3710 }
3711
3712 void OutputNumber::set_number_of_decimals(std::uint8_t decimalValue)
3713 {
3714 numberOfDecimals = decimalValue;
3715 }
3716
3718 {
3719 return format;
3720 }
3721
3722 void OutputNumber::set_format(bool shouldFormatAsExponential)
3723 {
3724 format = shouldFormatAsExponential;
3725 }
3726
3727 std::uint32_t OutputNumber::get_value() const
3728 {
3729 return value;
3730 }
3731
3732 void OutputNumber::set_value(std::uint32_t inputValue)
3733 {
3734 value = inputValue;
3735 }
3736
3737 void OutputNumber::set_variable_reference(std::uint16_t referencedObjectID)
3738 {
3739 variableReference = referencedObjectID;
3740 }
3741
3743 {
3744 return variableReference;
3745 }
3746
3748 {
3749 return fontAttributes;
3750 }
3751
3752 void OutputNumber::set_font_attributes(std::uint16_t fontAttributesValue)
3753 {
3754 fontAttributes = fontAttributesValue;
3755 }
3756
3761
3763 {
3764 return MIN_OBJECT_LENGTH;
3765 }
3766
3767 bool OutputList::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
3768 {
3769 bool anyWrongChildType = false;
3770
3771 // Verify the variable reference is a number variable or NULL_OBJECT_ID
3772 if (NULL_OBJECT_ID != get_variable_reference())
3773 {
3774 auto variableReference = get_object_by_id(get_variable_reference(), objectPool);
3775
3776 if (nullptr != variableReference)
3777 {
3778 if (VirtualTerminalObjectType::NumberVariable != variableReference->get_object_type())
3779 {
3780 anyWrongChildType = true;
3781 }
3782 }
3783 else
3784 {
3785 anyWrongChildType = true;
3786 }
3787 }
3788
3789 for (const auto &child : children)
3790 {
3791 auto childObject = get_object_by_id(child.id, objectPool);
3792 if (nullptr != childObject)
3793 {
3794 switch (childObject->get_object_type())
3795 {
3821 {
3822 // Valid Child Object
3823 }
3824 break;
3825
3826 default:
3827 {
3828 anyWrongChildType = true;
3829 }
3830 break;
3831 }
3832 }
3833 }
3834 return ((!anyWrongChildType) &&
3836 }
3837
3838 bool OutputList::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
3839 {
3840 bool retVal = false;
3841
3842 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
3843 {
3844 switch (static_cast<AttributeName>(attributeID))
3845 {
3846 case AttributeName::Width:
3847 {
3848 set_width(static_cast<std::uint16_t>(rawAttributeData));
3849 retVal = true;
3850 }
3851 break;
3852
3853 case AttributeName::Height:
3854 {
3855 set_height(static_cast<std::uint16_t>(rawAttributeData));
3856 retVal = true;
3857 }
3858 break;
3859
3860 case AttributeName::VariableReference:
3861 {
3862 auto variableObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
3863
3864 if ((NULL_OBJECT_ID == rawAttributeData) ||
3865 ((nullptr != variableObject) &&
3866 (VirtualTerminalObjectType::NumberVariable == variableObject->get_object_type())))
3867 {
3868 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
3869 retVal = true;
3870 }
3871 else
3872 {
3873 returnedError = AttributeError::InvalidValue;
3874 }
3875 }
3876 break;
3877
3878 case AttributeName::Value:
3879 {
3880 set_value(static_cast<std::uint8_t>(rawAttributeData));
3881 retVal = true;
3882 }
3883 break;
3884
3885 default:
3886 {
3887 returnedError = AttributeError::InvalidAttributeID;
3888 }
3889 break;
3890 }
3891 }
3892 else
3893 {
3894 returnedError = AttributeError::InvalidAttributeID;
3895 }
3896 return retVal;
3897 }
3898
3899 bool OutputList::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
3900 {
3901 bool retVal = false;
3902
3903 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
3904 {
3905 switch (attributeID)
3906 {
3907 case static_cast<std::uint8_t>(AttributeName::Type):
3908 {
3909 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
3910 retVal = true;
3911 }
3912 break;
3913
3914 case static_cast<std::uint8_t>(AttributeName::Width):
3915 {
3916 returnedAttributeData = get_width();
3917 retVal = true;
3918 }
3919 break;
3920
3921 case static_cast<std::uint8_t>(AttributeName::Height):
3922 {
3923 returnedAttributeData = get_height();
3924 retVal = true;
3925 }
3926 break;
3927
3928 case static_cast<std::uint8_t>(AttributeName::VariableReference):
3929 {
3930 returnedAttributeData = get_variable_reference();
3931 retVal = true;
3932 }
3933 break;
3934
3935 case static_cast<std::uint8_t>(AttributeName::Value):
3936 {
3937 returnedAttributeData = get_value();
3938 retVal = true;
3939 }
3940 break;
3941
3942 default:
3943 {
3944 // Do nothing, return false
3945 }
3946 break;
3947 }
3948 }
3949 return retVal;
3950 }
3951
3953 {
3954 return numberOfListItems;
3955 }
3956
3958 {
3959 numberOfListItems = value;
3960 }
3961
3962 std::uint8_t OutputList::get_value() const
3963 {
3964 return value;
3965 }
3966
3967 void OutputList::set_value(std::uint8_t aValue)
3968 {
3969 value = aValue;
3970 }
3971
3972 bool OutputList::change_list_item(std::uint8_t index, std::uint16_t newListItem, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool)
3973 {
3974 bool retVal = false;
3975
3976 if ((index < children.size()) &&
3977 ((NULL_OBJECT_ID == newListItem) ||
3978 ((nullptr != get_object_by_id(newListItem, objectPool)) &&
3980 {
3981 children.at(index).id = newListItem;
3982 retVal = true;
3983 }
3984 return retVal;
3985 }
3986
3987 void OutputList::set_variable_reference(std::uint16_t referencedObjectID)
3988 {
3989 variableReference = referencedObjectID;
3990 }
3991
3993 {
3994 return variableReference;
3995 }
3996
4001
4002 bool OutputLine::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
4003 {
4004 bool anyWrongChildType = false;
4005
4006 // Verify the line attributes is a line attribute or NULL_OBJECT_ID
4007 if (NULL_OBJECT_ID != get_line_attributes())
4008 {
4009 auto lineAttributesObject = get_object_by_id(get_line_attributes(), objectPool);
4010
4011 if (nullptr != lineAttributesObject)
4012 {
4013 if (VirtualTerminalObjectType::LineAttributes != lineAttributesObject->get_object_type())
4014 {
4015 anyWrongChildType = true;
4016 }
4017 }
4018 else
4019 {
4020 anyWrongChildType = true;
4021 }
4022 }
4023
4024 for (const auto &child : children)
4025 {
4026 auto childObject = get_object_by_id(child.id, objectPool);
4027
4028 if ((nullptr == childObject) ||
4029 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
4030 {
4031 anyWrongChildType = true;
4032 break;
4033 }
4034 }
4035 return (!anyWrongChildType);
4036 }
4037
4038 bool OutputLine::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
4039 {
4040 bool retVal = false;
4041
4042 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
4043 {
4044 switch (static_cast<AttributeName>(attributeID))
4045 {
4046 case AttributeName::LineAttributes:
4047 {
4048 auto lineAttributeObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
4049
4050 if ((NULL_OBJECT_ID == rawAttributeData) ||
4051 ((nullptr != lineAttributeObject) &&
4052 (VirtualTerminalObjectType::LineAttributes == lineAttributeObject->get_object_type())))
4053 {
4054 set_line_attributes(static_cast<std::uint16_t>(rawAttributeData));
4055 retVal = true;
4056 }
4057 else
4058 {
4059 returnedError = AttributeError::InvalidValue;
4060 }
4061 }
4062 break;
4063
4064 case AttributeName::Width:
4065 {
4066 set_width(static_cast<std::uint16_t>(rawAttributeData));
4067 retVal = true;
4068 }
4069 break;
4070
4071 case AttributeName::Height:
4072 {
4073 set_height(static_cast<std::uint16_t>(rawAttributeData));
4074 retVal = true;
4075 }
4076 break;
4077
4078 case AttributeName::LineDirection:
4079 {
4080 if (rawAttributeData <= static_cast<std::uint8_t>(LineDirection::BottomLeftToTopRight))
4081 {
4082 set_line_direction(static_cast<LineDirection>(rawAttributeData));
4083 retVal = true;
4084 }
4085 else
4086 {
4087 returnedError = AttributeError::AnyOtherError;
4088 }
4089 }
4090 break;
4091
4092 default:
4093 {
4094 returnedError = AttributeError::InvalidAttributeID;
4095 }
4096 break;
4097 }
4098 }
4099 else
4100 {
4101 returnedError = AttributeError::InvalidAttributeID;
4102 }
4103 return retVal;
4104 }
4105
4106 bool OutputLine::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
4107 {
4108 bool retVal = false;
4109
4110 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
4111 {
4112 switch (attributeID)
4113 {
4114 case static_cast<std::uint8_t>(AttributeName::Type):
4115 {
4116 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
4117 retVal = true;
4118 }
4119 break;
4120
4121 case static_cast<std::uint8_t>(AttributeName::Width):
4122 {
4123 returnedAttributeData = get_width();
4124 retVal = true;
4125 }
4126 break;
4127
4128 case static_cast<std::uint8_t>(AttributeName::Height):
4129 {
4130 returnedAttributeData = get_height();
4131 retVal = true;
4132 }
4133 break;
4134
4135 case static_cast<std::uint8_t>(AttributeName::LineAttributes):
4136 {
4137 returnedAttributeData = get_line_attributes();
4138 retVal = true;
4139 }
4140 break;
4141
4142 case static_cast<std::uint8_t>(AttributeName::LineDirection):
4143 {
4144 returnedAttributeData = lineDirection;
4145 retVal = true;
4146 }
4147 break;
4148
4149 default:
4150 {
4151 // Do nothing, return false
4152 }
4153 break;
4154 }
4155 }
4156 return retVal;
4157 }
4158
4160 {
4161 return MIN_OBJECT_LENGTH;
4162 }
4163
4165 {
4166 return static_cast<LineDirection>(lineDirection);
4167 }
4168
4170 {
4171 lineDirection = static_cast<std::uint8_t>(value);
4172 }
4173
4175 {
4176 return lineAttributes;
4177 }
4178
4179 void OutputLine::set_line_attributes(std::uint16_t lineAttributesObject)
4180 {
4181 lineAttributes = lineAttributesObject;
4182 }
4183
4188
4190 {
4191 return MIN_OBJECT_LENGTH;
4192 }
4193
4194 bool OutputRectangle::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
4195 {
4196 bool anyWrongChildType = false;
4197
4198 // Verify the line attributes is a line attribute or NULL_OBJECT_ID
4199 if (NULL_OBJECT_ID != get_line_attributes())
4200 {
4201 auto lineAttributesObject = get_object_by_id(get_line_attributes(), objectPool);
4202
4203 if (nullptr != lineAttributesObject)
4204 {
4205 if (VirtualTerminalObjectType::LineAttributes != lineAttributesObject->get_object_type())
4206 {
4207 anyWrongChildType = true;
4208 }
4209 }
4210 else
4211 {
4212 anyWrongChildType = true;
4213 }
4214 }
4215
4216 // Verify the fill attributes is a fill attribute or NULL_OBJECT_ID
4217 if (NULL_OBJECT_ID != get_fill_attributes())
4218 {
4219 auto fillAttributesObject = get_object_by_id(get_fill_attributes(), objectPool);
4220
4221 if (nullptr != fillAttributesObject)
4222 {
4223 if (VirtualTerminalObjectType::FillAttributes != fillAttributesObject->get_object_type())
4224 {
4225 anyWrongChildType = true;
4226 }
4227 }
4228 else
4229 {
4230 anyWrongChildType = true;
4231 }
4232 }
4233
4234 for (const auto &child : children)
4235 {
4236 auto childObject = get_object_by_id(child.id, objectPool);
4237
4238 if ((nullptr == childObject) ||
4239 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
4240 {
4241 anyWrongChildType = true;
4242 break;
4243 }
4244 }
4245 return (!anyWrongChildType);
4246 }
4247
4248 bool OutputRectangle::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
4249 {
4250 bool retVal = false;
4251
4252 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
4253 {
4254 switch (static_cast<AttributeName>(attributeID))
4255 {
4256 case AttributeName::LineAttributes:
4257 {
4258 auto lineAttributeObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
4259
4260 if ((NULL_OBJECT_ID == rawAttributeData) ||
4261 ((nullptr != lineAttributeObject) &&
4262 (VirtualTerminalObjectType::LineAttributes == lineAttributeObject->get_object_type())))
4263 {
4264 set_line_attributes(static_cast<std::uint16_t>(rawAttributeData));
4265 retVal = true;
4266 }
4267 else
4268 {
4269 returnedError = AttributeError::InvalidValue;
4270 }
4271 }
4272 break;
4273
4274 case AttributeName::Width:
4275 {
4276 set_width(static_cast<std::uint16_t>(rawAttributeData));
4277 retVal = true;
4278 }
4279 break;
4280
4281 case AttributeName::Height:
4282 {
4283 set_height(static_cast<std::uint16_t>(rawAttributeData));
4284 retVal = true;
4285 }
4286 break;
4287
4288 case AttributeName::LineSuppression:
4289 {
4290 set_line_suppression_bitfield(static_cast<std::uint8_t>(rawAttributeData));
4291 retVal = true;
4292 }
4293 break;
4294
4295 case AttributeName::FillAttributes:
4296 {
4297 auto fillAttributeObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
4298
4299 if ((NULL_OBJECT_ID == rawAttributeData) ||
4300 ((nullptr != fillAttributeObject) &&
4301 (VirtualTerminalObjectType::FillAttributes == fillAttributeObject->get_object_type())))
4302 {
4303 set_fill_attributes(static_cast<std::uint16_t>(rawAttributeData));
4304 retVal = true;
4305 }
4306 else
4307 {
4308 returnedError = AttributeError::InvalidValue;
4309 }
4310 }
4311 break;
4312
4313 default:
4314 {
4315 returnedError = AttributeError::InvalidAttributeID;
4316 }
4317 break;
4318 }
4319 }
4320 else
4321 {
4322 returnedError = AttributeError::InvalidAttributeID;
4323 }
4324 return retVal;
4325 }
4326
4327 bool OutputRectangle::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
4328 {
4329 bool retVal = false;
4330
4331 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
4332 {
4333 switch (attributeID)
4334 {
4335 case static_cast<std::uint8_t>(AttributeName::Type):
4336 {
4337 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
4338 retVal = true;
4339 }
4340 break;
4341
4342 case static_cast<std::uint8_t>(AttributeName::Width):
4343 {
4344 returnedAttributeData = get_width();
4345 retVal = true;
4346 }
4347 break;
4348
4349 case static_cast<std::uint8_t>(AttributeName::Height):
4350 {
4351 returnedAttributeData = get_height();
4352 retVal = true;
4353 }
4354 break;
4355
4356 case static_cast<std::uint8_t>(AttributeName::LineAttributes):
4357 {
4358 returnedAttributeData = get_line_attributes();
4359 retVal = true;
4360 }
4361 break;
4362
4363 case static_cast<std::uint8_t>(AttributeName::LineSuppression):
4364 {
4365 returnedAttributeData = lineSuppressionBitfield;
4366 retVal = true;
4367 }
4368 break;
4369
4370 case static_cast<std::uint8_t>(AttributeName::FillAttributes):
4371 {
4372 returnedAttributeData = get_fill_attributes();
4373 retVal = true;
4374 }
4375 break;
4376
4377 default:
4378 {
4379 // Do nothing, return false
4380 }
4381 break;
4382 }
4383 }
4384 return retVal;
4385 }
4386
4388 {
4389 return lineSuppressionBitfield;
4390 }
4391
4393 {
4394 lineSuppressionBitfield = value;
4395 }
4396
4398 {
4399 return lineAttributes;
4400 }
4401
4402 void OutputRectangle::set_line_attributes(std::uint16_t lineAttributesObject)
4403 {
4404 lineAttributes = lineAttributesObject;
4405 }
4406
4408 {
4409 return fillAttributes;
4410 }
4411
4412 void OutputRectangle::set_fill_attributes(std::uint16_t fillAttributesObject)
4413 {
4414 fillAttributes = fillAttributesObject;
4415 }
4416
4421
4423 {
4424 return MIN_OBJECT_LENGTH;
4425 }
4426
4427 bool OutputEllipse::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
4428 {
4429 bool anyWrongChildType = false;
4430
4431 // Verify the line attributes is a line attribute or NULL_OBJECT_ID
4432 if (NULL_OBJECT_ID != get_line_attributes())
4433 {
4434 auto lineAttributesObject = get_object_by_id(get_line_attributes(), objectPool);
4435
4436 if (nullptr != lineAttributesObject)
4437 {
4438 if (VirtualTerminalObjectType::LineAttributes != lineAttributesObject->get_object_type())
4439 {
4440 anyWrongChildType = true;
4441 }
4442 }
4443 else
4444 {
4445 anyWrongChildType = true;
4446 }
4447 }
4448
4449 // Verify the fill attributes is a fill attribute or NULL_OBJECT_ID
4450 if (NULL_OBJECT_ID != get_fill_attributes())
4451 {
4452 auto fillAttributesObject = get_object_by_id(get_fill_attributes(), objectPool);
4453
4454 if (nullptr != fillAttributesObject)
4455 {
4456 if (VirtualTerminalObjectType::FillAttributes != fillAttributesObject->get_object_type())
4457 {
4458 anyWrongChildType = true;
4459 }
4460 }
4461 else
4462 {
4463 anyWrongChildType = true;
4464 }
4465 }
4466
4467 for (const auto &child : children)
4468 {
4469 auto childObject = get_object_by_id(child.id, objectPool);
4470
4471 if ((nullptr == childObject) ||
4472 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
4473 {
4474 anyWrongChildType = true;
4475 break;
4476 }
4477 }
4478 return (!anyWrongChildType);
4479 }
4480
4481 bool OutputEllipse::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
4482 {
4483 bool retVal = false;
4484
4485 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
4486 {
4487 switch (static_cast<AttributeName>(attributeID))
4488 {
4489 case AttributeName::LineAttributes:
4490 {
4491 auto lineAttributeObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
4492
4493 if ((NULL_OBJECT_ID == rawAttributeData) ||
4494 ((nullptr != lineAttributeObject) &&
4495 (VirtualTerminalObjectType::LineAttributes == lineAttributeObject->get_object_type())))
4496 {
4497 set_line_attributes(static_cast<std::uint16_t>(rawAttributeData));
4498 retVal = true;
4499 }
4500 else
4501 {
4502 returnedError = AttributeError::InvalidValue;
4503 }
4504 }
4505 break;
4506
4507 case AttributeName::Width:
4508 {
4509 set_width(static_cast<std::uint16_t>(rawAttributeData));
4510 retVal = true;
4511 }
4512 break;
4513
4514 case AttributeName::Height:
4515 {
4516 set_height(static_cast<std::uint16_t>(rawAttributeData));
4517 retVal = true;
4518 }
4519 break;
4520
4521 case AttributeName::EllipseType:
4522 {
4523 if (rawAttributeData <= static_cast<std::uint8_t>(EllipseType::ClosedEllipseSection))
4524 {
4525 set_ellipse_type(static_cast<EllipseType>(rawAttributeData));
4526 retVal = true;
4527 }
4528 else
4529 {
4530 returnedError = AttributeError::AnyOtherError;
4531 }
4532 }
4533 break;
4534
4535 case AttributeName::StartAngle:
4536 {
4537 set_start_angle(static_cast<std::uint8_t>(rawAttributeData));
4538 retVal = true;
4539 }
4540 break;
4541
4542 case AttributeName::EndAngle:
4543 {
4544 set_end_angle(static_cast<std::uint8_t>(rawAttributeData));
4545 retVal = true;
4546 }
4547 break;
4548
4549 case AttributeName::FillAttributes:
4550 {
4551 auto fillAttributeObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
4552
4553 if ((NULL_OBJECT_ID == rawAttributeData) ||
4554 ((nullptr != fillAttributeObject) &&
4555 (VirtualTerminalObjectType::FillAttributes == fillAttributeObject->get_object_type())))
4556 {
4557 set_fill_attributes(static_cast<std::uint16_t>(rawAttributeData));
4558 retVal = true;
4559 }
4560 else
4561 {
4562 returnedError = AttributeError::InvalidValue;
4563 }
4564 }
4565 break;
4566
4567 default:
4568 {
4569 returnedError = AttributeError::InvalidAttributeID;
4570 }
4571 break;
4572 }
4573 }
4574 else
4575 {
4576 returnedError = AttributeError::InvalidAttributeID;
4577 }
4578 return retVal;
4579 }
4580
4581 bool OutputEllipse::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
4582 {
4583 bool retVal = false;
4584
4585 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
4586 {
4587 switch (attributeID)
4588 {
4589 case static_cast<std::uint8_t>(AttributeName::Type):
4590 {
4591 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
4592 retVal = true;
4593 }
4594 break;
4595
4596 case static_cast<std::uint8_t>(AttributeName::Width):
4597 {
4598 returnedAttributeData = get_width();
4599 retVal = true;
4600 }
4601 break;
4602
4603 case static_cast<std::uint8_t>(AttributeName::Height):
4604 {
4605 returnedAttributeData = get_height();
4606 retVal = true;
4607 }
4608 break;
4609
4610 case static_cast<std::uint8_t>(AttributeName::LineAttributes):
4611 {
4612 returnedAttributeData = get_line_attributes();
4613 retVal = true;
4614 }
4615 break;
4616
4617 case static_cast<std::uint8_t>(AttributeName::EllipseType):
4618 {
4619 returnedAttributeData = ellipseType;
4620 retVal = true;
4621 }
4622 break;
4623
4624 case static_cast<std::uint8_t>(AttributeName::StartAngle):
4625 {
4626 returnedAttributeData = startAngle;
4627 retVal = true;
4628 }
4629 break;
4630
4631 case static_cast<std::uint8_t>(AttributeName::EndAngle):
4632 {
4633 returnedAttributeData = endAngle;
4634 retVal = true;
4635 }
4636 break;
4637
4638 case static_cast<std::uint8_t>(AttributeName::FillAttributes):
4639 {
4640 returnedAttributeData = get_fill_attributes();
4641 retVal = true;
4642 }
4643 break;
4644
4645 default:
4646 {
4647 // Do nothing, return false
4648 }
4649 break;
4650 }
4651 }
4652 return retVal;
4653 }
4654
4656 {
4657 return static_cast<EllipseType>(ellipseType);
4658 }
4659
4661 {
4662 ellipseType = static_cast<std::uint8_t>(value);
4663 }
4664
4666 {
4667 return startAngle;
4668 }
4669
4670 void OutputEllipse::set_start_angle(std::uint8_t value)
4671 {
4672 startAngle = value;
4673 }
4674
4675 std::uint8_t OutputEllipse::get_end_angle() const
4676 {
4677 return endAngle;
4678 }
4679
4680 void OutputEllipse::set_end_angle(std::uint8_t value)
4681 {
4682 endAngle = value;
4683 }
4684
4686 {
4687 return lineAttributes;
4688 }
4689
4690 void OutputEllipse::set_line_attributes(std::uint16_t lineAttributesObject)
4691 {
4692 lineAttributes = lineAttributesObject;
4693 }
4694
4696 {
4697 return fillAttributes;
4698 }
4699
4700 void OutputEllipse::set_fill_attributes(std::uint16_t fillAttributesObject)
4701 {
4702 fillAttributes = fillAttributesObject;
4703 }
4704
4709
4711 {
4712 return MIN_OBJECT_LENGTH;
4713 }
4714
4715 bool OutputPolygon::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
4716 {
4717 bool anyWrongChildType = false;
4718
4719 // Verify the line attributes is a line attribute or NULL_OBJECT_ID
4720 if (NULL_OBJECT_ID != get_line_attributes())
4721 {
4722 auto lineAttributesObject = get_object_by_id(get_line_attributes(), objectPool);
4723
4724 if (nullptr != lineAttributesObject)
4725 {
4726 if (VirtualTerminalObjectType::LineAttributes != lineAttributesObject->get_object_type())
4727 {
4728 anyWrongChildType = true;
4729 }
4730 }
4731 else
4732 {
4733 anyWrongChildType = true;
4734 }
4735 }
4736
4737 // Verify the fill attributes is a fill attribute or NULL_OBJECT_ID
4738 if (NULL_OBJECT_ID != get_fill_attributes())
4739 {
4740 auto fillAttributesObject = get_object_by_id(get_fill_attributes(), objectPool);
4741
4742 if (nullptr != fillAttributesObject)
4743 {
4744 if (VirtualTerminalObjectType::FillAttributes != fillAttributesObject->get_object_type())
4745 {
4746 anyWrongChildType = true;
4747 }
4748 }
4749 else
4750 {
4751 anyWrongChildType = true;
4752 }
4753 }
4754
4755 for (const auto &child : children)
4756 {
4757 auto childObject = get_object_by_id(child.id, objectPool);
4758
4759 if ((nullptr == childObject) ||
4760 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
4761 {
4762 anyWrongChildType = true;
4763 break;
4764 }
4765 }
4766 return (!anyWrongChildType);
4767 }
4768
4769 bool OutputPolygon::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
4770 {
4771 bool retVal = false;
4772
4773 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
4774 {
4775 switch (static_cast<AttributeName>(attributeID))
4776 {
4777 case AttributeName::Width:
4778 {
4779 set_width(static_cast<std::uint16_t>(rawAttributeData));
4780 retVal = true;
4781 }
4782 break;
4783
4784 case AttributeName::Height:
4785 {
4786 set_height(static_cast<std::uint16_t>(rawAttributeData));
4787 retVal = true;
4788 }
4789 break;
4790
4791 case AttributeName::LineAttributes:
4792 {
4793 auto lineAttributeObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
4794
4795 if ((NULL_OBJECT_ID == rawAttributeData) ||
4796 ((nullptr != lineAttributeObject) &&
4797 (VirtualTerminalObjectType::LineAttributes == lineAttributeObject->get_object_type())))
4798 {
4799 set_line_attributes(static_cast<std::uint16_t>(rawAttributeData));
4800 retVal = true;
4801 }
4802 else
4803 {
4804 returnedError = AttributeError::InvalidValue;
4805 }
4806 }
4807 break;
4808
4809 case AttributeName::FillAttributes:
4810 {
4811 auto fillAttributeObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
4812
4813 if ((NULL_OBJECT_ID == rawAttributeData) ||
4814 ((nullptr != fillAttributeObject) &&
4815 (VirtualTerminalObjectType::FillAttributes == fillAttributeObject->get_object_type())))
4816 {
4817 set_fill_attributes(static_cast<std::uint16_t>(rawAttributeData));
4818 retVal = true;
4819 }
4820 else
4821 {
4822 returnedError = AttributeError::InvalidValue;
4823 }
4824 }
4825 break;
4826
4827 case AttributeName::PolygonType:
4828 {
4829 if (rawAttributeData <= static_cast<std::uint8_t>(PolygonType::Open))
4830 {
4831 set_type(static_cast<PolygonType>(rawAttributeData));
4832 retVal = true;
4833 }
4834 else
4835 {
4836 returnedError = AttributeError::AnyOtherError;
4837 }
4838 }
4839 break;
4840
4841 default:
4842 {
4843 returnedError = AttributeError::InvalidAttributeID;
4844 }
4845 break;
4846 }
4847 }
4848 else
4849 {
4850 returnedError = AttributeError::InvalidAttributeID;
4851 }
4852 return retVal;
4853 }
4854
4855 bool OutputPolygon::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
4856 {
4857 bool retVal = false;
4858
4859 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
4860 {
4861 switch (attributeID)
4862 {
4863 case static_cast<std::uint8_t>(AttributeName::Type):
4864 {
4865 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
4866 retVal = true;
4867 }
4868 break;
4869
4870 case static_cast<std::uint8_t>(AttributeName::Width):
4871 {
4872 returnedAttributeData = get_width();
4873 retVal = true;
4874 }
4875 break;
4876
4877 case static_cast<std::uint8_t>(AttributeName::Height):
4878 {
4879 returnedAttributeData = get_height();
4880 retVal = true;
4881 }
4882 break;
4883
4884 case static_cast<std::uint8_t>(AttributeName::LineAttributes):
4885 {
4886 returnedAttributeData = get_line_attributes();
4887 retVal = true;
4888 }
4889 break;
4890
4891 case static_cast<std::uint8_t>(AttributeName::FillAttributes):
4892 {
4893 returnedAttributeData = get_fill_attributes();
4894 retVal = true;
4895 }
4896 break;
4897
4898 case static_cast<std::uint8_t>(AttributeName::PolygonType):
4899 {
4900 returnedAttributeData = polygonType;
4901 retVal = true;
4902 }
4903 break;
4904
4905 default:
4906 {
4907 // Do nothing, return false
4908 }
4909 break;
4910 }
4911 }
4912 return retVal;
4913 }
4914
4915 void OutputPolygon::add_point(std::uint16_t x, std::uint16_t y)
4916 {
4917 pointList.push_back({ x, y });
4918 }
4919
4921 {
4922 return static_cast<std::uint8_t>(pointList.size());
4923 }
4924
4926 {
4927 PolygonPoint retVal = { 0, 0 };
4928
4929 if (index < pointList.size())
4930 {
4931 retVal = pointList[index];
4932 }
4933 return retVal;
4934 }
4935
4937 {
4938 return static_cast<PolygonType>(polygonType);
4939 }
4940
4942 {
4943 polygonType = static_cast<std::uint8_t>(value);
4944 }
4945
4947 {
4948 return lineAttributes;
4949 }
4950
4951 void OutputPolygon::set_line_attributes(std::uint16_t lineAttributesObject)
4952 {
4953 lineAttributes = lineAttributesObject;
4954 }
4955
4957 {
4958 return fillAttributes;
4959 }
4960
4961 void OutputPolygon::set_fill_attributes(std::uint16_t fillAttributesObject)
4962 {
4963 fillAttributes = fillAttributesObject;
4964 }
4965
4970
4972 {
4973 return MIN_OBJECT_LENGTH;
4974 }
4975
4976 bool OutputMeter::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
4977 {
4978 bool anyWrongChildType = false;
4979
4980 // Verify the variable reference is a number variable or NULL_OBJECT_ID
4981 if (NULL_OBJECT_ID != get_variable_reference())
4982 {
4983 auto variableObject = get_object_by_id(get_variable_reference(), objectPool);
4984
4985 if (nullptr != variableObject)
4986 {
4987 if (VirtualTerminalObjectType::NumberVariable != variableObject->get_object_type())
4988 {
4989 anyWrongChildType = true;
4990 }
4991 }
4992 else
4993 {
4994 anyWrongChildType = true;
4995 }
4996 }
4997
4998 for (const auto &child : children)
4999 {
5000 auto childObject = get_object_by_id(child.id, objectPool);
5001
5002 if ((nullptr == childObject) ||
5003 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
5004 {
5005 anyWrongChildType = true;
5006 break;
5007 }
5008 }
5009 return (!anyWrongChildType);
5010 }
5011
5012 bool OutputMeter::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
5013 {
5014 bool retVal = false;
5015
5016 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
5017 {
5018 switch (static_cast<AttributeName>(attributeID))
5019 {
5020 case AttributeName::Width:
5021 {
5022 set_width(static_cast<std::uint16_t>(rawAttributeData));
5023 retVal = true;
5024 }
5025 break;
5026
5027 case AttributeName::NeedleColour:
5028 {
5029 set_needle_colour(static_cast<std::uint8_t>(rawAttributeData));
5030 retVal = true;
5031 }
5032 break;
5033
5034 case AttributeName::BorderColour:
5035 {
5036 set_border_colour(static_cast<std::uint8_t>(rawAttributeData));
5037 retVal = true;
5038 }
5039 break;
5040
5041 case AttributeName::ArcAndTickColour:
5042 {
5043 set_arc_and_tick_colour(static_cast<std::uint8_t>(rawAttributeData));
5044 retVal = true;
5045 }
5046 break;
5047
5048 case AttributeName::Options:
5049 {
5050 set_options(static_cast<std::uint8_t>(rawAttributeData));
5051 retVal = true;
5052 }
5053 break;
5054
5055 case AttributeName::NumberOfTicks:
5056 {
5057 set_number_of_ticks(static_cast<std::uint8_t>(rawAttributeData));
5058 retVal = true;
5059 }
5060 break;
5061
5062 case AttributeName::StartAngle:
5063 {
5064 set_start_angle(static_cast<std::uint8_t>(rawAttributeData));
5065 retVal = true;
5066 }
5067 break;
5068
5069 case AttributeName::EndAngle:
5070 {
5071 set_end_angle(static_cast<std::uint8_t>(rawAttributeData));
5072 retVal = true;
5073 }
5074 break;
5075
5076 case AttributeName::MinValue:
5077 {
5078 set_min_value(static_cast<std::uint16_t>(rawAttributeData));
5079 retVal = true;
5080 }
5081 break;
5082
5083 case AttributeName::MaxValue:
5084 {
5085 set_max_value(static_cast<std::uint16_t>(rawAttributeData));
5086 retVal = true;
5087 }
5088 break;
5089
5090 case AttributeName::VariableReference:
5091 {
5092 auto variableObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
5093
5094 if ((NULL_OBJECT_ID == rawAttributeData) ||
5095 ((nullptr != variableObject) &&
5096 (VirtualTerminalObjectType::NumberVariable == variableObject->get_object_type())))
5097 {
5098 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
5099 retVal = true;
5100 }
5101 else
5102 {
5103 returnedError = AttributeError::InvalidValue;
5104 }
5105 }
5106 break;
5107
5108 case AttributeName::Value:
5109 {
5110 set_value(static_cast<std::uint16_t>(rawAttributeData));
5111 retVal = true;
5112 }
5113 break;
5114
5115 default:
5116 {
5117 returnedError = AttributeError::InvalidAttributeID;
5118 }
5119 break;
5120 }
5121 }
5122 else
5123 {
5124 returnedError = AttributeError::InvalidAttributeID;
5125 }
5126 return retVal;
5127 }
5128
5129 bool OutputMeter::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
5130 {
5131 bool retVal = false;
5132
5133 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
5134 {
5135 switch (attributeID)
5136 {
5137 case static_cast<std::uint8_t>(AttributeName::Type):
5138 {
5139 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
5140 retVal = true;
5141 }
5142 break;
5143
5144 case static_cast<std::uint8_t>(AttributeName::Width):
5145 {
5146 returnedAttributeData = get_width();
5147 retVal = true;
5148 }
5149 break;
5150
5151 case static_cast<std::uint8_t>(AttributeName::NeedleColour):
5152 {
5153 returnedAttributeData = get_needle_colour();
5154 retVal = true;
5155 }
5156 break;
5157
5158 case static_cast<std::uint8_t>(AttributeName::BorderColour):
5159 {
5160 returnedAttributeData = get_border_colour();
5161 retVal = true;
5162 }
5163 break;
5164
5165 case static_cast<std::uint8_t>(AttributeName::ArcAndTickColour):
5166 {
5167 returnedAttributeData = get_arc_and_tick_colour();
5168 retVal = true;
5169 }
5170 break;
5171
5172 case static_cast<std::uint8_t>(AttributeName::Options):
5173 {
5174 returnedAttributeData = optionsBitfield;
5175 retVal = true;
5176 }
5177 break;
5178
5179 case static_cast<std::uint8_t>(AttributeName::NumberOfTicks):
5180 {
5181 returnedAttributeData = get_number_of_ticks();
5182 retVal = true;
5183 }
5184 break;
5185
5186 case static_cast<std::uint8_t>(AttributeName::StartAngle):
5187 {
5188 returnedAttributeData = get_start_angle();
5189 retVal = true;
5190 }
5191 break;
5192
5193 case static_cast<std::uint8_t>(AttributeName::EndAngle):
5194 {
5195 returnedAttributeData = get_end_angle();
5196 retVal = true;
5197 }
5198 break;
5199
5200 case static_cast<std::uint8_t>(AttributeName::MinValue):
5201 {
5202 returnedAttributeData = get_min_value();
5203 retVal = true;
5204 }
5205 break;
5206
5207 case static_cast<std::uint8_t>(AttributeName::MaxValue):
5208 {
5209 returnedAttributeData = get_max_value();
5210 retVal = true;
5211 }
5212 break;
5213
5214 case static_cast<std::uint8_t>(AttributeName::VariableReference):
5215 {
5216 returnedAttributeData = get_variable_reference();
5217 retVal = true;
5218 }
5219 break;
5220
5221 case static_cast<std::uint8_t>(AttributeName::Value):
5222 {
5223 returnedAttributeData = get_value();
5224 retVal = true;
5225 }
5226 break;
5227
5228 default:
5229 {
5230 // Do nothing, return false
5231 }
5232 break;
5233 }
5234 }
5235 return retVal;
5236 }
5237
5238 std::uint16_t OutputMeter::get_min_value() const
5239 {
5240 return minValue;
5241 }
5242
5243 void OutputMeter::set_min_value(std::uint16_t value)
5244 {
5245 minValue = value;
5246 }
5247
5248 std::uint16_t OutputMeter::get_max_value() const
5249 {
5250 return maxValue;
5251 }
5252
5253 void OutputMeter::set_max_value(std::uint16_t value)
5254 {
5255 maxValue = value;
5256 }
5257
5258 std::uint16_t OutputMeter::get_value() const
5259 {
5260 return value;
5261 }
5262
5263 void OutputMeter::set_value(std::uint16_t aValue)
5264 {
5265 value = aValue;
5266 }
5267
5269 {
5270 return needleColour;
5271 }
5272
5273 void OutputMeter::set_needle_colour(std::uint8_t colourIndex)
5274 {
5275 needleColour = colourIndex;
5276 }
5277
5279 {
5280 return borderColour;
5281 }
5282
5283 void OutputMeter::set_border_colour(std::uint8_t colourIndex)
5284 {
5285 borderColour = colourIndex;
5286 }
5287
5289 {
5290 return arcAndTickColour;
5291 }
5292
5293 void OutputMeter::set_arc_and_tick_colour(std::uint8_t colourIndex)
5294 {
5295 arcAndTickColour = colourIndex;
5296 }
5297
5299 {
5300 return numberOfTicks;
5301 }
5302
5303 void OutputMeter::set_number_of_ticks(std::uint8_t ticks)
5304 {
5305 numberOfTicks = ticks;
5306 }
5307
5309 {
5310 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
5311 }
5312
5313 void OutputMeter::set_options(std::uint8_t options)
5314 {
5315 optionsBitfield = options;
5316 }
5317
5318 void OutputMeter::set_option(Options option, bool optionValue)
5319 {
5320 if (optionValue)
5321 {
5322 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
5323 }
5324 else
5325 {
5326 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
5327 }
5328 }
5329
5330 std::uint8_t OutputMeter::get_start_angle() const
5331 {
5332 return startAngle;
5333 }
5334
5335 void OutputMeter::set_start_angle(std::uint8_t value)
5336 {
5337 startAngle = value;
5338 }
5339
5340 std::uint8_t OutputMeter::get_end_angle() const
5341 {
5342 return endAngle;
5343 }
5344
5345 void OutputMeter::set_end_angle(std::uint8_t value)
5346 {
5347 endAngle = value;
5348 }
5349
5351 {
5352 return variableReference;
5353 }
5354
5355 void OutputMeter::set_variable_reference(std::uint16_t variableReferenceValue)
5356 {
5357 variableReference = variableReferenceValue;
5358 }
5359
5364
5366 {
5367 return MIN_OBJECT_LENGTH;
5368 }
5369
5370 bool OutputLinearBarGraph::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
5371 {
5372 bool anyWrongChildType = false;
5373
5374 // Verify the variable reference is a number variable or NULL_OBJECT_ID
5375 if (NULL_OBJECT_ID != get_variable_reference())
5376 {
5377 auto variableObject = get_object_by_id(get_variable_reference(), objectPool);
5378
5379 if (nullptr != variableObject)
5380 {
5381 if (VirtualTerminalObjectType::NumberVariable != variableObject->get_object_type())
5382 {
5383 anyWrongChildType = true;
5384 }
5385 }
5386 else
5387 {
5388 anyWrongChildType = true;
5389 }
5390 }
5391
5392 // Verify the target value variable reference is a number variable or NULL_OBJECT_ID
5393 if (NULL_OBJECT_ID != get_target_value_reference())
5394 {
5395 auto variableObject = get_object_by_id(get_target_value_reference(), objectPool);
5396
5397 if (nullptr != variableObject)
5398 {
5399 if (VirtualTerminalObjectType::NumberVariable != variableObject->get_object_type())
5400 {
5401 anyWrongChildType = true;
5402 }
5403 }
5404 else
5405 {
5406 anyWrongChildType = true;
5407 }
5408 }
5409
5410 for (const auto &child : children)
5411 {
5412 auto childObject = get_object_by_id(child.id, objectPool);
5413
5414 if ((nullptr == childObject) ||
5415 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
5416 {
5417 anyWrongChildType = true;
5418 break;
5419 }
5420 }
5421 return (!anyWrongChildType);
5422 }
5423
5424 bool OutputLinearBarGraph::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
5425 {
5426 bool retVal = false;
5427
5428 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
5429 {
5430 switch (static_cast<AttributeName>(attributeID))
5431 {
5432 case AttributeName::Width:
5433 {
5434 set_width(static_cast<std::uint16_t>(rawAttributeData));
5435 retVal = true;
5436 }
5437 break;
5438
5439 case AttributeName::Height:
5440 {
5441 set_height(static_cast<std::uint16_t>(rawAttributeData));
5442 retVal = true;
5443 }
5444 break;
5445
5446 case AttributeName::Colour:
5447 {
5448 set_colour(static_cast<std::uint8_t>(rawAttributeData));
5449 retVal = true;
5450 }
5451 break;
5452
5453 case AttributeName::TargetLineColour:
5454 {
5455 set_target_line_colour(static_cast<std::uint8_t>(rawAttributeData));
5456 retVal = true;
5457 }
5458 break;
5459
5460 case AttributeName::Options:
5461 {
5462 set_options(static_cast<std::uint8_t>(rawAttributeData));
5463 retVal = true;
5464 }
5465 break;
5466
5467 case AttributeName::NumberOfTicks:
5468 {
5469 set_number_of_ticks(static_cast<std::uint8_t>(rawAttributeData));
5470 retVal = true;
5471 }
5472 break;
5473
5474 case AttributeName::MinValue:
5475 {
5476 set_min_value(static_cast<std::uint16_t>(rawAttributeData));
5477 retVal = true;
5478 }
5479 break;
5480
5481 case AttributeName::MaxValue:
5482 {
5483 set_max_value(static_cast<std::uint16_t>(rawAttributeData));
5484 retVal = true;
5485 }
5486 break;
5487
5488 case AttributeName::VariableReference:
5489 {
5490 auto variableObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
5491
5492 if ((NULL_OBJECT_ID == rawAttributeData) ||
5493 ((nullptr != variableObject) &&
5494 (VirtualTerminalObjectType::NumberVariable == variableObject->get_object_type())))
5495 {
5496 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
5497 retVal = true;
5498 }
5499 else
5500 {
5501 returnedError = AttributeError::InvalidValue;
5502 }
5503 }
5504 break;
5505
5506 case AttributeName::TargetValueVariableReference:
5507 {
5508 set_target_value_reference(static_cast<std::uint16_t>(rawAttributeData));
5509 retVal = true;
5510 }
5511 break;
5512
5513 case AttributeName::TargetValue:
5514 {
5515 set_target_value(static_cast<std::uint16_t>(rawAttributeData));
5516 retVal = true;
5517 }
5518 break;
5519
5520 case AttributeName::Value:
5521 {
5522 set_value(static_cast<std::uint16_t>(rawAttributeData));
5523 retVal = true;
5524 }
5525 break;
5526
5527 default:
5528 {
5529 returnedError = AttributeError::InvalidAttributeID;
5530 }
5531 break;
5532 }
5533 }
5534 else
5535 {
5536 returnedError = AttributeError::InvalidAttributeID;
5537 }
5538 return retVal;
5539 }
5540
5541 bool OutputLinearBarGraph::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
5542 {
5543 bool retVal = false;
5544
5545 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
5546 {
5547 switch (attributeID)
5548 {
5549 case static_cast<std::uint8_t>(AttributeName::Type):
5550 {
5551 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
5552 retVal = true;
5553 }
5554 break;
5555
5556 case static_cast<std::uint8_t>(AttributeName::Width):
5557 {
5558 returnedAttributeData = get_width();
5559 retVal = true;
5560 }
5561 break;
5562
5563 case static_cast<std::uint8_t>(AttributeName::Height):
5564 {
5565 returnedAttributeData = get_height();
5566 retVal = true;
5567 }
5568 break;
5569
5570 case static_cast<std::uint8_t>(AttributeName::Colour):
5571 {
5572 returnedAttributeData = get_colour();
5573 retVal = true;
5574 }
5575 break;
5576
5577 case static_cast<std::uint8_t>(AttributeName::TargetLineColour):
5578 {
5579 returnedAttributeData = get_target_line_colour();
5580 retVal = true;
5581 }
5582 break;
5583
5584 case static_cast<std::uint8_t>(AttributeName::Options):
5585 {
5586 returnedAttributeData = optionsBitfield;
5587 retVal = true;
5588 }
5589 break;
5590
5591 case static_cast<std::uint8_t>(AttributeName::NumberOfTicks):
5592 {
5593 returnedAttributeData = get_number_of_ticks();
5594 retVal = true;
5595 }
5596 break;
5597
5598 case static_cast<std::uint8_t>(AttributeName::MinValue):
5599 {
5600 returnedAttributeData = get_min_value();
5601 retVal = true;
5602 }
5603 break;
5604
5605 case static_cast<std::uint8_t>(AttributeName::MaxValue):
5606 {
5607 returnedAttributeData = get_max_value();
5608 retVal = true;
5609 }
5610 break;
5611
5612 case static_cast<std::uint8_t>(AttributeName::VariableReference):
5613 {
5614 returnedAttributeData = get_variable_reference();
5615 retVal = true;
5616 }
5617 break;
5618
5619 case static_cast<std::uint8_t>(AttributeName::TargetValueVariableReference):
5620 {
5621 returnedAttributeData = get_target_value_reference();
5622 retVal = true;
5623 }
5624 break;
5625
5626 case static_cast<std::uint8_t>(AttributeName::TargetValue):
5627 {
5628 returnedAttributeData = get_target_value();
5629 retVal = true;
5630 }
5631 break;
5632
5633 case static_cast<std::uint8_t>(AttributeName::Value):
5634 {
5635 returnedAttributeData = get_value();
5636 retVal = true;
5637 }
5638 break;
5639
5640 default:
5641 {
5642 // Do nothing, return false
5643 }
5644 break;
5645 }
5646 }
5647 return retVal;
5648 }
5649
5651 {
5652 return minValue;
5653 }
5654
5655 void OutputLinearBarGraph::set_min_value(std::uint16_t value)
5656 {
5657 minValue = value;
5658 }
5659
5661 {
5662 return maxValue;
5663 }
5664
5665 void OutputLinearBarGraph::set_max_value(std::uint16_t value)
5666 {
5667 maxValue = value;
5668 }
5669
5671 {
5672 return value;
5673 }
5674
5675 void OutputLinearBarGraph::set_value(std::uint16_t aValue)
5676 {
5677 value = aValue;
5678 }
5679
5681 {
5682 return targetValue;
5683 }
5684
5685 void OutputLinearBarGraph::set_target_value(std::uint16_t valueTarget)
5686 {
5687 targetValue = valueTarget;
5688 }
5689
5691 {
5692 return targetValueReference;
5693 }
5694
5695 void OutputLinearBarGraph::set_target_value_reference(std::uint16_t valueReferenceObjectID)
5696 {
5697 targetValueReference = valueReferenceObjectID;
5698 }
5699
5701 {
5702 return numberOfTicks;
5703 }
5704
5706 {
5707 numberOfTicks = value;
5708 }
5709
5711 {
5712 return colour;
5713 }
5714
5715 void OutputLinearBarGraph::set_colour(std::uint8_t graphColour)
5716 {
5717 colour = graphColour;
5718 }
5719
5721 {
5722 return targetLineColour;
5723 }
5724
5726 {
5727 targetLineColour = lineColour;
5728 }
5729
5731 {
5732 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
5733 }
5734
5735 void OutputLinearBarGraph::set_options(std::uint8_t options)
5736 {
5737 optionsBitfield = options;
5738 }
5739
5740 void OutputLinearBarGraph::set_option(Options option, bool optionValue)
5741 {
5742 if (optionValue)
5743 {
5744 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
5745 }
5746 else
5747 {
5748 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
5749 }
5750 }
5751
5753 {
5754 return variableReference;
5755 }
5756
5757 void OutputLinearBarGraph::set_variable_reference(std::uint16_t variableReferenceValue)
5758 {
5759 variableReference = variableReferenceValue;
5760 }
5761
5766
5768 {
5769 return MIN_OBJECT_LENGTH;
5770 }
5771
5772 bool OutputArchedBarGraph::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
5773 {
5774 bool anyWrongChildType = false;
5775
5776 // Verify the variable reference is a number variable or NULL_OBJECT_ID
5777 if (NULL_OBJECT_ID != get_variable_reference())
5778 {
5779 auto variableObject = get_object_by_id(get_variable_reference(), objectPool);
5780
5781 if (nullptr != variableObject)
5782 {
5783 if (VirtualTerminalObjectType::NumberVariable != variableObject->get_object_type())
5784 {
5785 anyWrongChildType = true;
5786 }
5787 }
5788 else
5789 {
5790 anyWrongChildType = true;
5791 }
5792 }
5793
5794 // Verify the target value variable reference is a number variable or NULL_OBJECT_ID
5795 if (NULL_OBJECT_ID != get_target_value_reference())
5796 {
5797 auto variableObject = get_object_by_id(get_target_value_reference(), objectPool);
5798
5799 if (nullptr != variableObject)
5800 {
5801 if (VirtualTerminalObjectType::NumberVariable != variableObject->get_object_type())
5802 {
5803 anyWrongChildType = true;
5804 }
5805 }
5806 else
5807 {
5808 anyWrongChildType = true;
5809 }
5810 }
5811
5812 for (const auto &child : children)
5813 {
5814 auto childObject = get_object_by_id(child.id, objectPool);
5815
5816 if ((nullptr == childObject) ||
5817 (VirtualTerminalObjectType::Macro != childObject->get_object_type()))
5818 {
5819 anyWrongChildType = true;
5820 break;
5821 }
5822 }
5823 return (!anyWrongChildType);
5824 }
5825
5826 bool OutputArchedBarGraph::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
5827 {
5828 bool retVal = false;
5829
5830 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
5831 {
5832 switch (static_cast<AttributeName>(attributeID))
5833 {
5834 case AttributeName::Width:
5835 {
5836 set_width(static_cast<std::uint16_t>(rawAttributeData));
5837 retVal = true;
5838 }
5839 break;
5840
5841 case AttributeName::Height:
5842 {
5843 set_height(static_cast<std::uint16_t>(rawAttributeData));
5844 retVal = true;
5845 }
5846 break;
5847
5848 case AttributeName::Colour:
5849 {
5850 set_colour(static_cast<std::uint8_t>(rawAttributeData));
5851 retVal = true;
5852 }
5853 break;
5854
5855 case AttributeName::TargetLineColour:
5856 {
5857 set_target_line_colour(static_cast<std::uint8_t>(rawAttributeData));
5858 retVal = true;
5859 }
5860 break;
5861
5862 case AttributeName::Options:
5863 {
5864 set_options(static_cast<std::uint8_t>(rawAttributeData));
5865 retVal = true;
5866 }
5867 break;
5868
5869 case AttributeName::StartAngle:
5870 {
5871 set_start_angle(static_cast<std::uint8_t>(rawAttributeData));
5872 retVal = true;
5873 }
5874 break;
5875
5876 case AttributeName::EndAngle:
5877 {
5878 set_end_angle(static_cast<std::uint8_t>(rawAttributeData));
5879 retVal = true;
5880 }
5881 break;
5882
5883 case AttributeName::BarGraphWidth:
5884 {
5885 set_bar_graph_width(static_cast<std::uint16_t>(rawAttributeData));
5886 retVal = true;
5887 }
5888 break;
5889
5890 case AttributeName::MinValue:
5891 {
5892 set_min_value(static_cast<std::uint16_t>(rawAttributeData));
5893 retVal = true;
5894 }
5895 break;
5896
5897 case AttributeName::MaxValue:
5898 {
5899 set_max_value(static_cast<std::uint16_t>(rawAttributeData));
5900 retVal = true;
5901 }
5902 break;
5903
5904 case AttributeName::VariableReference:
5905 {
5906 auto variableObject = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
5907
5908 if ((NULL_OBJECT_ID == rawAttributeData) ||
5909 ((nullptr != variableObject) &&
5910 (VirtualTerminalObjectType::NumberVariable == variableObject->get_object_type())))
5911 {
5912 set_variable_reference(static_cast<std::uint16_t>(rawAttributeData));
5913 retVal = true;
5914 }
5915 else
5916 {
5917 returnedError = AttributeError::InvalidValue;
5918 }
5919 }
5920 break;
5921
5922 case AttributeName::TargetValueVariableReference:
5923 {
5924 set_target_value_reference(static_cast<std::uint16_t>(rawAttributeData));
5925 retVal = true;
5926 }
5927 break;
5928
5929 case AttributeName::TargetValue:
5930 {
5931 set_target_value(static_cast<std::uint16_t>(rawAttributeData));
5932 retVal = true;
5933 }
5934 break;
5935
5936 default:
5937 {
5938 returnedError = AttributeError::InvalidAttributeID;
5939 }
5940 break;
5941 }
5942 }
5943 else
5944 {
5945 returnedError = AttributeError::InvalidAttributeID;
5946 }
5947 return retVal;
5948 }
5949
5950 bool OutputArchedBarGraph::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
5951 {
5952 bool retVal = false;
5953
5954 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
5955 {
5956 switch (attributeID)
5957 {
5958 case static_cast<std::uint8_t>(AttributeName::Type):
5959 {
5960 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
5961 retVal = true;
5962 }
5963 break;
5964
5965 case static_cast<std::uint8_t>(AttributeName::Width):
5966 {
5967 returnedAttributeData = get_width();
5968 retVal = true;
5969 }
5970 break;
5971
5972 case static_cast<std::uint8_t>(AttributeName::Height):
5973 {
5974 returnedAttributeData = get_height();
5975 retVal = true;
5976 }
5977 break;
5978
5979 case static_cast<std::uint8_t>(AttributeName::Colour):
5980 {
5981 returnedAttributeData = get_colour();
5982 retVal = true;
5983 }
5984 break;
5985
5986 case static_cast<std::uint8_t>(AttributeName::TargetLineColour):
5987 {
5988 returnedAttributeData = get_target_line_colour();
5989 retVal = true;
5990 }
5991 break;
5992
5993 case static_cast<std::uint8_t>(AttributeName::Options):
5994 {
5995 returnedAttributeData = optionsBitfield;
5996 retVal = true;
5997 }
5998 break;
5999
6000 case static_cast<std::uint8_t>(AttributeName::StartAngle):
6001 {
6002 returnedAttributeData = get_start_angle();
6003 retVal = true;
6004 }
6005 break;
6006
6007 case static_cast<std::uint8_t>(AttributeName::EndAngle):
6008 {
6009 returnedAttributeData = get_end_angle();
6010 retVal = true;
6011 }
6012 break;
6013
6014 case static_cast<std::uint8_t>(AttributeName::BarGraphWidth):
6015 {
6016 returnedAttributeData = get_bar_graph_width();
6017 retVal = true;
6018 }
6019 break;
6020
6021 case static_cast<std::uint8_t>(AttributeName::MinValue):
6022 {
6023 returnedAttributeData = get_min_value();
6024 retVal = true;
6025 }
6026 break;
6027
6028 case static_cast<std::uint8_t>(AttributeName::MaxValue):
6029 {
6030 returnedAttributeData = get_max_value();
6031 retVal = true;
6032 }
6033 break;
6034
6035 case static_cast<std::uint8_t>(AttributeName::VariableReference):
6036 {
6037 returnedAttributeData = get_variable_reference();
6038 retVal = true;
6039 }
6040 break;
6041
6042 case static_cast<std::uint8_t>(AttributeName::TargetValueVariableReference):
6043 {
6044 returnedAttributeData = get_target_value_reference();
6045 retVal = true;
6046 }
6047 break;
6048
6049 case static_cast<std::uint8_t>(AttributeName::TargetValue):
6050 {
6051 returnedAttributeData = get_target_value();
6052 retVal = true;
6053 }
6054 break;
6055
6056 default:
6057 {
6058 // Do nothing, return false
6059 }
6060 break;
6061 }
6062 }
6063 return retVal;
6064 }
6065
6067 {
6068 return barGraphWidth;
6069 }
6070
6072 {
6073 barGraphWidth = width;
6074 }
6075
6077 {
6078 return minValue;
6079 }
6080
6081 void OutputArchedBarGraph::set_min_value(std::uint16_t minimumValue)
6082 {
6083 minValue = minimumValue;
6084 }
6085
6087 {
6088 return maxValue;
6089 }
6090
6091 void OutputArchedBarGraph::set_max_value(std::uint16_t maximumValue)
6092 {
6093 maxValue = maximumValue;
6094 }
6095
6097 {
6098 return value;
6099 }
6100
6101 void OutputArchedBarGraph::set_value(std::uint16_t aValue)
6102 {
6103 value = aValue;
6104 }
6105
6107 {
6108 return targetLineColour;
6109 }
6110
6112 {
6113 targetLineColour = value;
6114 }
6115
6117 {
6118 return colour;
6119 }
6120
6121 void OutputArchedBarGraph::set_colour(std::uint8_t value)
6122 {
6123 colour = value;
6124 }
6125
6127 {
6128 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
6129 }
6130
6131 void OutputArchedBarGraph::set_options(std::uint8_t options)
6132 {
6133 optionsBitfield = options;
6134 }
6135
6136 void OutputArchedBarGraph::set_option(Options option, bool optionValue)
6137 {
6138 if (optionValue)
6139 {
6140 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
6141 }
6142 else
6143 {
6144 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
6145 }
6146 }
6147
6149 {
6150 return startAngle;
6151 }
6152
6154 {
6155 startAngle = value;
6156 }
6157
6159 {
6160 return endAngle;
6161 }
6162
6164 {
6165 endAngle = value;
6166 }
6167
6169 {
6170 return targetValue;
6171 }
6172
6174 {
6175 targetValue = value;
6176 }
6177
6179 {
6180 return targetValueReference;
6181 }
6182
6184 {
6185 targetValueReference = value;
6186 }
6187
6189 {
6190 return variableReference;
6191 }
6192
6193 void OutputArchedBarGraph::set_variable_reference(std::uint16_t variableReferenceValue)
6194 {
6195 variableReference = variableReferenceValue;
6196 }
6197
6202
6204 {
6205 return MIN_OBJECT_LENGTH;
6206 }
6207
6208 bool PictureGraphic::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
6209 {
6210 return true;
6211 }
6212
6213 bool PictureGraphic::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
6214 {
6215 bool retVal = false;
6216
6217 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
6218 {
6219 switch (static_cast<AttributeName>(attributeID))
6220 {
6221 case AttributeName::Width:
6222 {
6223 set_width(static_cast<std::uint16_t>(rawAttributeData));
6224 retVal = true;
6225 }
6226 break;
6227
6228 case AttributeName::Options:
6229 {
6230 set_options(static_cast<std::uint8_t>(rawAttributeData));
6231 retVal = true;
6232 }
6233 break;
6234
6235 case AttributeName::TransparencyColour:
6236 {
6237 set_transparency_colour(static_cast<std::uint8_t>(rawAttributeData));
6238 retVal = true;
6239 }
6240 break;
6241
6242 default:
6243 {
6244 returnedError = AttributeError::InvalidAttributeID;
6245 }
6246 break;
6247 }
6248 }
6249 else
6250 {
6251 returnedError = AttributeError::InvalidAttributeID;
6252 }
6253 return retVal;
6254 }
6255
6256 bool PictureGraphic::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
6257 {
6258 bool retVal = false;
6259
6260 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
6261 {
6262 switch (attributeID)
6263 {
6264 case static_cast<std::uint8_t>(AttributeName::Type):
6265 {
6266 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
6267 retVal = true;
6268 }
6269 break;
6270
6271 case static_cast<std::uint8_t>(AttributeName::Width):
6272 {
6273 returnedAttributeData = get_width();
6274 retVal = true;
6275 }
6276 break;
6277
6278 case static_cast<std::uint8_t>(AttributeName::ActualWidth):
6279 {
6280 returnedAttributeData = get_actual_width();
6281 retVal = true;
6282 }
6283 break;
6284
6285 case static_cast<std::uint8_t>(AttributeName::ActualHeight):
6286 {
6287 returnedAttributeData = get_actual_height();
6288 retVal = true;
6289 }
6290 break;
6291
6292 case static_cast<std::uint8_t>(AttributeName::Options):
6293 {
6294 returnedAttributeData = optionsBitfield;
6295 retVal = true;
6296 }
6297 break;
6298
6299 case static_cast<std::uint8_t>(AttributeName::TransparencyColour):
6300 {
6301 returnedAttributeData = get_transparency_colour();
6302 retVal = true;
6303 }
6304 break;
6305
6306 case static_cast<std::uint8_t>(AttributeName::Format):
6307 {
6308 returnedAttributeData = static_cast<std::uint8_t>(get_format());
6309 retVal = true;
6310 }
6311 break;
6312
6313 default:
6314 {
6315 // Do nothing, return false
6316 }
6317 break;
6318 }
6319 }
6320 return retVal;
6321 }
6322
6323 std::vector<std::uint8_t> &PictureGraphic::get_raw_data()
6324 {
6325 return rawData;
6326 }
6327
6328 void PictureGraphic::set_raw_data(const std::uint8_t *data, std::uint32_t size)
6329 {
6330 rawData.clear();
6331 rawData.resize(size);
6332
6333 for (std::uint32_t i = 0; i < size; i++)
6334 {
6335 rawData[i] = data[i];
6336 }
6337 }
6338
6339 void PictureGraphic::add_raw_data(std::uint8_t dataByte)
6340 {
6341 rawData.push_back(dataByte);
6342 }
6343
6345 {
6346 return numberOfBytesInRawData;
6347 }
6348
6350 {
6351 numberOfBytesInRawData = value;
6352 rawData.reserve(value);
6353 }
6354
6356 {
6357 return actualWidth;
6358 }
6359
6360 void PictureGraphic::set_actual_width(std::uint16_t value)
6361 {
6362 actualWidth = value;
6363 }
6364
6366 {
6367 return actualHeight;
6368 }
6369
6370 void PictureGraphic::set_actual_height(std::uint16_t value)
6371 {
6372 actualHeight = value;
6373 }
6374
6376 {
6377 return static_cast<Format>(formatByte);
6378 }
6379
6381 {
6382 formatByte = static_cast<std::uint8_t>(value);
6383 }
6384
6386 {
6387 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
6388 }
6389
6390 void PictureGraphic::set_options(std::uint8_t value)
6391 {
6392 optionsBitfield = value;
6393 }
6394
6395 void PictureGraphic::set_option(Options option, bool value)
6396 {
6397 if (value)
6398 {
6399 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
6400 }
6401 else
6402 {
6403 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
6404 }
6405 }
6406
6408 {
6409 return transparencyColour;
6410 }
6411
6413 {
6414 transparencyColour = value;
6415 }
6416
6421
6423 {
6424 return MIN_OBJECT_LENGTH;
6425 }
6426
6427 bool NumberVariable::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
6428 {
6429 return true;
6430 }
6431
6432 bool NumberVariable::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
6433 {
6434 returnedError = AttributeError::InvalidAttributeID;
6435 return false;
6436 }
6437
6438 bool NumberVariable::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
6439 {
6440 bool retVal = false;
6441
6442 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
6443 {
6444 switch (attributeID)
6445 {
6446 case static_cast<std::uint8_t>(AttributeName::Type):
6447 {
6448 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
6449 retVal = true;
6450 }
6451 break;
6452
6453 case static_cast<std::uint8_t>(AttributeName::Value):
6454 {
6455 returnedAttributeData = get_value();
6456 retVal = true;
6457 }
6458 break;
6459
6460 default:
6461 {
6462 // Do nothing, return false
6463 }
6464 break;
6465 }
6466 }
6467 return retVal;
6468 }
6469
6470 std::uint32_t NumberVariable::get_value() const
6471 {
6472 return value;
6473 }
6474
6475 void NumberVariable::set_value(std::uint32_t aValue)
6476 {
6477 value = aValue;
6478 }
6479
6484
6486 {
6487 return MIN_OBJECT_LENGTH;
6488 }
6489
6490 bool StringVariable::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
6491 {
6492 return true;
6493 }
6494
6495 bool StringVariable::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
6496 {
6497 returnedError = AttributeError::InvalidAttributeID;
6498 return false;
6499 }
6500
6501 bool StringVariable::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
6502 {
6503 bool retVal = false;
6504
6505 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
6506 {
6507 switch (attributeID)
6508 {
6509 case static_cast<std::uint8_t>(AttributeName::Type):
6510 {
6511 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
6512 retVal = true;
6513 }
6514 break;
6515
6516 default:
6517 {
6518 // Do nothing, return false
6519 }
6520 break;
6521 }
6522 }
6523 return retVal;
6524 }
6525
6526 std::string StringVariable::get_value() const
6527 {
6528 return value;
6529 }
6530
6531 void StringVariable::set_value(const std::string &aValue)
6532 {
6533 value = aValue;
6534 }
6535
6540
6542 {
6543 return MIN_OBJECT_LENGTH;
6544 }
6545
6546 bool FontAttributes::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
6547 {
6548 return true;
6549 }
6550
6551 bool FontAttributes::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
6552 {
6553 bool retVal = false;
6554
6555 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
6556 {
6557 switch (static_cast<AttributeName>(attributeID))
6558 {
6559 case AttributeName::FontColour:
6560 {
6561 set_colour(static_cast<std::uint8_t>(rawAttributeData));
6562 retVal = true;
6563 }
6564 break;
6565
6566 case AttributeName::FontSize:
6567 {
6568 if (rawAttributeData <= static_cast<std::uint8_t>(FontAttributes::FontSize::Size128x192))
6569 {
6570 set_size(static_cast<FontAttributes::FontSize>(rawAttributeData));
6571 retVal = true;
6572 }
6573 else
6574 {
6575 returnedError = AttributeError::AnyOtherError;
6576 }
6577 }
6578 break;
6579
6580 case AttributeName::FontType:
6581 {
6582 set_type(static_cast<FontAttributes::FontType>(rawAttributeData));
6583 retVal = true;
6584 }
6585 break;
6586
6587 case AttributeName::FontStyle:
6588 {
6589 set_style(static_cast<std::uint8_t>(rawAttributeData));
6590 retVal = true;
6591 }
6592 break;
6593
6594 default:
6595 {
6596 returnedError = AttributeError::InvalidAttributeID;
6597 }
6598 break;
6599 }
6600 }
6601 else
6602 {
6603 returnedError = AttributeError::InvalidAttributeID;
6604 }
6605 return retVal;
6606 }
6607
6608 bool FontAttributes::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
6609 {
6610 bool retVal = false;
6611
6612 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
6613 {
6614 switch (attributeID)
6615 {
6616 case static_cast<std::uint8_t>(AttributeName::Type):
6617 {
6618 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
6619 retVal = true;
6620 }
6621 break;
6622
6623 case static_cast<std::uint8_t>(AttributeName::FontColour):
6624 {
6625 returnedAttributeData = get_colour();
6626 retVal = true;
6627 }
6628 break;
6629
6630 case static_cast<std::uint8_t>(AttributeName::FontSize):
6631 {
6632 returnedAttributeData = static_cast<std::uint8_t>(get_size());
6633 retVal = true;
6634 }
6635 break;
6636
6637 case static_cast<std::uint8_t>(AttributeName::FontType):
6638 {
6639 returnedAttributeData = static_cast<std::uint8_t>(get_type());
6640 retVal = true;
6641 }
6642 break;
6643
6644 case static_cast<std::uint8_t>(AttributeName::FontStyle):
6645 {
6646 returnedAttributeData = get_style();
6647 retVal = true;
6648 }
6649 break;
6650
6651 default:
6652 {
6653 // Do nothing, return false
6654 }
6655 break;
6656 }
6657 }
6658 return retVal;
6659 }
6660
6662 {
6663 return static_cast<FontType>(type);
6664 }
6665
6667 {
6668 type = static_cast<std::uint8_t>(value);
6669 }
6670
6671 std::uint8_t FontAttributes::get_style() const
6672 {
6673 return style;
6674 }
6675
6677 {
6678 return (style >> static_cast<std::uint8_t>(styleSetting)) & 0x01;
6679 }
6680
6682 {
6683 style = (static_cast<std::uint8_t>(value) << static_cast<std::uint8_t>(bit));
6684 }
6685
6686 void FontAttributes::set_style(std::uint8_t value)
6687 {
6688 style = value;
6689 }
6690
6692 {
6693 return static_cast<FontSize>(size);
6694 }
6695
6697 {
6698 size = static_cast<std::uint8_t>(value);
6699 }
6700
6701 std::uint8_t FontAttributes::get_colour() const
6702 {
6703 return colour;
6704 }
6705
6706 void FontAttributes::set_colour(std::uint8_t value)
6707 {
6708 colour = value;
6709 }
6710
6712 {
6713 std::uint8_t retVal = 0;
6714
6715 switch (static_cast<FontSize>(size))
6716 {
6717 case FontSize::Size6x8:
6718 {
6719 retVal = 6;
6720 }
6721 break;
6722
6723 case FontSize::Size8x8:
6724 case FontSize::Size8x12:
6725 {
6726 retVal = 8;
6727 }
6728 break;
6729
6730 case FontSize::Size12x16:
6731 {
6732 retVal = 12;
6733 }
6734 break;
6735
6736 case FontSize::Size16x16:
6737 case FontSize::Size16x24:
6738 {
6739 retVal = 16;
6740 }
6741 break;
6742
6743 case FontSize::Size24x32:
6744 {
6745 retVal = 24;
6746 }
6747 break;
6748
6749 case FontSize::Size32x32:
6750 case FontSize::Size32x48:
6751 {
6752 retVal = 32;
6753 }
6754 break;
6755
6756 case FontSize::Size48x64:
6757 {
6758 retVal = 48;
6759 }
6760 break;
6761
6762 case FontSize::Size64x64:
6763 case FontSize::Size64x96:
6764 {
6765 retVal = 64;
6766 }
6767 break;
6768
6769 case FontSize::Size96x128:
6770 {
6771 retVal = 96;
6772 }
6773 break;
6774
6775 case FontSize::Size128x128:
6776 case FontSize::Size128x192:
6777 {
6778 retVal = 128;
6779 }
6780 break;
6781
6782 default:
6783 break;
6784 }
6785 return retVal;
6786 }
6787
6789 {
6790 std::uint8_t retVal = 0;
6791
6792 switch (static_cast<FontSize>(size))
6793 {
6794 case FontSize::Size6x8:
6795 case FontSize::Size8x8:
6796 {
6797 retVal = 8;
6798 }
6799 break;
6800
6801 case FontSize::Size8x12:
6802 {
6803 retVal = 12;
6804 }
6805 break;
6806
6807 case FontSize::Size12x16:
6808 case FontSize::Size16x16:
6809 {
6810 retVal = 16;
6811 }
6812 break;
6813
6814 case FontSize::Size16x24:
6815 {
6816 retVal = 24;
6817 }
6818 break;
6819
6820 case FontSize::Size24x32:
6821 case FontSize::Size32x32:
6822 {
6823 retVal = 32;
6824 }
6825 break;
6826
6827 case FontSize::Size32x48:
6828 {
6829 retVal = 48;
6830 }
6831 break;
6832
6833 case FontSize::Size48x64:
6834 case FontSize::Size64x64:
6835 {
6836 retVal = 64;
6837 }
6838 break;
6839
6840 case FontSize::Size64x96:
6841 {
6842 retVal = 96;
6843 }
6844 break;
6845
6846 case FontSize::Size96x128:
6847 case FontSize::Size128x128:
6848 {
6849 retVal = 128;
6850 }
6851 break;
6852
6853 case FontSize::Size128x192:
6854 {
6855 retVal = 192;
6856 }
6857 break;
6858
6859 default:
6860 break;
6861 }
6862 return retVal;
6863 }
6864
6869
6871 {
6872 return MIN_OBJECT_LENGTH;
6873 }
6874
6875 bool LineAttributes::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
6876 {
6877 return true;
6878 }
6879
6880 bool LineAttributes::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
6881 {
6882 bool retVal = false;
6883
6884 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
6885 {
6886 switch (static_cast<AttributeName>(attributeID))
6887 {
6888 case AttributeName::LineColour:
6889 {
6890 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
6891 retVal = true;
6892 }
6893 break;
6894
6895 case AttributeName::LineWidth:
6896 {
6897 set_width(static_cast<std::uint16_t>(rawAttributeData & 0xFF));
6898 retVal = true;
6899 }
6900 break;
6901
6902 case AttributeName::LineArt:
6903 {
6904 set_line_art_bit_pattern(static_cast<std::uint16_t>(rawAttributeData));
6905 retVal = true;
6906 }
6907 break;
6908
6909 default:
6910 {
6911 returnedError = AttributeError::InvalidAttributeID;
6912 }
6913 break;
6914 }
6915 }
6916 else
6917 {
6918 returnedError = AttributeError::InvalidAttributeID;
6919 }
6920 return retVal;
6921 }
6922
6923 bool LineAttributes::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
6924 {
6925 bool retVal = false;
6926
6927 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
6928 {
6929 switch (attributeID)
6930 {
6931 case static_cast<std::uint8_t>(AttributeName::Type):
6932 {
6933 returnedAttributeData = static_cast<std::uint8_t>(get_object_type());
6934 retVal = true;
6935 }
6936 break;
6937
6938 case static_cast<std::uint8_t>(AttributeName::LineColour):
6939 {
6940 returnedAttributeData = static_cast<std::uint32_t>(get_background_color());
6941 retVal = true;
6942 }
6943 break;
6944
6945 case static_cast<std::uint8_t>(AttributeName::LineWidth):
6946 {
6947 returnedAttributeData = static_cast<std::uint32_t>(get_width());
6948 retVal = true;
6949 }
6950 break;
6951
6952 case static_cast<std::uint8_t>(AttributeName::LineArt):
6953 {
6954 returnedAttributeData = static_cast<std::uint32_t>(get_line_art_bit_pattern());
6955 retVal = true;
6956 }
6957 break;
6958
6959 default:
6960 {
6961 // Do nothing, return false
6962 }
6963 break;
6964 }
6965 }
6966 return retVal;
6967 }
6968
6970 {
6971 return lineArtBitpattern;
6972 }
6973
6975 {
6976 lineArtBitpattern = value;
6977 }
6978
6983
6985 {
6986 return MIN_OBJECT_LENGTH;
6987 }
6988
6989 bool FillAttributes::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
6990 {
6991 return ((NULL_OBJECT_ID == get_fill_pattern()) ||
6992 ((nullptr != get_object_by_id(get_fill_pattern(), objectPool)) &&
6993 (VirtualTerminalObjectType::PictureGraphic == get_object_by_id(get_fill_pattern(), objectPool)->get_object_type())));
6994 }
6995
6996 bool FillAttributes::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
6997 {
6998 bool retVal = false;
6999
7000 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7001 {
7002 switch (static_cast<AttributeName>(attributeID))
7003 {
7004 case AttributeName::FillType:
7005 {
7006 if (rawAttributeData <= static_cast<std::uint8_t>(FillType::FillWithPatternGivenByFillPatternAttribute))
7007 {
7008 set_type(static_cast<FillType>(rawAttributeData));
7009 retVal = true;
7010 }
7011 else
7012 {
7013 returnedError = AttributeError::AnyOtherError;
7014 }
7015 }
7016 break;
7017
7018 case AttributeName::FillColour:
7019 {
7020 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
7021 retVal = true;
7022 }
7023 break;
7024
7025 case AttributeName::FillPattern:
7026 {
7027 auto fillPictureGraphic = get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool);
7028
7029 if (NULL_OBJECT_ID == rawAttributeData)
7030 {
7031 set_fill_pattern(static_cast<std::uint16_t>(rawAttributeData));
7032 retVal = true;
7033 }
7034 else if ((nullptr != fillPictureGraphic) &&
7035 (VirtualTerminalObjectType::PictureGraphic == fillPictureGraphic->get_object_type()))
7036 {
7037 set_fill_pattern(static_cast<std::uint16_t>(rawAttributeData));
7038 retVal = true;
7039 }
7040 else
7041 {
7042 returnedError = AttributeError::InvalidValue;
7043 }
7044 }
7045 break;
7046
7047 default:
7048 {
7049 returnedError = AttributeError::InvalidAttributeID;
7050 }
7051 break;
7052 }
7053 }
7054 else
7055 {
7056 returnedError = AttributeError::InvalidAttributeID;
7057 }
7058 return retVal;
7059 }
7060
7061 bool FillAttributes::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
7062 {
7063 bool retVal = false;
7064
7065 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7066 {
7067 switch (static_cast<AttributeName>(attributeID))
7068 {
7069 case AttributeName::Type:
7070 {
7071 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
7072 retVal = true;
7073 }
7074 break;
7075
7076 case AttributeName::FillType:
7077 {
7078 returnedAttributeData = static_cast<std::uint32_t>(get_type());
7079 retVal = true;
7080 }
7081 break;
7082
7083 case AttributeName::FillColour:
7084 {
7085 returnedAttributeData = static_cast<std::uint32_t>(get_background_color());
7086 retVal = true;
7087 }
7088 break;
7089
7090 case AttributeName::FillPattern:
7091 {
7092 returnedAttributeData = static_cast<std::uint32_t>(get_fill_pattern());
7093 retVal = true;
7094 }
7095 break;
7096
7097 default:
7098 {
7099 // Do nothing return false
7100 }
7101 break;
7102 }
7103 }
7104 return retVal;
7105 }
7106
7108 {
7109 return fillPattern;
7110 }
7111
7112 void FillAttributes::set_fill_pattern(std::uint16_t value)
7113 {
7114 fillPattern = value;
7115 }
7116
7118 {
7119 return type;
7120 }
7121
7123 {
7124 type = value;
7125 }
7126
7131
7133 {
7134 return MIN_OBJECT_LENGTH;
7135 }
7136
7137 bool InputAttributes::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
7138 {
7139 return true;
7140 }
7141
7142 bool InputAttributes::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
7143 {
7144 returnedError = AttributeError::InvalidAttributeID;
7145 return false;
7146 }
7147
7148 bool InputAttributes::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
7149 {
7150 bool retVal = false;
7151
7152 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7153 {
7154 switch (static_cast<AttributeName>(attributeID))
7155 {
7156 case AttributeName::Type:
7157 {
7158 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
7159 retVal = true;
7160 }
7161 break;
7162
7163 case AttributeName::ValidationType:
7164 {
7165 returnedAttributeData = static_cast<std::uint32_t>(get_validation_type());
7166 retVal = true;
7167 }
7168 break;
7169
7170 default:
7171 {
7172 // Do nothing return false
7173 }
7174 break;
7175 }
7176 }
7177 return retVal;
7178 }
7179
7181 {
7182 return validationString;
7183 }
7184
7185 void InputAttributes::set_validation_string(const std::string &value)
7186 {
7187 validationString = value;
7188 }
7189
7191 {
7192 return validationType;
7193 }
7194
7196 {
7197 validationType = newValidationType;
7198 }
7199
7204
7206 {
7207 return MIN_OBJECT_LENGTH;
7208 }
7209
7210 bool ExtendedInputAttributes::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
7211 {
7212 return true;
7213 }
7214
7215 bool ExtendedInputAttributes::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
7216 {
7217 returnedError = AttributeError::InvalidAttributeID;
7218 return false;
7219 }
7220
7221 bool ExtendedInputAttributes::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
7222 {
7223 bool retVal = false;
7224
7225 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7226 {
7227 switch (static_cast<AttributeName>(attributeID))
7228 {
7229 case AttributeName::Type:
7230 {
7231 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
7232 retVal = true;
7233 }
7234 break;
7235
7236 case AttributeName::ValidationType:
7237 {
7238 returnedAttributeData = static_cast<std::uint32_t>(get_validation_type());
7239 retVal = true;
7240 }
7241 break;
7242
7243 default:
7244 {
7245 // Do nothing return false
7246 }
7247 break;
7248 }
7249 }
7250 return retVal;
7251 }
7252
7254 {
7255 return static_cast<std::uint8_t>(codePlanes.size());
7256 }
7257
7259 {
7260 codePlanes.resize(value);
7261 }
7262
7267
7269 {
7270 validationType = value;
7271 }
7272
7277
7279 {
7280 return MIN_OBJECT_LENGTH;
7281 }
7282
7283 bool ObjectPointer::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
7284 {
7285 return ((NULL_OBJECT_ID == value) || (nullptr != get_object_by_id(value, objectPool)));
7286 }
7287
7288 bool ObjectPointer::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
7289 {
7290 returnedError = AttributeError::InvalidAttributeID;
7291 return false;
7292 }
7293
7294 std::uint16_t ObjectPointer::get_value() const
7295 {
7296 return value;
7297 }
7298
7299 void ObjectPointer::set_value(std::uint16_t objectIDToPointTo)
7300 {
7301 value = objectIDToPointTo;
7302 }
7303
7304 bool ObjectPointer::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
7305 {
7306 bool retVal = false;
7307 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7308 {
7309 switch (static_cast<AttributeName>(attributeID))
7310 {
7311 case AttributeName::Type:
7312 {
7313 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
7314 retVal = true;
7315 }
7316 break;
7317
7318 case AttributeName::Value:
7319 {
7320 if (get_number_children() > 0)
7321 {
7322 returnedAttributeData = get_child_id(0);
7323 }
7324 else
7325 {
7326 returnedAttributeData = NULL_OBJECT_ID;
7327 }
7328 retVal = true;
7329 }
7330 break;
7331
7332 default:
7333 {
7334 // Do nothing return false
7335 }
7336 break;
7337 }
7338 }
7339 return retVal;
7340 }
7341
7346
7348 {
7349 return 9;
7350 }
7351
7352 bool ExternalObjectPointer::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
7353 {
7354 bool isDefaultObjectValid = (NULL_OBJECT_ID == get_default_object_id()) ||
7355 (nullptr != objectPool.at(get_default_object_id()));
7356 bool isExternalNAMEIDValid = (NULL_OBJECT_ID == get_external_reference_name_id()) ||
7357 (nullptr != objectPool.at(get_external_reference_name_id()));
7358 return (isDefaultObjectValid && isExternalNAMEIDValid);
7359 }
7360
7361 bool ExternalObjectPointer::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
7362 {
7363 bool retVal = false;
7364
7365 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7366 {
7367 switch (static_cast<AttributeName>(attributeID))
7368 {
7369 case AttributeName::DefaultObjectID:
7370 {
7371 if ((NULL_OBJECT_ID == rawAttributeData) ||
7372 (nullptr != get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool)))
7373 {
7374 set_default_object_id(static_cast<std::uint16_t>(rawAttributeData));
7375 retVal = true;
7376 }
7377 else
7378 {
7379 returnedError = AttributeError::InvalidValue;
7380 }
7381 }
7382 break;
7383
7384 case AttributeName::ExternalReferenceNAMEID:
7385 {
7386 if ((NULL_OBJECT_ID == rawAttributeData) ||
7387 (nullptr != get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool)))
7388 {
7389 set_external_reference_name_id(static_cast<std::uint16_t>(rawAttributeData));
7390 retVal = true;
7391 }
7392 else
7393 {
7394 returnedError = AttributeError::InvalidValue;
7395 }
7396 }
7397 break;
7398
7399 case AttributeName::ExternalObjectID:
7400 {
7401 set_external_object_id(static_cast<std::uint16_t>(rawAttributeData));
7402 retVal = true;
7403 }
7404 break;
7405
7406 default:
7407 {
7408 returnedError = AttributeError::InvalidAttributeID;
7409 }
7410 break;
7411 }
7412 }
7413 else
7414 {
7415 returnedError = AttributeError::InvalidAttributeID;
7416 }
7417 return retVal;
7418 }
7419
7420 bool ExternalObjectPointer::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
7421 {
7422 bool retVal = false;
7423 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7424 {
7425 switch (static_cast<AttributeName>(attributeID))
7426 {
7427 case AttributeName::Type:
7428 {
7429 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
7430 retVal = true;
7431 }
7432 break;
7433
7434 case AttributeName::DefaultObjectID:
7435 {
7436 returnedAttributeData = static_cast<std::uint32_t>(get_default_object_id());
7437 retVal = true;
7438 }
7439 break;
7440
7441 case AttributeName::ExternalReferenceNAMEID:
7442 {
7443 returnedAttributeData = static_cast<std::uint32_t>(get_external_reference_name_id());
7444 retVal = true;
7445 }
7446 break;
7447
7448 case AttributeName::ExternalObjectID:
7449 {
7450 returnedAttributeData = static_cast<std::uint32_t>(get_external_object_id());
7451 retVal = true;
7452 }
7453 break;
7454
7455 default:
7456 {
7457 // Do nothing return false
7458 }
7459 break;
7460 }
7461 }
7462 return retVal;
7463 }
7464
7466 {
7467 return defaultObjectID;
7468 }
7469
7471 {
7472 defaultObjectID = id;
7473 }
7474
7476 {
7477 return externalReferenceNAMEID;
7478 }
7479
7481 {
7482 externalReferenceNAMEID = id;
7483 }
7484
7486 {
7487 return externalObjectID;
7488 }
7489
7491 {
7492 externalObjectID = id;
7493 }
7494
7495 const std::array<std::uint8_t, 28> Macro::ALLOWED_COMMANDS_LOOKUP_TABLE = {
7496 static_cast<std::uint8_t>(Command::HideShowObject),
7497 static_cast<std::uint8_t>(Command::EnableDisableObject),
7498 static_cast<std::uint8_t>(Command::SelectInputObject),
7499 static_cast<std::uint8_t>(Command::ControlAudioSignal),
7500 static_cast<std::uint8_t>(Command::SetAudioVolume),
7501 static_cast<std::uint8_t>(Command::ChangeChildLocation),
7502 static_cast<std::uint8_t>(Command::ChangeSize),
7503 static_cast<std::uint8_t>(Command::ChangeBackgroundColour),
7504 static_cast<std::uint8_t>(Command::ChangeNumericValue),
7505 static_cast<std::uint8_t>(Command::ChangeEndPoint),
7506 static_cast<std::uint8_t>(Command::ChangeFontAttributes),
7507 static_cast<std::uint8_t>(Command::ChangeLineAttributes),
7508 static_cast<std::uint8_t>(Command::ChangeFillAttributes),
7509 static_cast<std::uint8_t>(Command::ChangeActiveMask),
7510 static_cast<std::uint8_t>(Command::ChangeSoftKeyMask),
7511 static_cast<std::uint8_t>(Command::ChangeAttribute),
7512 static_cast<std::uint8_t>(Command::ChangePriority),
7513 static_cast<std::uint8_t>(Command::ChangeListItem),
7514 static_cast<std::uint8_t>(Command::ChangeStringValue),
7515 static_cast<std::uint8_t>(Command::ChangeChildPosition),
7516 static_cast<std::uint8_t>(Command::ChangeObjectLabel),
7517 static_cast<std::uint8_t>(Command::ChangePolygonPoint),
7518 static_cast<std::uint8_t>(Command::LockUnlockMask),
7519 static_cast<std::uint8_t>(Command::ExecuteMacro),
7520 static_cast<std::uint8_t>(Command::ChangePolygonScale),
7521 static_cast<std::uint8_t>(Command::GraphicsContextCommand),
7522 static_cast<std::uint8_t>(Command::SelectColourMap),
7523 static_cast<std::uint8_t>(Command::ExecuteExtendedMacro)
7524 };
7525
7530
7532 {
7533 return MIN_OBJECT_LENGTH;
7534 }
7535
7536 bool Macro::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
7537 {
7538 return get_are_command_packets_valid();
7539 }
7540
7541 bool Macro::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
7542 {
7543 returnedError = AttributeError::InvalidAttributeID;
7544 return false;
7545 }
7546
7547 bool Macro::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
7548 {
7549 bool retVal = false;
7550 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7551 {
7552 switch (static_cast<AttributeName>(attributeID))
7553 {
7554 case AttributeName::Type:
7555 {
7556 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
7557 retVal = true;
7558 }
7559 break;
7560
7561 default:
7562 {
7563 // Do nothing return false
7564 }
7565 break;
7566 }
7567 }
7568 return retVal;
7569 }
7570
7571 bool Macro::add_command_packet(const std::vector<std::uint8_t> &command)
7572 {
7573 bool retVal = false;
7574
7575 if (commandPackets.size() < 255)
7576 {
7577 commandPackets.push_back(command);
7578 retVal = true;
7579 }
7580 return retVal;
7581 }
7582
7584 {
7585 return static_cast<std::uint8_t>(commandPackets.size());
7586 }
7587
7588 bool Macro::get_command_packet(std::uint8_t index, std::vector<std::uint8_t> &command)
7589 {
7590 bool retVal = false;
7591
7592 if (index < commandPackets.size())
7593 {
7594 command = commandPackets.at(index);
7595 retVal = true;
7596 }
7597 return retVal;
7598 }
7599
7600 bool Macro::remove_command_packet(std::uint8_t index)
7601 {
7602 bool retVal = false;
7603
7604 if (index < commandPackets.size())
7605 {
7606 auto eraseLocation = commandPackets.begin() + index;
7607 commandPackets.erase(eraseLocation);
7608 retVal = true;
7609 }
7610 return retVal;
7611 }
7612
7614 {
7615 bool retVal = true;
7616
7617 if (commandPackets.empty())
7618 {
7619 retVal = true;
7620 }
7621 else
7622 {
7623 for (const auto &command : commandPackets)
7624 {
7625 bool currentCommandAllowed = false;
7626
7627 for (const auto &allowedCommand : ALLOWED_COMMANDS_LOOKUP_TABLE)
7628 {
7629 if (!command.empty() && (command.at(0) == allowedCommand))
7630 {
7631 currentCommandAllowed = true;
7632 break;
7633 }
7634 }
7635
7636 if (!currentCommandAllowed)
7637 {
7638 retVal = false;
7639 break;
7640 }
7641 }
7642 }
7643 return retVal;
7644 }
7645
7650
7652 {
7653 return MIN_OBJECT_LENGTH;
7654 }
7655
7656 bool ColourMap::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &) const
7657 {
7658 return true;
7659 }
7660
7661 bool ColourMap::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
7662 {
7663 returnedError = AttributeError::InvalidAttributeID;
7664 return false;
7665 }
7666
7667 bool ColourMap::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
7668 {
7669 bool retVal = false;
7670
7671 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
7672 {
7673 switch (static_cast<AttributeName>(attributeID))
7674 {
7675 case AttributeName::Type:
7676 {
7677 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
7678 retVal = true;
7679 }
7680 break;
7681
7682 default:
7683 {
7684 // Do nothing return false
7685 }
7686 break;
7687 }
7688 }
7689 return retVal;
7690 }
7691
7693 {
7694 bool retVal = false;
7695
7696 if ((value != colourMapData.size()) &&
7697 ((2 == value) ||
7698 (16 == value) ||
7699 (256 == value)))
7700 {
7701 colourMapData.clear();
7702 colourMapData.resize(value);
7703
7704 for (std::size_t i = 0; i < colourMapData.size(); i++)
7705 {
7706 colourMapData[i] = static_cast<std::uint8_t>(i);
7707 }
7708 retVal = true;
7709 }
7710 return retVal;
7711 }
7712
7714 {
7715 return static_cast<std::uint16_t>(colourMapData.size());
7716 }
7717
7718 bool ColourMap::set_colour_map_index(std::uint8_t index, std::uint8_t value)
7719 {
7720 bool retVal = false;
7721
7722 if (index < colourMapData.size())
7723 {
7724 colourMapData[index] = value;
7725 retVal = true;
7726 }
7727 return retVal;
7728 }
7729
7730 std::uint8_t ColourMap::get_colour_map_index(std::uint8_t index) const
7731 {
7732 std::uint8_t retVal = 0;
7733
7734 if (index < get_number_of_colour_indexes())
7735 {
7736 retVal = colourMapData[index];
7737 }
7738 return retVal;
7739 }
7740
7745
7747 {
7748 return MIN_OBJECT_LENGTH;
7749 }
7750
7751 bool WindowMask::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
7752 {
7753 bool anyWrongChildType = false;
7754
7755 if (WindowType::Freeform != get_window_type())
7756 {
7757 if (NULL_OBJECT_ID != title)
7758 {
7759 auto titleObject = get_object_by_id(title, objectPool);
7760
7761 if (nullptr != titleObject)
7762 {
7763 if ((VirtualTerminalObjectType::ObjectPointer != titleObject->get_object_type()) &&
7764 (VirtualTerminalObjectType::OutputString != titleObject->get_object_type()))
7765 {
7766 anyWrongChildType = true;
7767 }
7768 else if (VirtualTerminalObjectType::ObjectPointer == titleObject->get_object_type())
7769 {
7770 if (0 == titleObject->get_number_children())
7771 {
7772 anyWrongChildType = true;
7773 }
7774 else
7775 {
7776 std::uint16_t titleObjectPointedTo = std::static_pointer_cast<ObjectPointer>(titleObject)->get_child_id(0);
7777 auto child = get_object_by_id(titleObjectPointedTo, objectPool);
7778
7779 if ((nullptr != child) && (VirtualTerminalObjectType::OutputString == child->get_object_type()))
7780 {
7781 // Valid
7782 }
7783 else
7784 {
7785 anyWrongChildType = true;
7786 }
7787 }
7788 }
7789 else
7790 {
7791 // Valid
7792 }
7793 }
7794 else
7795 {
7796 anyWrongChildType = true;
7797 }
7798 }
7799 else
7800 {
7801 anyWrongChildType = true;
7802 }
7803
7804 if (NULL_OBJECT_ID != name)
7805 {
7806 auto nameObject = get_object_by_id(name, objectPool);
7807
7808 if (nullptr != nameObject)
7809 {
7810 if ((VirtualTerminalObjectType::ObjectPointer != nameObject->get_object_type()) &&
7811 (VirtualTerminalObjectType::OutputString != nameObject->get_object_type()))
7812 {
7813 anyWrongChildType = true;
7814 }
7815 else if (VirtualTerminalObjectType::ObjectPointer == nameObject->get_object_type())
7816 {
7817 if (0 == nameObject->get_number_children())
7818 {
7819 anyWrongChildType = true;
7820 }
7821 else
7822 {
7823 std::uint16_t titleObjectPointedTo = std::static_pointer_cast<ObjectPointer>(nameObject)->get_child_id(0);
7824 auto child = get_object_by_id(titleObjectPointedTo, objectPool);
7825
7826 if ((nullptr != child) && (VirtualTerminalObjectType::OutputString == child->get_object_type()))
7827 {
7828 // Valid
7829 }
7830 else
7831 {
7832 anyWrongChildType = true;
7833 }
7834 }
7835 }
7836 else
7837 {
7838 // Valid
7839 }
7840 }
7841 else
7842 {
7843 anyWrongChildType = true;
7844 }
7845 }
7846 else
7847 {
7848 anyWrongChildType = true;
7849 }
7850
7851 if (NULL_OBJECT_ID != icon)
7852 {
7853 auto nameObject = get_object_by_id(icon, objectPool);
7854
7855 if (nullptr != nameObject)
7856 {
7857 switch (nameObject->get_object_type())
7858 {
7874 {
7875 // Valid
7876 }
7877 break;
7878
7879 default:
7880 {
7881 anyWrongChildType = true;
7882 }
7883 break;
7884 }
7885 }
7886 else
7887 {
7888 anyWrongChildType = true;
7889 }
7890 }
7891 else
7892 {
7893 anyWrongChildType = true;
7894 }
7895 }
7896 else if (NULL_OBJECT_ID != title)
7897 {
7898 anyWrongChildType = true;
7899 }
7900
7901 // Validate the actual child object references for each window type
7902 switch (static_cast<WindowType>(windowType))
7903 {
7904 case WindowType::Freeform:
7905 {
7906 // Basically anything goes
7907 }
7908 break;
7909
7910 case WindowType::NumericOutputValueWithUnits1x1:
7911 case WindowType::NumericOutputValueWithUnits2x1:
7912 {
7913 if (2 == get_number_children())
7914 {
7915 auto outputNum = get_object_by_id(get_child_id(0), objectPool);
7916 auto outputString = get_object_by_id(get_child_id(1), objectPool);
7917
7918 if ((nullptr == outputNum) ||
7919 (nullptr == outputString) ||
7920 (VirtualTerminalObjectType::OutputNumber != outputNum->get_object_type()) ||
7921 (VirtualTerminalObjectType::OutputString != outputString->get_object_type()))
7922 {
7923 anyWrongChildType = true;
7924 }
7925 }
7926 else
7927 {
7928 anyWrongChildType = true;
7929 }
7930 }
7931 break;
7932
7933 case WindowType::NumericOutputValueNoUnits1x1:
7934 case WindowType::NumericOutputValueNoUnits2x1:
7935 {
7936 if (1 == get_number_children())
7937 {
7938 auto outputNum = get_object_by_id(get_child_id(0), objectPool);
7939
7940 if ((nullptr == outputNum) ||
7941 (VirtualTerminalObjectType::OutputNumber != outputNum->get_object_type()))
7942 {
7943 anyWrongChildType = true;
7944 }
7945 }
7946 else
7947 {
7948 anyWrongChildType = true;
7949 }
7950 }
7951 break;
7952
7953 case WindowType::StringOutputValue1x1:
7954 case WindowType::StringOutputValue2x1:
7955 {
7956 if (1 == get_number_children())
7957 {
7958 auto outputString = get_object_by_id(get_child_id(0), objectPool);
7959
7960 if ((nullptr == outputString) ||
7961 (VirtualTerminalObjectType::OutputString != outputString->get_object_type()))
7962 {
7963 anyWrongChildType = true;
7964 }
7965 }
7966 else
7967 {
7968 anyWrongChildType = true;
7969 }
7970 }
7971 break;
7972
7973 case WindowType::NumericInputValueWithUnits1x1:
7974 case WindowType::NumericInputValueWithUnits2x1:
7975 {
7976 if (2 == get_number_children())
7977 {
7978 auto inputNum = get_object_by_id(get_child_id(0), objectPool);
7979 auto outputString = get_object_by_id(get_child_id(1), objectPool);
7980
7981 if ((nullptr == inputNum) ||
7982 (nullptr == outputString) ||
7983 (VirtualTerminalObjectType::InputNumber != inputNum->get_object_type()) ||
7984 (VirtualTerminalObjectType::OutputString != outputString->get_object_type()))
7985 {
7986 anyWrongChildType = true;
7987 }
7988 }
7989 else
7990 {
7991 anyWrongChildType = true;
7992 }
7993 }
7994 break;
7995
7996 case WindowType::NumericInputValueNoUnits1x1:
7997 case WindowType::NumericInputValueNoUnits2x1:
7998 {
7999 if (1 == get_number_children())
8000 {
8001 auto inputNum = get_object_by_id(get_child_id(0), objectPool);
8002
8003 if ((nullptr == inputNum) ||
8004 (VirtualTerminalObjectType::InputNumber != inputNum->get_object_type()))
8005 {
8006 anyWrongChildType = true;
8007 }
8008 }
8009 else
8010 {
8011 anyWrongChildType = true;
8012 }
8013 }
8014 break;
8015
8016 case WindowType::StringInputValue1x1:
8017 case WindowType::StringInputValue2x1:
8018 {
8019 if (1 == get_number_children())
8020 {
8021 auto inputStr = get_object_by_id(get_child_id(0), objectPool);
8022
8023 if ((nullptr == inputStr) ||
8024 (VirtualTerminalObjectType::InputString != inputStr->get_object_type()))
8025 {
8026 anyWrongChildType = true;
8027 }
8028 }
8029 else
8030 {
8031 anyWrongChildType = true;
8032 }
8033 }
8034 break;
8035
8036 case WindowType::HorizontalLinearBarGraphNoUnits1x1:
8037 case WindowType::HorizontalLinearBarGraphNoUnits2x1:
8038 {
8039 if (1 == get_number_children())
8040 {
8041 auto outputBargraph = get_object_by_id(get_child_id(0), objectPool);
8042
8043 if ((nullptr == outputBargraph) ||
8044 (VirtualTerminalObjectType::OutputLinearBarGraph != outputBargraph->get_object_type()))
8045 {
8046 anyWrongChildType = true;
8047 }
8048 }
8049 else
8050 {
8051 anyWrongChildType = true;
8052 }
8053 }
8054 break;
8055
8056 case WindowType::SingleButton1x1:
8057 case WindowType::SingleButton2x1:
8058 {
8059 if (1 == get_number_children())
8060 {
8061 auto button = get_object_by_id(get_child_id(0), objectPool);
8062
8063 if ((nullptr == button) ||
8064 (VirtualTerminalObjectType::Button != button->get_object_type()))
8065 {
8066 anyWrongChildType = true;
8067 }
8068 }
8069 else
8070 {
8071 anyWrongChildType = true;
8072 }
8073 }
8074 break;
8075
8076 case WindowType::DoubleButton1x1:
8077 case WindowType::DoubleButton2x1:
8078 {
8079 if (2 == get_number_children())
8080 {
8081 auto button1 = get_object_by_id(get_child_id(0), objectPool);
8082 auto button2 = get_object_by_id(get_child_id(1), objectPool);
8083
8084 if ((nullptr == button1) ||
8085 (nullptr == button2) ||
8086 (VirtualTerminalObjectType::Button != button1->get_object_type()) ||
8087 (VirtualTerminalObjectType::Button != button2->get_object_type()))
8088 {
8089 anyWrongChildType = true;
8090 }
8091 }
8092 else
8093 {
8094 anyWrongChildType = true;
8095 }
8096 }
8097 break;
8098
8099 default:
8100 {
8101 anyWrongChildType = true;
8102 }
8103 break;
8104 }
8105 return !anyWrongChildType;
8106 }
8107
8108 bool WindowMask::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
8109 {
8110 bool retVal = false;
8111
8112 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
8113 {
8114 switch (static_cast<AttributeName>(attributeID))
8115 {
8116 case AttributeName::BackgroundColour:
8117 {
8118 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
8119 retVal = true;
8120 }
8121 break;
8122
8123 case AttributeName::Options:
8124 {
8125 set_options(static_cast<std::uint8_t>(rawAttributeData));
8126 retVal = true;
8127 }
8128 break;
8129
8130 case AttributeName::Name:
8131 {
8132 set_name_object_id(static_cast<std::uint16_t>(rawAttributeData));
8133 retVal = true;
8134 }
8135 break;
8136
8137 default:
8138 {
8139 returnedError = AttributeError::InvalidAttributeID;
8140 }
8141 break;
8142 }
8143 }
8144 else
8145 {
8146 returnedError = AttributeError::InvalidAttributeID;
8147 }
8148 return retVal;
8149 }
8150
8151 bool WindowMask::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
8152 {
8153 bool retVal = false;
8154
8155 if (attributeID < static_cast<std::uint8_t>(AttributeName::NumberOfAttributes))
8156 {
8157 switch (static_cast<AttributeName>(attributeID))
8158 {
8159 case AttributeName::Type:
8160 {
8161 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
8162 retVal = true;
8163 }
8164 break;
8165
8166 case AttributeName::BackgroundColour:
8167 {
8168 returnedAttributeData = static_cast<std::uint32_t>(get_background_color());
8169 retVal = true;
8170 }
8171 break;
8172
8173 case AttributeName::Options:
8174 {
8175 returnedAttributeData = optionsBitfield;
8176 retVal = true;
8177 }
8178 break;
8179
8180 case AttributeName::Name:
8181 {
8182 returnedAttributeData = static_cast<std::uint32_t>(get_name_object_id());
8183 retVal = true;
8184 }
8185 break;
8186
8187 default:
8188 {
8189 // Do nothing return false
8190 }
8191 break;
8192 }
8193 }
8194 return retVal;
8195 }
8196
8198 {
8199 return name;
8200 }
8201
8202 void WindowMask::set_name_object_id(std::uint16_t object)
8203 {
8204 name = object;
8205 }
8206
8208 {
8209 return title;
8210 }
8211
8212 void WindowMask::set_title_object_id(std::uint16_t object)
8213 {
8214 title = object;
8215 }
8216
8218 {
8219 return icon;
8220 }
8221
8222 void WindowMask::set_icon_object_id(std::uint16_t object)
8223 {
8224 icon = object;
8225 }
8226
8228 {
8229 return static_cast<WindowType>(windowType);
8230 }
8231
8233 {
8234 if (static_cast<std::uint8_t>(type) <= static_cast<std::uint8_t>(WindowType::DoubleButton2x1))
8235 {
8236 windowType = static_cast<std::uint8_t>(type);
8237 }
8238 }
8239
8241 {
8242 return (0 != ((1 << static_cast<std::uint8_t>(option)) & optionsBitfield));
8243 }
8244
8245 void WindowMask::set_options(std::uint8_t value)
8246 {
8247 optionsBitfield = value;
8248 }
8249
8250 void WindowMask::set_option(Options option, bool value)
8251 {
8252 if (value)
8253 {
8254 optionsBitfield |= (1 << static_cast<std::uint8_t>(option));
8255 }
8256 else
8257 {
8258 optionsBitfield &= ~(1 << static_cast<std::uint8_t>(option));
8259 }
8260 }
8261
8266
8268 {
8269 return 6;
8270 }
8271
8272 bool AuxiliaryFunctionType1::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
8273 {
8274 // Despite modern VTs not using this object, we still have to validate it.
8275 bool anyWrongChildType = false;
8276
8277 for (const auto &child : children)
8278 {
8279 auto childObject = get_object_by_id(child.id, objectPool);
8280
8281 if (nullptr != childObject)
8282 {
8283 switch (childObject->get_object_type())
8284 {
8292 {
8293 // Valid
8294 }
8295 break;
8296
8297 default:
8298 {
8299 anyWrongChildType = true;
8300 }
8301 break;
8302 }
8303 }
8304 else
8305 {
8306 anyWrongChildType = true; // Some invalid child ID
8307 break;
8308 }
8309 }
8310 return !anyWrongChildType;
8311 }
8312
8313 bool AuxiliaryFunctionType1::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
8314 {
8315 returnedError = AttributeError::InvalidAttributeID;
8316 return false; // All attributes are read only
8317 }
8318
8319 bool AuxiliaryFunctionType1::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
8320 {
8321 bool retVal = false;
8322
8323 if (attributeID == static_cast<std::uint8_t>(AttributeName::Type))
8324 {
8325 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
8326 retVal = true;
8327 }
8328 return retVal;
8329 }
8330
8335
8337 {
8338 functionType = type;
8339 }
8340
8345
8347 {
8348 return 6;
8349 }
8350
8351 bool AuxiliaryFunctionType2::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
8352 {
8353 bool anyWrongChildType = false;
8354
8355 for (const auto &child : children)
8356 {
8357 auto childObject = get_object_by_id(child.id, objectPool);
8358
8359 if (nullptr != childObject)
8360 {
8361 switch (childObject->get_object_type())
8362 {
8376 {
8377 // Valid
8378 }
8379 break;
8380
8381 default:
8382 {
8383 anyWrongChildType = true;
8384 }
8385 break;
8386 }
8387 }
8388 else
8389 {
8390 anyWrongChildType = true; // Some invalid child ID
8391 break;
8392 }
8393 }
8394 return !anyWrongChildType;
8395 }
8396
8397 bool AuxiliaryFunctionType2::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
8398 {
8399 bool retVal = false;
8400
8401 if (attributeID == static_cast<std::uint8_t>(AttributeName::BackgroundColour))
8402 {
8403 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
8404 retVal = true;
8405 }
8406 else
8407 {
8408 returnedError = AttributeError::InvalidAttributeID;
8409 }
8410 return retVal;
8411 }
8412
8413 bool AuxiliaryFunctionType2::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
8414 {
8415 bool retVal = false;
8416
8417 switch (attributeID)
8418 {
8419 case static_cast<std::uint8_t>(AttributeName::Type):
8420 {
8421 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
8422 retVal = true;
8423 }
8424 break;
8425
8426 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
8427 {
8428 returnedAttributeData = static_cast<std::uint32_t>(get_background_color());
8429 retVal = true;
8430 }
8431 break;
8432
8433 case static_cast<std::uint8_t>(AttributeName::FunctionAttributes):
8434 {
8435 returnedAttributeData = functionAttributesBitfield;
8436 retVal = true;
8437 }
8438 break;
8439
8440 default:
8441 {
8442 // Do nothing return false
8443 }
8444 break;
8445 }
8446 return retVal;
8447 }
8448
8450 {
8451 return static_cast<FunctionType>(functionAttributesBitfield & 0x1F);
8452 }
8453
8455 {
8456 functionAttributesBitfield &= 0xE0;
8457 functionAttributesBitfield |= static_cast<std::uint8_t>(type) & 0x1F;
8458 }
8459
8461 {
8462 return (0 != ((1 << static_cast<std::uint8_t>(attributeToCheck)) & functionAttributesBitfield));
8463 }
8464
8466 {
8467 if (value)
8468 {
8469 functionAttributesBitfield |= (1 << static_cast<std::uint8_t>(attributeToSet));
8470 }
8471 else
8472 {
8473 functionAttributesBitfield &= ~(1 << static_cast<std::uint8_t>(attributeToSet));
8474 }
8475 }
8476
8481
8483 {
8484 return 7;
8485 }
8486
8487 bool AuxiliaryInputType1::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
8488 {
8489 bool anyWrongChildType = false;
8490
8491 for (const auto &child : children)
8492 {
8493 auto childObject = get_object_by_id(child.id, objectPool);
8494
8495 if (nullptr != childObject)
8496 {
8497 switch (childObject->get_object_type())
8498 {
8506 {
8507 // Valid
8508 }
8509 break;
8510
8511 default:
8512 {
8513 anyWrongChildType = true;
8514 }
8515 break;
8516 }
8517 }
8518 else
8519 {
8520 anyWrongChildType = true; // Some invalid child ID
8521 break;
8522 }
8523 }
8524 return !anyWrongChildType;
8525 }
8526
8527 bool AuxiliaryInputType1::set_attribute(std::uint8_t, std::uint32_t, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
8528 {
8529 returnedError = AttributeError::InvalidAttributeID;
8530 return false; // All attributes are read only
8531 }
8532
8533 bool AuxiliaryInputType1::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
8534 {
8535 bool retVal = false;
8536
8537 if (attributeID == static_cast<std::uint8_t>(AttributeName::Type))
8538 {
8539 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
8540 retVal = true;
8541 }
8542 return retVal;
8543 }
8544
8546 {
8547 return functionType;
8548 }
8549
8551 {
8552 functionType = type;
8553 }
8554
8556 {
8557 return inputID;
8558 }
8559
8561 {
8562 bool retVal = false;
8563
8564 if (id <= 250) // The range is defined in ISO 11783-6 table J.3
8565 {
8566 inputID = id;
8567 retVal = true;
8568 }
8569 return retVal;
8570 }
8571
8576
8578 {
8579 return 6;
8580 }
8581
8582 bool AuxiliaryInputType2::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
8583 {
8584 bool anyWrongChildType = false;
8585
8586 for (const auto &child : children)
8587 {
8588 auto childObject = get_object_by_id(child.id, objectPool);
8589
8590 if (nullptr != childObject)
8591 {
8592 switch (childObject->get_object_type())
8593 {
8607 {
8608 // Valid
8609 }
8610 break;
8611
8612 default:
8613 {
8614 anyWrongChildType = true;
8615 }
8616 break;
8617 }
8618 }
8619 else
8620 {
8621 anyWrongChildType = true; // Some invalid child ID
8622 break;
8623 }
8624 }
8625 return !anyWrongChildType;
8626 }
8627
8628 bool AuxiliaryInputType2::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &, AttributeError &returnedError)
8629 {
8630 bool retVal = false;
8631
8632 switch (attributeID)
8633 {
8634 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
8635 {
8636 set_background_color(static_cast<std::uint8_t>(rawAttributeData));
8637 retVal = true;
8638 }
8639 break;
8640
8641 case static_cast<std::uint8_t>(AttributeName::FunctionAttributes):
8642 {
8643 functionAttributesBitfield = (static_cast<std::uint8_t>(rawAttributeData));
8644 retVal = true;
8645 }
8646 break;
8647
8648 default:
8649 {
8650 returnedError = AttributeError::InvalidAttributeID;
8651 }
8652 break;
8653 }
8654 return retVal;
8655 }
8656
8657 bool AuxiliaryInputType2::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
8658 {
8659 bool retVal = false;
8660
8661 switch (attributeID)
8662 {
8663 case static_cast<std::uint8_t>(AttributeName::Type):
8664 {
8665 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
8666 retVal = true;
8667 }
8668 break;
8669
8670 case static_cast<std::uint8_t>(AttributeName::FunctionAttributes):
8671 {
8672 returnedAttributeData = functionAttributesBitfield;
8673 retVal = true;
8674 }
8675 break;
8676
8677 case static_cast<std::uint8_t>(AttributeName::BackgroundColour):
8678 {
8679 returnedAttributeData = get_background_color();
8680 retVal = true;
8681 }
8682 break;
8683
8684 default:
8685 {
8686 // Do nothing return false
8687 }
8688 break;
8689 }
8690 return retVal;
8691 }
8692
8694 {
8695 return static_cast<AuxiliaryFunctionType2::FunctionType>(functionAttributesBitfield & 0x1F);
8696 }
8697
8699 {
8700 functionAttributesBitfield &= 0xE0;
8701 functionAttributesBitfield |= static_cast<std::uint8_t>(type) & 0x1F;
8702 }
8703
8705 {
8706 return (0 != ((1 << static_cast<std::uint8_t>(attributeToCheck)) & functionAttributesBitfield));
8707 }
8708
8710 {
8711 if (value)
8712 {
8713 functionAttributesBitfield |= (1 << static_cast<std::uint8_t>(attributeToSet));
8714 }
8715 else
8716 {
8717 functionAttributesBitfield &= ~(1 << static_cast<std::uint8_t>(attributeToSet));
8718 }
8719 }
8720
8725
8727 {
8728 return 6;
8729 }
8730
8731 bool AuxiliaryControlDesignatorType2::get_is_valid(const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool) const
8732 {
8733 bool retVal = (((NULL_OBJECT_ID == auxiliaryObjectID) || ((nullptr != get_object_by_id(auxiliaryObjectID, objectPool)))) && (pointerType <= 3));
8734
8735 if (retVal)
8736 {
8737 // Check the referenced object is valid
8738 auto object = get_object_by_id(auxiliaryObjectID, objectPool);
8739
8740 if ((VirtualTerminalObjectType::AuxiliaryFunctionType2 == object->get_object_type()) ||
8741 (VirtualTerminalObjectType::AuxiliaryInputType2 == object->get_object_type()))
8742 {
8743 // Valid
8744 }
8745 else
8746 {
8747 retVal = false;
8748 }
8749 }
8750 return retVal;
8751 }
8752
8753 bool AuxiliaryControlDesignatorType2::set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map<std::uint16_t, std::shared_ptr<VTObject>> &objectPool, AttributeError &returnedError)
8754 {
8755 bool retVal = false;
8756 returnedError = AttributeError::InvalidAttributeID;
8757
8758 if (static_cast<std::uint8_t>(AttributeName::AuxiliaryObjectID) == attributeID)
8759 {
8760 if ((NULL_OBJECT_ID == rawAttributeData) ||
8761 ((nullptr != get_object_by_id(static_cast<std::uint16_t>(rawAttributeData), objectPool)) &&
8762 ((VirtualTerminalObjectType::AuxiliaryFunctionType2 == objectPool.at(static_cast<std::uint16_t>(rawAttributeData))->get_object_type()) ||
8763 (VirtualTerminalObjectType::AuxiliaryInputType2 == objectPool.at(static_cast<std::uint16_t>(rawAttributeData))->get_object_type()))))
8764 {
8765 set_auxiliary_object_id(static_cast<std::uint16_t>(rawAttributeData));
8766 retVal = true;
8767 }
8768 else
8769 {
8770 returnedError = AttributeError::InvalidValue;
8771 }
8772 }
8773 return retVal;
8774 }
8775
8776 bool AuxiliaryControlDesignatorType2::get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const
8777 {
8778 bool retVal = false;
8779
8780 switch (attributeID)
8781 {
8782 case static_cast<std::uint8_t>(AttributeName::Type):
8783 {
8784 returnedAttributeData = static_cast<std::uint32_t>(get_object_type());
8785 retVal = true;
8786 }
8787 break;
8788
8789 case static_cast<std::uint8_t>(AttributeName::PointerType):
8790 {
8791 returnedAttributeData = get_pointer_type();
8792 retVal = true;
8793 }
8794 break;
8795
8796 case static_cast<std::uint8_t>(AttributeName::AuxiliaryObjectID):
8797 {
8798 returnedAttributeData = get_auxiliary_object_id();
8799 retVal = true;
8800 }
8801 break;
8802
8803 default:
8804 {
8805 // Invalid attribute ID
8806 }
8807 break;
8808 }
8809 return retVal;
8810 }
8811
8813 {
8814 return auxiliaryObjectID;
8815 }
8816
8818 {
8819 auxiliaryObjectID = id;
8820 }
8821
8823 {
8824 return pointerType;
8825 }
8826
8828 {
8829 pointerType = type;
8830 }
8831
8832} // namespace isobus
Priority
Enumerates the different mask priorities. Higher priority masks will be shown over lower priority one...
@ Low
Low, information only.
Priority get_mask_priority() const
Returns the priority of the alarm mask.
void set_mask_priority(Priority value)
Sets the priority of the alarm mask.
bool change_soft_key_mask(std::uint16_t newMaskID, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool)
Changes the soft key mask associated to this alarm mask to a new object ID. Performs error checking o...
AcousticSignal get_signal_priority() const
Returns the acoustic signal priority for the alarm mask.
void set_soft_key_mask(std::uint16_t newMaskID)
Changes the soft key mask associated to this alarm mask to a new object ID, but does no checking on t...
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
AcousticSignal
Enumerates the acoustic signal values for the alarm mask. Works only if your VT has a way to make sou...
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint16_t get_soft_key_mask() const
Returns the object ID of the soft key mask associated with this alarm mask.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_signal_priority(AcousticSignal value)
Sets the acoustic signal priority for the alarm mask.
std::uint16_t get_auxiliary_object_id() const
Returns the object ID of the referenced auxiliary object or the null object ID. Used in conjunction w...
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint8_t get_pointer_type() const
Returns the pointer type, which describes how this object should be rendered.
void set_auxiliary_object_id(std::uint16_t id)
Sets the object ID of the referenced auxiliary object Used in conjunction with the pointer type.
void set_pointer_type(std::uint8_t type)
Sets the pointer type which describes how this object should be rendered.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
FunctionType
Enumerates the different kinds of auxiliary functions (type 1)
FunctionType get_function_type() const
Returns the function type.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_function_type(FunctionType type)
Sets the function type.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_function_attribute(FunctionAttribute attributeToSet, bool value)
Sets the value of a specified function attribute.
FunctionType get_function_type() const
Returns the function type.
FunctionAttribute
Enumerates bit offsets of attributes of auxiliary functions to be assigned to an input control.
void set_function_type(FunctionType type)
Sets the function type.
FunctionType
Aux inputs must be one of these types, and the input and function types must match.
bool get_function_attribute(FunctionAttribute attributeToCheck) const
returns the value of a specified function attribute
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
FunctionType
Enumerates the different kinds of auxiliary functions (type 1)
bool set_input_id(std::uint8_t id)
Sets the identification number of the input. Maximum value is 250.
FunctionType get_function_type() const
Returns the function type.
std::uint8_t get_input_id() const
Returns the identification number of the input. Maximum value is 250.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
void set_function_type(FunctionType type)
Sets the function type.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
AuxiliaryFunctionType2::FunctionType get_function_type() const
Returns the type of input function that the input control performs when assigned.
void set_function_attribute(FunctionAttribute attributeToSet, bool value)
Sets the value of a specified function attribute.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_function_attribute(FunctionAttribute attributeToCheck) const
returns the value of a specified function attribute
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
FunctionAttribute
Enumerates bit offsets of attributes of auxiliary inputs.
void set_function_type(AuxiliaryFunctionType2::FunctionType type)
Sets the type of input function that the input control performs when assigned.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_border_colour(std::uint8_t value)
Sets the border colour.
void set_options(std::uint8_t value)
Sets the options bitfield for this object to a new value.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint8_t get_border_colour() const
Returns the colour of the button's border as an index into the VT colour table.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
void set_key_code(std::uint8_t value)
Sets the key code associated with this button's events.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
void set_option(Options option, bool value)
Sets a single option in the options bitfield to the specified value.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
Options
Enumerates the options encoded into the options bitfield for a button.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint8_t get_key_code() const
Returns the key code associated with this button's events.
bool set_number_of_colour_indexes(std::uint16_t value)
This is used to initialize the colour map data to either 2, 16, or 256 colour indexes....
bool set_colour_map_index(std::uint8_t index, std::uint8_t value)
Sets the colour map index to the specified value/colour.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint16_t get_number_of_colour_indexes() const
Returns the number of colour indexes in this colour map.
std::uint8_t get_colour_map_index(std::uint8_t index) const
Returns the colour index into the VT colour table at the specified index in this colour map.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_hidden() const
Returns the "hidden" attribute for this container.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_hidden(bool value)
Sets the "hidden" attribute for this container.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint16_t get_soft_key_mask() const
Returns the object ID of the soft key mask associated with this data mask.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_soft_key_mask(std::uint16_t newMaskID)
Changes the soft key mask associated to this data mask to a new object ID, but does no checking on th...
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
bool change_soft_key_mask(std::uint16_t newMaskID, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool)
Changes the soft key mask associated to this data mask to a new object ID. Performs error checking on...
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
void set_number_of_code_planes(std::uint8_t value)
Sets the number of code planes in this extended input attributes object.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
ValidationType get_validation_type() const
Returns the validation type setting for this object.
ValidationType
Enumerates the different validation types for this object, which describe how to interpret the valida...
void set_validation_type(ValidationType value)
Sets the validation type setting for this object.
std::uint8_t get_number_of_code_planes() const
Returns the number of code planes in this extended input attributes.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint16_t get_external_object_id() const
Returns the external object ID. The referenced object is found in the object pool of the Working Set ...
std::uint16_t get_default_object_id() const
Returns the default object id which is the object ID of an object which shall be displayed if the Ext...
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
void set_default_object_id(std::uint16_t id)
Sets the default object id which is the object ID of an object which shall be displayed if the Extern...
std::uint16_t get_external_reference_name_id() const
Returns the external reference NAME ID.
void set_external_reference_name_id(std::uint16_t id)
Sets the external reference NAME ID.
void set_external_object_id(std::uint16_t id)
Sets the external object ID. The referenced object is found in the object pool of the Working Set Mas...
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
FillType get_type() const
Returns the fill type/mode associated with this object.
std::uint16_t get_fill_pattern() const
Returns the fill pattern associated with this fill attributes object.
void set_fill_pattern(std::uint16_t value)
Sets the fill pattern for this fill attributes object.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_type(FillType value)
Sets the fill type/mode associated with this object.
FillType
Enumerates the different fill types for an object.
FontType
Enumerates the different font types.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
FontStyleBits
Enumerates the font style options that can be encoded in a font style bitfield.
std::uint8_t get_font_width_pixels() const
Returns the width of the associated font size in pixels.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
void set_colour(std::uint8_t value)
Sets the colour of the font to a new VT colour.
void set_size(FontSize value)
Sets the font size to a new value.
void set_style(FontStyleBits bit, bool value)
Sets a specific font style bit to a new value.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
FontType get_type() const
Returns the font type associated to this font attributes object.
FontSize
Enumerates the different font sizes.
@ Size128x192
128x192 Font size
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint8_t get_colour() const
Returns the font colour as an index into the VT colour table.
std::uint8_t get_font_height_pixels() const
Returns the height of the associated font size in pixels.
std::uint8_t get_style() const
Returns the font style bitfield.
FontSize get_size() const
Returns the font size.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
void set_type(FontType value)
Sets the font type.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::string get_validation_string() const
Returns the validation string associated to this input attributes object.
void set_validation_type(ValidationType newValidationType)
Sets the validation type setting for this object.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
ValidationType
Enumerates the different validation types for this object, which describe how to interpret the valida...
ValidationType get_validation_type() const
Returns the validation type setting for this object.
void set_validation_string(const std::string &value)
Sets the validation string for this object.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_foreground_colour_object_id(std::uint16_t fontAttributeValue)
Sets the object ID of the foreground colour object. Does not perform error checking on the type of th...
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint16_t get_foreground_colour_object_id() const
Returns the object ID of a font attributes object that defines the foreground colour,...
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_variable_reference(std::uint16_t numberVariableValue)
Sets the object ID of the number variable object that contains the value of the Input Boolean object....
void set_enabled(bool isEnabled)
Sets the enabled attribute on this object to a new value.
std::uint16_t get_variable_reference() const
Returns the object ID of a number variable object that contains the value of the Input Boolean object...
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint8_t get_value() const
Returns the value of the boolean (only matters if a reference object is not present)
void set_value(std::uint8_t inputValue)
Sets the value of the boolean object (only matters if a reference object is not present)
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_enabled() const
Returns if this object is enabled based on the enabled attribute.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
Options
Enumerates the bits in the options bitfield for an InputList.
std::uint16_t get_variable_reference() const
Returns the variable reference, which is an object ID of a number variable or NULL_OBJECT_ID (0xFFFF)
std::uint8_t get_value() const
Returns the value of the selected list index (only matters if there is no child number variable)
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
void set_value(std::uint8_t inputValue)
Sets the selected list index (only matters when the object has no child number variable)
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool change_list_item(std::uint8_t index, std::uint16_t newListItem, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool)
Changes a list item to a new ID by index.
void set_options(std::uint8_t options)
Sets the options bitfield for this object to a new value.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_variable_reference(std::uint16_t referencedObjectID)
A dedicated way to set the stored variable reference so we don't have to worry about the child object...
std::uint8_t get_number_of_list_items() const
Returns the number of items in the list.
void set_option(Options option, bool optionValue)
Sets a single option in the options bitfield to the specified value.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
void set_number_of_list_items(std::uint8_t value)
Sets the number of items in the list.
std::uint32_t get_minimum_value() const
Returns the minimum value for this input number.
void set_variable_reference(std::uint16_t variableReferenceValue)
Sets the object ID of a number variable object that contains the value of the Input Number object....
VerticalJustification
The allowable vertical justification options.
HorizontalJustification get_horizontal_justification() const
Returns the horizontal justification setting of the input number.
void set_option2(Options2 option, bool newOption)
Sets a single option in the second options bitfield to the specified value.
void set_font_attributes(std::uint16_t fontAttributesValue)
Sets the object ID of a font attributes object that defines the font attributes of the Input Number o...
std::uint16_t get_variable_reference() const
Returns the object ID of a number variable object that contains the value of the Input Number object.
float get_scale() const
Returns the scale factor that is applied to the value of the input number.
void set_offset(std::int32_t newOffset)
Sets the offset that will be applied to the number's value when it is displayed.
std::uint32_t get_maximum_value() const
Returns the maximum value for the input number.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
void set_value(std::uint32_t inputValue)
Sets the value of the input number (only matters if there's no child number variable object).
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
void set_justification_bitfield(std::uint8_t newJustification)
Sets the justification bitfield of the input number.
std::uint8_t get_number_of_decimals() const
Returns the number of decimals to display when rendering this input number.
std::uint32_t get_value() const
Returns the value of the input number (only matters if there's no child number variable object).
void set_minimum_value(std::uint32_t newMin)
Sets the minimum value for the input number.
void set_maximum_value(std::uint32_t newMax)
Sets the maximum value for the input number.
void set_options(std::uint8_t newOptions)
Sets the options bitfield for this object to a new value.
Options
Options that can be applied to the input number.
Options2
More options, for some reason they are different bytes.
void set_option(Options option, bool optionValue)
Sets a single option in the options bitfield to the specified value.
HorizontalJustification
The allowable horizontal justification options.
bool get_format() const
Returns if the format option is set for this input number.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_option2(Options2 newOption) const
Returns the state of a single option in the object's second option bitfield.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
std::uint16_t get_font_attributes() const
Returns the object ID of a font attributes object that defines the font attributes of the Input Numbe...
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_scale(float newScale)
Sets the scale factor that is applied to the value of the input number.
VerticalJustification get_vertical_justification() const
Returns the vertical justification setting of the input number.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
void set_options2(std::uint8_t newOptions)
Sets the second options bitfield for this object to a new value.
void set_format(bool newFormat)
Sets the format option.
void set_number_of_decimals(std::uint8_t numDecimals)
Sets the number of decimals to display when rendering this number.
std::int32_t get_offset() const
Returns the offset that will be applied to the number's value when it is displayed.
void set_font_attributes(std::uint16_t fontAttributesValue)
Sets the object ID of a font attributes object that defines the font attributes of the Input String o...
void set_enabled(bool value)
Sets the enable/disable state of the input string.
void set_option(Options option, bool value)
Sets a single option in the options bitfield to the specified value.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint16_t get_variable_reference() const
Returns the object ID of a string variable object that contains the value of the Input String object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint16_t get_input_attributes() const
Returns the object ID of a input attributes object that defines what can be input into the Input Stri...
Options
Options that can be applied to the input string.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
void set_options(std::uint8_t value)
Sets the options bitfield for this object to a new value.
void set_input_attributes(std::uint16_t inputAttributesValue)
Sets the object ID of a input attributes object that defines what can be input into the Input String ...
void set_justification_bitfield(std::uint8_t value)
Sets the justification bitfield of the string.
VerticalJustification get_vertical_justification() const
Returns the vertical justification setting of the string.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
std::uint16_t get_font_attributes() const
Returns the object ID of a font attributes object that defines the font attributes of the Input Strin...
VerticalJustification
The allowable vertical justification options.
std::string get_value() const
Returns a copy of the stored string value. Used only when no string variable objects are children of ...
void set_variable_reference(std::uint16_t variableReferenceValue)
Sets the object ID of a string variable object that contains the value of the Input String object....
void set_value(const std::string &value)
Changes the stored string value. Use only when no string variable objects are children of this object...
bool get_enabled() const
Returns if the input string is enabled for text entry.
HorizontalJustification
The allowable horizontal justification options.
HorizontalJustification get_horizontal_justification() const
Returns the horizontal justification setting of the string.
void set_name_object_id(std::uint16_t value)
Sets the Object ID of an Output String object or an Object Pointer object that points to an Output St...
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
Options
Enumerates the options bits in the options bitfield of a KeyGroup.
void set_options(std::uint8_t value)
Sets the options bitfield for this object to a new value.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
std::uint16_t get_name_object_id() const
Sets the Object ID of an Output String object or an Object Pointer object that points to an Output St...
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_key_group_icon(std::uint16_t value)
Sets the object ID of the icon to use when representing this key group.
bool validate_name(std::uint16_t nameIDToValidate, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const
Validates that the specified name ID is valid for this object.
std::uint16_t get_key_group_icon() const
Returns the key group icon that represents this key group.
void set_option(Options option, bool value)
Sets a single option in the options bitfield to the specified value.
std::uint8_t get_key_code() const
Returns the key code associated to this key object.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
void set_key_code(std::uint8_t value)
Sets the key code associated to this key object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_line_art_bit_pattern(std::uint16_t value)
Sets the line art bit patter for the line attribute.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint16_t get_line_art_bit_pattern() const
Sets the line art bit pattern. Each bit represents 1 pixel's on/off state.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool remove_command_packet(std::uint8_t index)
Deletes a command packet from the macro by index.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint8_t get_number_of_commands() const
Returns the number of stored command packets inside this macro (max 255)
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool add_command_packet(const std::vector< std::uint8_t > &command)
Adds a macro command packet to this macro. Essentially these are CAN messages that represent normal E...
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool get_command_packet(std::uint8_t index, std::vector< std::uint8_t > &command)
Returns a command packet by index.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
static const std::array< std::uint8_t, 28 > ALLOWED_COMMANDS_LOOKUP_TABLE
The list of all allowed commands in a table for easy lookup when validating macro content.
bool get_are_command_packets_valid() const
Returns if the command packets in this macro are valid.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint32_t get_value() const
Returns the number variable's value.
void set_value(std::uint32_t value)
Sets the number variable's value.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
void set_value(std::uint16_t objectIDToPointTo)
Sets the object id of the object this object points to. Does not do error checking on the type of obj...
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint16_t get_value() const
Returns the object id of the object this object points to.
void set_option(Options option, bool optionValue)
Sets a single option in the options bitfield to the specified value.
std::uint8_t get_target_line_colour() const
Returns the colour of the target line.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint16_t get_target_value() const
Returns the target value of the graph (only matters when no target value reference is used)
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_target_line_colour(std::uint8_t value)
Sets the colour of the target line.
std::uint16_t get_max_value() const
Returns the maximum value of the bar graph.
std::uint16_t get_target_value_reference() const
Returns the target value reference object ID.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
void set_max_value(std::uint16_t maximumValue)
Sets the max value of the bar graph.
void set_target_value(std::uint16_t value)
Sets the target value of the graph (only matters when no target value reference is used)
void set_value(std::uint16_t value)
Sets the value of the bar graph (only matters when no child number variable is used)
void set_bar_graph_width(std::uint16_t width)
Sets the width (px) of the bar graph.
void set_end_angle(std::uint8_t value)
Sets the end angle for the graph.
void set_colour(std::uint8_t value)
Sets the colour of the bar graph.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint16_t get_min_value() const
Returns the minimum value of the bar graph.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_target_value_reference(std::uint16_t value)
Sets the target value reference object ID.
Options
Options that can be applied to the input number.
void set_start_angle(std::uint8_t value)
Sets the start angle for the graph.
std::uint16_t get_value() const
Returns the value of the bar graph (only matters when no child number variable is used)
std::uint8_t get_start_angle() const
Returns the start angle of the graph.
std::uint8_t get_end_angle() const
Returns the end angle of the graph.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint16_t get_bar_graph_width() const
Returns the width (px) of the bar graph.
std::uint8_t get_colour() const
Returns the colour of the bar graph.
void set_min_value(std::uint16_t minimumValue)
Sets the minimum value for the bar graph.
void set_variable_reference(std::uint16_t variableReferenceValue)
Sets the value reference object ID, which is a number variable object that should be used to determin...
void set_options(std::uint8_t options)
Sets the options bitfield for this object to a new value.
std::uint16_t get_variable_reference() const
Returns the value reference object ID, which is a number variable object that should be used to deter...
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
void set_ellipse_type(EllipseType value)
Sets the ellipse type.
void set_line_attributes(std::uint16_t lineAttributesObject)
Sets the object ID of the line attributes used to display this ellipse's lines. Does not perform any ...
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_start_angle(std::uint8_t value)
Sets the start angle for the ellipse.
void set_end_angle(std::uint8_t value)
Sets the end angle for the ellipse.
std::uint8_t get_end_angle() const
Returns the end angle/2 (in degrees) from positive X axis counter clockwise(90° is straight up).
void set_fill_attributes(std::uint16_t fillAttributesObject)
Sets the object ID of the fill attributes used to display this ellipse's fill. Does not perform any e...
std::uint16_t get_line_attributes() const
Returns the object ID of the line attributes used to display this ellipse's lines.
EllipseType get_ellipse_type() const
Returns the type of the ellipse.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
std::uint8_t get_start_angle() const
Returns the Start angle/2 (in degrees) from positive X axis counter clockwise(90° is straight up) for...
std::uint16_t get_fill_attributes() const
Returns the object ID of the fill attributes used to display this ellipse's fill.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint16_t get_line_attributes() const
Returns the object ID of the line attributes used to display this line.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
LineDirection get_line_direction() const
Returns the line's direction.
LineDirection
Enumerates the different directions a line can be drawn.
void set_line_direction(LineDirection value)
Sets the line's direction.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
void set_line_attributes(std::uint16_t lineAttributesObject)
Sets the object ID of the line attributes used to display this line. Does not perform any error check...
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint8_t get_number_of_ticks() const
Returns the number of ticks to render across the graph.
std::uint16_t get_min_value() const
Returns the minimum value on the graph. Used to scale the graph's range.
void set_option(Options option, bool optionValue)
Sets a single option in the options bitfield to the specified value.
void set_value(std::uint16_t value)
Sets the value of the graph (only matters if there's no child number variable object).
std::uint8_t get_target_line_colour() const
Returns the target line colour as an index into the VT colour table.
std::uint16_t get_target_value_reference() const
Returns the target value reference object ID.
void set_options(std::uint8_t options)
Sets the options bitfield for this object to a new value.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_number_of_ticks(std::uint8_t value)
Sets the number of ticks to render when drawing the graph.
std::uint16_t get_target_value() const
Returns the graph's target value (only matters if there's no target value reference).
void set_target_line_colour(std::uint8_t lineColour)
Sets the target line colour.
void set_target_value_reference(std::uint16_t valueReferenceObjectID)
Sets the target value reference object ID.
std::uint16_t get_max_value() const
Returns the max value for the graph.
void set_variable_reference(std::uint16_t variableReferenceValue)
Sets the value reference object ID, which is a number variable object that should be used to determin...
void set_colour(std::uint8_t graphColour)
Sets the colour of the graph.
void set_target_value(std::uint16_t valueTarget)
Sets the target value for the graph (only matters if there's no target value reference).
void set_max_value(std::uint16_t value)
Sets the max value for the graph.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint16_t get_value() const
Returns the value of the graph (only matters if there's no child number variable object).
void set_min_value(std::uint16_t value)
Sets the minimum value on the graph.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
std::uint8_t get_colour() const
Returns the colour of the graph.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
std::uint16_t get_variable_reference() const
Returns the value reference object ID, which is a number variable object that should be used to deter...
Options
Options that can be applied to the input number.
std::uint8_t get_number_of_list_items() const
Returns the number of items in the list.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
void set_value(std::uint8_t value)
Sets the value of the selected list index (only matters if no child number variable object is present...
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint8_t get_value() const
Returns the value of the selected list index (only matters if no child number variable object is pres...
bool change_list_item(std::uint8_t index, std::uint16_t newListItem, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool)
Changes a list item to a new ID by index.
void set_number_of_list_items(std::uint8_t value)
Sets the number of items in the list.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint16_t get_variable_reference() const
Returns the variable reference, which is an object ID of a number variable or NULL_OBJECT_ID (0xFFFF)
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_variable_reference(std::uint16_t referencedObjectID)
A dedicated way to set the stored variable reference so we don't have to worry about the child object...
std::uint8_t get_number_of_ticks() const
Returns the number of ticks to render across the meter.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint8_t get_needle_colour() const
Returns the value of the needle colour.
void set_options(std::uint8_t options)
Sets the options bitfield for this object to a new value.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
std::uint8_t get_end_angle() const
Returns the end angle of the meter.
std::uint16_t get_variable_reference() const
Returns the value reference object ID, which is a number variable object that should be used to deter...
void set_option(Options option, bool optionValue)
Sets a single option in the options bitfield to the specified value.
std::uint8_t get_start_angle() const
Returns the start angle for the meter.
void set_needle_colour(std::uint8_t colourIndex)
Sets the value of the needle colour.
void set_border_colour(std::uint8_t colourIndex)
Sets the border colour of the meter.
void set_end_angle(std::uint8_t value)
Sets the end angle for this meter in degrees from the +x axis counter clockwise.
std::uint16_t get_min_value() const
Returns the minimum value of the output meter.
std::uint16_t get_value() const
Returns the value for the output meter (only matters if there's no child number variable object).
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
void set_min_value(std::uint16_t value)
Sets the minimum value of the output meter.
void set_arc_and_tick_colour(std::uint8_t colourIndex)
Sets the arc and tick colour for the meter.
void set_value(std::uint16_t value)
Sets the value of the output meter (only matters if there's no child number variable object).
void set_variable_reference(std::uint16_t variableReferenceValue)
Sets the value reference object ID, which is a number variable object that should be used to determin...
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_number_of_ticks(std::uint8_t ticks)
Sets the number of ticks to render when drawing the meter.
void set_max_value(std::uint16_t value)
Sets the max value for the output meter.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_start_angle(std::uint8_t value)
Sets the start angle for the meter.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint16_t get_max_value() const
Returns the max value for the output meter.
Options
Options that can be applied to the input number.
std::uint8_t get_arc_and_tick_colour() const
Returns the arc and tick colour for the meter.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint8_t get_border_colour() const
Returns the border colour of the meter.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
std::uint16_t get_font_attributes() const
Returns the object ID of a font attributes object that defines the font attributes of the Output Numb...
std::uint8_t get_number_of_decimals() const
Returns the number of decimals to render in the output number.
void set_number_of_decimals(std::uint8_t decimalValue)
Sets the number of decimals to render in the output number.
HorizontalJustification
The allowable horizontal justification options.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
void set_variable_reference(std::uint16_t referencedObjectID)
A dedicated way to set the stored variable reference so we don't have to worry about the child object...
float get_scale() const
Returns the scale factor of the output number.
void set_font_attributes(std::uint16_t fontAttributesValue)
Sets the object ID of a font attributes object that defines the font attributes of the Output Number ...
std::uint32_t get_value() const
Returns the value of the output number (only matters if there's no child number variable object).
void set_scale(float scaleValue)
Sets the scale factor for the output number.
void set_format(bool shouldFormatAsExponential)
Sets the format option for this object.
VerticalJustification
The allowable vertical justification options.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_value(std::uint32_t inputValue)
Sets the value of the output number (only matters if there's no child number variable object).
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_format() const
Returns if the "format" option is set for this object.
Options
Options that can be applied to the input number.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::int32_t get_offset() const
Returns the offset that is applied to the output number.
VerticalJustification get_vertical_justification() const
Returns the vertical justification of the output number within its bounding box.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_justification_bitfield(std::uint8_t value)
Sets the justification bitfield to a new value.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
void set_option(Options option, bool value)
Sets a single option in the options bitfield to the specified value.
std::uint16_t get_variable_reference() const
Returns the variable reference, which is an object ID of a number variable or NULL_OBJECT_ID (0xFFFF)
void set_options(std::uint8_t value)
Sets the options bitfield for this object to a new value.
void set_offset(std::int32_t offsetValue)
Sets the offset of the output number.
HorizontalJustification get_horizontal_justification() const
Returns the horizontal justification of the output number within its bounding box.
void set_type(PolygonType value)
Sets the polygon type for this object.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint16_t get_line_attributes() const
Returns the object ID of the line attributes used to display this polygon's lines.
void set_fill_attributes(std::uint16_t fillAttributesObject)
Sets the object ID of the fill attributes used to display this polygon's fill. Does not perform any e...
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
void add_point(std::uint16_t x, std::uint16_t y)
Adds a point to the polygon, defined by x and y coordinates.
void set_line_attributes(std::uint16_t lineAttributesObject)
Sets the object ID of the line attributes used to display this polygon's lines. Does not perform any ...
std::uint16_t get_fill_attributes() const
Returns the object ID of the fill attributes used to display this polygon's fill.
PolygonType
Polygon type. The first three types are useful only if the polygon is to be filled.
std::uint8_t get_number_of_points() const
Returns the number of polygon points.
PolygonType get_type() const
Returns the polygon type of this object.
PolygonPoint get_point(std::uint8_t index)
Returns a point from the polygon by index.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint8_t get_line_suppression_bitfield() const
Returns the line suppression bitfield.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_line_suppression_bitfield(std::uint8_t value)
Sets the line suppression bitfield value.
void set_line_attributes(std::uint16_t lineAttributesObject)
Sets the object ID of the line attributes used to display this rectangle's lines. Does not perform an...
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint16_t get_line_attributes() const
Returns the object ID of the line attributes used to display this rectangle's lines.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint16_t get_fill_attributes() const
Returns the object ID of the fill attributes used to display this rectangle's fill.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
void set_fill_attributes(std::uint16_t fillAttributesObject)
Sets the object ID of the fill attributes used to display this rectangle's fill. Does not perform any...
VerticalJustification
The allowable vertical justification options.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_font_attributes(std::uint16_t fontAttributesValue)
Sets the object ID of a font attributes object that defines the font attributes of the Output String ...
HorizontalJustification
The allowable horizontal justification options.
std::string get_value() const
Returns the value of the string, used only if the variable reference (a child var string) is NULL_OBJ...
void set_justification_bitfield(std::uint8_t value)
Sets the justification bitfield for the object to a new value.
void set_options(std::uint8_t value)
Sets the options bitfield for this object to a new value.
void set_variable_reference(std::uint16_t variableReferenceValue)
Sets the object ID of a string variable object that contains the value of the Output String object....
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
std::uint16_t get_variable_reference() const
Returns the object ID of a string variable object that contains the value of the Output String object...
HorizontalJustification get_horizontal_justification() const
Returns the horizontal justification of the output string within its bounding box.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
Options
Enumerates the option bits in the options bitfield for an output string.
void set_option(Options option, bool value)
Sets a single option in the options bitfield to the specified value.
void set_value(const std::string &value)
Sets the value of the string (only matters if it has no child string variable)
std::uint16_t get_font_attributes() const
Returns the object ID of a font attributes object that defines the font attributes of the Output Stri...
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
VerticalJustification get_vertical_justification() const
Returns the vertical justification of the output string within its bounding box.
void set_format(Format value)
Sets the picture's colour format.
std::uint32_t get_number_of_bytes_in_raw_data() const
Returns the number of bytes in the raw data that comprises the underlying bitmap.
std::uint16_t get_actual_height() const
Returns the actual height of the underlying bitmap.
void set_raw_data(const std::uint8_t *data, std::uint32_t size)
Sets a large chunk of data to the underlying bitmap.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
Options
Enumerates the different options bits in the options bitfield.
void set_number_of_bytes_in_raw_data(std::uint32_t value)
Sets the number of bytes in the raw data that comprises the underlying bitmap.
void set_actual_height(std::uint16_t value)
Sets the actual height of the underlying bitmap.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
std::vector< std::uint8_t > & get_raw_data()
Returns a reference to the underlying bitmap data.
void set_actual_width(std::uint16_t value)
Sets the actual width of the underlying bitmap.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_transparency_colour(std::uint8_t value)
Sets the transparency colour to use when rendering the object as an index into the VT colour table.
Format
Enumerates the different colour formats a picture graphic can have (mutually exclusive)
std::uint16_t get_actual_width() const
Returns the actual width of the underlying bitmap.
Format get_format() const
Returns the picture's colour format.
void set_options(std::uint8_t value)
Sets the options bitfield for this object to a new value.
void set_option(Options option, bool value)
Sets a single option in the options bitfield to the specified value.
void add_raw_data(std::uint8_t dataByte)
Sets one byte of raw data to the underlying bitmap.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
std::uint8_t get_transparency_colour() const
Returns the transparency colour to use when rendering the object as an index into the VT colour table...
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::string get_value() const
Returns the actual string value stored in this object.
void set_value(const std::string &value)
Sets the actual string value stored in this object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
static constexpr std::size_t VT_COLOUR_TABLE_SIZE
The size of the VT colour table as specified in ISO11783-6.
VTColourTable()
Constructor for a VT colour table.
std::array< VTColourVector, VT_COLOUR_TABLE_SIZE > colourTable
Colour table data. Associates VT colour index with RGB value.
VTColourVector get_colour(std::uint8_t colourIndex) const
Returns the colour vector associated to the specified VT colour index, which is what gets provided no...
void set_colour(std::uint8_t colourIndex, VTColourVector newColour)
Sets the specified VT colour index to a new RGB colour value.
ChildObjectData()=default
Default constructor for child object data with default values.
bool offset_all_children_with_id(std::uint16_t childObjectID, std::int8_t xOffset, std::int8_t yOffset)
Offsets all child objects with the specified ID by the amount specified relative to its parent.
std::uint16_t width
The width of the object. Not always applicable, but often used.
void set_child_x(std::uint16_t index, std::int16_t xOffset)
Sets the X offset of the child object associated with the specified index into the parent object.
MacroMetadata get_macro(std::uint8_t index) const
Returns the macro ID at the specified index.
virtual VirtualTerminalObjectType get_object_type() const =0
Returns the VT object type of the underlying derived object.
std::uint16_t get_id() const
Returns the object ID of this VT object.
AttributeError
Enumerates the bit indices of the error fields that can be set when changing an attribute.
std::uint16_t height
The height of the object. Not always applicable, but often used.
static std::shared_ptr< VTObject > get_object_by_id(std::uint16_t objectID, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool)
Returns a VT object from its member pool by ID, or the null id if it does not exist.
void pop_child()
Removes the last added child object. This is meant to be a faster way to deal with objects that only ...
void add_macro(MacroMetadata macroToAdd)
Adds a macro to the list of macros referenced by this object.
std::uint16_t get_child_id(std::uint16_t index) const
Returns the ID of the child by index, if one was added previously.
void add_child(std::uint16_t objectID, std::int16_t relativeXLocation, std::int16_t relativeYLocation)
Adds an object as a child to another object, which essentially creates a tree of object association.
void set_child_y(std::uint16_t index, std::int16_t yOffset)
Sets the Y offset of the child object associated with the specified index into the parent object.
std::uint16_t objectID
Object identifier. Shall be unique within the object pool.
std::uint16_t get_number_children() const
Returns the number of child objects within this object.
std::int16_t get_child_y(std::uint16_t index) const
Returns the Y offset of the child object associated with the specified index into the parent object.
void set_width(std::uint16_t value)
Sets the width of this object in px.
void remove_child(std::uint16_t objectIDToRemove, std::int16_t relativeXLocation, std::int16_t relativeYLocation)
Removes an object reference from another object. All fields must exactly match for the object to be r...
std::uint8_t backgroundColor
The background color (from the VT colour table)
std::int16_t get_child_x(std::uint16_t index) const
Returns the X offset of the child object associated with the specified index into the parent object.
void set_background_color(std::uint8_t value)
Sets the background color attribute of this object.
std::uint16_t get_height() const
Returns the height of this object in px.
std::vector< MacroMetadata > macros
List of macros referenced by this object.
void set_id(std::uint16_t value)
Sets the object ID of this VT object.
std::vector< ChildObjectData > children
List of child objects.
void set_height(std::uint16_t value)
Sets the height of this object in px.
std::uint8_t get_number_macros() const
Returns the number of macros referenced by this object.
std::uint16_t get_width() const
Returns the width of this object in px.
std::uint8_t get_background_color() const
Returns the background color attribute of this object.
void set_option(Options option, bool value)
Sets a single option in the options bitfield to the specified value.
std::uint16_t get_title_object_id() const
Returns Object ID of an Output String object or an Object Pointer object that points to an Output Str...
WindowType
Enumerates the different kinds of window masks which imply how they are displayed and what they conta...
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool get_option(Options option) const
Returns the state of a single option in the object's option bitfield.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
void set_window_type(WindowType type)
Sets the window type for this object.
WindowType get_window_type() const
Returns the window type for this object.
void set_icon_object_id(std::uint16_t object)
Sets the object ID of an output object that contains an icon for the window.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_title_object_id(std::uint16_t object)
Sets the Object ID of an Output String object or an Object Pointer object that points to an Output St...
void set_name_object_id(std::uint16_t object)
Sets the object ID of an Output String object or an Object Pointer object that points to an Output St...
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
std::uint16_t get_name_object_id() const
Returns object ID of an Output String object or an Object Pointer object that points to an Output Str...
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
std::uint16_t get_icon_object_id() const
Returns the object ID of an output object that contains an icon for the window.
Options
Enumerates the bit indexes of options encoded in the object's options bitfield.
void set_options(std::uint8_t value)
Sets the options bitfield for this object to a new value.
std::uint16_t get_active_mask() const
Returns tha currently active mask for this working set.
AttributeName
Enumerates this object's attributes which are assigned an attribute ID. The Change Attribute command ...
void set_active_mask(std::uint16_t value)
Sets the object id of the active mask for this working set.
std::uint32_t get_minumum_object_length() const override
Returns the minimum binary serialized length of the associated object.
bool get_is_valid(const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool) const override
Performs basic error checking on the object and returns if the object is valid.
void set_selectable(bool value)
Sets if the working set is selectable.
bool get_attribute(std::uint8_t attributeID, std::uint32_t &returnedAttributeData) const override
Gets an attribute and returns the raw data in the last parameter.
bool get_selectable() const
Returns if the working set is currently selectable.
VirtualTerminalObjectType get_object_type() const override
Returns the VT object type of the underlying derived object.
bool set_attribute(std::uint8_t attributeID, std::uint32_t rawAttributeData, const std::map< std::uint16_t, std::shared_ptr< VTObject > > &objectPool, AttributeError &returnedError) override
Sets an attribute and optionally returns an error code in the last parameter.
Defines the different VT object types that can comprise a VT object pool.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
constexpr std::uint16_t NULL_OBJECT_ID
Special ID used to indicate no object.
@ Reserved
Reserved.
VirtualTerminalObjectType
The types of objects in an object pool by object type byte value.
@ OutputPolygon
Used to output a polygon.
@ FontAttributes
Used to group font based attributes. Can only be referenced by other objects.
@ WorkingSet
Top level object that describes an implement’s ECU or group of ECUs.
@ NumberVariable
Used to store a 32-bit unsigned integer value.
@ WindowMask
Top level object that contains other objects. The Window Mask is activated by the VT.
@ Container
Used to group objects.
@ AuxiliaryInputType1
The Auxiliary Input Type 1 object defines the designator, key number, and function type for an auxili...
@ PictureGraphic
Used to output a picture graphic (bitmap).
@ Macro
Special object that contains a list of commands that can be executed in response to an event.
@ ObjectPointer
Used to reference another object.
@ OutputList
Used to output a list item.
@ DataMask
Top level object that contains other objects. A Data Mask is activated by a Working Set to become the...
@ OutputEllipse
Used to output an ellipse or circle.
@ OutputString
Used to output a character string.
@ StringVariable
Used to store a fixed length string value.
@ InputNumber
Used to input an integer or float numeric.
@ OutputArchedBarGraph
Used to output an arched bar graph.
@ AuxiliaryFunctionType1
The Auxiliary Function Type 1 object defines the designator and function type for an Auxiliary Functi...
@ InputString
Used to input a character string.
@ AuxiliaryControlDesignatorType2
Used to reference Auxiliary Input Type 2 object or Auxiliary Function Type 2 object.
@ OutputRectangle
Used to output a rectangle or square.
@ Button
Used to describe a Button control.
@ Key
Used to describe a Soft Key.
@ FillAttributes
Used to group fill based attributes. Can only be referenced by other objects.
@ ExtendedInputAttributes
Used to specify a list of valid WideChars. Can only be referenced by Input Field Objects.
@ GraphicsContext
Used to output a graphics context.
@ OutputMeter
Used to output a meter.
@ ExternalObjectPointer
Used to reference an object in another Working Set.
@ AlarmMask
Top level object that contains other objects. Describes an alarm display.
@ ScaledGraphic
Used to display a scaled representation of a graphic object.
@ SoftKeyMask
Top level object that contains Key objects.
@ OutputNumber
Used to output an integer or float numeric.
@ InputList
Used to select an item from a pre-defined list.
@ AuxiliaryInputType2
The Auxiliary Input Type 2 object defines the designator, key number, and function type for an Auxili...
@ AuxiliaryFunctionType2
The Auxiliary Function Type 2 object defines the designator and function type for an Auxiliary Functi...
@ LineAttributes
Used to group line based attributes. Can only be referenced by other objects.
@ OutputLine
Used to output a line.
@ Animation
The Animation object is used to display simple animations.
@ KeyGroup
Top level object that contains Key objects.
@ InputBoolean
Used to input a TRUE/FALSE type input.
@ OutputLinearBarGraph
Used to output a linear bar graph.
@ ColourMap
Used to specify a colour table object.
@ InputAttributes
Used to specify a list of valid characters. Can only be referenced by input field objects.
A helper structure to group a macro ID with an event ID.