Botcraft 26.2
Loading...
Searching...
No Matches
DataComponents.cpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
4
36#if PROTOCOL_VERSION < 774 /* < 1.21.115 */
38#endif
41#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
43#endif
47#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
49#endif
50#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
58#endif
59#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
70#endif
71#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
73#endif
74#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
81#endif
82#if PROTOCOL_VERSION > 775 /* > 26.1.2 */
84#endif
85
87
88namespace ProtocolCraft
89{
90 namespace Components
91 {
99#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
102#endif
103#if PROTOCOL_VERSION > 765 /* > 1.20.4 */
105#endif
107#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
109#endif
110#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
112#endif
113#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
115#endif
116#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
119#endif
122#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
125#endif
126#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
129#endif
130#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
131 DEFINE_NETWORK_TYPE(PossibleEffect);
132#endif
139
171#if PROTOCOL_VERSION < 774 /* < 1.21.11 */
172 DEFINE_NETWORK_TYPE(DataComponentTypeResourceLocation);
173#endif
176#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
177 DEFINE_NETWORK_TYPE(DataComponentTypeUnbreakable);
178#endif
182#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
184#endif
185#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
193#endif
194#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
205#endif
206#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
208#endif
209#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
216#endif
217#if PROTOCOL_VERSION > 775 /* > 26.1.2 */
219#endif
220
222 {
223 static constexpr std::array<std::string_view, static_cast<size_t>(DataComponentTypes::NUM_DATA_COMPONENT_TYPES)> names = {
224 "custom_data",
225 "max_stack_size",
226 "max_damage",
227 "damage",
228 "unbreakable",
229#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
230 "use_effects",
231#endif
232 "custom_name",
233#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
234 "minimum_attack_charge",
235 "damage_type",
236#endif
237 "item_name",
238#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
239 "item_model",
240#endif
241 "lore",
242 "rarity",
243 "enchantments",
244 "can_place_on",
245 "can_break",
246 "attribute_modifiers",
247 "custom_model_data",
248#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
249 "hide_additional_tooltip",
250 "hide_tooltip",
251#endif
252#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
253 "tooltip_display",
254#endif
255 "repair_cost",
256 "creative_slot_lock",
257 "enchantment_glint_override",
258 "intangible_projectile",
259 "food",
260#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
261 "fire_resistant",
262#endif
263#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
264 "consumable",
265 "use_remainder",
266 "use_cooldown",
267 "damage_resistant",
268#endif
269 "tool",
270#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
271 "weapon",
272#endif
273#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
274 "attack_range",
275#endif
276#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
277 "enchantable",
278 "equippable",
279 "repairable",
280 "glider",
281 "tooltip_style",
282 "death_protection",
283#endif
284#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
285 "blocks_attacks",
286#endif
287#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
288 "piercing_weapon",
289 "kinetic_weapon",
290 "swing_animation",
291#endif
292#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
293 "additional_trade_cost",
294#endif
295 "stored_enchantments",
296#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
297 "dye",
298#endif
299 "dyed_color",
300 "map_color",
301 "map_id",
302 "map_decorations",
303 "map_post_processing",
304 "charged_projectiles",
305 "bundle_contents",
306 "potion_contents",
307#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
308 "potion_duration_scale",
309#endif
310 "suspicious_stew_effects",
311 "writable_book_content",
312 "written_book_content",
313 "trim",
314 "debug_stick_state",
315 "entity_data",
316 "bucket_entity_data",
317 "block_entity_data",
318 "instrument",
319#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
320 "provides_trim_material",
321#endif
322 "ominous_bottle_amplifier",
323#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
324 "jukebox_playable",
325#endif
326#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
327 "provides_banner_patterns",
328#endif
329 "recipes",
330 "lodestone_tracker",
331 "firework_explosion",
332 "fireworks",
333 "profile",
334 "note_block_sound",
335 "banner_patterns",
336 "base_color",
337 "pot_decorations",
338 "container",
339 "block_state",
340 "bees",
341#if PROTOCOL_VERSION > 775 /* > 26.1.2 */
342 "sulfur_cube_content",
343#endif
344 "lock",
345 "container_loot",
346#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
347 "break_sound",
348 "villager/variant",
349 "wolf/variant",
350 "wolf/sound_variant",
351 "wolf/collar",
352 "fox/variant",
353 "salmon/size",
354 "parrot/variant",
355 "tropical_fish/pattern",
356 "tropical_fish/base_color",
357 "tropical_fish/pattern_color",
358 "mooshroom/variant",
359 "rabbit/variant",
360 "pig/variant",
361#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
362 "pig/sound_variant",
363#endif
364 "cow/variant",
365#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
366 "cow/sound_variant",
367#endif
368 "chicken/variant",
369#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
370 "chicken/sound_variant",
371#endif
372#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
373 "zombie_nautilus/variant",
374#endif
375 "frog/variant",
376 "horse/variant",
377 "painting/variant",
378 "llama/variant",
379 "axolotl/variant",
380 "cat/variant",
381#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
382 "cat/sound_variant",
383#endif
384 "cat/collar",
385 "sheep/color",
386 "shulker/color",
387#endif
388 };
389 if (type <= DataComponentTypes::None || type >= DataComponentTypes::NUM_DATA_COMPONENT_TYPES)
390 {
391 return "";
392 }
393 return names[static_cast<size_t>(type)];
394 }
395
396 std::shared_ptr<DataComponentType> CreateComponentType(const DataComponentTypes type)
397 {
398 if (type <= DataComponentTypes::None || type >= DataComponentTypes::NUM_DATA_COMPONENT_TYPES)
399 {
400 throw std::runtime_error("Unable to create data component with id: " + std::to_string(static_cast<int>(type)) + ".");
401 }
402
403 switch (type)
404 {
407 return std::make_shared<DataComponentTypeAdventureModePredicate>();
409 return std::make_shared<DataComponentTypeArmorTrim>();
411 return std::make_shared<DataComponentTypeBannerPatternLayers>();
413 return std::make_shared<DataComponentTypeBlockItemStateProperties>();
415 return std::make_shared<DataComponentTypeBoolean>();
417 return std::make_shared<DataComponentTypeBundleContents>();
419 return std::make_shared<DataComponentTypeChargedProjectiles>();
422 return std::make_shared<DataComponentTypeComponent>();
424#if PROTOCOL_VERSION < 773 /* < 1.21.9 */
427#endif
428 return std::make_shared<DataComponentTypeCustomData>();
430 return std::make_shared<DataComponentTypeCustomModelData>();
438 // Component with no network serializer specified fallback to NBT
439 return std::make_shared<DataComponentTypeDefault>();
441 return std::make_shared<DataComponentTypeDyeColor>();
443 return std::make_shared<DataComponentTypeDyedItemColor>();
445 return std::make_shared<DataComponentTypeFireworkExplosion>();
447 return std::make_shared<DataComponentTypeFireworks>();
449 return std::make_shared<DataComponentTypeFoodProperties>();
451 return std::make_shared<DataComponentTypeInstrument>();
457#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
459#endif
460 return std::make_shared<DataComponentTypeInteger>();
462 return std::make_shared<DataComponentTypeItemAttributeModifiers>();
464 return std::make_shared<DataComponentTypeItemContainerContents>();
467 return std::make_shared<DataComponentTypeItemEnchantments>();
469 return std::make_shared<DataComponentTypeItemLore>();
470#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
472 return std::make_shared<DataComponentTypeJukeboxPlayable>();
473#endif
475 return std::make_shared<DataComponentTypeListBeehiveBlockEntityOccupant>();
477 return std::make_shared<DataComponentTypeLodestoneTracker>();
479 return std::make_shared<DataComponentTypeMapId>();
481 return std::make_shared<DataComponentTypeMapItemColor>();
483 return std::make_shared<DataComponentTypeMapPostProcessing>();
485 return std::make_shared<DataComponentTypePotDecorations>();
487 return std::make_shared<DataComponentTypePotionContents>();
489 return std::make_shared<DataComponentTypeRarity>();
491 return std::make_shared<DataComponentTypeResolvableProfile>();
493 return std::make_shared<DataComponentTypeIdentifier>();
494#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
496 return std::make_shared<DataComponentTypeDamageResistant>();
499#endif
500#if PROTOCOL_VERSION < 774 /* < 1.21.11 */
501 return std::make_shared<DataComponentTypeResourceLocation>();
502#else
503 return std::make_shared<DataComponentTypeIdentifier>();
504#endif
506 return std::make_shared<DataComponentTypeSuspiciousStewEffects>();
508 return std::make_shared<DataComponentTypeTool>();
509#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
511 return std::make_shared<DataComponentTypeUnbreakable>();
512#else
513 // From custom Unbreakable to Unit in 1.21.5
515#endif
516#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
517 case DataComponentTypes::HideAdditionalTooltip:
518 case DataComponentTypes::HideTooltip:
519#endif
521#if PROTOCOL_VERSION < 768 /* < 1.21.2 */
522 case DataComponentTypes::FireResistant:
523#endif
524#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
526#endif
527 return std::make_shared<DataComponentTypeUnit>();
529 return std::make_shared<DataComponentTypeWritableBookContent>();
531 return std::make_shared<DataComponentTypeWrittenBookContent>();
532#if PROTOCOL_VERSION > 767 /* > 1.21.1 */
534 return std::make_shared<DataComponentTypeConsumable>();
536 return std::make_shared<DataComponentTypeDeathProtection>();
538 return std::make_shared<DataComponentTypeEquippable>();
540 return std::make_shared<DataComponentTypeRepairable>();
542 return std::make_shared<DataComponentTypeUseCooldown>();
544 return std::make_shared<DataComponentTypeUseRemainder>();
545#endif
546#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
548 return std::make_shared<DataComponentTypeBlocksAttacks>();
550 return std::make_shared<DataComponentTypeBreakSound>();
552 return std::make_shared<DataComponentTypePaintingVariant>();
554 return std::make_shared<DataComponentTypeFloat>();
556 return std::make_shared<DataComponentTypeProvidesBannerPattern>();
558 return std::make_shared<DataComponentTypeProvidesTrimMaterial>();
560 return std::make_shared<DataComponentTypeTooltipDisplay>();
562 return std::make_shared<DataComponentTypeWeapon>();
563#if PROTOCOL_VERSION < 775 /* < 1.21.11 */
565 return std::make_shared<DataComponentTypeEitherRegistryVarint>();
566#endif
583 return std::make_shared<DataComponentTypeVariantEnum>();
590 return std::make_shared<DataComponentTypeDyeColor>();
591#endif
592#if PROTOCOL_VERSION > 772 /* > 1.21.8 */
595 return std::make_shared<DataComponentTypeTypedEntityData>();
596#endif
597#if PROTOCOL_VERSION > 773 /* > 1.21.10 */
599 return std::make_shared<DataComponentTypeUseEffects>();
601 return std::make_shared<DataComponentTypeFloat>();
603 return std::make_shared<DataComponentTypeAttackRange>();
604#if PROTOCOL_VERSION < 775 /* < 1.21.11 */
607 return std::make_shared<DataComponentTypeEitherRegistryVarint>();
608#endif
610 return std::make_shared<DataComponentTypePiercingWeapon>();
612 return std::make_shared<DataComponentTypeKineticWeapon>();
614 return std::make_shared<DataComponentTypeSwingAnimation>();
615#endif
616#if PROTOCOL_VERSION > 774 /* > 1.21.11 */
618 return std::make_shared<DataComponentTypeDyeColor>();
626 return std::make_shared<DataComponentTypeVariantEnum>();
628 return std::make_shared<DataComponentTypeInteger>();
629#endif
630#if PROTOCOL_VERSION > 775 /* > 26.1.2 */
632 return std::make_shared<DataComponentTypeSulfurCubeContent>();
633#endif
634 default:
635 // Should never happen but will make the compilers happy
636 throw std::runtime_error("Unable to create data component with id: " + std::to_string(static_cast<int>(type)) + ".");
637 }
638 }
639
644
645 const std::map<DataComponentTypes, std::shared_ptr<DataComponentType>>& DataComponentPredicate::GetMap() const
646 {
647 return map;
648 }
649
650 DataComponentPredicate& DataComponentPredicate::SetMap(const std::map<DataComponentTypes, std::shared_ptr<DataComponentType>>& map_)
651 {
652 map = map_;
653 return *this;
654 }
655
657 {
658 // special case, dynamic factory
659 const int map_size = ReadData<VarInt>(iter, length);
660 map.clear();
661 for (int i = 0; i < map_size; ++i)
662 {
663 const DataComponentTypes k = ReadData<DataComponentTypes, VarInt>(iter, length);
664 std::shared_ptr<DataComponentType> v = CreateComponentType(k);
665 if (v != nullptr)
666 {
667 v->Read(iter, length);
668 }
669 map[k] = v;
670 }
671 }
672
674 {
675 // special case, dynamic factory
676 WriteData<VarInt>(static_cast<int>(map.size()), container);
677 for (const auto& [k, v] : map)
678 {
679 WriteData<DataComponentTypes, VarInt>(k, container);
680 if (v != nullptr)
681 {
682 v->Write(container);
683 }
684 }
685 }
686
688 {
689 Json::Value output;
690
691 output["map"] = Json::Array();
692 for (const auto& p : map)
693 {
694 output["map"].push_back({
695 { "name", DataComponentTypesToString(p.first) },
696 { "data", p.second == nullptr ? nullptr : p.second->Serialize() }
697 });
698 }
699
700 return output;
701 }
702
703
704#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
709#endif
710
711
716
717 const std::map<DataComponentTypes, std::shared_ptr<DataComponentType>>& DataComponentPatch::GetMap() const
718 {
719 return map;
720 }
721
722 DataComponentPatch& DataComponentPatch::SetMap(const std::map<DataComponentTypes, std::shared_ptr<DataComponentType>>& map_)
723 {
724 map = map_;
725 return *this;
726 }
727
728 void DataComponentPatch::ReadImpl(ReadIterator& iter, size_t& length)
729 {
730 const int num_data = ReadData<VarInt>(iter, length);
731 const int num_void = ReadData<VarInt>(iter, length);
732
733 map.clear();
734
735 for (int i = 0; i < num_data; ++i)
736 {
737 const DataComponentTypes type = ReadData<DataComponentTypes, VarInt>(iter, length);
738 std::shared_ptr<DataComponentType> data = CreateComponentType(type);
739
740 if (data != nullptr)
741 {
742 data->Read(iter, length);
743 }
744 map.insert({ type, data });
745 }
746
747 for (int i = 0; i < num_void; ++i)
748 {
749 const DataComponentTypes type = ReadData<DataComponentTypes, VarInt>(iter, length);
750 map.insert({ type, nullptr });
751 }
752 }
753
755 {
756 int num_data = 0;
757 for (const auto& p : map)
758 {
759 num_data += p.second != nullptr;
760 }
761 const int num_void = static_cast<int>(map.size()) - num_data;
762
763 WriteData<VarInt>(num_data, container);
764 WriteData<VarInt>(num_void, container);
765
766 for (const auto& p : map)
767 {
768 if (p.second == nullptr)
769 {
770 continue;
771 }
772 WriteData<DataComponentTypes, VarInt>(p.first, container);
773 p.second->Write(container);
774 }
775
776 for (const auto& p : map)
777 {
778 if (p.second != nullptr)
779 {
780 continue;
781 }
782 WriteData<DataComponentTypes, VarInt>(p.first, container);
783 }
784 }
785
787 {
788 Json::Value output;
789
790 output["map"] = Json::Array();
791 for (const auto& p : map)
792 {
793 output["map"].push_back({
794 { "name", DataComponentTypesToString(p.first) },
795 { "data", p.second == nullptr ? nullptr : p.second->Serialize() }
796 });
797 }
798
799 return output;
800 }
801
802#if PROTOCOL_VERSION > 769 /* > 1.21.4 */
804 {
805 for (const auto& [k, v] : patch.GetMap())
806 {
807 if (v == nullptr)
808 {
809 RemovedComponents.push_back(k);
810 }
811 else
812 {
813 // TODO: Fix this, this is *NOT* how the components are serialized to bytes
814 std::vector<unsigned char> serialized;
815 WriteData<DataComponentTypes, VarInt>(k, serialized);
816 v->Write(serialized);
817 // This however should be the right CRC32C hash calculation
818 // CRC32c polynomial, from https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Polynomial_representations
819 // no idea why we need the reversed one but it works
820 constexpr unsigned int polynomial = 0x82F63B78;
821
822 unsigned int crc = 0xFFFFFFFF;
823
824 for (const auto byte : serialized)
825 {
826 crc ^= byte;
827 // TODO: replace slow loop with a faster version with lookup table and cool fancy stuff ?
828 for (int i = 0; i < 8; ++i)
829 {
830 // Trick to replace if branch
831 // if (crc & 1) crc = (crc >> 1) ^ polynomial;
832 // else crc = crc >> 1;
833 // Works because a ^ 0 == a
834 crc = (crc >> 1) ^ (crc & 1) * polynomial;
835 }
836 }
837 AddedComponents[k] = static_cast<int>(~crc);
838 }
839 }
840 }
841
843#endif
848
849 const std::map<DataComponentTypes, std::shared_ptr<DataComponentType>>& LengthPrefixedDataComponentPatch::GetMap() const
850 {
851 return map;
852 }
853
854 LengthPrefixedDataComponentPatch& LengthPrefixedDataComponentPatch::SetMap(const std::map<DataComponentTypes, std::shared_ptr<DataComponentType>>& map_)
855 {
856 map = map_;
857 return *this;
858 }
859
861 {
862 const int num_data = ReadData<VarInt>(iter, length);
863 const int num_void = ReadData<VarInt>(iter, length);
864
865 map.clear();
866
867 for (int i = 0; i < num_data; ++i)
868 {
869 const DataComponentTypes type = ReadData<DataComponentTypes, VarInt>(iter, length);
870 const int data_size = ReadData<VarInt>(iter, length);
871 std::shared_ptr<DataComponentType> data = CreateComponentType(type);
872
873 if (data != nullptr)
874 {
875 data->Read(iter, length);
876 }
877 map.insert({ type, data });
878 }
879
880 for (int i = 0; i < num_void; ++i)
881 {
882 const DataComponentTypes type = ReadData<DataComponentTypes, VarInt>(iter, length);
883 map.insert({ type, nullptr });
884 }
885 }
886
888 {
889 int num_data = 0;
890 for (const auto& p : map)
891 {
892 num_data += p.second != nullptr;
893 }
894 const int num_void = static_cast<int>(map.size()) - num_data;
895
896 WriteData<VarInt>(num_data, container);
897 WriteData<VarInt>(num_void, container);
898
899 for (const auto& p : map)
900 {
901 if (p.second == nullptr)
902 {
903 continue;
904 }
905 WriteData<DataComponentTypes, VarInt>(p.first, container);
906 WriteContainer temp;
907 // Serialize to an intermediate vector to get the size
908 p.second->Write(temp);
909 WriteData<VarInt>(static_cast<int>(temp.size()), container);
910 WriteByteArray(temp, container);
911 }
912
913 for (const auto& p : map)
914 {
915 if (p.second != nullptr)
916 {
917 continue;
918 }
919 WriteData<DataComponentTypes, VarInt>(p.first, container);
920 }
921 }
922
924 {
925 Json::Value output;
926
927 output["map"] = Json::Array();
928 for (const auto& p : map)
929 {
930 output["map"].push_back({
931 { "name", DataComponentTypesToString(p.first) },
932 { "data", p.second == nullptr ? nullptr : p.second->Serialize() }
933 });
934 }
935
936 return output;
937 }
938}
939}
940#endif
#define DEFINE_NETWORK_TYPE(ClassName)
virtual Json::Value SerializeImpl() const override
std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > map
const std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > & GetMap() const
virtual void ReadImpl(ReadIterator &iter, size_t &length) override
DataComponentPatch & SetMap(const std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > &map_)
virtual void WriteImpl(WriteContainer &container) const override
virtual void WriteImpl(WriteContainer &container) const override
std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > map
virtual Json::Value SerializeImpl() const override
virtual void ReadImpl(ReadIterator &iter, size_t &length) override
const std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > & GetMap() const
DataComponentPredicate & SetMap(const std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > &map_)
virtual void ReadImpl(ReadIterator &iter, size_t &length) override
std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > map
const std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > & GetMap() const
virtual void WriteImpl(WriteContainer &container) const override
LengthPrefixedDataComponentPatch & SetMap(const std::map< DataComponentTypes, std::shared_ptr< DataComponentType > > &map_)
Real class declaration, just a derived class of std::vector<Value>
Definition Json.hpp:180
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45
void push_back(const Value &value)
Definition Json.cpp:257
std::shared_ptr< DataComponentType > CreateComponentType(const DataComponentTypes type)
std::string_view DataComponentTypesToString(const DataComponentTypes type)
std::vector< unsigned char > WriteContainer
std::vector< unsigned char >::const_iterator ReadIterator
void WriteByteArray(const std::vector< unsigned char > &my_array, WriteContainer &container)