IOLink  IOL_v1.2.0_release
VariantDataValueFactory.h
1 #pragma once
2 
3 #include <cstdint>
4 
5 #include <memory>
6 
7 #include <iolink/IOLinkAPI.h>
8 #include <iolink/VariantDataValue.h>
9 
10 namespace iolink
11 {
12 
16 class IOLINK_API VariantDataValueFactory
17 {
18  VariantDataValueFactory() = delete;
19  VariantDataValueFactory(const VariantDataValueFactory& other) = delete; // copy constructor
20  VariantDataValueFactory(VariantDataValueFactory&& other) = delete; // move constructor
21  VariantDataValueFactory& operator=(const VariantDataValueFactory& other) = delete; // copy assignment
22  VariantDataValueFactory& operator=(VariantDataValueFactory&& other) = delete; // move assignment
23 
24 public:
25  static std::shared_ptr<VariantDataValue> create(uint8_t value);
26  static std::shared_ptr<VariantDataValue> create(uint16_t value);
27  static std::shared_ptr<VariantDataValue> create(uint32_t value);
28  static std::shared_ptr<VariantDataValue> create(uint64_t value);
29 
30  static std::shared_ptr<VariantDataValue> create(int8_t value);
31  static std::shared_ptr<VariantDataValue> create(int16_t value);
32  static std::shared_ptr<VariantDataValue> create(int32_t value);
33  static std::shared_ptr<VariantDataValue> create(int64_t value);
34 
35  static std::shared_ptr<VariantDataValue> create(float value);
36  static std::shared_ptr<VariantDataValue> create(double value);
37 
38  static std::shared_ptr<VariantDataValue> create(const char* value);
39  static std::shared_ptr<VariantDataValue> create(const std::string& value);
40 
41  //============================================================================
42 
43  static std::shared_ptr<VariantDataValue> create(const uint8_t* values, size_t count);
44  static std::shared_ptr<VariantDataValue> create(const uint16_t* values, size_t count);
45  static std::shared_ptr<VariantDataValue> create(const uint32_t* values, size_t count);
46  static std::shared_ptr<VariantDataValue> create(const uint64_t* values, size_t count);
47 
48  static std::shared_ptr<VariantDataValue> create(const int8_t* values, size_t count);
49  static std::shared_ptr<VariantDataValue> create(const int16_t* values, size_t count);
50  static std::shared_ptr<VariantDataValue> create(const int32_t* values, size_t count);
51  static std::shared_ptr<VariantDataValue> create(const int64_t* values, size_t count);
52 
53  static std::shared_ptr<VariantDataValue> create(const float* values, size_t count);
54  static std::shared_ptr<VariantDataValue> create(const double* values, size_t count);
55 
56  static std::shared_ptr<VariantDataValue> create(const char** values, size_t count);
57 };
58 
59 } // end namespace iolink