GridGain C++ Client Library
Classes | Namespaces | Macros | Functions
portable_type.h File Reference

Declares gridgain::portable::PortableType class template and helping macros to declare binary type specialisation for user types. More...

#include <stdint.h>
#include <ignite/common/common.h>
#include "gridgain/grid_error.h"

Go to the source code of this file.

Classes

struct  gridgain::portable::PortableType< T >
 Portable type structure. More...
 
struct  gridgain::portable::PortableType< T * >
 Templated portable type for pointers. More...
 

Namespaces

 gridgain
 GridGain API.
 
 gridgain::portable
 GridGain Portable Objects API.
 

Macros

#define GG_PORTABLE_TYPE_START(T)
 Start portable type definition. More...
 
#define GG_PORTABLE_TYPE_END   };
 End portable type definition.
 
#define GG_PORTABLE_GET_TYPE_ID_AS_CONST(id)
 Implementation of GetTypeId() which returns predefined constant. More...
 
#define GG_PORTABLE_GET_TYPE_ID_AS_HASH(typeName)
 Implementation of GetTypeId() which returns hash of passed type name. More...
 
#define GG_PORTABLE_GET_TYPE_NAME_AS_IS(typeName)
 Implementation of GetTypeName() which returns type name as is. More...
 
#define GG_PORTABLE_GET_FIELD_ID_AS_HASH
 Default implementation of GetFieldId() function which returns Java-way hash code of the string. More...
 
#define GG_PORTABLE_GET_HASH_CODE_ZERO(T)
 Implementation of GetHashCode() function which always returns 0. More...
 
#define GG_PORTABLE_IS_NULL_FALSE(T)
 Implementation of IsNull() function which always returns false. More...
 
#define GG_PORTABLE_IS_NULL_IF_NULLPTR(T)
 Implementation of IsNull() function which return true if passed object is null pointer. More...
 
#define GG_PORTABLE_GET_NULL_DEFAULT_CTOR(T)
 Implementation of GetNull() function which returns an instance created with defult constructor. More...
 
#define GG_PORTABLE_GET_NULL_NULLPTR(T)
 Implementation of GetNull() function which returns NULL pointer. More...
 

Functions

IGNITE_IMPORT_EXPORT int32_t gridgain::portable::GetPortableStringHashCode (const char *val)
 Get portable string hash code. More...
 

Detailed Description

Declares gridgain::portable::PortableType class template and helping macros to declare binary type specialisation for user types.

Macro Definition Documentation

#define GG_PORTABLE_GET_FIELD_ID_AS_HASH
Value:
int32_t GetFieldId(const char* name) \
{ \
return GetPortableStringHashCode(name); \
}
IGNITE_IMPORT_EXPORT int32_t GetPortableStringHashCode(const char *val)
Get portable string hash code.
Definition: portable_type.cpp:16

Default implementation of GetFieldId() function which returns Java-way hash code of the string.

#define GG_PORTABLE_GET_HASH_CODE_ZERO (   T)
Value:
int32_t GetHashCode(const T& obj) \
{ \
return 0; \
}

Implementation of GetHashCode() function which always returns 0.

#define GG_PORTABLE_GET_NULL_DEFAULT_CTOR (   T)
Value:
T GetNull() \
{ \
return T(); \
}

Implementation of GetNull() function which returns an instance created with defult constructor.

#define GG_PORTABLE_GET_NULL_NULLPTR (   T)
Value:
T GetNull() \
{ \
return NULL; \
}

Implementation of GetNull() function which returns NULL pointer.

#define GG_PORTABLE_GET_TYPE_ID_AS_CONST (   id)
Value:
int32_t GetTypeId() \
{ \
return id; \
}

Implementation of GetTypeId() which returns predefined constant.

#define GG_PORTABLE_GET_TYPE_ID_AS_HASH (   typeName)
Value:
int32_t GetTypeId() \
{ \
return GetPortableStringHashCode(#typeName); \
}
IGNITE_IMPORT_EXPORT int32_t GetPortableStringHashCode(const char *val)
Get portable string hash code.
Definition: portable_type.cpp:16

Implementation of GetTypeId() which returns hash of passed type name.

#define GG_PORTABLE_GET_TYPE_NAME_AS_IS (   typeName)
Value:
std::string GetTypeName() \
{ \
return #typeName; \
}

Implementation of GetTypeName() which returns type name as is.

#define GG_PORTABLE_IS_NULL_FALSE (   T)
Value:
bool IsNull(const T& obj) \
{ \
return false; \
}

Implementation of IsNull() function which always returns false.

#define GG_PORTABLE_IS_NULL_IF_NULLPTR (   T)
Value:
bool IsNull(const T& obj) \
{ \
return obj; \
}

Implementation of IsNull() function which return true if passed object is null pointer.

#define GG_PORTABLE_TYPE_START (   T)
Value:
template<> \
struct PortableType<T> \
{

Start portable type definition.