23 #ifndef _IGNITE_BINARY_CONTAINERS
24 #define _IGNITE_BINARY_CONTAINERS
28 #include "ignite/impl/binary/binary_writer_impl.h"
29 #include "ignite/impl/binary/binary_reader_impl.h"
30 #include "ignite/impl/utils.h"
56 void Write(
const char* val);
64 void Write(
const char* val, int32_t len);
71 void Write(
const std::string& val)
82 impl::binary::BinaryWriterImpl* impl;
113 impl->WriteElement<T>(id, val);
121 impl->CommitContainer(
id);
125 impl::binary::BinaryWriterImpl* impl;
156 impl->WriteElement<T>(id, val);
164 impl->CommitContainer(
id);
168 impl::binary::BinaryWriterImpl* impl;
177 template<
typename K,
typename V>
186 BinaryMapWriter(impl::binary::BinaryWriterImpl* impl, int32_t
id) : impl(impl), id(id)
197 void Write(
const K& key,
const V& val)
199 impl->WriteElement<K, V>(id, key, val);
207 impl->CommitContainer(
id);
211 impl::binary::BinaryWriterImpl* impl;
250 int32_t GetNext(
char* res, int32_t len);
259 int32_t len = GetNext(NULL, 0);
263 impl::utils::SafeArray<char> arr(len + 1);
265 GetNext(arr.target, len + 1);
267 return std::string(arr.target);
270 return std::string();
278 int32_t GetSize()
const;
286 impl::binary::BinaryReaderImpl* impl;
310 impl(impl), id(id), size(size)
322 return impl->HasNextElement(
id);
332 return impl->ReadElement<T>(id);
354 impl::binary::BinaryReaderImpl* impl;
379 const CollectionType type, int32_t size) : impl(impl), id(id), type(type), size(size)
391 return impl->HasNextElement(
id);
401 return impl->ReadElement<T>(id);
433 impl::binary::BinaryReaderImpl* impl;
448 template<
typename K,
typename V>
461 int32_t size) : impl(impl), id(id), type(type), size(size)
473 return impl->HasNextElement(
id);
484 return impl->ReadElement<K, V>(id, key, val);
516 impl::binary::BinaryReaderImpl* impl;
BinaryMapWriter(impl::binary::BinaryWriterImpl *impl, int32_t id)
Constructor.
Definition: binary_containers.h:186
void Write(const T &val)
Write a value.
Definition: binary_containers.h:111
T GetNext()
Read next element.
Definition: binary_containers.h:330
Declares specific binary constatants.
CollectionType GetType()
Get collection type.
Definition: binary_containers.h:409
bool IsNull()
Whether array is NULL.
Definition: binary_containers.h:348
Binary string array reader.
Definition: binary_containers.h:220
BinaryCollectionWriter(impl::binary::BinaryWriterImpl *impl, int32_t id)
Constructor.
Definition: binary_containers.h:144
Binary map reader.
Definition: binary_containers.h:449
Binary collection reader.
Definition: binary_containers.h:367
void Close()
Close the writer.
Definition: binary_containers.h:162
std::string GetNext()
Get next element.
Definition: binary_containers.h:257
void Close()
Close the writer.
Definition: binary_containers.h:205
void Write(const T &val)
Write a value.
Definition: binary_containers.h:154
BinaryCollectionReader(impl::binary::BinaryReaderImpl *impl, int32_t id, const CollectionType type, int32_t size)
Constructor.
Definition: binary_containers.h:378
CollectionType
Binary collection types.
Definition: binary_consts.h:35
int32_t GetSize()
Get collection size.
Definition: binary_containers.h:419
MapType GetType()
Get map type.
Definition: binary_containers.h:492
void GetNext(K *key, V *val)
Read next element.
Definition: binary_containers.h:482
Binary collection writer.
Definition: binary_containers.h:135
bool IsNull()
Whether collection is NULL.
Definition: binary_containers.h:427
void Close()
Close the writer.
Definition: binary_containers.h:119
bool IsNull()
Whether map is NULL.
Definition: binary_containers.h:510
Binary collection writer.
Definition: binary_containers.h:92
Binary array reader.
Definition: binary_containers.h:299
T GetNext()
Read next element.
Definition: binary_containers.h:399
Binary string array writer.
Definition: binary_containers.h:40
bool HasNext()
Check whether next element is available for read.
Definition: binary_containers.h:471
void Write(const std::string &val)
Write string.
Definition: binary_containers.h:71
BinaryMapReader(impl::binary::BinaryReaderImpl *impl, int32_t id, MapType type, int32_t size)
Constructor.
Definition: binary_containers.h:460
BinaryArrayWriter(impl::binary::BinaryWriterImpl *impl, int32_t id)
Constructor.
Definition: binary_containers.h:101
int32_t GetSize()
Get array size.
Definition: binary_containers.h:340
int32_t GetSize()
Get map size.
Definition: binary_containers.h:502
Binary map writer.
Definition: binary_containers.h:178
bool HasNext()
Check whether next element is available for read.
Definition: binary_containers.h:320
void Write(const K &key, const V &val)
Write a value.
Definition: binary_containers.h:197
BinaryArrayReader(impl::binary::BinaryReaderImpl *impl, int32_t id, int32_t size)
Constructor.
Definition: binary_containers.h:309
Apache Ignite API.
Definition: binary_consts.h:28
bool HasNext()
Check whether next element is available for read.
Definition: binary_containers.h:389
MapType
Binary map types.
Definition: binary_consts.h:66