Apache Ignite C++
Classes | Namespaces | Macros | Functions
binary_type.h File Reference

Declares ignite::binary::BinaryType class template and helping macros to declare binary type specialisation for user types. More...

#include <stdint.h>
#include <ignite/common/common.h>
#include "ignite/ignite_error.h"

Go to the source code of this file.

Classes

struct  ignite::binary::BinaryType< T >
 Binary type structure. More...
 
struct  ignite::binary::BinaryType< T * >
 Templated binary type specification for pointers. More...
 

Namespaces

 ignite
 Apache Ignite API.
 
 ignite::binary
 Ignite Binary Objects API.
 

Macros

#define IGNITE_BINARY_TYPE_START(T)
 Start binary type definition. More...
 
#define IGNITE_BINARY_TYPE_END   };
 End binary type definition.
 
#define IGNITE_BINARY_GET_TYPE_ID_AS_CONST(id)
 Implementation of GetTypeId() which returns predefined constant. More...
 
#define IGNITE_BINARY_GET_TYPE_ID_AS_HASH(typeName)
 Implementation of GetTypeId() which returns hash of passed type name. More...
 
#define IGNITE_BINARY_GET_TYPE_NAME_AS_IS(typeName)
 Implementation of GetTypeName() which returns type name as is. More...
 
#define IGNITE_BINARY_GET_FIELD_ID_AS_HASH
 Default implementation of GetFieldId() function which returns Java-way hash code of the string. More...
 
#define IGNITE_BINARY_GET_HASH_CODE_ZERO(T)
 Implementation of GetHashCode() function which always returns 0. More...
 
#define IGNITE_BINARY_IS_NULL_FALSE(T)
 Implementation of IsNull() function which always returns false. More...
 
#define IGNITE_BINARY_IS_NULL_IF_NULLPTR(T)
 Implementation of IsNull() function which return true if passed object is null pointer. More...
 
#define IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(T)
 Implementation of GetNull() function which returns an instance created with defult constructor. More...
 
#define IGNITE_BINARY_GET_NULL_NULLPTR(T)
 Implementation of GetNull() function which returns NULL pointer. More...
 

Functions

IGNITE_IMPORT_EXPORT int32_t ignite::binary::GetBinaryStringHashCode (const char *val)
 Get binary string hash code. More...
 

Detailed Description

Declares ignite::binary::BinaryType class template and helping macros to declare binary type specialisation for user types.

Macro Definition Documentation

#define IGNITE_BINARY_GET_FIELD_ID_AS_HASH
Value:
int32_t GetFieldId(const char* name) \
{ \
return GetBinaryStringHashCode(name); \
}
IGNITE_IMPORT_EXPORT int32_t GetBinaryStringHashCode(const char *val)
Get binary string hash code.
Definition: binary_type.cpp:24

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

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

Implementation of GetHashCode() function which always returns 0.

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

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

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

Implementation of GetNull() function which returns NULL pointer.

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

Implementation of GetTypeId() which returns predefined constant.

#define IGNITE_BINARY_GET_TYPE_ID_AS_HASH (   typeName)
Value:
int32_t GetTypeId() \
{ \
return GetBinaryStringHashCode(#typeName); \
}
IGNITE_IMPORT_EXPORT int32_t GetBinaryStringHashCode(const char *val)
Get binary string hash code.
Definition: binary_type.cpp:24

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

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

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

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

Implementation of IsNull() function which always returns false.

#define IGNITE_BINARY_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 IGNITE_BINARY_TYPE_START (   T)
Value:
template<> \
struct BinaryType<T> \
{

Start binary type definition.