15 #ifndef _GRIDGAIN_PORTABLE_CONTAINERS 16 #define _GRIDGAIN_PORTABLE_CONTAINERS 20 #include "gridgain/impl/portable/portable_writer_impl.h" 21 #include "gridgain/impl/portable/portable_reader_impl.h" 22 #include "gridgain/impl/utils.h" 48 void Write(
const char* val);
56 void Write(
const char* val, int32_t len);
63 void Write(
const std::string& val)
74 impl::portable::PortableWriterImpl* impl;
105 impl->WriteElement<T>(id, val);
113 impl->CommitContainer(
id);
117 impl::portable::PortableWriterImpl* impl;
148 impl->WriteElement<T>(id, val);
156 impl->CommitContainer(
id);
160 impl::portable::PortableWriterImpl* impl;
169 template<
typename K,
typename V>
189 void Write(
const K& key,
const V& val)
191 impl->WriteElement<K, V>(id, key, val);
199 impl->CommitContainer(
id);
203 impl::portable::PortableWriterImpl* impl;
229 bool HasNext()
const;
242 int32_t GetNext(
char* res, int32_t len);
251 int32_t len = GetNext(NULL, 0);
255 impl::utils::SafeArray<char> arr(len + 1);
257 GetNext(arr.target, len + 1);
259 return std::string(arr.target);
262 return std::string();
270 int32_t GetSize()
const;
278 impl::portable::PortableReaderImpl* impl;
302 impl(impl), id(id), size(size)
314 return impl->HasNextElement(
id);
324 return impl->ReadElement<T>(id);
346 impl::portable::PortableReaderImpl* impl;
371 CollectionType type, int32_t size) : impl(impl), id(id), type(type), size(size)
383 return impl->HasNextElement(
id);
393 return impl->ReadElement<T>(id);
425 impl::portable::PortableReaderImpl* impl;
440 template<
typename K,
typename V>
453 int32_t size) : impl(impl), id(id), type(type), size(size)
465 return impl->HasNextElement(
id);
476 return impl->ReadElement<K, V>(id, key, val);
508 impl::portable::PortableReaderImpl* impl;
bool HasNext() const
Check whether next element is available for read.
Definition: portable_containers.h:463
Portable collection writer.
Definition: portable_containers.h:127
PortableArrayWriter(impl::portable::PortableWriterImpl *impl, int32_t id)
Constructor.
Definition: portable_containers.h:93
PortableMapReader(impl::portable::PortableReaderImpl *impl, int32_t id, MapType type, int32_t size)
Constructor.
Definition: portable_containers.h:452
int32_t GetSize() const
Get array size.
Definition: portable_containers.h:332
bool IsNull() const
Whether array is NULL.
Definition: portable_containers.h:340
Portable collection writer.
Definition: portable_containers.h:84
PortableMapWriter(impl::portable::PortableWriterImpl *impl, int32_t id)
Constructor.
Definition: portable_containers.h:178
void Write(const T &val)
Write a value.
Definition: portable_containers.h:146
Portable array reader.
Definition: portable_containers.h:291
Portable string array reader.
Definition: portable_containers.h:212
CollectionType
Portable collection types.
Definition: portable_consts.h:27
bool IsNull() const
Whether collection is NULL.
Definition: portable_containers.h:419
Portable string array writer.
Definition: portable_containers.h:32
void GetNext(K *key, V *val)
Read next element.
Definition: portable_containers.h:474
T GetNext()
Read next element.
Definition: portable_containers.h:322
Portable map writer.
Definition: portable_containers.h:170
T GetNext()
Read next element.
Definition: portable_containers.h:391
Portable collection reader.
Definition: portable_containers.h:359
PortableArrayReader(impl::portable::PortableReaderImpl *impl, int32_t id, int32_t size)
Constructor.
Definition: portable_containers.h:301
Portable map reader.
Definition: portable_containers.h:441
void Write(const K &key, const V &val)
Write a value.
Definition: portable_containers.h:189
PortableCollectionReader(impl::portable::PortableReaderImpl *impl, int32_t id, CollectionType type, int32_t size)
Constructor.
Definition: portable_containers.h:370
Declares specific portable constants.
void Write(const T &val)
Write a value.
Definition: portable_containers.h:103
bool HasNext() const
Check whether next element is available for read.
Definition: portable_containers.h:312
void Close()
Close the writer.
Definition: portable_containers.h:197
PortableCollectionWriter(impl::portable::PortableWriterImpl *impl, int32_t id)
Constructor.
Definition: portable_containers.h:136
CollectionType GetType() const
Get collection type.
Definition: portable_containers.h:401
void Close()
Close the writer.
Definition: portable_containers.h:111
void Close()
Close the writer.
Definition: portable_containers.h:154
int32_t GetSize() const
Get collection size.
Definition: portable_containers.h:411
std::string GetNext()
Get next element.
Definition: portable_containers.h:249
bool IsNull() const
Whether map is NULL.
Definition: portable_containers.h:502
GridGain API.
Definition: cache.h:35
MapType
Portable map types.
Definition: portable_consts.h:68
bool HasNext() const
Check whether next element is available for read.
Definition: portable_containers.h:381
MapType GetType() const
Get map type.
Definition: portable_containers.h:484
int32_t GetSize() const
Get map size.
Definition: portable_containers.h:494
void Write(const std::string &val)
Write string.
Definition: portable_containers.h:63