3#ifndef ICE_STREAMABLE_TRAITS_H
4#define ICE_STREAMABLE_TRAITS_H
89 template<
typename T>
struct IsContainer
91 template<
typename C>
static char test(
typename C::iterator*)
noexcept;
93 template<
typename C>
static long test(...)
noexcept;
95 static constexpr bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(
char);
102 template<
typename T>
struct IsMap
104 template<
typename C>
static char test(
typename C::mapped_type*)
noexcept;
106 template<
typename C>
static long test(...) noexcept;
108 static constexpr
bool value = IsContainer<T>::value && sizeof(test<T>(
nullptr)) == sizeof(
char);
142 template<
typename T>
struct StreamableTraits<T, std::enable_if_t<IsMap<T>::value || IsContainer<T>::value>>
144 static constexpr StreamHelperCategory helper =
145 IsMap<T>::value ? StreamHelperCategoryDictionary : StreamHelperCategorySequence;
147 static constexpr int minWireSize = 1;
148 static constexpr bool fixedLength =
false;
152 template<
typename T>
struct StreamableTraits<T, std::enable_if_t<std::is_base_of_v<UserException, T>>>
161 template<
typename T>
struct StreamableTraits<std::pair<T*, T*>>
164 static constexpr int minWireSize = 1;
165 static constexpr bool fixedLength =
false;
173 template<>
struct StreamableTraits<bool>
176 static constexpr int minWireSize = 1;
177 static constexpr bool fixedLength =
true;
180 template<>
struct StreamableTraits<std::byte>
183 static constexpr int minWireSize = 1;
184 static constexpr bool fixedLength =
true;
187 template<>
struct StreamableTraits<std::uint8_t>
190 static constexpr int minWireSize = 1;
191 static constexpr bool fixedLength =
true;
194 template<>
struct StreamableTraits<std::int16_t>
197 static constexpr int minWireSize = 2;
198 static constexpr bool fixedLength =
true;
201 template<>
struct StreamableTraits<std::int32_t>
204 static constexpr int minWireSize = 4;
205 static constexpr bool fixedLength =
true;
208 template<>
struct StreamableTraits<std::int64_t>
211 static constexpr int minWireSize = 8;
212 static constexpr bool fixedLength =
true;
214 template<>
struct StreamableTraits<float>
217 static constexpr int minWireSize = 4;
218 static constexpr bool fixedLength =
true;
221 template<>
struct StreamableTraits<double>
224 static constexpr int minWireSize = 8;
225 static constexpr bool fixedLength =
true;
228 template<>
struct StreamableTraits<std::string>
231 static constexpr int minWireSize = 1;
232 static constexpr bool fixedLength =
false;
235 template<>
struct StreamableTraits<std::string_view>
238 static constexpr int minWireSize = 1;
239 static constexpr bool fixedLength =
false;
242 template<>
struct StreamableTraits<std::wstring>
245 static constexpr int minWireSize = 1;
246 static constexpr bool fixedLength =
false;
249 template<>
struct StreamableTraits<std::wstring_view>
252 static constexpr int minWireSize = 1;
253 static constexpr bool fixedLength =
false;
257 template<>
struct StreamableTraits<std::vector<bool>>
260 static constexpr int minWireSize = 1;
261 static constexpr bool fixedLength =
false;
268 template<
typename T>
struct StreamableTraits<std::optional<T>, std::enable_if_t<std::is_base_of_v<ObjectPrx, T>>>
271 static constexpr int minWireSize = 2;
272 static constexpr bool fixedLength =
false;
275 template<
typename T>
struct StreamableTraits<std::shared_ptr<T>, std::enable_if_t<std::is_base_of_v<Value, T>>>
278 static constexpr int minWireSize = 1;
279 static constexpr bool fixedLength =
false;
282 template<
typename T, StreamHelperCategory st>
struct StreamHelper;
287 template<
typename T, StreamHelperCategory st,
bool fixedLength>
struct StreamOptionalHelper;
The base class for all Ice proxies.
Abstract base class for all Ice exceptions defined in Slice.
constexpr StreamHelperCategory StreamHelperCategoryBuiltin
Built-in types usually passed by reference.
OptionalFormat
The optional format, used for marshaling optional fields and arguments.
@ VSize
"Size encoding" using 1 to 5 bytes followed by data, e.g., string, fixed size struct,...
@ F8
Fixed 8-byte encoding.
@ Size
"Size encoding" using 1 to 5 bytes, e.g., enum, class identifier.
@ Class
Class instance. Not longer supported.
@ F1
Fixed 1-byte encoding.
@ FSize
Fixed size using 4 bytes followed by data, e.g., variable-size struct, container.
@ F4
Fixed 4-byte encoding.
@ F2
Fixed 2-byte encoding.
constexpr StreamHelperCategory StreamHelperCategoryDictionary
Dictionary types.
constexpr StreamHelperCategory StreamHelperCategoryEnum
Generated enum types.
constexpr StreamHelperCategory StreamHelperCategoryProxy
Proxy types.
int StreamHelperCategory
The stream helper category allows to select a StreamHelper specialization for a specific category of ...
constexpr StreamHelperCategory StreamHelperCategoryClass
Generated class types.
constexpr StreamHelperCategory StreamHelperCategoryStruct
Generated struct types.
constexpr StreamHelperCategory StreamHelperCategorySequence
Sequence types.
constexpr StreamHelperCategory StreamHelperCategoryBuiltinValue
Built-in types usually passed by value.
constexpr StreamHelperCategory StreamHelperCategoryUnknown
Types with no StreamHelper specialization.
constexpr StreamHelperCategory StreamHelperCategoryUserException
User exception types.
static constexpr bool fixedLength
Indicates if the type is always encoded on a fixed number of bytes.
static constexpr int minWireSize
The minimum number of bytes needed to marshal this type.
static constexpr StreamHelperCategory helper
The category trait, used for selecting the appropriate StreamHelper.
Provides traits for a type that can be marshaled or unmarshaled to/from a stream of bytes using the S...