From 33f388f6c441a12fa1ebc464e20682265d2e477b Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Mon, 16 Aug 2021 23:45:12 +0200 Subject: [PATCH] WIP: fix merge of f-files --- CMakeLists.txt | 2 +- conanfile.py | 2 +- include/caosdb/entity.h | 26 +++++++++++++------------- src/ccaosdb.cpp | 10 +++++----- test/test_entity.cpp | 26 +++++++++++++------------- test/test_transaction.cpp | 16 ++++++++-------- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9c6718..b55de29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ cmake_minimum_required(VERSION 3.13) -set(libcaosdb_VERSION 0.0.11) +set(libcaosdb_VERSION 0.0.12) set(libcaosdb_COMPATIBLE_SERVER_VERSION_MAJOR 0) set(libcaosdb_COMPATIBLE_SERVER_VERSION_MINOR 5) set(libcaosdb_COMPATIBLE_SERVER_VERSION_PATCH 0) diff --git a/conanfile.py b/conanfile.py index 300f652..cbe0fe6 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,7 +3,7 @@ from conans import ConanFile, CMake, tools class CaosdbConan(ConanFile): name = "caosdb" - version = "0.0.11" + version = "0.0.12" license = "AGPL-3.0-or-later" author = "Timm C. Fitschen <t.fitschen@indiscale.com>" url = "https://gitlab.indiscale.com/caosdb/src/caosdb-cpplib.git" diff --git a/include/caosdb/entity.h b/include/caosdb/entity.h index 622ea3c..3917e93 100644 --- a/include/caosdb/entity.h +++ b/include/caosdb/entity.h @@ -43,11 +43,11 @@ #include <google/protobuf/message.h> // for RepeatedPtrField #include <google/protobuf/util/json_util.h> // for MessageToJson... #include <iosfwd> // for streamsize -#include <iterator> // for iterator, output_iterato... -#include <map> // for map -#include <random> // for mt19937, rand... -#include <stdexcept> // for out_of_range -#include <string> // for string, basic... +#include <iterator> // for iterator, output_iterato... +#include <map> // for map +#include <random> // for mt19937, rand... +#include <stdexcept> // for out_of_range +#include <string> // for string, basic... namespace caosdb::entity { using boost::filesystem::exists; @@ -58,10 +58,10 @@ using ProtoProperty = caosdb::entity::v1alpha1::Property; using ProtoEntity = caosdb::entity::v1alpha1::Entity; using ProtoFileDescriptor = caosdb::entity::v1alpha1::FileDescriptor; using ProtoMessage = caosdb::entity::v1alpha1::Message; -using ::google::protobuf::RepeatedPtrField; using caosdb::StatusCode; using caosdb::entity::v1alpha1::EntityResponse; using caosdb::entity::v1alpha1::FileTransmissionId; +using ::google::protobuf::RepeatedPtrField; using google::protobuf::RepeatedPtrField; static const std::string logger_name = "caosdb::entity"; @@ -84,11 +84,11 @@ public: /** * Return the current size of the container. */ - [[nodiscard]] inline auto Size() const -> int { return wrapped->size(); } + [[nodiscard]] inline auto size() const -> int { return wrapped->size(); } /** * Return a const reference to the element at the given index. */ - [[nodiscard]] inline auto At(int index) const -> const T & { + [[nodiscard]] inline auto at(int index) const -> const T & { return *mutable_at(index); } @@ -96,8 +96,8 @@ public: * Return a mutable pointer to the element at the given index. */ [[nodiscard]] inline auto mutable_at(int index) const -> T * { - if (index >= Size() || index < 0) { - throw std::out_of_range("Container has size " + std::to_string(Size())); + if (index >= size() || index < 0) { + throw std::out_of_range("Container has size " + std::to_string(size())); } if (cache.count(index) == 0) { cache.emplace(index, T(&(wrapped->at(index)))); @@ -157,7 +157,7 @@ protected: // shift all indices in the cache above index (such that the values do not // get deleted/copied because this could destroy pointers (c-interface). - for (int i = index + 1; i < Size(); i++) { + for (int i = index + 1; i < size(); i++) { if (cache.count(i) > 0) { auto handle = cache.extract(i); handle.key()--; @@ -225,7 +225,7 @@ auto RepeatedPtrFieldWrapper<T, P>::begin() template <typename T, typename P> auto RepeatedPtrFieldWrapper<T, P>::end() -> RepeatedPtrFieldWrapper<T, P>::iterator { - return RepeatedPtrFieldWrapper<T, P>::iterator(this, Size()); + return RepeatedPtrFieldWrapper<T, P>::iterator(this, size()); } template <typename T, typename P> @@ -237,7 +237,7 @@ auto RepeatedPtrFieldWrapper<T, P>::begin() const template <typename T, typename P> auto RepeatedPtrFieldWrapper<T, P>::end() const -> const RepeatedPtrFieldWrapper<T, P>::iterator { - return RepeatedPtrFieldWrapper<T, P>::iterator(this, Size()); + return RepeatedPtrFieldWrapper<T, P>::iterator(this, size()); } /** diff --git a/src/ccaosdb.cpp b/src/ccaosdb.cpp index e42d04b..d962c5b 100644 --- a/src/ccaosdb.cpp +++ b/src/ccaosdb.cpp @@ -606,7 +606,7 @@ ERROR_RETURN_CODE( { auto *wrapped_entity = static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); - *out = wrapped_entity->GetErrors().Size(); + *out = wrapped_entity->GetErrors().size(); return 0; }) @@ -632,7 +632,7 @@ ERROR_RETURN_CODE( { auto *wrapped_entity = static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); - *out = wrapped_entity->GetWarnings().Size(); + *out = wrapped_entity->GetWarnings().size(); return 0; }) @@ -658,7 +658,7 @@ ERROR_RETURN_CODE( { auto *wrapped_entity = static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); - *out = wrapped_entity->GetInfos().Size(); + *out = wrapped_entity->GetInfos().size(); return 0; }) @@ -684,7 +684,7 @@ ERROR_RETURN_CODE( { auto *wrapped_entity = static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); - *out = wrapped_entity->GetProperties().Size(); + *out = wrapped_entity->GetProperties().size(); return 0; }) @@ -710,7 +710,7 @@ ERROR_RETURN_CODE( { auto *wrapped_entity = static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); - *out = wrapped_entity->GetParents().Size(); + *out = wrapped_entity->GetParents().size(); return 0; }) diff --git a/test/test_entity.cpp b/test/test_entity.cpp index 49b3c7c..3d2343b 100644 --- a/test/test_entity.cpp +++ b/test/test_entity.cpp @@ -33,8 +33,8 @@ #include <gtest/gtest-test-part.h> // for TestPartResult, Sui... #include <gtest/gtest_pred_impl.h> // for Test, EXPECT_EQ #include <iostream> -#include <memory> // for allocator, shared_ptr -#include <string> // for operator+, string +#include <memory> // for allocator, shared_ptr +#include <string> // for operator+, string namespace caosdb::entity { using caosdb::entity::v1alpha1::IdResponse; @@ -302,7 +302,7 @@ TEST(test_entity, test_remove_property) { // not initializing the cache } - ASSERT_EQ(entity.GetProperties().Size(), 5); + ASSERT_EQ(entity.GetProperties().size(), 5); for (int i = 5; i < 10; i++) { auto name = "PROPERTY-" + std::to_string(i); @@ -314,16 +314,16 @@ TEST(test_entity, test_remove_property) { EXPECT_EQ(property.GetName(), name); // initializing the cache - const auto &property_2 = entity.GetProperties().At(i); + const auto &property_2 = entity.GetProperties().at(i); EXPECT_EQ(property_2.GetName(), name); } - ASSERT_EQ(entity.GetProperties().Size(), 10); + ASSERT_EQ(entity.GetProperties().size(), 10); for (int i = 5; i < 10; i++) { // double checking the cache auto name = "PROPERTY-" + std::to_string(i); - const auto &property = entity.GetProperties().At(i); + const auto &property = entity.GetProperties().at(i); EXPECT_EQ(property.GetName(), name); } @@ -338,7 +338,7 @@ TEST(test_entity, test_remove_property) { // ^ // P0,P1,P2, P4,P5,P6, P8,P9 entity.RemoveProperty(6); - ASSERT_EQ(entity.GetProperties().Size(), 8); + ASSERT_EQ(entity.GetProperties().size(), 8); // AppendProperty another property // P0,P1,P2, P4,P5,P6, P8,P9 @@ -347,27 +347,27 @@ TEST(test_entity, test_remove_property) { Property property10; property10.SetName("PROPERTY-10"); entity.AppendProperty(property10); - ASSERT_EQ(entity.GetProperties().Size(), 9); + ASSERT_EQ(entity.GetProperties().size(), 9); std::cout << "[" << std::endl; for (int i = 0; i < 9; i++) { - std::cout << " " << entity.GetProperties().At(i).GetName() << ",\n"; + std::cout << " " << entity.GetProperties().at(i).GetName() << ",\n"; } std::cout << "]" << std::endl; for (int i = 0; i < 3; i++) { auto name = "PROPERTY-" + std::to_string(i); - const auto &property = entity.GetProperties().At(i); + const auto &property = entity.GetProperties().at(i); EXPECT_EQ(property.GetName(), name); } for (int i = 3; i < 6; i++) { auto name = "PROPERTY-" + std::to_string(i + 1); - const auto &property = entity.GetProperties().At(i); + const auto &property = entity.GetProperties().at(i); EXPECT_EQ(property.GetName(), name); } for (int i = 6; i < 9; i++) { auto name = "PROPERTY-" + std::to_string(i + 2); - const auto &property = entity.GetProperties().At(i); + const auto &property = entity.GetProperties().at(i); EXPECT_EQ(property.GetName(), name); } } @@ -383,7 +383,7 @@ TEST(test_entity, test_property_iterator) { entity.AppendProperty(property); } - ASSERT_EQ(entity.GetProperties().Size(), 5); + ASSERT_EQ(entity.GetProperties().size(), 5); int counter = 0; for (auto &property : entity.GetProperties()) { auto name = "PROPERTY-" + std::to_string(counter); diff --git a/test/test_transaction.cpp b/test/test_transaction.cpp index 69dac41..70ba13a 100644 --- a/test/test_transaction.cpp +++ b/test/test_transaction.cpp @@ -23,18 +23,18 @@ #include "caosdb/entity/v1alpha1/main.pb.h" // for Entity #include "caosdb/exceptions.h" // for ConnectionError #include "caosdb/status_code.h" -#include "caosdb/transaction.h" // for Transaction +#include "caosdb/transaction.h" // for Transaction #include "caosdb/transaction_handler.h" // for MultiTransactionResponse -#include "caosdb/transaction_status.h" // for ConnectionError -#include "caosdb_test_utility.h" // for EXPECT_THROW_MESSAGE +#include "caosdb/transaction_status.h" // for ConnectionError +#include "caosdb_test_utility.h" // for EXPECT_THROW_MESSAGE #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestPa... #include <gtest/gtest_pred_impl.h> // for Test, TestInfo, TEST -#include <memory> // for allocator, unique_ptr -#include <stdexcept> // for out_of_range -#include <string> // for string, basic_string -#include <utility> // for move -#include <vector> // for vector +#include <memory> // for allocator, unique_ptr +#include <stdexcept> // for out_of_range +#include <string> // for string, basic_string +#include <utility> // for move +#include <vector> // for vector namespace caosdb::transaction { using caosdb::configuration::InsecureConnectionConfiguration; -- GitLab