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

WIP: return to int64 for integer values

parent 90cd36c6
Branches
Tags
1 merge request!22Return to int64 for integer values
Pipeline #12859 passed
Pipeline: caosdb-cppinttest

#12861

    This commit is part of merge request !22. Comments created here will be created in the context of that merge request.
    ...@@ -516,10 +516,10 @@ public: ...@@ -516,10 +516,10 @@ public:
    auto SetValue(const double value) -> StatusCode; auto SetValue(const double value) -> StatusCode;
    auto SetValue(const std::vector<std::string> &values) -> StatusCode; auto SetValue(const std::vector<std::string> &values) -> StatusCode;
    auto SetValue(const std::vector<char *> &values) -> StatusCode; auto SetValue(const std::vector<char *> &values) -> StatusCode;
    auto SetValue(const std::vector<int32_t> &values) -> StatusCode; auto SetValue(const std::vector<int64_t> &values) -> StatusCode;
    auto SetValue(const std::vector<double> &values) -> StatusCode; auto SetValue(const std::vector<double> &values) -> StatusCode;
    auto SetValue(const std::vector<bool> &values) -> StatusCode; auto SetValue(const std::vector<bool> &values) -> StatusCode;
    auto SetValue(const int32_t value) -> StatusCode; auto SetValue(const int64_t value) -> StatusCode;
    auto SetValue(const bool value) -> StatusCode; auto SetValue(const bool value) -> StatusCode;
    /** /**
    ...@@ -670,10 +670,10 @@ public: ...@@ -670,10 +670,10 @@ public:
    auto SetValue(const double value) -> StatusCode; auto SetValue(const double value) -> StatusCode;
    auto SetValue(const std::vector<std::string> &values) -> StatusCode; auto SetValue(const std::vector<std::string> &values) -> StatusCode;
    auto SetValue(const std::vector<char *> &values) -> StatusCode; auto SetValue(const std::vector<char *> &values) -> StatusCode;
    auto SetValue(const std::vector<int32_t> &values) -> StatusCode; auto SetValue(const std::vector<int64_t> &values) -> StatusCode;
    auto SetValue(const std::vector<double> &values) -> StatusCode; auto SetValue(const std::vector<double> &values) -> StatusCode;
    auto SetValue(const std::vector<bool> &values) -> StatusCode; auto SetValue(const std::vector<bool> &values) -> StatusCode;
    auto SetValue(const int32_t value) -> StatusCode; auto SetValue(const int64_t value) -> StatusCode;
    auto SetValue(const bool value) -> StatusCode; auto SetValue(const bool value) -> StatusCode;
    auto SetUnit(const std::string &unit) -> void; auto SetUnit(const std::string &unit) -> void;
    ......
    ...@@ -110,7 +110,6 @@ public: ...@@ -110,7 +110,6 @@ public:
    explicit inline Value(int64_t value) : ProtoMessageWrapper<ProtoValue>() { explicit inline Value(int64_t value) : ProtoMessageWrapper<ProtoValue>() {
    this->wrapped->mutable_scalar_value()->set_integer_value(value); this->wrapped->mutable_scalar_value()->set_integer_value(value);
    } }
    explicit inline Value(int value) : Value((int64_t)value) {}
    explicit inline Value(bool value) : ProtoMessageWrapper<ProtoValue>() { explicit inline Value(bool value) : ProtoMessageWrapper<ProtoValue>() {
    this->wrapped->mutable_scalar_value()->set_boolean_value(value); this->wrapped->mutable_scalar_value()->set_boolean_value(value);
    } }
    ......
    ...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
    * *
    */ */
    #include <cstdint> // for uint32_t #include <cstdint> // for int64_t
    #ifdef __cplusplus #ifdef __cplusplus
    extern "C" { extern "C" {
    ...@@ -347,11 +347,11 @@ int caosdb_entity_entity_get_datatype(caosdb_entity_entity *entity, char **name, ...@@ -347,11 +347,11 @@ int caosdb_entity_entity_get_datatype(caosdb_entity_entity *entity, char **name,
    bool *is_list); bool *is_list);
    int caosdb_entity_entity_get_unit(caosdb_entity_entity *entity, char **out); int caosdb_entity_entity_get_unit(caosdb_entity_entity *entity, char **out);
    int caosdb_entity_entity_get_int_value(caosdb_entity_entity *entity, int32_t *out); int caosdb_entity_entity_get_int_value(caosdb_entity_entity *entity, int64_t *out);
    int caosdb_entity_entity_get_double_value(caosdb_entity_entity *entity, double *out); int caosdb_entity_entity_get_double_value(caosdb_entity_entity *entity, double *out);
    int caosdb_entity_entity_get_boolean_value(caosdb_entity_entity *entity, bool *out); int caosdb_entity_entity_get_boolean_value(caosdb_entity_entity *entity, bool *out);
    int caosdb_entity_entity_get_string_value(caosdb_entity_entity *entity, char **out); int caosdb_entity_entity_get_string_value(caosdb_entity_entity *entity, char **out);
    int caosdb_entity_entity_get_int_list_value_at(caosdb_entity_entity *entity, int32_t *out, int caosdb_entity_entity_get_int_list_value_at(caosdb_entity_entity *entity, int64_t *out,
    const int index); const int index);
    int caosdb_entity_entity_get_double_list_value_at(caosdb_entity_entity *entity, double *out, int caosdb_entity_entity_get_double_list_value_at(caosdb_entity_entity *entity, double *out,
    const int index); const int index);
    ...@@ -389,11 +389,11 @@ int caosdb_entity_property_get_datatype(caosdb_entity_property *property, char * ...@@ -389,11 +389,11 @@ int caosdb_entity_property_get_datatype(caosdb_entity_property *property, char *
    bool *is_list); bool *is_list);
    int caosdb_entity_property_get_unit(caosdb_entity_property *property, char **out); int caosdb_entity_property_get_unit(caosdb_entity_property *property, char **out);
    int caosdb_entity_property_get_int_value(caosdb_entity_property *property, int32_t *out); int caosdb_entity_property_get_int_value(caosdb_entity_property *property, int64_t *out);
    int caosdb_entity_property_get_double_value(caosdb_entity_property *property, double *out); int caosdb_entity_property_get_double_value(caosdb_entity_property *property, double *out);
    int caosdb_entity_property_get_boolean_value(caosdb_entity_property *property, bool *out); int caosdb_entity_property_get_boolean_value(caosdb_entity_property *property, bool *out);
    int caosdb_entity_property_get_string_value(caosdb_entity_property *property, char **out); int caosdb_entity_property_get_string_value(caosdb_entity_property *property, char **out);
    int caosdb_entity_property_get_int_list_value_at(caosdb_entity_property *property, int32_t *out, int caosdb_entity_property_get_int_list_value_at(caosdb_entity_property *property, int64_t *out,
    const int index); const int index);
    int caosdb_entity_property_get_double_list_value_at(caosdb_entity_property *property, double *out, int caosdb_entity_property_get_double_list_value_at(caosdb_entity_property *property, double *out,
    const int index); const int index);
    ...@@ -431,11 +431,11 @@ int caosdb_entity_entity_set_datatype(caosdb_entity_entity *entity, const char * ...@@ -431,11 +431,11 @@ int caosdb_entity_entity_set_datatype(caosdb_entity_entity *entity, const char *
    const bool is_ref, const bool is_list); const bool is_ref, const bool is_list);
    int caosdb_entity_entity_set_unit(caosdb_entity_entity *entity, const char *unit); int caosdb_entity_entity_set_unit(caosdb_entity_entity *entity, const char *unit);
    // TODO(fspreck) replace by more specific setters // TODO(fspreck) replace by more specific setters
    int caosdb_entity_entity_set_int_value(caosdb_entity_entity *entity, const int32_t value); int caosdb_entity_entity_set_int_value(caosdb_entity_entity *entity, const int64_t value);
    int caosdb_entity_entity_set_double_value(caosdb_entity_entity *entity, const double value); int caosdb_entity_entity_set_double_value(caosdb_entity_entity *entity, const double value);
    int caosdb_entity_entity_set_boolean_value(caosdb_entity_entity *entity, const bool value); int caosdb_entity_entity_set_boolean_value(caosdb_entity_entity *entity, const bool value);
    int caosdb_entity_entity_set_string_value(caosdb_entity_entity *entity, const char *value); int caosdb_entity_entity_set_string_value(caosdb_entity_entity *entity, const char *value);
    int caosdb_entity_entity_set_int_list_value(caosdb_entity_entity *entity, const int32_t *value, int caosdb_entity_entity_set_int_list_value(caosdb_entity_entity *entity, const int64_t *value,
    const int length); const int length);
    int caosdb_entity_entity_set_double_list_value(caosdb_entity_entity *entity, const double *value, int caosdb_entity_entity_set_double_list_value(caosdb_entity_entity *entity, const double *value,
    const int length); const int length);
    ...@@ -460,12 +460,12 @@ int caosdb_entity_property_set_datatype(caosdb_entity_property *property, const ...@@ -460,12 +460,12 @@ int caosdb_entity_property_set_datatype(caosdb_entity_property *property, const
    int caosdb_entity_property_set_importance(caosdb_entity_property *property, const char *importance); int caosdb_entity_property_set_importance(caosdb_entity_property *property, const char *importance);
    int caosdb_entity_property_set_unit(caosdb_entity_property *property, const char *unit); int caosdb_entity_property_set_unit(caosdb_entity_property *property, const char *unit);
    int caosdb_entity_property_set_int_value(caosdb_entity_property *property, const int32_t value); int caosdb_entity_property_set_int_value(caosdb_entity_property *property, const int64_t value);
    int caosdb_entity_property_set_double_value(caosdb_entity_property *property, const double value); int caosdb_entity_property_set_double_value(caosdb_entity_property *property, const double value);
    int caosdb_entity_property_set_boolean_value(caosdb_entity_property *property, const bool value); int caosdb_entity_property_set_boolean_value(caosdb_entity_property *property, const bool value);
    int caosdb_entity_property_set_string_value(caosdb_entity_property *property, const char *value); int caosdb_entity_property_set_string_value(caosdb_entity_property *property, const char *value);
    int caosdb_entity_property_set_int_list_value(caosdb_entity_property *property, int caosdb_entity_property_set_int_list_value(caosdb_entity_property *property,
    const int32_t *value, const int length); const int64_t *value, const int length);
    int caosdb_entity_property_set_double_list_value(caosdb_entity_property *property, int caosdb_entity_property_set_double_list_value(caosdb_entity_property *property,
    const double *value, const int length); const double *value, const int length);
    int caosdb_entity_property_set_boolean_list_value(caosdb_entity_property *property, int caosdb_entity_property_set_boolean_list_value(caosdb_entity_property *property,
    ......
    ...@@ -124,7 +124,7 @@ auto Property::SetValue(const std::vector<char *> &values) -> StatusCode { ...@@ -124,7 +124,7 @@ auto Property::SetValue(const std::vector<char *> &values) -> StatusCode {
    return SetValue(Value(values)); return SetValue(Value(values));
    } }
    auto Property::SetValue(const std::vector<int32_t> &values) -> StatusCode { auto Property::SetValue(const std::vector<int64_t> &values) -> StatusCode {
    return SetValue(Value(values)); return SetValue(Value(values));
    } }
    ...@@ -136,7 +136,7 @@ auto Property::SetValue(const std::vector<bool> &values) -> StatusCode { ...@@ -136,7 +136,7 @@ auto Property::SetValue(const std::vector<bool> &values) -> StatusCode {
    return SetValue(Value(values)); return SetValue(Value(values));
    } }
    auto Property::SetValue(const int32_t value) -> StatusCode { return SetValue(Value(value)); } auto Property::SetValue(const int64_t value) -> StatusCode { return SetValue(Value(value)); }
    auto Property::SetValue(const bool value) -> StatusCode { return SetValue(Value(value)); } auto Property::SetValue(const bool value) -> StatusCode { return SetValue(Value(value)); }
    ...@@ -222,7 +222,7 @@ auto Entity::SetValue(const std::vector<char *> &values) -> StatusCode { ...@@ -222,7 +222,7 @@ auto Entity::SetValue(const std::vector<char *> &values) -> StatusCode {
    return SetValue(Value(values)); return SetValue(Value(values));
    } }
    auto Entity::SetValue(const std::vector<int32_t> &values) -> StatusCode { auto Entity::SetValue(const std::vector<int64_t> &values) -> StatusCode {
    return SetValue(Value(values)); return SetValue(Value(values));
    } }
    ...@@ -234,7 +234,7 @@ auto Entity::SetValue(const std::vector<bool> &values) -> StatusCode { ...@@ -234,7 +234,7 @@ auto Entity::SetValue(const std::vector<bool> &values) -> StatusCode {
    return SetValue(Value(values)); return SetValue(Value(values));
    } }
    auto Entity::SetValue(const int32_t value) -> StatusCode { return SetValue(Value(value)); } auto Entity::SetValue(const int64_t value) -> StatusCode { return SetValue(Value(value)); }
    auto Entity::SetValue(const bool value) -> StatusCode { return SetValue(Value(value)); } auto Entity::SetValue(const bool value) -> StatusCode { return SetValue(Value(value)); }
    ......
    ...@@ -641,7 +641,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ...@@ -641,7 +641,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
    }) })
    ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR,
    int caosdb_entity_entity_get_int_value(caosdb_entity_entity *entity, int caosdb_entity_entity_get_int_value(caosdb_entity_entity *entity,
    int32_t *out), int64_t *out),
    { {
    auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity);
    *out = wrapped_entity->GetValue().AsInteger(); *out = wrapped_entity->GetValue().AsInteger();
    ...@@ -667,7 +667,7 @@ CAOSDB_ENTITY_GET(string_value, GetValue().AsString()) ...@@ -667,7 +667,7 @@ CAOSDB_ENTITY_GET(string_value, GetValue().AsString())
    ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR,
    int caosdb_entity_entity_get_int_list_value_at(caosdb_entity_entity *entity, int caosdb_entity_entity_get_int_list_value_at(caosdb_entity_entity *entity,
    int32_t *out, const int index), int64_t *out, const int index),
    { {
    auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity);
    auto value_list = wrapped_entity->GetValue().AsList(); auto value_list = wrapped_entity->GetValue().AsList();
    ...@@ -896,7 +896,7 @@ CAOSDB_PROPERTY_GET(unit, GetUnit()) ...@@ -896,7 +896,7 @@ CAOSDB_PROPERTY_GET(unit, GetUnit())
    ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR,
    int caosdb_entity_property_get_int_value(caosdb_entity_property *property, int caosdb_entity_property_get_int_value(caosdb_entity_property *property,
    int32_t *out), int64_t *out),
    { {
    auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); auto *wrapped_property = WRAPPED_PROPERTY_CAST(property);
    *out = wrapped_property->GetValue().AsInteger(); *out = wrapped_property->GetValue().AsInteger();
    ...@@ -922,7 +922,7 @@ CAOSDB_PROPERTY_GET(string_value, GetValue().AsString()) ...@@ -922,7 +922,7 @@ CAOSDB_PROPERTY_GET(string_value, GetValue().AsString())
    ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR,
    int caosdb_entity_property_get_int_list_value_at(caosdb_entity_property *property, int caosdb_entity_property_get_int_list_value_at(caosdb_entity_property *property,
    int32_t *out, const int index), int64_t *out, const int index),
    { {
    auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); auto *wrapped_property = WRAPPED_PROPERTY_CAST(property);
    auto value_list = wrapped_property->GetValue().AsList(); auto value_list = wrapped_property->GetValue().AsList();
    ...@@ -1039,7 +1039,7 @@ CAOSDB_ENTITY_SET(unit, unit, wrapped_entity->SetUnit(std::string(unit));) ...@@ -1039,7 +1039,7 @@ CAOSDB_ENTITY_SET(unit, unit, wrapped_entity->SetUnit(std::string(unit));)
    ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR,
    int caosdb_entity_entity_set_int_value(caosdb_entity_entity *entity, int caosdb_entity_entity_set_int_value(caosdb_entity_entity *entity,
    const int32_t value), const int64_t value),
    { {
    auto *wrapped_entity = auto *wrapped_entity =
    static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); static_cast<caosdb::entity::Entity *>(entity->wrapped_entity);
    ...@@ -1079,12 +1079,12 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ...@@ -1079,12 +1079,12 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
    ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR,
    int caosdb_entity_entity_set_int_list_value(caosdb_entity_entity *entity, int caosdb_entity_entity_set_int_list_value(caosdb_entity_entity *entity,
    const int32_t *value, const int64_t *value,
    const int length), const int length),
    { {
    auto *wrapped_entity = auto *wrapped_entity =
    static_cast<caosdb::entity::Entity *>(entity->wrapped_entity); static_cast<caosdb::entity::Entity *>(entity->wrapped_entity);
    std::vector<int32_t> value_list; std::vector<int64_t> value_list;
    for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
    value_list.push_back(value[i]); value_list.push_back(value[i]);
    } }
    ...@@ -1226,7 +1226,7 @@ CAOSDB_PROPERTY_SET(unit, unit, wrapped_property->SetUnit(std::string(unit));) ...@@ -1226,7 +1226,7 @@ CAOSDB_PROPERTY_SET(unit, unit, wrapped_property->SetUnit(std::string(unit));)
    ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR,
    int caosdb_entity_property_set_int_value(caosdb_entity_property *property, int caosdb_entity_property_set_int_value(caosdb_entity_property *property,
    const int32_t value), const int64_t value),
    { {
    auto *wrapped_property = auto *wrapped_property =
    static_cast<caosdb::entity::Property *>(property->wrapped_property); static_cast<caosdb::entity::Property *>(property->wrapped_property);
    ...@@ -1266,12 +1266,12 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ...@@ -1266,12 +1266,12 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
    ERROR_RETURN_CODE(GENERIC_ERROR, ERROR_RETURN_CODE(GENERIC_ERROR,
    int caosdb_entity_property_set_int_list_value(caosdb_entity_property *property, int caosdb_entity_property_set_int_list_value(caosdb_entity_property *property,
    const int32_t *value, const int64_t *value,
    const int length), const int length),
    { {
    auto *wrapped_property = auto *wrapped_property =
    static_cast<caosdb::entity::Property *>(property->wrapped_property); static_cast<caosdb::entity::Property *>(property->wrapped_property);
    std::vector<int32_t> value_list; std::vector<int64_t> value_list;
    for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
    value_list.push_back(value[i]); value_list.push_back(value[i]);
    } }
    ......
    ...@@ -68,7 +68,7 @@ TEST(test_value, test_string) { ...@@ -68,7 +68,7 @@ TEST(test_value, test_string) {
    // Test inequality // Test inequality
    Value string1("1"); Value string1("1");
    Value int1(1); Value int1(static_cast<int64_t>(1));
    EXPECT_FALSE(string1 == int1); EXPECT_FALSE(string1 == int1);
    } }
    ...@@ -93,7 +93,7 @@ TEST(test_value, test_double) { ...@@ -93,7 +93,7 @@ TEST(test_value, test_double) {
    } }
    TEST(test_value, test_integer) { TEST(test_value, test_integer) {
    Value value(1337); Value value(static_cast<int64_t>(1337));
    EXPECT_FALSE(value.IsNull()); EXPECT_FALSE(value.IsNull());
    EXPECT_FALSE(value.IsString()); EXPECT_FALSE(value.IsString());
    EXPECT_FALSE(value.IsDouble()); EXPECT_FALSE(value.IsDouble());
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment