24 #ifndef _IGNITE_BINARY_TYPE
25 #define _IGNITE_BINARY_TYPE
29 #include <ignite/common/common.h>
37 #define IGNITE_BINARY_TYPE_START(T) \
39 struct BinaryType<T> \
46 #define IGNITE_BINARY_TYPE_END \
53 #define IGNITE_BINARY_GET_TYPE_ID_AS_CONST(id) \
63 #define IGNITE_BINARY_GET_TYPE_ID_AS_HASH(typeName) \
66 return GetBinaryStringHashCode(#typeName); \
73 #define IGNITE_BINARY_GET_TYPE_NAME_AS_IS(typeName) \
74 std::string GetTypeName() \
83 #define IGNITE_BINARY_GET_FIELD_ID_AS_HASH \
84 int32_t GetFieldId(const char* name) \
86 return GetBinaryStringHashCode(name); \
93 #define IGNITE_BINARY_GET_HASH_CODE_ZERO(T) \
94 int32_t GetHashCode(const T& obj) \
103 #define IGNITE_BINARY_IS_NULL_FALSE(T) \
104 bool IsNull(const T& obj) \
113 #define IGNITE_BINARY_IS_NULL_IF_NULLPTR(T) \
114 bool IsNull(const T& obj) \
123 #define IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(T) \
133 #define IGNITE_BINARY_GET_NULL_NULLPTR(T) \
249 template <
typename T>
268 std::string GetTypeName()
273 int32_t GetFieldId(
const char* name)
278 int32_t GetHashCode(T*
const& obj)
283 void Write(BinaryWriter& writer, T*
const& obj)
285 typ.
Write(writer, *obj);
288 T* Read(BinaryReader& reader)
292 *res = typ.
Read(reader);
297 bool IsNull(T*
const& obj)
299 return !obj || typ.
IsNull(*obj);
IGNITE_IMPORT_EXPORT int32_t GetBinaryStringHashCode(const char *val)
Get binary string hash code.
Definition: binary_type.cpp:24
void Write(BinaryWriter &writer, const T &obj)
Write binary object.
Definition: binary_type.h:208
int32_t GetHashCode(const T &obj)
Get binary object hash code.
Definition: binary_type.h:197
static const int IGNITE_ERR_BINARY
Binary error.
Definition: ignite_error.h:109
BinaryType< T > typ
Actual type.
Definition: binary_type.h:253
Binary writer.
Definition: binary_writer.h:40
T Read(BinaryReader &reader)
Read binary object.
Definition: binary_type.h:219
Binary type structure.
Definition: binary_type.h:158
int32_t GetFieldId(const char *name)
Get binary object field ID.
Definition: binary_type.h:186
int32_t GetTypeId()
Get binary object type ID.
Definition: binary_type.h:165
T GetNull()
Get NULL value for the given binary type.
Definition: binary_type.h:240
bool IsNull(const T &obj)
Check whether passed binary object should be interpreted as NULL.
Definition: binary_type.h:230
BinaryType()
Constructor.
Definition: binary_type.h:258
Apache Ignite API.
Definition: binary_consts.h:28
Declares ignite::IgniteError class.
Binary reader.
Definition: binary_reader.h:41
std::string GetTypeName()
Get binary object type name.
Definition: binary_type.h:175