3#ifndef ICE_STREAMABLE_TRAITS_H
4#define ICE_STREAMABLE_TRAITS_H
90 template<
typename T>
struct IsContainer
92 template<
typename C>
static char test(
typename C::iterator*)
noexcept;
94 template<
typename C>
static long test(...)
noexcept;
96 static constexpr bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(
char);
103 template<
typename T>
struct IsMap
105 template<
typename C>
static char test(
typename C::mapped_type*)
noexcept;
107 template<
typename C>
static long test(...) noexcept;
109 static constexpr
bool value = IsContainer<T>::value && sizeof(test<T>(
nullptr)) == sizeof(
char);
143 template<
typename T>
struct StreamableTraits<T, std::enable_if_t<IsMap<T>::value || IsContainer<T>::value>>
145 static constexpr StreamHelperCategory helper =
146 IsMap<T>::value ? StreamHelperCategoryDictionary : StreamHelperCategorySequence;
148 static constexpr int minWireSize = 1;
149 static constexpr bool fixedLength =
false;
153 template<
typename T>
struct StreamableTraits<T, std::enable_if_t<std::is_base_of_v<UserException, T>>>
162 template<
typename T>
struct StreamableTraits<std::pair<T*, T*>>
165 static constexpr int minWireSize = 1;
166 static constexpr bool fixedLength =
false;
174 template<>
struct StreamableTraits<bool>
177 static constexpr int minWireSize = 1;
178 static constexpr bool fixedLength =
true;
181 template<>
struct StreamableTraits<std::byte>
184 static constexpr int minWireSize = 1;
185 static constexpr bool fixedLength =
true;
188 template<>
struct StreamableTraits<std::uint8_t>
191 static constexpr int minWireSize = 1;
192 static constexpr bool fixedLength =
true;
195 template<>
struct StreamableTraits<std::int16_t>
198 static constexpr int minWireSize = 2;
199 static constexpr bool fixedLength =
true;
202 template<>
struct StreamableTraits<std::int32_t>
205 static constexpr int minWireSize = 4;
206 static constexpr bool fixedLength =
true;
209 template<>
struct StreamableTraits<std::int64_t>
212 static constexpr int minWireSize = 8;
213 static constexpr bool fixedLength =
true;
215 template<>
struct StreamableTraits<float>
218 static constexpr int minWireSize = 4;
219 static constexpr bool fixedLength =
true;
222 template<>
struct StreamableTraits<double>
225 static constexpr int minWireSize = 8;
226 static constexpr bool fixedLength =
true;
229 template<>
struct StreamableTraits<std::string>
232 static constexpr int minWireSize = 1;
233 static constexpr bool fixedLength =
false;
236 template<>
struct StreamableTraits<std::string_view>
239 static constexpr int minWireSize = 1;
240 static constexpr bool fixedLength =
false;
243 template<>
struct StreamableTraits<std::wstring>
246 static constexpr int minWireSize = 1;
247 static constexpr bool fixedLength =
false;
250 template<>
struct StreamableTraits<std::wstring_view>
253 static constexpr int minWireSize = 1;
254 static constexpr bool fixedLength =
false;
258 template<>
struct StreamableTraits<std::vector<bool>>
261 static constexpr int minWireSize = 1;
262 static constexpr bool fixedLength =
false;
269 template<
typename T>
struct StreamableTraits<std::optional<T>, std::enable_if_t<std::is_base_of_v<ObjectPrx, T>>>
272 static constexpr int minWireSize = 2;
273 static constexpr bool fixedLength =
false;
276 template<
typename T>
struct StreamableTraits<std::shared_ptr<T>, std::enable_if_t<std::is_base_of_v<Value, T>>>
279 static constexpr int minWireSize = 1;
280 static constexpr bool fixedLength =
false;
283 template<
typename T, StreamHelperCategory st>
struct StreamHelper;
288 template<
typename T, StreamHelperCategory st,
bool fixedLength>
struct StreamOptionalHelper;
The base class for all Ice proxies.
Abstract base class for all 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
Variable "size encoding" using either 1 or 5 bytes followed by data.
@ F8
Fixed 8-byte encoding.
@ Size
"Size encoding" using either 1 or 5 bytes. Used by enums, class identifiers, etc.
@ Class
Class instance. No longer supported.
@ F1
Fixed 1-byte encoding.
@ FSize
Fixed "size encoding" using 4 bytes followed by data.
@ 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...