43 class VSG_DECLSPEC Input
48 Input(
const Input& output) =
delete;
49 Input& operator=(
const Input& rhs) =
delete;
55 virtual void read(
size_t num, int8_t* value) = 0;
56 virtual void read(
size_t num, uint8_t* value) = 0;
57 virtual void read(
size_t num, int16_t* value) = 0;
58 virtual void read(
size_t num, uint16_t* value) = 0;
59 virtual void read(
size_t num, int32_t* value) = 0;
60 virtual void read(
size_t num, uint32_t* value) = 0;
61 virtual void read(
size_t num, int64_t* value) = 0;
62 virtual void read(
size_t num, uint64_t* value) = 0;
63 virtual void read(
size_t num,
float* value) = 0;
64 virtual void read(
size_t num,
double* value) = 0;
65 virtual void read(
size_t num,
long double* value) = 0;
66 virtual void read(
size_t num, std::string* value) = 0;
67 virtual void read(
size_t num, std::wstring* value) = 0;
68 virtual void read(
size_t num,
Path* value) = 0;
74 void read(
size_t num,
char* value) { read(num,
reinterpret_cast<int8_t*
>(value)); }
75 void read(
size_t num,
bool* value) { read(num,
reinterpret_cast<int8_t*
>(value)); }
78 void read(
size_t num, vec2* value) { read(num * value->size(), value->data()); }
79 void read(
size_t num, vec3* value) { read(num * value->size(), value->data()); }
80 void read(
size_t num, vec4* value) { read(num * value->size(), value->data()); }
81 void read(
size_t num, dvec2* value) { read(num * value->size(), value->data()); }
82 void read(
size_t num, dvec3* value) { read(num * value->size(), value->data()); }
83 void read(
size_t num, ldvec4* value) { read(num * value->size(), value->data()); }
84 void read(
size_t num, ldvec2* value) { read(num * value->size(), value->data()); }
85 void read(
size_t num, ldvec3* value) { read(num * value->size(), value->data()); }
86 void read(
size_t num, dvec4* value) { read(num * value->size(), value->data()); }
87 void read(
size_t num, bvec2* value) { read(num * value->size(), value->data()); }
88 void read(
size_t num, bvec3* value) { read(num * value->size(), value->data()); }
89 void read(
size_t num, bvec4* value) { read(num * value->size(), value->data()); }
90 void read(
size_t num, ubvec2* value) { read(num * value->size(), value->data()); }
91 void read(
size_t num, ubvec3* value) { read(num * value->size(), value->data()); }
92 void read(
size_t num, ubvec4* value) { read(num * value->size(), value->data()); }
93 void read(
size_t num, svec2* value) { read(num * value->size(), value->data()); }
94 void read(
size_t num, svec3* value) { read(num * value->size(), value->data()); }
95 void read(
size_t num, svec4* value) { read(num * value->size(), value->data()); }
96 void read(
size_t num, usvec2* value) { read(num * value->size(), value->data()); }
97 void read(
size_t num, usvec3* value) { read(num * value->size(), value->data()); }
98 void read(
size_t num, usvec4* value) { read(num * value->size(), value->data()); }
99 void read(
size_t num, ivec2* value) { read(num * value->size(), value->data()); }
100 void read(
size_t num, ivec3* value) { read(num * value->size(), value->data()); }
101 void read(
size_t num, ivec4* value) { read(num * value->size(), value->data()); }
102 void read(
size_t num, uivec2* value) { read(num * value->size(), value->data()); }
103 void read(
size_t num, uivec3* value) { read(num * value->size(), value->data()); }
104 void read(
size_t num, uivec4* value) { read(num * value->size(), value->data()); }
105 void read(
size_t num, quat* value) { read(num * value->size(), value->data()); }
106 void read(
size_t num, dquat* value) { read(num * value->size(), value->data()); }
107 void read(
size_t num, mat3* value) { read(num * value->size(), value->data()); }
108 void read(
size_t num, dmat3* value) { read(num * value->size(), value->data()); }
109 void read(
size_t num, mat4* value) { read(num * value->size(), value->data()); }
110 void read(
size_t num, dmat4* value) { read(num * value->size(), value->data()); }
111 void read(
size_t num, sphere* value) { read(num * value->size(), value->data()); }
112 void read(
size_t num, dsphere* value) { read(num * value->size(), value->data()); }
113 void read(
size_t num, box* value) { read(num * value->size(), value->data()); }
114 void read(
size_t num, dbox* value) { read(num * value->size(), value->data()); }
115 void read(
size_t num, plane* value) { read(num * value->size(), value->data()); }
116 void read(
size_t num, dplane* value) { read(num * value->size(), value->data()); }
120 void read(
size_t num, T* value)
122 if constexpr (has_read_write<T>())
124 for (
size_t i = 0; i < num; ++i) value[i].read(*
this);
128 read(num *
sizeof(T),
reinterpret_cast<uint8_t*
>(value));
133 void read(
const char* propertyName,
ref_ptr<T>& arg)
135 if (!matchPropertyName(propertyName))
return;
136 arg = read().cast<T>();
140 void readObjects(
const char* propertyName, T& values)
142 if (!matchPropertyName(propertyName))
return;
144 uint32_t numElements = 0;
145 read(1, &numElements);
146 values.resize(numElements);
148 using element_type =
typename T::value_type::element_type;
149 const char* element_name = type_name<element_type>();
151 for (uint32_t i = 0; i < numElements; ++i)
153 read(element_name, values[i]);
158 void readValues(
const char* propertyName, std::vector<T>& values)
160 if (!matchPropertyName(propertyName))
return;
162 uint32_t numElements = 0;
163 read(1, &numElements);
164 values.resize(numElements);
166 for (uint32_t i = 0; i < numElements; ++i)
168 read(
"element", values[i]);
173 void readValues(
const char* propertyName, std::set<T>& values)
175 if (!matchPropertyName(propertyName))
return;
177 uint32_t numElements = 0;
178 read(1, &numElements);
180 for (uint32_t i = 0; i < numElements; ++i)
189 template<
typename... Args>
190 void read(
const char* propertyName, Args&... args)
195 (read(1, &(args)), ...);
213 return ref_ptr<T>(
dynamic_cast<T*
>(
object.get()));
222 arg = read().cast<T>();
230 read(propertyName, v);
235 template<
typename W,
typename T>
239 read(propertyName, read_value);
240 value =
static_cast<T
>(read_value);
243 using ObjectID = uint32_t;
244 using ObjectIDMap = std::map<ObjectID, ref_ptr<Object>>;
246 ObjectIDMap objectIDMap;
253 virtual bool version_less(uint32_t major, uint32_t minor, uint32_t patch, uint32_t soversion = 0)
const;
254 virtual bool version_greater_equal(uint32_t major, uint32_t minor, uint32_t patch, uint32_t soversion = 0)
const;