16 #ifndef _GRIDGAIN_PORTABLE_TYPE 17 #define _GRIDGAIN_PORTABLE_TYPE 21 #include <ignite/common/common.h> 29 #define GG_PORTABLE_TYPE_START(T) \ 31 struct PortableType<T> \ 38 #define GG_PORTABLE_TYPE_END \ 45 #define GG_PORTABLE_GET_TYPE_ID_AS_CONST(id) \ 55 #define GG_PORTABLE_GET_TYPE_ID_AS_HASH(typeName) \ 58 return GetPortableStringHashCode(#typeName); \ 65 #define GG_PORTABLE_GET_TYPE_NAME_AS_IS(typeName) \ 66 std::string GetTypeName() \ 75 #define GG_PORTABLE_GET_FIELD_ID_AS_HASH \ 76 int32_t GetFieldId(const char* name) \ 78 return GetPortableStringHashCode(name); \ 85 #define GG_PORTABLE_GET_HASH_CODE_ZERO(T) \ 86 int32_t GetHashCode(const T& obj) \ 95 #define GG_PORTABLE_IS_NULL_FALSE(T) \ 96 bool IsNull(const T& obj) \ 105 #define GG_PORTABLE_IS_NULL_IF_NULLPTR(T) \ 106 bool IsNull(const T& obj) \ 115 #define GG_PORTABLE_GET_NULL_DEFAULT_CTOR(T) \ 125 #define GG_PORTABLE_GET_NULL_NULLPTR(T) \ 135 class PortableWriter;
136 class PortableReader;
241 template <
typename T>
260 std::string GetTypeName()
265 int32_t GetFieldId(
const char* name)
270 int32_t GetHashCode(T*
const& obj)
277 typ.
Write(writer, *obj);
284 *res = typ.
Read(reader);
289 bool IsNull(T*
const& obj)
291 return !obj || typ.
IsNull(*obj);
int32_t GetHashCode(const T &obj)
Get portable object hash code.
Definition: portable_type.h:189
int32_t GetTypeId()
Get portable object type ID.
Definition: portable_type.h:157
Portable writer.
Definition: portable_writer.h:32
static const int GG_ERR_PORTABLE
Portable error.
Definition: grid_error.h:101
int32_t GetFieldId(const char *name)
Get portable object field ID.
Definition: portable_type.h:178
PortableType()
Constructor.
Definition: portable_type.h:250
Declares gridgain::GridError class.
IGNITE_IMPORT_EXPORT int32_t GetPortableStringHashCode(const char *val)
Get portable string hash code.
Definition: portable_type.cpp:16
T GetNull()
Get NULL value for the given portable type.
Definition: portable_type.h:232
void Write(PortableWriter &writer, const T &obj)
Write portable object.
Definition: portable_type.h:200
T Read(PortableReader &reader)
Read portable object.
Definition: portable_type.h:211
PortableType< T > typ
Actual type.
Definition: portable_type.h:245
bool IsNull(const T &obj)
Check whether passed portable object should be interpreted as NULL.
Definition: portable_type.h:222
std::string GetTypeName()
Get portable object type name.
Definition: portable_type.h:167
Portable type structure.
Definition: portable_type.h:150
GridGain API.
Definition: cache.h:35
Portable reader.
Definition: portable_reader.h:33