IGNITE-3581: Moved enums to separate structs for C++
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7e106cd0 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7e106cd0 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7e106cd0 Branch: refs/heads/ignite-4587 Commit: 7e106cd093134acab1c4202a6849c177bacc909b Parents: d298e75 Author: Igor Sapego <[email protected]> Authored: Thu Apr 13 19:06:01 2017 +0300 Committer: Igor Sapego <[email protected]> Committed: Thu Apr 13 19:06:01 2017 +0300 ---------------------------------------------------------------------- .../include/ignite/binary/binary_consts.h | 86 +++-- .../include/ignite/binary/binary_containers.h | 12 +- .../include/ignite/binary/binary_raw_reader.h | 6 +- .../include/ignite/binary/binary_raw_writer.h | 16 +- .../include/ignite/binary/binary_reader.h | 6 +- .../include/ignite/binary/binary_writer.h | 13 +- .../ignite/impl/binary/binary_reader_impl.h | 31 +- .../include/ignite/impl/binary/binary_schema.h | 19 +- .../ignite/impl/binary/binary_writer_impl.h | 18 +- .../cpp/binary/src/binary/binary_raw_reader.cpp | 2 +- .../cpp/binary/src/binary/binary_reader.cpp | 2 +- .../src/impl/binary/binary_reader_impl.cpp | 50 +-- .../binary/src/impl/binary/binary_schema.cpp | 17 +- .../src/impl/binary/binary_writer_impl.cpp | 14 +- .../src/binary_reader_writer_raw_test.cpp | 34 +- .../core-test/src/binary_reader_writer_test.cpp | 96 ++--- .../cpp/core-test/src/cache_store_test.cpp | 6 +- .../platforms/cpp/core-test/src/cache_test.cpp | 62 +-- .../cpp/core-test/src/transactions_test.cpp | 76 ++-- .../cpp/core/include/ignite/cache/cache.h | 12 +- .../core/include/ignite/cache/cache_peek_mode.h | 67 ++-- .../cpp/core/include/ignite/ignite_binding.h | 4 +- .../cpp/core/include/ignite/impl/bindings.h | 4 +- .../impl/cache/cache_entry_processor_holder.h | 37 +- .../include/ignite/impl/ignite_binding_impl.h | 11 +- .../ignite/impl/interop/interop_target.h | 21 +- .../ignite/impl/transactions/transaction_impl.h | 4 +- .../impl/transactions/transactions_impl.h | 10 +- .../include/ignite/transactions/transaction.h | 12 +- .../ignite/transactions/transaction_consts.h | 181 ++++----- .../include/ignite/transactions/transactions.h | 16 +- .../impl/binary/binary_type_updater_impl.cpp | 17 +- .../continuous/continuous_query_handle_impl.cpp | 13 +- .../src/impl/cluster/cluster_group_impl.cpp | 9 +- .../cpp/core/src/impl/ignite_environment.cpp | 42 +- .../core/src/impl/interop/interop_target.cpp | 12 +- .../src/impl/transactions/transaction_impl.cpp | 18 +- .../src/impl/transactions/transactions_impl.cpp | 92 +++-- .../cpp/core/src/transactions/transaction.cpp | 8 +- .../cpp/core/src/transactions/transactions.cpp | 20 +- .../src/application_data_buffer_test.cpp | 94 ++--- .../platforms/cpp/odbc-test/src/column_test.cpp | 56 +-- .../cpp/odbc-test/src/connection_info_test.cpp | 72 ++-- .../platforms/cpp/odbc-test/src/row_test.cpp | 16 +- .../ignite/odbc/app/application_data_buffer.h | 6 +- .../cpp/odbc/include/ignite/odbc/column.h | 2 +- .../cpp/odbc/include/ignite/odbc/common_types.h | 350 +++++++++-------- .../ignite/odbc/config/connection_info.h | 2 +- .../cpp/odbc/include/ignite/odbc/connection.h | 18 +- .../ignite/odbc/diagnostic/diagnosable.h | 4 +- .../odbc/diagnostic/diagnosable_adapter.h | 8 +- .../ignite/odbc/diagnostic/diagnostic_record.h | 4 +- .../odbc/diagnostic/diagnostic_record_storage.h | 8 +- .../cpp/odbc/include/ignite/odbc/environment.h | 10 +- .../cpp/odbc/include/ignite/odbc/message.h | 56 +-- .../ignite/odbc/query/column_metadata_query.h | 10 +- .../odbc/include/ignite/odbc/query/data_query.h | 23 +- .../ignite/odbc/query/foreign_keys_query.h | 8 +- .../ignite/odbc/query/primary_keys_query.h | 8 +- .../cpp/odbc/include/ignite/odbc/query/query.h | 32 +- .../ignite/odbc/query/special_columns_query.h | 8 +- .../ignite/odbc/query/table_metadata_query.h | 10 +- .../include/ignite/odbc/query/type_info_query.h | 8 +- .../cpp/odbc/include/ignite/odbc/row.h | 2 +- .../cpp/odbc/include/ignite/odbc/statement.h | 52 +-- .../odbc/system/ui/dsn_configuration_window.h | 35 +- .../cpp/odbc/include/ignite/odbc/type_traits.h | 91 ++--- .../ignite/odbc/system/ui/custom_window.h | 12 +- .../odbc/os/win/src/system/ui/custom_window.cpp | 4 +- .../src/system/ui/dsn_configuration_window.cpp | 42 +- .../cpp/odbc/os/win/src/system_dsn.cpp | 2 +- .../odbc/src/app/application_data_buffer.cpp | 386 +++++++++---------- .../platforms/cpp/odbc/src/app/parameter.cpp | 6 +- modules/platforms/cpp/odbc/src/column.cpp | 14 +- modules/platforms/cpp/odbc/src/common_types.cpp | 54 +-- .../cpp/odbc/src/config/connection_info.cpp | 12 +- modules/platforms/cpp/odbc/src/connection.cpp | 74 ++-- .../odbc/src/diagnostic/diagnosable_adapter.cpp | 4 +- .../odbc/src/diagnostic/diagnostic_record.cpp | 46 +-- .../diagnostic/diagnostic_record_storage.cpp | 78 ++-- modules/platforms/cpp/odbc/src/environment.cpp | 62 +-- modules/platforms/cpp/odbc/src/odbc.cpp | 20 +- .../odbc/src/query/column_metadata_query.cpp | 123 +++--- .../platforms/cpp/odbc/src/query/data_query.cpp | 102 ++--- .../cpp/odbc/src/query/foreign_keys_query.cpp | 26 +- .../cpp/odbc/src/query/primary_keys_query.cpp | 71 ++-- .../odbc/src/query/special_columns_query.cpp | 26 +- .../cpp/odbc/src/query/table_metadata_query.cpp | 81 ++-- .../cpp/odbc/src/query/type_info_query.cpp | 231 +++++------ modules/platforms/cpp/odbc/src/row.cpp | 4 +- modules/platforms/cpp/odbc/src/statement.cpp | 258 ++++++------- modules/platforms/cpp/odbc/src/type_traits.cpp | 46 +-- 92 files changed, 2023 insertions(+), 1930 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/binary/binary_consts.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_consts.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_consts.h index 8f3245a..f076e6a 100644 --- a/modules/platforms/cpp/binary/include/ignite/binary/binary_consts.h +++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_consts.h @@ -23,8 +23,6 @@ #ifndef _IGNITE_BINARY_BINARY_CONSTS #define _IGNITE_BINARY_BINARY_CONSTS -#include <ignite/common/common.h> - namespace ignite { namespace binary @@ -32,53 +30,59 @@ namespace ignite /** * Binary collection types. */ - enum CollectionType + struct CollectionType { - /** - * Undefined. Maps to ArrayList in Java. - */ - IGNITE_COLLECTION_UNDEFINED = 0, + enum Type + { + /** + * Undefined. Maps to ArrayList in Java. + */ + UNDEFINED = 0, + + /** + * Array list. Maps to ArrayList in Java. + */ + ARRAY_LIST = 1, + + /** + * Linked list. Maps to LinkedList in Java. + */ + LINKED_LIST = 2, - /** - * Array list. Maps to ArrayList in Java. - */ - IGNITE_COLLECTION_ARRAY_LIST = 1, - - /** - * Linked list. Maps to LinkedList in Java. - */ - IGNITE_COLLECTION_LINKED_LIST = 2, - - /** - * Hash set. Maps to HashSet in Java. - */ - IGNITE_COLLECTION_HASH_SET = 3, - - /** - * Linked hash set. Maps to LinkedHashSet in Java. - */ - IGNITE_COLLECTION_LINKED_HASH_SET = 4 + /** + * Hash set. Maps to HashSet in Java. + */ + HASH_SET = 3, + + /** + * Linked hash set. Maps to LinkedHashSet in Java. + */ + LINKED_HASH_SET = 4 + }; }; /** * Binary map types. */ - enum MapType + struct MapType { - /** - * Undefined. Maps to HashMap in Java. - */ - IGNITE_MAP_UNDEFINED = 0, - - /** - * Hash map. Maps to HashMap in Java. - */ - IGNITE_MAP_HASH_MAP = 1, - - /** - * Linked hash map. Maps to LinkedHashMap in Java. - */ - IGNITE_MAP_LINKED_HASH_MAP = 2 + enum Type + { + /** + * Undefined. Maps to HashMap in Java. + */ + UNDEFINED = 0, + + /** + * Hash map. Maps to HashMap in Java. + */ + HASH_MAP = 1, + + /** + * Linked hash map. Maps to LinkedHashMap in Java. + */ + LINKED_HASH_MAP = 2 + }; }; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h index fb77b44..72e98a5 100644 --- a/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h +++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_containers.h @@ -478,7 +478,7 @@ namespace ignite * @param size Collection size. */ BinaryCollectionReader(impl::binary::BinaryReaderImpl* impl, int32_t id, - const CollectionType type, int32_t size) : impl(impl), id(id), type(type), size(size) + const CollectionType::Type type, int32_t size) : impl(impl), id(id), type(type), size(size) { // No-op. } @@ -511,7 +511,7 @@ namespace ignite * @return Collection type. See CollectionType for the list of * available values and their description. */ - CollectionType GetType() + CollectionType::Type GetType() { return type; } @@ -543,7 +543,7 @@ namespace ignite const int32_t id; /** Collection type. */ - const CollectionType type; + const CollectionType::Type type; /** Size. */ const int32_t size; @@ -570,7 +570,7 @@ namespace ignite * @param type Map type. * @param size Map size. */ - BinaryMapReader(impl::binary::BinaryReaderImpl* impl, int32_t id, MapType type, + BinaryMapReader(impl::binary::BinaryReaderImpl* impl, int32_t id, MapType::Type type, int32_t size) : impl(impl), id(id), type(type), size(size) { // No-op. @@ -607,7 +607,7 @@ namespace ignite * @return Map type. See MapType for the list of available values * and their description. */ - MapType GetType() + MapType::Type GetType() { return type; } @@ -639,7 +639,7 @@ namespace ignite const int32_t id; /** Map type. */ - const MapType type; + const MapType::Type type; /** Size. */ const int32_t size; http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h index d110078..c06cb91 100644 --- a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h +++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_reader.h @@ -357,7 +357,7 @@ namespace ignite template<typename T> BinaryCollectionReader<T> ReadCollection() { - CollectionType typ; + CollectionType::Type typ; int32_t size; int32_t id = impl->ReadCollection(&typ, &size); @@ -385,7 +385,7 @@ namespace ignite template<typename K, typename V> BinaryMapReader<K, V> ReadMap() { - MapType typ; + MapType::Type typ; int32_t size; int32_t id = impl->ReadMap(&typ, &size); @@ -398,7 +398,7 @@ namespace ignite * * @return Collection type. */ - CollectionType ReadCollectionType(); + CollectionType::Type ReadCollectionType(); /** * Read type of the collection. http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h index a43c957..81e34b0 100644 --- a/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h +++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_raw_writer.h @@ -302,17 +302,17 @@ namespace ignite template<typename T> BinaryCollectionWriter<T> WriteCollection() { - return WriteCollection<T>(IGNITE_COLLECTION_UNDEFINED); + return WriteCollection<T>(CollectionType::UNDEFINED); } /** * Start collection write. * - * @param type Collection type. + * @param typ Collection type. * @return Collection writer. */ template<typename T> - BinaryCollectionWriter<T> WriteCollection(CollectionType typ) + BinaryCollectionWriter<T> WriteCollection(CollectionType::Type typ) { int32_t id = impl->WriteCollection(typ); @@ -324,12 +324,11 @@ namespace ignite * * @param first Iterator pointing to the beginning of the interval. * @param last Iterator pointing to the end of the interval. - * @param typ Collection type. */ template<typename InputIterator> void WriteCollection(InputIterator first, InputIterator last) { - impl->WriteCollection(first, last, IGNITE_COLLECTION_UNDEFINED); + impl->WriteCollection(first, last, CollectionType::UNDEFINED); } /** @@ -340,7 +339,7 @@ namespace ignite * @param typ Collection type. */ template<typename InputIterator> - void WriteCollection(InputIterator first, InputIterator last, CollectionType typ) + void WriteCollection(InputIterator first, InputIterator last, CollectionType::Type typ) { impl->WriteCollection(first, last, typ); } @@ -348,13 +347,12 @@ namespace ignite /** * Start map write. * - * @param typ Map type. * @return Map writer. */ template<typename K, typename V> BinaryMapWriter<K, V> WriteMap() { - return WriteMap<K, V>(IGNITE_MAP_UNDEFINED); + return WriteMap<K, V>(MapType::UNDEFINED); } /** @@ -364,7 +362,7 @@ namespace ignite * @return Map writer. */ template<typename K, typename V> - BinaryMapWriter<K, V> WriteMap(MapType typ) + BinaryMapWriter<K, V> WriteMap(MapType::Type typ) { int32_t id = impl->WriteMap(typ); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h index e07ec14..7103fec 100644 --- a/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h +++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_reader.h @@ -385,7 +385,7 @@ namespace ignite template<typename T> BinaryCollectionReader<T> ReadCollection(const char* fieldName) { - CollectionType typ; + CollectionType::Type typ; int32_t size; int32_t id = impl->ReadCollection(fieldName, &typ, &size); @@ -415,7 +415,7 @@ namespace ignite template<typename K, typename V> BinaryMapReader<K, V> ReadMap(const char* fieldName) { - MapType typ; + MapType::Type typ; int32_t size; int32_t id = impl->ReadMap(fieldName, &typ, &size); @@ -429,7 +429,7 @@ namespace ignite * @param fieldName Field name. * @return Collection type. */ - CollectionType ReadCollectionType(const char* fieldName); + CollectionType::Type ReadCollectionType(const char* fieldName); /** * Read type of the collection. http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h index f8e7de3..1489494 100644 --- a/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h +++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_writer.h @@ -330,7 +330,7 @@ namespace ignite template<typename T> BinaryCollectionWriter<T> WriteCollection(const char* fieldName) { - return WriteCollection<T>(fieldName, IGNITE_COLLECTION_UNDEFINED); + return WriteCollection<T>(fieldName, CollectionType::UNDEFINED); } /** @@ -341,7 +341,7 @@ namespace ignite * @return Collection writer. */ template<typename T> - BinaryCollectionWriter<T> WriteCollection(const char* fieldName, ignite::binary::CollectionType typ) + BinaryCollectionWriter<T> WriteCollection(const char* fieldName, CollectionType::Type typ) { int32_t id = impl->WriteCollection(fieldName, typ); @@ -358,7 +358,7 @@ namespace ignite template<typename InputIterator> void WriteCollection(const char* fieldName, InputIterator first, InputIterator last) { - WriteCollection(fieldName, first, last, IGNITE_COLLECTION_UNDEFINED); + WriteCollection(fieldName, first, last, CollectionType::UNDEFINED); } /** @@ -370,7 +370,7 @@ namespace ignite * @param typ Collection type. */ template<typename InputIterator> - void WriteCollection(const char* fieldName, InputIterator first, InputIterator last, CollectionType typ) + void WriteCollection(const char* fieldName, InputIterator first, InputIterator last, CollectionType::Type typ) { impl->WriteCollection(fieldName, first, last, typ); } @@ -379,13 +379,12 @@ namespace ignite * Start map write. * * @param fieldName Field name. - * @param typ Map type. * @return Map writer. */ template<typename K, typename V> BinaryMapWriter<K, V> WriteMap(const char* fieldName) { - return WriteMap<K, V>(fieldName, IGNITE_MAP_UNDEFINED); + return WriteMap<K, V>(fieldName, MapType::UNDEFINED); } /** @@ -396,7 +395,7 @@ namespace ignite * @return Map writer. */ template<typename K, typename V> - BinaryMapWriter<K, V> WriteMap(const char* fieldName, ignite::binary::MapType typ) + BinaryMapWriter<K, V> WriteMap(const char* fieldName, MapType::Type typ) { int32_t id = impl->WriteMap(fieldName, typ); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h index 6d66416..5621c0d 100644 --- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h +++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_reader_impl.h @@ -55,7 +55,7 @@ namespace ignite * @param pos Object position in the stream. * @param usrType user type flag. * @param typeId Type ID. - * @param hashcode Hash code. + * @param hashCode Hash code. * @param len Length in bytes. * @param rawOff Raw data offset. * @param footerBegin Footer beginning absolute position in stream. @@ -63,7 +63,7 @@ namespace ignite */ BinaryReaderImpl(interop::InteropInputStream* stream, BinaryIdResolver* idRslvr, int32_t pos, bool usrType, int32_t typeId, int32_t hashCode, int32_t len, int32_t rawOff, - int32_t footerBegin, int32_t footerEnd, BinaryOffsetType schemaType); + int32_t footerBegin, int32_t footerEnd, BinaryOffsetType::Type schemaType); /** * Constructor used to construct light-weight reader allowing only raw operations @@ -632,7 +632,7 @@ namespace ignite * @param size Collection size. * @return Read session ID. */ - int32_t ReadCollection(ignite::binary::CollectionType* typ, int32_t* size); + int32_t ReadCollection(ignite::binary::CollectionType::Type* typ, int32_t* size); /** * Start collection read. @@ -642,7 +642,8 @@ namespace ignite * @param size Collection size. * @return Read session ID. */ - int32_t ReadCollection(const char* fieldName, ignite::binary::CollectionType* typ, int32_t* size); + int32_t ReadCollection(const char* fieldName, + ignite::binary::CollectionType::Type* typ, int32_t* size); /** * Read values and insert them to specified position. @@ -713,7 +714,7 @@ namespace ignite * @param size Map size. * @return Read session ID. */ - int32_t ReadMap(ignite::binary::MapType* typ, int32_t* size); + int32_t ReadMap(ignite::binary::MapType::Type* typ, int32_t* size); /** * Start map read. @@ -723,14 +724,14 @@ namespace ignite * @param size Map size. * @return Read session ID. */ - int32_t ReadMap(const char* fieldName, ignite::binary::MapType* typ, int32_t* size); + int32_t ReadMap(const char* fieldName, ignite::binary::MapType::Type* typ, int32_t* size); /** * Read type of the collection. * * @return Collection type. */ - ignite::binary::CollectionType ReadCollectionType(); + ignite::binary::CollectionType::Type ReadCollectionType(); /** * Read type of the collection. @@ -738,7 +739,7 @@ namespace ignite * @param fieldName Field name. * @return Collection type. */ - ignite::binary::CollectionType ReadCollectionType(const char* fieldName); + ignite::binary::CollectionType::Type ReadCollectionType(const char* fieldName); /** * Read size of the collection. @@ -950,14 +951,14 @@ namespace ignite else footerBegin = pos + len; - BinaryOffsetType schemaType; + BinaryOffsetType::Type schemaType; if (flags & IGNITE_BINARY_FLAG_OFFSET_ONE_BYTE) - schemaType = OFFSET_TYPE_ONE_BYTE; + schemaType = BinaryOffsetType::ONE_BYTE; else if (flags & IGNITE_BINARY_FLAG_OFFSET_TWO_BYTES) - schemaType = OFFSET_TYPE_TWO_BYTES; + schemaType = BinaryOffsetType::TWO_BYTES; else - schemaType = OFFSET_TYPE_FOUR_BYTES; + schemaType = BinaryOffsetType::FOUR_BYTES; int32_t footerEnd; @@ -1066,7 +1067,7 @@ namespace ignite int32_t footerEnd; /** Object schema type. */ - BinaryOffsetType schemaType; + BinaryOffsetType::Type schemaType; IGNITE_NO_COPY_ASSIGNMENT(BinaryReaderImpl) @@ -1351,7 +1352,7 @@ namespace ignite /** * Check whether session ID matches. * - * @param ses Expected session ID. + * @param expSes Expected session ID. */ void CheckSession(int32_t expSes) const; @@ -1386,7 +1387,7 @@ namespace ignite * * @return Collection type. */ - ignite::binary::CollectionType ReadCollectionTypeUnprotected(); + ignite::binary::CollectionType::Type ReadCollectionTypeUnprotected(); /** * Read size of the collection. Do not preserve stream position. http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h index c42adef..50429c9 100644 --- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h +++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_schema.h @@ -38,16 +38,19 @@ namespace ignite /** * Schema size variants. */ - enum BinaryOffsetType + struct BinaryOffsetType { - /** Means all field offsets can be fit in one byte. */ - OFFSET_TYPE_ONE_BYTE, + enum Type + { + /** Means all field offsets can be fit in one byte. */ + ONE_BYTE, - /** Means all field offsets can be fit in two bytes. */ - OFFSET_TYPE_TWO_BYTES, + /** Means all field offsets can be fit in two bytes. */ + TWO_BYTES, - /** Means field offsets should be stored in four bytes. */ - OFFSET_TYPE_FOUR_BYTES + /** Means field offsets should be stored in four bytes. */ + FOUR_BYTES + }; }; /** @@ -108,7 +111,7 @@ namespace ignite * * @return Type of schema. */ - BinaryOffsetType GetType() const; + BinaryOffsetType::Type GetType() const; private: /** http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h index e7dafb2..5d38e93 100644 --- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h +++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h @@ -531,7 +531,7 @@ namespace ignite * @param typ Collection type. * @return Session ID. */ - int32_t WriteCollection(ignite::binary::CollectionType typ); + int32_t WriteCollection(ignite::binary::CollectionType::Type typ); /** * Start collection write. @@ -540,7 +540,7 @@ namespace ignite * @param typ Collection type. * @return Session ID. */ - int32_t WriteCollection(const char* fieldName, ignite::binary::CollectionType typ); + int32_t WriteCollection(const char* fieldName, ignite::binary::CollectionType::Type typ); /** * Write values in interval [first, last). @@ -550,7 +550,7 @@ namespace ignite * @param typ Collection type. */ template<typename InputIterator> - void WriteCollection(InputIterator first, InputIterator last, ignite::binary::CollectionType typ) + void WriteCollection(InputIterator first, InputIterator last, ignite::binary::CollectionType::Type typ) { StartContainerSession(true); @@ -567,7 +567,7 @@ namespace ignite */ template<typename InputIterator> void WriteCollection(const char* fieldName, InputIterator first, InputIterator last, - ignite::binary::CollectionType typ) + ignite::binary::CollectionType::Type typ) { StartContainerSession(false); @@ -582,7 +582,7 @@ namespace ignite * @param typ Map type. * @return Session ID. */ - int32_t WriteMap(ignite::binary::MapType typ); + int32_t WriteMap(ignite::binary::MapType::Type typ); /** * Start map write. @@ -591,7 +591,7 @@ namespace ignite * @param typ Map type. * @return Session ID. */ - int32_t WriteMap(const char* fieldName, ignite::binary::MapType typ); + int32_t WriteMap(const char* fieldName, ignite::binary::MapType::Type typ); /** * Write collection element. @@ -755,10 +755,10 @@ namespace ignite * * @return Stream. */ - impl::interop::InteropOutputStream* GetStream(); + interop::InteropOutputStream* GetStream(); private: /** Underlying stream. */ - ignite::impl::interop::InteropOutputStream* stream; + interop::InteropOutputStream* stream; /** ID resolver. */ BinaryIdResolver* idRslvr; @@ -916,7 +916,7 @@ namespace ignite */ template<typename InputIterator> void WriteCollectionWithinSession(InputIterator first, InputIterator last, - ignite::binary::CollectionType typ) + ignite::binary::CollectionType::Type typ) { stream->WriteInt8(IGNITE_TYPE_COLLECTION); stream->Position(stream->Position() + 4); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp b/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp index 9c1d6d9..f751685 100644 --- a/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp +++ b/modules/platforms/cpp/binary/src/binary/binary_raw_reader.cpp @@ -163,7 +163,7 @@ namespace ignite return BinaryStringArrayReader(impl, id, size); } - CollectionType BinaryRawReader::ReadCollectionType() + CollectionType::Type BinaryRawReader::ReadCollectionType() { return impl->ReadCollectionType(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/src/binary/binary_reader.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/src/binary/binary_reader.cpp b/modules/platforms/cpp/binary/src/binary/binary_reader.cpp index f9fa72e..0ba82e6 100644 --- a/modules/platforms/cpp/binary/src/binary/binary_reader.cpp +++ b/modules/platforms/cpp/binary/src/binary/binary_reader.cpp @@ -163,7 +163,7 @@ namespace ignite return BinaryStringArrayReader(impl, id, size); } - CollectionType BinaryReader::ReadCollectionType(const char* fieldName) + CollectionType::Type BinaryReader::ReadCollectionType(const char* fieldName) { return impl->ReadCollectionType(fieldName); } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp index 1c4104b..c6bb4f3 100644 --- a/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp +++ b/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp @@ -37,7 +37,7 @@ namespace ignite { BinaryReaderImpl::BinaryReaderImpl(InteropInputStream* stream, BinaryIdResolver* idRslvr, int32_t pos, bool usrType, int32_t typeId, int32_t hashCode, int32_t len, int32_t rawOff, - int32_t footerBegin, int32_t footerEnd, BinaryOffsetType schemaType) : + int32_t footerBegin, int32_t footerEnd, BinaryOffsetType::Type schemaType) : stream(stream), idRslvr(idRslvr), pos(pos), usrType(usrType), typeId(typeId), hashCode(hashCode), len(len), rawOff(rawOff), rawMode(false), elemIdGen(0), elemId(0), elemCnt(-1), elemRead(0), footerBegin(footerBegin), footerEnd(footerEnd), schemaType(schemaType) @@ -48,7 +48,7 @@ namespace ignite BinaryReaderImpl::BinaryReaderImpl(InteropInputStream* stream) : stream(stream), idRslvr(NULL), pos(0), usrType(false), typeId(0), hashCode(0), len(0), rawOff(0), rawMode(true), elemIdGen(0), elemId(0), elemCnt(-1), elemRead(0), footerBegin(-1), - footerEnd(-1), schemaType(OFFSET_TYPE_FOUR_BYTES) + footerEnd(-1), schemaType(BinaryOffsetType::FOUR_BYTES) { // No-op. } @@ -556,19 +556,19 @@ namespace ignite return StartContainerSession(false, IGNITE_TYPE_ARRAY, size); } - int32_t BinaryReaderImpl::ReadCollection(CollectionType* typ, int32_t* size) + int32_t BinaryReaderImpl::ReadCollection(CollectionType::Type* typ, int32_t* size) { int32_t id = StartContainerSession(true, IGNITE_TYPE_COLLECTION, size); if (*size == -1) - *typ = IGNITE_COLLECTION_UNDEFINED; + *typ = CollectionType::UNDEFINED; else - *typ = static_cast<CollectionType>(stream->ReadInt8()); + *typ = static_cast<CollectionType::Type>(stream->ReadInt8()); return id; } - int32_t BinaryReaderImpl::ReadCollection(const char* fieldName, CollectionType* typ, int32_t* size) + int32_t BinaryReaderImpl::ReadCollection(const char* fieldName, CollectionType::Type* typ, int32_t* size) { CheckRawMode(false); CheckSingleMode(true); @@ -578,7 +578,7 @@ namespace ignite if (fieldPos <= 0) { - *typ = IGNITE_COLLECTION_UNDEFINED; + *typ = CollectionType::UNDEFINED; *size = -1; return ++elemIdGen; @@ -589,26 +589,26 @@ namespace ignite int32_t id = StartContainerSession(false, IGNITE_TYPE_COLLECTION, size); if (*size == -1) - *typ = IGNITE_COLLECTION_UNDEFINED; + *typ = CollectionType::UNDEFINED; else - *typ = static_cast<CollectionType>(stream->ReadInt8()); + *typ = static_cast<CollectionType::Type>(stream->ReadInt8()); return id; } - int32_t BinaryReaderImpl::ReadMap(MapType* typ, int32_t* size) + int32_t BinaryReaderImpl::ReadMap(MapType::Type* typ, int32_t* size) { int32_t id = StartContainerSession(true, IGNITE_TYPE_MAP, size); if (*size == -1) - *typ = IGNITE_MAP_UNDEFINED; + *typ = MapType::UNDEFINED; else - *typ = static_cast<MapType>(stream->ReadInt8()); + *typ = static_cast<MapType::Type>(stream->ReadInt8()); return id; } - int32_t BinaryReaderImpl::ReadMap(const char* fieldName, MapType* typ, int32_t* size) + int32_t BinaryReaderImpl::ReadMap(const char* fieldName, MapType::Type* typ, int32_t* size) { CheckRawMode(false); CheckSingleMode(true); @@ -618,7 +618,7 @@ namespace ignite if (fieldPos <= 0) { - *typ = IGNITE_MAP_UNDEFINED; + *typ = MapType::UNDEFINED; *size = -1; return ++elemIdGen; @@ -629,32 +629,32 @@ namespace ignite int32_t id = StartContainerSession(false, IGNITE_TYPE_MAP, size); if (*size == -1) - *typ = IGNITE_MAP_UNDEFINED; + *typ = MapType::UNDEFINED; else - *typ = static_cast<MapType>(stream->ReadInt8()); + *typ = static_cast<MapType::Type>(stream->ReadInt8()); return id; } - CollectionType BinaryReaderImpl::ReadCollectionTypeUnprotected() + CollectionType::Type BinaryReaderImpl::ReadCollectionTypeUnprotected() { int32_t size = ReadCollectionSizeUnprotected(); if (size == -1) - return IGNITE_COLLECTION_UNDEFINED; + return CollectionType::UNDEFINED; - CollectionType typ = static_cast<CollectionType>(stream->ReadInt8()); + CollectionType::Type typ = static_cast<CollectionType::Type>(stream->ReadInt8()); return typ; } - CollectionType BinaryReaderImpl::ReadCollectionType() + CollectionType::Type BinaryReaderImpl::ReadCollectionType() { InteropStreamPositionGuard<InteropInputStream> positionGuard(*stream); return ReadCollectionTypeUnprotected(); } - CollectionType BinaryReaderImpl::ReadCollectionType(const char* fieldName) + CollectionType::Type BinaryReaderImpl::ReadCollectionType(const char* fieldName) { CheckRawMode(false); CheckSingleMode(true); @@ -665,7 +665,7 @@ namespace ignite int32_t fieldPos = FindField(fieldId); if (fieldPos <= 0) - return IGNITE_COLLECTION_UNDEFINED; + return CollectionType::UNDEFINED; stream->Position(fieldPos); @@ -892,7 +892,7 @@ namespace ignite switch (schemaType) { - case OFFSET_TYPE_ONE_BYTE: + case BinaryOffsetType::ONE_BYTE: { for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 5) { @@ -904,7 +904,7 @@ namespace ignite break; } - case OFFSET_TYPE_TWO_BYTES: + case BinaryOffsetType::TWO_BYTES: { for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 6) { @@ -916,7 +916,7 @@ namespace ignite break; } - case OFFSET_TYPE_FOUR_BYTES: + case BinaryOffsetType::FOUR_BYTES: { for (int32_t schemaPos = footerBegin; schemaPos < footerEnd; schemaPos += 8) { http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/src/impl/binary/binary_schema.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_schema.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_schema.cpp index 0b8025a..736b43c 100644 --- a/modules/platforms/cpp/binary/src/impl/binary/binary_schema.cpp +++ b/modules/platforms/cpp/binary/src/impl/binary/binary_schema.cpp @@ -70,7 +70,7 @@ namespace ignite { switch (GetType()) { - case OFFSET_TYPE_ONE_BYTE: + case BinaryOffsetType::ONE_BYTE: { for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i) { @@ -80,7 +80,7 @@ namespace ignite break; } - case OFFSET_TYPE_TWO_BYTES: + case BinaryOffsetType::TWO_BYTES: { for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i) { @@ -90,7 +90,7 @@ namespace ignite break; } - case OFFSET_TYPE_FOUR_BYTES: + case BinaryOffsetType::FOUR_BYTES: { for (FieldContainer::const_iterator i = fieldsInfo->begin(); i != fieldsInfo->end(); ++i) { @@ -119,16 +119,17 @@ namespace ignite fieldsInfo->clear(); } - BinaryOffsetType BinarySchema::GetType() const + BinaryOffsetType::Type BinarySchema::GetType() const { int32_t maxOffset = fieldsInfo->back().offset; if (maxOffset < 0x100) - return OFFSET_TYPE_ONE_BYTE; - else if (maxOffset < 0x10000) - return OFFSET_TYPE_TWO_BYTES; + return BinaryOffsetType::ONE_BYTE; - return OFFSET_TYPE_FOUR_BYTES; + if (maxOffset < 0x10000) + return BinaryOffsetType::TWO_BYTES; + + return BinaryOffsetType::FOUR_BYTES; } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp index 15e1ab9..f93f0d3 100644 --- a/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp +++ b/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp @@ -560,7 +560,7 @@ namespace ignite return elemId; } - int32_t BinaryWriterImpl::WriteCollection(CollectionType typ) + int32_t BinaryWriterImpl::WriteCollection(CollectionType::Type typ) { StartContainerSession(true); @@ -571,7 +571,7 @@ namespace ignite return elemId; } - int32_t BinaryWriterImpl::WriteCollection(const char* fieldName, CollectionType typ) + int32_t BinaryWriterImpl::WriteCollection(const char* fieldName, CollectionType::Type typ) { StartContainerSession(false); @@ -584,7 +584,7 @@ namespace ignite return elemId; } - int32_t BinaryWriterImpl::WriteMap(ignite::binary::MapType typ) + int32_t BinaryWriterImpl::WriteMap(ignite::binary::MapType::Type typ) { StartContainerSession(true); @@ -595,7 +595,7 @@ namespace ignite return elemId; } - int32_t BinaryWriterImpl::WriteMap(const char* fieldName, ignite::binary::MapType typ) + int32_t BinaryWriterImpl::WriteMap(const char* fieldName, ignite::binary::MapType::Type typ) { StartContainerSession(false); @@ -785,7 +785,7 @@ namespace ignite else { int32_t schemaId = schema.GetId(); - BinaryOffsetType schemaType = schema.GetType(); + BinaryOffsetType::Type schemaType = schema.GetType(); WriteAndClearSchema(); @@ -796,9 +796,9 @@ namespace ignite flags |= IGNITE_BINARY_FLAG_HAS_SCHEMA; - if (schemaType == OFFSET_TYPE_ONE_BYTE) + if (schemaType == BinaryOffsetType::ONE_BYTE) flags |= IGNITE_BINARY_FLAG_OFFSET_ONE_BYTE; - else if (schemaType == OFFSET_TYPE_TWO_BYTES) + else if (schemaType == BinaryOffsetType::TWO_BYTES) flags |= IGNITE_BINARY_FLAG_OFFSET_TWO_BYTES; stream->WriteInt16(start + IGNITE_OFFSET_FLAGS, flags); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp index 14d64b0..53e584f 100644 --- a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp +++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp @@ -221,7 +221,7 @@ void CheckRawReadsRestricted(BinaryRawReader& reader) BOOST_CHECK_EXCEPTION((reader.ReadMap<int8_t, int8_t>()), IgniteError, IsBinaryError); } -void CheckRawCollectionEmpty(CollectionType* colType) +void CheckRawCollectionEmpty(CollectionType::Type* colType) { InteropUnpooledMemory mem(1024); @@ -253,7 +253,7 @@ void CheckRawCollectionEmpty(CollectionType* colType) if (colType) BOOST_REQUIRE(colReader.GetType() == *colType); else - BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED); + BOOST_REQUIRE(colReader.GetType() == CollectionType::UNDEFINED); BOOST_REQUIRE(colReader.GetSize() == 0); BOOST_REQUIRE(!colReader.HasNext()); @@ -264,7 +264,7 @@ void CheckRawCollectionEmpty(CollectionType* colType) BOOST_REQUIRE(rawReader.ReadInt8() == 1); } -void CheckRawCollection(CollectionType* colType) +void CheckRawCollection(CollectionType::Type* colType) { BinaryInner writeVal1 = BinaryInner(1); BinaryInner writeVal2 = BinaryInner(0); @@ -306,7 +306,7 @@ void CheckRawCollection(CollectionType* colType) if (colType) BOOST_REQUIRE(colReader.GetType() == *colType); else - BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED); + BOOST_REQUIRE(colReader.GetType() == CollectionType::UNDEFINED); BOOST_REQUIRE(colReader.GetSize() == 3); BOOST_REQUIRE(!colReader.IsNull()); @@ -327,7 +327,7 @@ void CheckRawCollection(CollectionType* colType) BOOST_REQUIRE(rawReader.ReadInt8() == 1); } -void CheckRawCollectionIterators(CollectionType* colType) +void CheckRawCollectionIterators(CollectionType::Type* colType) { typedef std::vector<BinaryInner> BinaryInnerVector; @@ -361,7 +361,7 @@ void CheckRawCollectionIterators(CollectionType* colType) if (colType) BOOST_REQUIRE(rawReader.ReadCollectionType() == *colType); else - BOOST_REQUIRE(rawReader.ReadCollectionType() == IGNITE_COLLECTION_UNDEFINED); + BOOST_REQUIRE(rawReader.ReadCollectionType() == CollectionType::UNDEFINED); BinaryInnerVector readValues(collectionSize); @@ -376,7 +376,7 @@ void CheckRawCollectionIterators(CollectionType* colType) BOOST_REQUIRE(rawReader.ReadInt8() == 1); } -void CheckRawMapEmpty(MapType* mapType) +void CheckRawMapEmpty(MapType::Type* mapType) { InteropUnpooledMemory mem(1024); @@ -408,7 +408,7 @@ void CheckRawMapEmpty(MapType* mapType) if (mapType) BOOST_REQUIRE(mapReader.GetType() == *mapType); else - BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED); + BOOST_REQUIRE(mapReader.GetType() == MapType::UNDEFINED); BOOST_REQUIRE(mapReader.GetSize() == 0); BOOST_REQUIRE(!mapReader.HasNext()); @@ -421,7 +421,7 @@ void CheckRawMapEmpty(MapType* mapType) BOOST_REQUIRE(rawReader.ReadInt8() == 1); } -void CheckRawMap(MapType* mapType) +void CheckRawMap(MapType::Type* mapType) { BinaryInner writeVal1 = BinaryInner(1); BinaryInner writeVal2 = BinaryInner(0); @@ -463,7 +463,7 @@ void CheckRawMap(MapType* mapType) if (mapType) BOOST_REQUIRE(mapReader.GetType() == *mapType); else - BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED); + BOOST_REQUIRE(mapReader.GetType() == MapType::UNDEFINED); BOOST_REQUIRE(mapReader.GetSize() == 3); BOOST_REQUIRE(!mapReader.IsNull()); @@ -1157,7 +1157,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionNull) BinaryCollectionReader<BinaryInner> colReader = rawReader.ReadCollection<BinaryInner>(); - BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED); + BOOST_REQUIRE(colReader.GetType() == CollectionType::UNDEFINED); BOOST_REQUIRE(colReader.GetSize() == -1); BOOST_REQUIRE(!colReader.HasNext()); BOOST_REQUIRE(colReader.IsNull()); @@ -1174,7 +1174,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionEmpty) BOOST_AUTO_TEST_CASE(TestCollectionEmptyTyped) { - CollectionType typ = IGNITE_COLLECTION_LINKED_HASH_SET; + CollectionType::Type typ = CollectionType::LINKED_HASH_SET; CheckRawCollectionEmpty(&typ); } @@ -1186,7 +1186,7 @@ BOOST_AUTO_TEST_CASE(TestCollection) BOOST_AUTO_TEST_CASE(TestCollectionTyped) { - CollectionType typ = IGNITE_COLLECTION_LINKED_HASH_SET; + CollectionType::Type typ = CollectionType::LINKED_HASH_SET; CheckRawCollection(&typ); } @@ -1198,7 +1198,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionIterators) BOOST_AUTO_TEST_CASE(TestCollectionIteratorsTyped) { - CollectionType typ = IGNITE_COLLECTION_LINKED_HASH_SET; + CollectionType::Type typ = CollectionType::LINKED_HASH_SET; CheckRawCollectionIterators(&typ); } @@ -1222,7 +1222,7 @@ BOOST_AUTO_TEST_CASE(TestMapNull) BinaryMapReader<int8_t, BinaryInner> mapReader = rawReader.ReadMap<int8_t, BinaryInner>(); - BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED); + BOOST_REQUIRE(mapReader.GetType() == MapType::UNDEFINED); BOOST_REQUIRE(mapReader.GetSize() == -1); BOOST_REQUIRE(!mapReader.HasNext()); BOOST_REQUIRE(mapReader.IsNull()); @@ -1241,7 +1241,7 @@ BOOST_AUTO_TEST_CASE(TestMapEmpty) BOOST_AUTO_TEST_CASE(TestMapEmptyTyped) { - MapType typ = IGNITE_MAP_LINKED_HASH_MAP; + MapType::Type typ = MapType::LINKED_HASH_MAP; CheckRawMapEmpty(&typ); } @@ -1253,7 +1253,7 @@ BOOST_AUTO_TEST_CASE(TestMap) BOOST_AUTO_TEST_CASE(TestMapTyped) { - MapType typ = IGNITE_MAP_LINKED_HASH_MAP; + MapType::Type typ = MapType::LINKED_HASH_MAP; CheckRawMap(&typ); } http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp index 7802d15..f494cb0 100644 --- a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp +++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp @@ -61,7 +61,7 @@ void CheckPrimitive(T val) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); BOOST_CHECK_EXCEPTION(Read<T>(reader, NULL), IgniteError, IsBinaryError); @@ -116,7 +116,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -149,7 +149,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -186,7 +186,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -226,7 +226,7 @@ void CheckPrimitiveArray(T dflt, T val1, T val2) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -301,7 +301,7 @@ void CheckReadsRestricted(BinaryReader& reader) BOOST_CHECK_EXCEPTION((reader.ReadMap<int8_t, int8_t>("field")), IgniteError, IsBinaryError); } -void CheckCollectionEmpty(CollectionType* colType) +void CheckCollectionEmpty(CollectionType::Type* colType) { TemplatedBinaryIdResolver<BinaryDummy> idRslvr; @@ -335,7 +335,7 @@ void CheckCollectionEmpty(CollectionType* colType) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -345,7 +345,7 @@ void CheckCollectionEmpty(CollectionType* colType) if (colType) BOOST_REQUIRE(colReader.GetType() == *colType); else - BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED); + BOOST_REQUIRE(colReader.GetType() == CollectionType::UNDEFINED); BOOST_REQUIRE(colReader.GetSize() == 0); BOOST_REQUIRE(!colReader.HasNext()); @@ -356,7 +356,7 @@ void CheckCollectionEmpty(CollectionType* colType) BOOST_REQUIRE(reader.ReadInt8("field2") == 1); } -void CheckCollection(CollectionType* colType) +void CheckCollection(CollectionType::Type* colType) { BinaryInner writeVal1 = BinaryInner(1); BinaryInner writeVal2 = BinaryInner(0); @@ -398,7 +398,7 @@ void CheckCollection(CollectionType* colType) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -410,7 +410,7 @@ void CheckCollection(CollectionType* colType) if (colType) BOOST_REQUIRE(colReader.GetType() == *colType); else - BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED); + BOOST_REQUIRE(colReader.GetType() == CollectionType::UNDEFINED); BOOST_REQUIRE(colReader.GetSize() == 3); BOOST_REQUIRE(!colReader.IsNull()); @@ -431,7 +431,7 @@ void CheckCollection(CollectionType* colType) BOOST_REQUIRE(reader.ReadInt8("field2") == 1); } -void CheckCollectionIterators(CollectionType* colType) +void CheckCollectionIterators(CollectionType::Type* colType) { typedef std::vector<BinaryInner> BinaryInnerVector; BinaryInnerVector writeValues; @@ -466,14 +466,14 @@ void CheckCollectionIterators(CollectionType* colType) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); BOOST_REQUIRE(reader.ReadCollectionSize("field1") == writeValues.size()); - CollectionType expectedCollectionType = colType ? *colType : IGNITE_COLLECTION_UNDEFINED; + CollectionType::Type expectedCollectionType = colType ? *colType : CollectionType::UNDEFINED; BOOST_REQUIRE(reader.ReadCollectionType("field1") == expectedCollectionType); BinaryInnerVector readValues; @@ -490,7 +490,7 @@ void CheckCollectionIterators(CollectionType* colType) BOOST_REQUIRE(reader.ReadInt8("field2") == 1); } -void CheckMapEmpty(MapType* mapType) +void CheckMapEmpty(MapType::Type* mapType) { TemplatedBinaryIdResolver<BinaryDummy> idRslvr; @@ -524,7 +524,7 @@ void CheckMapEmpty(MapType* mapType) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -534,7 +534,7 @@ void CheckMapEmpty(MapType* mapType) if (mapType) BOOST_REQUIRE(mapReader.GetType() == *mapType); else - BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED); + BOOST_REQUIRE(mapReader.GetType() == MapType::UNDEFINED); BOOST_REQUIRE(mapReader.GetSize() == 0); BOOST_REQUIRE(!mapReader.HasNext()); @@ -547,7 +547,7 @@ void CheckMapEmpty(MapType* mapType) BOOST_REQUIRE(reader.ReadInt8("field2") == 1); } -void CheckMap(MapType* mapType) +void CheckMap(MapType::Type* mapType) { BinaryInner writeVal1 = BinaryInner(1); BinaryInner writeVal2 = BinaryInner(0); @@ -589,7 +589,7 @@ void CheckMap(MapType* mapType) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -601,7 +601,7 @@ void CheckMap(MapType* mapType) if (mapType) BOOST_REQUIRE(mapReader.GetType() == *mapType); else - BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED); + BOOST_REQUIRE(mapReader.GetType() == MapType::UNDEFINED); BOOST_REQUIRE(mapReader.GetSize() == 3); BOOST_REQUIRE(!mapReader.IsNull()); @@ -801,7 +801,7 @@ BOOST_AUTO_TEST_CASE(TestGuidNull) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -839,7 +839,7 @@ BOOST_AUTO_TEST_CASE(TestDateNull) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -877,7 +877,7 @@ BOOST_AUTO_TEST_CASE(TestTimeNull) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -915,7 +915,7 @@ BOOST_AUTO_TEST_CASE(TestTimestampNull) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -964,7 +964,7 @@ BOOST_AUTO_TEST_CASE(TestString) { int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 5; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1023,7 +1023,7 @@ BOOST_AUTO_TEST_CASE(TestStringArrayNull) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1079,7 +1079,7 @@ BOOST_AUTO_TEST_CASE(TestStringArrayEmpty) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1146,7 +1146,7 @@ BOOST_AUTO_TEST_CASE(TestStringArray) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1241,7 +1241,7 @@ BOOST_AUTO_TEST_CASE(TestObject) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 3; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1285,7 +1285,7 @@ BOOST_AUTO_TEST_CASE(TestNestedObject) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 3; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1327,7 +1327,7 @@ BOOST_AUTO_TEST_CASE(TestArrayNull) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1376,7 +1376,7 @@ BOOST_AUTO_TEST_CASE(TestArrayEmpty) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1433,7 +1433,7 @@ BOOST_AUTO_TEST_CASE(TestArray) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1485,14 +1485,14 @@ BOOST_AUTO_TEST_CASE(TestCollectionNull) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); BinaryCollectionReader<BinaryInner> colReader = reader.ReadCollection<BinaryInner>("field1"); - BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED); + BOOST_REQUIRE(colReader.GetType() == CollectionType::UNDEFINED); BOOST_REQUIRE(colReader.GetSize() == -1); BOOST_REQUIRE(!colReader.HasNext()); BOOST_REQUIRE(colReader.IsNull()); @@ -1509,7 +1509,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionEmpty) BOOST_AUTO_TEST_CASE(TestCollectionEmptyTyped) { - CollectionType typ = IGNITE_COLLECTION_LINKED_HASH_SET; + CollectionType::Type typ = CollectionType::LINKED_HASH_SET; CheckCollectionEmpty(&typ); } @@ -1521,7 +1521,7 @@ BOOST_AUTO_TEST_CASE(TestCollection) BOOST_AUTO_TEST_CASE(testCollectionTyped) { - CollectionType typ = IGNITE_COLLECTION_LINKED_HASH_SET; + CollectionType::Type typ = CollectionType::LINKED_HASH_SET; CheckCollection(&typ); } @@ -1533,7 +1533,7 @@ BOOST_AUTO_TEST_CASE(TestCollectionIterators) BOOST_AUTO_TEST_CASE(TestCollectionIteratorsTyped) { - CollectionType typ = IGNITE_COLLECTION_LINKED_HASH_SET; + CollectionType::Type typ = CollectionType::LINKED_HASH_SET; CheckCollectionIterators(&typ); } @@ -1562,14 +1562,14 @@ BOOST_AUTO_TEST_CASE(TestMapNull) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 5 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); BinaryMapReader<int8_t, BinaryInner> mapReader = reader.ReadMap<int8_t, BinaryInner>("field1"); - BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED); + BOOST_REQUIRE(mapReader.GetType() == MapType::UNDEFINED); BOOST_REQUIRE(mapReader.GetSize() == -1); BOOST_REQUIRE(!mapReader.HasNext()); BOOST_REQUIRE(mapReader.IsNull()); @@ -1588,7 +1588,7 @@ BOOST_AUTO_TEST_CASE(TestMapEmpty) BOOST_AUTO_TEST_CASE(TestMapEmptyTyped) { - MapType typ = IGNITE_MAP_LINKED_HASH_MAP; + MapType::Type typ = MapType::LINKED_HASH_MAP; CheckMapEmpty(&typ); } @@ -1600,7 +1600,7 @@ BOOST_AUTO_TEST_CASE(TestMap) BOOST_AUTO_TEST_CASE(TestMapTyped) { - MapType typ = IGNITE_MAP_LINKED_HASH_MAP; + MapType::Type typ = MapType::LINKED_HASH_MAP; CheckMap(&typ); } @@ -1634,7 +1634,7 @@ BOOST_AUTO_TEST_CASE(TestRawMode) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, footerBegin, footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, footerBegin, footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1702,7 +1702,7 @@ BOOST_AUTO_TEST_CASE(TestFieldSeek) BinaryReaderImpl readerImpl(&in, &idRslvr, pos, usrType, typeId, hashCode, len, rawOff, - footerBegin, footerEnd, OFFSET_TYPE_ONE_BYTE); + footerBegin, footerEnd, BinaryOffsetType::ONE_BYTE); BinaryReader reader(&readerImpl); @@ -1824,7 +1824,7 @@ BOOST_AUTO_TEST_CASE(TestSchemaOffset2ByteFields) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 6 * fieldsNum; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_TWO_BYTES); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::TWO_BYTES); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1869,7 +1869,7 @@ BOOST_AUTO_TEST_CASE(TestSchemaOffset4ByteFields) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 8 * fieldsNum; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_FOUR_BYTES); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::FOUR_BYTES); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1909,7 +1909,7 @@ BOOST_AUTO_TEST_CASE(TestSchemaOffset2ByteArray) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 6 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_TWO_BYTES); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::TWO_BYTES); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); @@ -1943,7 +1943,7 @@ BOOST_AUTO_TEST_CASE(TestSchemaOffset4ByteArray) int32_t footerBegin = in.ReadInt32(IGNITE_OFFSET_SCHEMA_OR_RAW_OFF); int32_t footerEnd = footerBegin + 8 * 2; - BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, OFFSET_TYPE_FOUR_BYTES); + BinaryReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100, footerBegin, footerEnd, BinaryOffsetType::FOUR_BYTES); BinaryReader reader(&readerImpl); in.Position(IGNITE_DFLT_HDR_LEN); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core-test/src/cache_store_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/cache_store_test.cpp b/modules/platforms/cpp/core-test/src/cache_store_test.cpp index f1b4630..b6bfefb 100644 --- a/modules/platforms/cpp/core-test/src/cache_store_test.cpp +++ b/modules/platforms/cpp/core-test/src/cache_store_test.cpp @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(LoadCacheSingleNodeNoPredicate) BOOST_CHECK(!cache.IsEmpty()); - BOOST_CHECK_EQUAL(cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY), entriesNum); + BOOST_CHECK_EQUAL(cache.Size(cache::CachePeekMode::PRIMARY), entriesNum); std::string val42 = cache.Get(42); @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(LoadCacheSeveralNodesNoPredicate) BOOST_CHECK(!cache.IsEmpty()); - BOOST_CHECK_EQUAL(cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY), entriesNum); + BOOST_CHECK_EQUAL(cache.Size(cache::CachePeekMode::PRIMARY), entriesNum); std::string val42 = cache.Get(42); @@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE(LocalLoadCacheSingleNodeNoPredicate) BOOST_CHECK(!cache.IsEmpty()); - BOOST_CHECK_EQUAL(cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY), entriesNum); + BOOST_CHECK_EQUAL(cache.Size(cache::CachePeekMode::PRIMARY), entriesNum); std::string val42 = cache.Get(42); http://git-wip-us.apache.org/repos/asf/ignite/blob/7e106cd0/modules/platforms/cpp/core-test/src/cache_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/cache_test.cpp b/modules/platforms/cpp/core-test/src/cache_test.cpp index 99e0f1b..d3f73be 100644 --- a/modules/platforms/cpp/core-test/src/cache_test.cpp +++ b/modules/platforms/cpp/core-test/src/cache_test.cpp @@ -119,13 +119,13 @@ BOOST_AUTO_TEST_CASE(TestRemoveAllKeys) cache.Put(2, 2); cache.Put(3, 3); - int size = cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY); + int size = cache.Size(cache::CachePeekMode::PRIMARY); BOOST_REQUIRE(3 == size); cache.RemoveAll(); - size = cache.Size(cache::IGNITE_PEEK_MODE_ALL); + size = cache.Size(cache::CachePeekMode::ALL); BOOST_REQUIRE(0 == size); @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(TestRemoveAllKeys) cache.RemoveAll(keySet); - size = cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY); + size = cache.Size(cache::CachePeekMode::PRIMARY); BOOST_REQUIRE(1 == size); } @@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(TestRemoveAllKeysIterVector) { cache::Cache<int, int> cache = Cache(); - int size = cache.Size(cache::IGNITE_PEEK_MODE_ALL); + int size = cache.Size(cache::CachePeekMode::ALL); BOOST_REQUIRE(0 == size); @@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(TestRemoveAllKeysIterVector) cache.RemoveAll(keySet.begin(), keySet.end()); - size = cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY); + size = cache.Size(cache::CachePeekMode::PRIMARY); BOOST_REQUIRE(1 == size); } @@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(TestRemoveAllKeysIterArray) { cache::Cache<int, int> cache = Cache(); - int size = cache.Size(cache::IGNITE_PEEK_MODE_ALL); + int size = cache.Size(cache::CachePeekMode::ALL); BOOST_REQUIRE(0 == size); @@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE(TestRemoveAllKeysIterArray) cache.RemoveAll(keys, keys + 4); - size = cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY); + size = cache.Size(cache::CachePeekMode::PRIMARY); BOOST_REQUIRE(1 == size); } @@ -455,11 +455,11 @@ BOOST_AUTO_TEST_CASE(TestLocalClear) cache.Put(0, 2); - BOOST_REQUIRE(2 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(2 == cache.LocalPeek(0, cache::CachePeekMode::PRIMARY)); cache.LocalClear(0); - BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::CachePeekMode::PRIMARY)); } BOOST_AUTO_TEST_CASE(TestLocalClearAll) @@ -473,13 +473,13 @@ BOOST_AUTO_TEST_CASE(TestLocalClearAll) std::set<int> keySet(keys, keys + 2); - BOOST_REQUIRE(3 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY)); - BOOST_REQUIRE(3 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(3 == cache.LocalPeek(0, cache::CachePeekMode::PRIMARY)); + BOOST_REQUIRE(3 == cache.LocalPeek(1, cache::CachePeekMode::PRIMARY)); cache.LocalClearAll(keySet); - BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY)); - BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::CachePeekMode::PRIMARY)); + BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::CachePeekMode::PRIMARY)); } BOOST_AUTO_TEST_CASE(TestLocalClearAllIterList) @@ -493,13 +493,13 @@ BOOST_AUTO_TEST_CASE(TestLocalClearAllIterList) std::list<int> keySet(keys, keys + 2); - BOOST_REQUIRE(3 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY)); - BOOST_REQUIRE(3 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(3 == cache.LocalPeek(0, cache::CachePeekMode::PRIMARY)); + BOOST_REQUIRE(3 == cache.LocalPeek(1, cache::CachePeekMode::PRIMARY)); cache.LocalClearAll(keySet.begin(), keySet.end()); - BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY)); - BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::CachePeekMode::PRIMARY)); + BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::CachePeekMode::PRIMARY)); } BOOST_AUTO_TEST_CASE(TestLocalClearAllIterArray) @@ -511,13 +511,13 @@ BOOST_AUTO_TEST_CASE(TestLocalClearAllIterArray) int keys[] = { 0, 1 }; - BOOST_REQUIRE(3 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY)); - BOOST_REQUIRE(3 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(3 == cache.LocalPeek(0, cache::CachePeekMode::PRIMARY)); + BOOST_REQUIRE(3 == cache.LocalPeek(1, cache::CachePeekMode::PRIMARY)); cache.LocalClearAll(keys, keys + 2); - BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY)); - BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::CachePeekMode::PRIMARY)); + BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::CachePeekMode::PRIMARY)); } BOOST_AUTO_TEST_CASE(TestSizes) @@ -531,7 +531,7 @@ BOOST_AUTO_TEST_CASE(TestSizes) BOOST_REQUIRE(2 <= cache.Size()); - BOOST_REQUIRE(1 <= cache.LocalSize(cache::IGNITE_PEEK_MODE_PRIMARY)); + BOOST_REQUIRE(1 <= cache.LocalSize(cache::CachePeekMode::PRIMARY)); } BOOST_AUTO_TEST_CASE(TestLocalEvict) @@ -540,7 +540,7 @@ BOOST_AUTO_TEST_CASE(TestLocalEvict) cache.Put(1, 5); - BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); int keys[] = { 0, 1 }; @@ -548,11 +548,11 @@ BOOST_AUTO_TEST_CASE(TestLocalEvict) cache.LocalEvict(keySet); - BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); BOOST_REQUIRE(5 == cache.Get(1)); - BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); } BOOST_AUTO_TEST_CASE(TestLocalEvictIterSet) @@ -561,7 +561,7 @@ BOOST_AUTO_TEST_CASE(TestLocalEvictIterSet) cache.Put(1, 5); - BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); int keys[] = { 0, 1 }; @@ -569,11 +569,11 @@ BOOST_AUTO_TEST_CASE(TestLocalEvictIterSet) cache.LocalEvict(keySet.begin(), keySet.end()); - BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); BOOST_REQUIRE(5 == cache.Get(1)); - BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); } BOOST_AUTO_TEST_CASE(TestLocalEvictIterArray) @@ -582,17 +582,17 @@ BOOST_AUTO_TEST_CASE(TestLocalEvictIterArray) cache.Put(1, 5); - BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); int keys[] = { 0, 1 }; cache.LocalEvict(keys, keys + 2); - BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); BOOST_REQUIRE(5 == cache.Get(1)); - BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP)); + BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::CachePeekMode::ONHEAP)); } BOOST_AUTO_TEST_CASE(TestBinary)
