| Apache Ignite C++

Public Member Functions | List of all members
ignite::binary::BinaryReader Class Reference

Binary reader. More...

`#include <binary_reader.h>`

## Public Member Functions
| BinaryReader (ignite::impl::binary::BinaryReaderImpl *impl)
| Constructor. More...
int8_t | ReadInt8 (const char *fieldName)
| Read 8-byte signed integer. More...
int32_t | ReadInt8Array (const char *fieldName, int8_t *res, int32_t len)
| Read array of 8-byte signed integers. More...
bool | ReadBool (const char *fieldName)
| Read bool. More...
int32_t | ReadBoolArray (const char *fieldName, bool *res, int32_t len)
| Read array of bools. More...
int16_t | ReadInt16 (const char *fieldName)
| Read 16-byte signed integer. More...
int32_t | ReadInt16Array (const char *fieldName, int16_t *res, int32_t len)
| Read array of 16-byte signed integers. More...
uint16_t | ReadUInt16 (const char *fieldName)
| Read 16-byte unsigned integer. More...
int32_t | ReadUInt16Array (const char *fieldName, uint16_t *res, int32_t len)
| Read array of 16-byte unsigned integers. More...
int32_t | ReadInt32 (const char *fieldName)
| Read 32-byte signed integer. More...
int32_t | ReadInt32Array (const char *fieldName, int32_t *res, int32_t len)
| Read array of 32-byte signed integers. More...
int64_t | ReadInt64 (const char *fieldName)
| Read 64-byte signed integer. More...
int32_t | ReadInt64Array (const char *fieldName, int64_t *res, int32_t len)
| Read array of 64-byte signed integers. More...
float | ReadFloat (const char *fieldName)
| Read float. More...
int32_t | ReadFloatArray (const char *fieldName, float *res, int32_t len)
| Read array of floats. More...
double | ReadDouble (const char *fieldName)
| Read double. More...
int32_t | ReadDoubleArray (const char *fieldName, double *res, int32_t len)
| Read array of doubles. More...
Guid | ReadGuid (const char *fieldName)
| Read Guid. More...
int32_t | ReadGuidArray (const char *fieldName, Guid *res, int32_t len)
| Read array of Guids. More...
Date | ReadDate (const char *fieldName)
| Read Date. More...
int32_t | ReadDateArray (const char *fieldName, Date *res, int32_t len)
| Read array of Dates. More...
Timestamp | ReadTimestamp (const char *fieldName)
| Read Timestamp. More...
int32_t | ReadTimestampArray (const char *fieldName, Timestamp *res, int32_t len)
| Read array of Timestamps. More...
Time | ReadTime (const char *fieldName)
| Read Time. More...
int32_t | ReadTimeArray (const char *fieldName, Time *res, int32_t len)
| Read array of Times. More...
int32_t | ReadString (const char *fieldName, char *res, int32_t len)
| Read string. More...
std::string | ReadString (const char *fieldName)
| Read string from the stream. More...
BinaryStringArrayReader | ReadStringArray (const char *fieldName)
| Start string array read. More...
BinaryEnumEntry | ReadBinaryEnum (const char *fieldName)
| Read enum entry. More...
template<typename T >
BinaryArrayReader< T > | ReadArray (const char *fieldName)
| Start array read. More...
template<typename T >
BinaryCollectionReader< T > | ReadCollection (const char *fieldName)
| Start collection read. More...
template<typename T , typename OutputIterator >
int32_t | ReadCollection (const char *fieldName, OutputIterator out)
| Read values and insert them to specified position. More...
template<typename K , typename V >
BinaryMapReader< K, V > | ReadMap (const char *fieldName)
| Start map read. More...
CollectionType::Type | ReadCollectionType (const char *fieldName)
| Read type of the collection. More...
int32_t | ReadCollectionSize (const char *fieldName)
| Read type of the collection. More...
template<typename T >
T | ReadObject (const char *fieldName)
| Read object. More...
template<typename T >
T | ReadEnum (const char *fieldName)
| Read enum value. More...
BinaryRawReader | RawReader ()
| Get raw reader for this reader. More...

## Detailed Description

Binary reader.

This class implemented as a reference to an implementation so copying of this class instance will only create another reference to the same underlying object.

Note
  User should not store copy of this instance as it can be invalidated as soon as the initially passed to user instance has been destructed. For example this means that if user received an instance of this class as a function argument then he should not store and use copy of this class out of the scope of this function.

## Constructor & Destructor Documentation

## ◆ BinaryReader()

ignite::binary::BinaryReader::BinaryReader | ( | ignite::impl::binary::BinaryReaderImpl * | impl | ) |

Constructor.

Internal method. Should not be used by user.

Parameters

  impl | Implementation.

## Member Function Documentation

## ◆ RawReader()

BinaryRawReader ignite::binary::BinaryReader::RawReader | ( |  | ) |

Get raw reader for this reader.

Returns
  Raw reader.

## ◆ ReadArray()

template<typename T >

BinaryArrayReader<T> ignite::binary::BinaryReader::ReadArray | ( | const char * | fieldName | ) |
| inline

Start array read.

Every time you get a BinaryArrayReader from BinaryReader you start reading session. Only one single reading session can be open at a time. So it is not allowed to start new reading session until all elements of the collection have been read.

Parameters

  fieldName | Field name.

Returns
  Array reader.

## ◆ ReadBinaryEnum()

BinaryEnumEntry ignite::binary::BinaryReader::ReadBinaryEnum | ( | const char * | fieldName | ) |

Read enum entry.

Parameters

  fieldName | Field name.

Returns
  Enum entry.

## ◆ ReadBool()

bool ignite::binary::BinaryReader::ReadBool | ( | const char * | fieldName | ) |

Read bool.

Maps to "short" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadBoolArray()

int32_t ignite::binary::BinaryReader::ReadBoolArray | ( | const char * | fieldName,
|  | bool * | res,
|  | int32_t | len
| ) |  |

Read array of bools.

Maps to "bool[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadCollection() [1/2]

template<typename T >

BinaryCollectionReader<T> ignite::binary::BinaryReader::ReadCollection | ( | const char * | fieldName | ) |
| inline

Start collection read.

Every time you get a BinaryCollectionReader from BinaryReader you start reading session. Only one single reading session can be open at a time. So it is not allowed to start new reading session until all elements of the collection have been read.

Parameters

  fieldName | Field name.

Returns
  Collection reader.

## ◆ ReadCollection() [2/2]

template<typename T , typename OutputIterator >

int32_t ignite::binary::BinaryReader::ReadCollection | ( | const char * | fieldName,
|  | OutputIterator | out
| ) |  |
| inline

Read values and insert them to specified position.

Parameters

  fieldName | Field name.
  out | Output iterator to the initial position in the destination sequence.

Returns
  Number of elements that have been read.

## ◆ ReadCollectionSize()

int32_t ignite::binary::BinaryReader::ReadCollectionSize | ( | const char * | fieldName | ) |

Read type of the collection.

Parameters

  fieldName | Field name.

Returns
  Collection size.

## ◆ ReadCollectionType()

CollectionType::Type ignite::binary::BinaryReader::ReadCollectionType | ( | const char * | fieldName | ) |

Read type of the collection.

Parameters

  fieldName | Field name.

Returns
  Collection type.

## ◆ ReadDate()

Date ignite::binary::BinaryReader::ReadDate | ( | const char * | fieldName | ) |

Read Date.

Maps to "Date" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadDateArray()

int32_t ignite::binary::BinaryReader::ReadDateArray | ( | const char * | fieldName,
|  | Date * | res,
|  | int32_t | len
| ) |  |

Read array of Dates.

Maps to "Date[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadDouble()

double ignite::binary::BinaryReader::ReadDouble | ( | const char * | fieldName | ) |

Read double.

Maps to "double" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadDoubleArray()

int32_t ignite::binary::BinaryReader::ReadDoubleArray | ( | const char * | fieldName,
|  | double * | res,
|  | int32_t | len
| ) |  |

Read array of doubles.

Maps to "double[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadEnum()

template<typename T >

T ignite::binary::BinaryReader::ReadEnum | ( | const char * | fieldName | ) |
| inline

Read enum value.

Returns
  Enum value.

T Enum type. BinaryEnum class template should be specialized for the type.

## ◆ ReadFloat()

float ignite::binary::BinaryReader::ReadFloat | ( | const char * | fieldName | ) |

Read float.

Maps to "float" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadFloatArray()

int32_t ignite::binary::BinaryReader::ReadFloatArray | ( | const char * | fieldName,
|  | float * | res,
|  | int32_t | len
| ) |  |

Read array of floats.

Maps to "float[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadGuid()

Guid ignite::binary::BinaryReader::ReadGuid | ( | const char * | fieldName | ) |

Read Guid.

Maps to "UUID" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadGuidArray()

int32_t ignite::binary::BinaryReader::ReadGuidArray | ( | const char * | fieldName,
|  | Guid * | res,
|  | int32_t | len
| ) |  |

Read array of Guids.

Maps to "UUID[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadInt16()

int16_t ignite::binary::BinaryReader::ReadInt16 | ( | const char * | fieldName | ) |

Read 16-byte signed integer.

Maps to "short" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadInt16Array()

int32_t ignite::binary::BinaryReader::ReadInt16Array | ( | const char * | fieldName,
|  | int16_t * | res,
|  | int32_t | len
| ) |  |

Read array of 16-byte signed integers.

Maps to "short[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadInt32()

int32_t ignite::binary::BinaryReader::ReadInt32 | ( | const char * | fieldName | ) |

Read 32-byte signed integer.

Maps to "int" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadInt32Array()

int32_t ignite::binary::BinaryReader::ReadInt32Array | ( | const char * | fieldName,
|  | int32_t * | res,
|  | int32_t | len
| ) |  |

Read array of 32-byte signed integers.

Maps to "int[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadInt64()

int64_t ignite::binary::BinaryReader::ReadInt64 | ( | const char * | fieldName | ) |

Read 64-byte signed integer.

Maps to "long" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadInt64Array()

int32_t ignite::binary::BinaryReader::ReadInt64Array | ( | const char * | fieldName,
|  | int64_t * | res,
|  | int32_t | len
| ) |  |

Read array of 64-byte signed integers.

Maps to "long[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadInt8()

int8_t ignite::binary::BinaryReader::ReadInt8 | ( | const char * | fieldName | ) |

Read 8-byte signed integer.

Maps to "byte" type in Java.

Parameters

  fieldName | Field name.
  fieldName | Field name.

Returns
  Result.

## ◆ ReadInt8Array()

int32_t ignite::binary::BinaryReader::ReadInt8Array | ( | const char * | fieldName,
|  | int8_t * | res,
|  | int32_t | len
| ) |  |

Read array of 8-byte signed integers.

Maps to "byte[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadMap()

template<typename K , typename V >

BinaryMapReader<K, V> ignite::binary::BinaryReader::ReadMap | ( | const char * | fieldName | ) |
| inline

Start map read.

Every time you get a BinaryMapReader from BinaryReader you start reading session. Only one single reading session can be open at a time. So it is not allowed to start new reading session until all elements of the collection have been read.

Parameters

  fieldName | Field name.

Returns
  Map reader.

## ◆ ReadObject()

template<typename T >

T ignite::binary::BinaryReader::ReadObject | ( | const char * | fieldName | ) |
| inline

Read object.

Parameters

  fieldName | Field name.

Returns
  Object.

T Object type. BinaryType class template should be specialized for the type.

## ◆ ReadString() [1/2]

int32_t ignite::binary::BinaryReader::ReadString | ( | const char * | fieldName,
|  | char * | res,
|  | int32_t | len
| ) |  |

Read string.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of string. NULL terminator will be set in case len is greater than real string length.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadString() [2/2]

std::string ignite::binary::BinaryReader::ReadString | ( | const char * | fieldName | ) |
| inline

Read string from the stream.

Parameters

  fieldName | Field name.

Returns
  String.

## ◆ ReadStringArray()

BinaryStringArrayReader ignite::binary::BinaryReader::ReadStringArray | ( | const char * | fieldName | ) |

Start string array read.

Every time you get a BinaryStringArrayReader from BinaryReader you start reading session. Only one single reading session can be open at a time. So it is not allowed to start new reading session until all elements of the collection have been read.

Parameters

  fieldName | Field name.

Returns
  String array reader.

## ◆ ReadTime()

Time ignite::binary::BinaryReader::ReadTime | ( | const char * | fieldName | ) |

Read Time.

Maps to "Time" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadTimeArray()

int32_t ignite::binary::BinaryReader::ReadTimeArray | ( | const char * | fieldName,
|  | Time * | res,
|  | int32_t | len
| ) |  |

Read array of Times.

Maps to "Time[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadTimestamp()

Timestamp ignite::binary::BinaryReader::ReadTimestamp | ( | const char * | fieldName | ) |

Read Timestamp.

Maps to "Timestamp" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadTimestampArray()

int32_t ignite::binary::BinaryReader::ReadTimestampArray | ( | const char * | fieldName,
|  | Timestamp * | res,
|  | int32_t | len
| ) |  |

Read array of Timestamps.

Maps to "Timestamp[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

## ◆ ReadUInt16()

uint16_t ignite::binary::BinaryReader::ReadUInt16 | ( | const char * | fieldName | ) |

Read 16-byte unsigned integer.

Maps to "char" type in Java.

Parameters

  fieldName | Field name.

Returns
  Result.

## ◆ ReadUInt16Array()

int32_t ignite::binary::BinaryReader::ReadUInt16Array | ( | const char * | fieldName,
|  | uint16_t * | res,
|  | int32_t | len
| ) |  |

Read array of 16-byte unsigned integers.

Maps to "char[]" type in Java.

Parameters

  fieldName | Field name.
  res | Array to store data to.
  len | Expected length of array.

Returns
  Actual amount of elements read. If "len" argument is less than actual array size or resulting array is set to null, nothing will be written to resulting array and returned value will contain required array length. -1 will be returned in case array in stream was null.

The documentation for this class was generated from the following files:

- binary_reader.h
- binary_reader.cpp