Skip to content
Snippets Groups Projects
Verified Commit c8161806 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Moved around some code

parent 14a14b11
No related branches found
No related tags found
1 merge request!5F multi retrieve
Pipeline #11414 passed
Pipeline: caosdb-cppinttest

#11416

    This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
    ...@@ -299,7 +299,7 @@ if(_LINTING) ...@@ -299,7 +299,7 @@ if(_LINTING)
    else() else()
    message(STATUS "clang-tidy: ${clang_tidy}") message(STATUS "clang-tidy: ${clang_tidy}")
    set(_CMAKE_CXX_CLANG_TIDY_CHECKS set(_CMAKE_CXX_CLANG_TIDY_CHECKS
    "--checks=*,-fuchsia-*,-llvmlibc-*,-readability-convert-member-functions-to-static,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-llvm-else-after-return,-readability-else-after-return,-modernize-use-trailing-return-type") "--checks=*,-fuchsia-*,-llvmlibc-*,-readability-convert-member-functions-to-static,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-llvm-else-after-return,-readability-else-after-return,-modernize-use-trailing-return-type,-bugprone-branch-clone")
    set(_CMAKE_C_CLANG_TIDY_CHECKS "${_CMAKE_CXX_CLANG_TIDY_CHECKS}") set(_CMAKE_C_CLANG_TIDY_CHECKS "${_CMAKE_CXX_CLANG_TIDY_CHECKS}")
    set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}" set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}"
    "--header-filter=caosdb/.*[^\(\.pb\.h\)]$" "--header-filter=caosdb/.*[^\(\.pb\.h\)]$"
    ......
    ...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
    #include "google/protobuf/util/json_util.h" // for MessageToJsonString, Jso... #include "google/protobuf/util/json_util.h" // for MessageToJsonString, Jso...
    #include <stdexcept> #include <stdexcept>
    #include <iterator> #include <iterator>
    // IWYU pragma: no_include <ext/alloc_traits.h>
    #include <memory> // for shared_ptr, unique_ptr #include <memory> // for shared_ptr, unique_ptr
    #include <string> // for string #include <string> // for string
    #include <vector> // for vector #include <vector> // for vector
    ...@@ -119,6 +120,8 @@ using caosdb::transaction::TransactionStatus; ...@@ -119,6 +120,8 @@ using caosdb::transaction::TransactionStatus;
    using WrappedResponseCase = using WrappedResponseCase =
    caosdb::entity::v1alpha1::TransactionResponse::WrappedResponseCase; caosdb::entity::v1alpha1::TransactionResponse::WrappedResponseCase;
    class Transaction;
    static const std::string logger_name = "caosdb::transaction"; static const std::string logger_name = "caosdb::transaction";
    class ResultSet { class ResultSet {
    ...@@ -131,31 +134,7 @@ public: ...@@ -131,31 +134,7 @@ public:
    class MultiResultSet : public ResultSet { class MultiResultSet : public ResultSet {
    public: public:
    ~MultiResultSet() = default; ~MultiResultSet() = default;
    explicit inline MultiResultSet(MultiTransactionResponse *response) { explicit MultiResultSet(MultiTransactionResponse *response);
    auto responses = response->mutable_responses();
    Entity *entity = nullptr;
    for (auto sub_response : *responses) {
    switch (sub_response.wrapped_response_case()) {
    case WrappedResponseCase::kRetrieveResponse:
    entity = new Entity(
    sub_response.mutable_retrieve_response()->release_entity());
    break;
    case WrappedResponseCase::kInsertResponse:
    entity = new Entity(sub_response.release_insert_response());
    break;
    case WrappedResponseCase::kDeleteResponse:
    entity = new Entity(sub_response.release_delete_response());
    break;
    default:
    // TODO(tf) Updates
    break;
    }
    if (entity) {
    this->entities.push_back(std::unique_ptr<Entity>(entity));
    }
    }
    }
    [[nodiscard]] inline auto Size() const noexcept -> int override { [[nodiscard]] inline auto Size() const noexcept -> int override {
    return this->entities.size(); return this->entities.size();
    } }
    ......
    ...@@ -39,11 +39,12 @@ ...@@ -39,11 +39,12 @@
    #include <cstdlib> // for getenv #include <cstdlib> // for getenv
    #include <cstring> // for strcmp #include <cstring> // for strcmp
    #include <exception> // IWYU pragma: keep #include <exception> // IWYU pragma: keep
    #include <grpcpp/security/credentials.h> // for SslCredentials // IWYU pragma: no_include <bits/exception.h>
    #include <iterator> // for next #include <grpcpp/security/credentials.h> // for SslCredentials
    #include <map> // for map #include <iterator> // for next
    #include <stdexcept> // for out_of_range #include <map> // for map
    #include <string> // for string, operator+ #include <stdexcept> // for out_of_range
    #include <string> // for string, operator+
    namespace caosdb::configuration { namespace caosdb::configuration {
    using boost::filesystem::exists; using boost::filesystem::exists;
    ......
    ...@@ -90,6 +90,29 @@ using grpc::ClientAsyncResponseReader; ...@@ -90,6 +90,29 @@ using grpc::ClientAsyncResponseReader;
    using ProtoEntity = caosdb::entity::v1alpha1::Entity; using ProtoEntity = caosdb::entity::v1alpha1::Entity;
    using grpc::CompletionQueue; using grpc::CompletionQueue;
    MultiResultSet::MultiResultSet(MultiTransactionResponse *response) {
    auto *responses = response->mutable_responses();
    for (auto sub_response : *responses) {
    switch (sub_response.wrapped_response_case()) {
    case WrappedResponseCase::kRetrieveResponse:
    this->entities.push_back(std::make_unique<Entity>(
    sub_response.mutable_retrieve_response()->release_entity()));
    break;
    case WrappedResponseCase::kInsertResponse:
    this->entities.push_back(
    std::make_unique<Entity>(sub_response.release_insert_response()));
    break;
    case WrappedResponseCase::kDeleteResponse:
    this->entities.push_back(
    std::make_unique<Entity>(sub_response.release_insert_response()));
    break;
    default:
    // TODO(tf) Updates
    break;
    }
    }
    }
    [[nodiscard]] auto UniqueResult::GetEntity() const -> const Entity & { [[nodiscard]] auto UniqueResult::GetEntity() const -> const Entity & {
    const Entity *result = this->entity.get(); const Entity *result = this->entity.get();
    return *result; return *result;
    ...@@ -239,7 +262,7 @@ auto Transaction::WaitForIt() const noexcept -> TransactionStatus { ...@@ -239,7 +262,7 @@ auto Transaction::WaitForIt() const noexcept -> TransactionStatus {
    this->result_set = std::make_unique<UniqueResult>(deletedIdResponse); this->result_set = std::make_unique<UniqueResult>(deletedIdResponse);
    } break; } break;
    default: default:
    // TODO(tf) // TODO(tf) Error and Update
    break; break;
    } }
    } else { } else {
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment