Commit 88346a31 authored by Morten Ofstad's avatar Morten Ofstad
Browse files

Merge branch feature/morten.ofstad/FixMetadataKeyGetters with...

Merge branch feature/morten.ofstad/FixMetadataKeyGetters with refs/heads/master into refs/merge-requests/133/train
parents 4b8efeff a11c93a0
Pipeline #1548 passed with stages
in 2 minutes and 55 seconds
......@@ -465,9 +465,9 @@ extern "C" {
int i = 0;
for( MetadataKey key : keys ) {
jobject jKey = env->NewObject( keyClass, initMethod,
(jint) key.Type(),
NewJString( env, key.Category() ),
NewJString( env, key.Name() ) );
(jint) key.GetType(),
NewJString( env, key.GetCategory() ),
NewJString( env, key.GetName() ) );
env->SetObjectArrayElement( jKeysArray, i, jKey );
++i;
}
......
......@@ -230,9 +230,12 @@ PyMetadata::initModule(py::module& m)
MetadataKey_.def(py::init< >(), OPENVDS_DOCSTRING(MetadataKey_MetadataKey));
MetadataKey_.def(py::init<native::MetadataType, const char *, const char *>(), py::arg("type"), py::arg("category"), py::arg("name"), OPENVDS_DOCSTRING(MetadataKey_MetadataKey_2));
MetadataKey_.def("type" , static_cast<native::MetadataType(MetadataKey::*)() const>(&MetadataKey::Type), OPENVDS_DOCSTRING(MetadataKey_Type));
MetadataKey_.def("category" , static_cast<const char *(MetadataKey::*)() const>(&MetadataKey::Category), OPENVDS_DOCSTRING(MetadataKey_Category));
MetadataKey_.def("name" , static_cast<const char *(MetadataKey::*)() const>(&MetadataKey::Name), OPENVDS_DOCSTRING(MetadataKey_Name));
MetadataKey_.def("getType" , static_cast<native::MetadataType(MetadataKey::*)() const>(&MetadataKey::GetType), OPENVDS_DOCSTRING(MetadataKey_GetType));
MetadataKey_.def_property_readonly("type", &MetadataKey::GetType, OPENVDS_DOCSTRING(MetadataKey_GetType));
MetadataKey_.def("getCategory" , static_cast<const char *(MetadataKey::*)() const>(&MetadataKey::GetCategory), OPENVDS_DOCSTRING(MetadataKey_GetCategory));
MetadataKey_.def_property_readonly("category", &MetadataKey::GetCategory, OPENVDS_DOCSTRING(MetadataKey_GetCategory));
MetadataKey_.def("getName" , static_cast<const char *(MetadataKey::*)() const>(&MetadataKey::GetName), OPENVDS_DOCSTRING(MetadataKey_GetName));
MetadataKey_.def_property_readonly("name", &MetadataKey::GetName, OPENVDS_DOCSTRING(MetadataKey_GetName));
MetadataKey_.def(py::self == py::self);
MetadataKey_.def(py::self != py::self);
......@@ -362,7 +365,7 @@ PyMetadata::initModule(py::module& m)
MetadataReadAccess_.def("getMetadata", [](MetadataReadAccess* self, native::MetadataKey const& key)
{
return GetMetadata(self, key.Category(), key.Name(), key.Type());
return GetMetadata(self, key.GetCategory(), key.GetName(), key.GetType());
}, py::arg("key"));
MetadataReadAccess_.def("getMetadata", [](MetadataReadAccess* self, const char* category, const char* name, native::MetadataType type)
{
......@@ -381,7 +384,7 @@ PyMetadata::initModule(py::module& m)
MetadataKey_.def("__repr__", [](MetadataKey* self)
{
const char* type = "unknown";
switch(self->Type())
switch(self->GetType())
{
case MetadataType::Int : type = "Int" ; break;
case MetadataType::IntVector2 : type = "IntVector2" ; break;
......@@ -398,7 +401,7 @@ PyMetadata::initModule(py::module& m)
case MetadataType::String : type = "String" ; break;
case MetadataType::BLOB : type = "BLOB" ; break;
}
return std::string("MetadataKey(category='") + self->Category() + "', name='" + self->Name() + "', type=MetadataType." + type + ")";
return std::string("MetadataKey(category='") + self->GetCategory() + "', name='" + self->GetName() + "', type=MetadataType." + type + ")";
});
}
......@@ -822,13 +822,27 @@ static const char *__doc_OpenVDS_MetadataKeyRange_m_begin = R"doc()doc";
static const char *__doc_OpenVDS_MetadataKeyRange_m_end = R"doc()doc";
static const char *__doc_OpenVDS_MetadataKey_Category =
static const char *__doc_OpenVDS_MetadataKey_GetCategory =
R"doc(Get the category of metadata that this key identifies
Returns:
--------
The category of the metadata that this key identifies)doc";
static const char *__doc_OpenVDS_MetadataKey_GetName =
R"doc(Get the name of metadata that this key identifies
Returns:
--------
The name of the metadata that this key identifies)doc";
static const char *__doc_OpenVDS_MetadataKey_GetType =
R"doc(Get the type of metadata that this key identifies
Returns:
--------
The type of the metadata that this key identifies)doc";
static const char *__doc_OpenVDS_MetadataKey_MetadataKey = R"doc(Default constructor)doc";
static const char *__doc_OpenVDS_MetadataKey_MetadataKey_2 =
......@@ -851,20 +865,6 @@ category :
name :
The name of the metadata that this key identifies)doc";
static const char *__doc_OpenVDS_MetadataKey_Name =
R"doc(Get the name of metadata that this key identifies
Returns:
--------
The name of the metadata that this key identifies)doc";
static const char *__doc_OpenVDS_MetadataKey_Type =
R"doc(Get the type of metadata that this key identifies
Returns:
--------
The type of the metadata that this key identifies)doc";
static const char *__doc_OpenVDS_MetadataKey_m_category = R"doc()doc";
static const char *__doc_OpenVDS_MetadataKey_m_name = R"doc()doc";
......
......@@ -180,7 +180,7 @@ static void copyMetadataToContainer(MetadataContainer &container, const Metadata
std::unordered_set<std::string> categories;
for (auto &key : readAccess.GetMetadataKeys())
{
categories.insert(key.Category());
categories.insert(key.GetCategory());
}
for (auto &category : categories)
{
......
......@@ -87,7 +87,7 @@ public:
/// <returns>
/// The type of the metadata that this key identifies
/// </returns>
MetadataType Type() const { return m_type; }
MetadataType GetType() const { return m_type; }
/// <summary>
/// Get the category of metadata that this key identifies
......@@ -95,7 +95,7 @@ public:
/// <returns>
/// The category of the metadata that this key identifies
/// </returns>
const char *Category() const { return m_category; }
const char *GetCategory() const { return m_category; }
/// <summary>
/// Get the name of metadata that this key identifies
......@@ -103,7 +103,7 @@ public:
/// <returns>
/// The name of the metadata that this key identifies
/// </returns>
const char *Name() const { return m_name; }
const char *GetName() const { return m_name; }
bool operator==(const MetadataKey& other) const { return m_type == other.m_type && strcmp(m_category, other.m_category) == 0 && strcmp(m_name, other.m_name) == 0; }
bool operator!=(const MetadataKey& other) const { return m_type != other.m_type || strcmp(m_category, other.m_category) != 0 || strcmp(m_name, other.m_name) != 0; }
......@@ -226,8 +226,8 @@ struct hash<OpenVDS::MetadataKey>
{
std::size_t operator()(const OpenVDS::MetadataKey &k) const
{
size_t const h1= std::hash<std::string>()(k.Category());
size_t const h2= std::hash<std::string>()(k.Name());
size_t const h1= std::hash<std::string>()(k.GetCategory());
size_t const h2= std::hash<std::string>()(k.GetName());
return h1 ^ (h2 << 1);
}
};
......@@ -291,53 +291,53 @@ public:
{
for (auto &key : metadataReadAccess->GetMetadataKeys())
{
if (strcmp(key.Category(), category) == 0)
if (strcmp(key.GetCategory(), category) == 0)
{
switch(key.Type())
switch(key.GetType())
{
case MetadataType::Int:
SetMetadataInt(key.Category(), key.Name(), metadataReadAccess->GetMetadataInt(key.Category(), key.Name()));
SetMetadataInt(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataInt(key.GetCategory(), key.GetName()));
break;
case MetadataType::IntVector2:
SetMetadataIntVector2(key.Category(), key.Name(), metadataReadAccess->GetMetadataIntVector2(key.Category(), key.Name()));
SetMetadataIntVector2(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataIntVector2(key.GetCategory(), key.GetName()));
break;
case MetadataType::IntVector3:
SetMetadataIntVector3(key.Category(), key.Name(), metadataReadAccess->GetMetadataIntVector3(key.Category(), key.Name()));
SetMetadataIntVector3(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataIntVector3(key.GetCategory(), key.GetName()));
break;
case MetadataType::IntVector4:
SetMetadataIntVector4(key.Category(), key.Name(), metadataReadAccess->GetMetadataIntVector4(key.Category(), key.Name()));
SetMetadataIntVector4(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataIntVector4(key.GetCategory(), key.GetName()));
break;
case MetadataType::Float:
SetMetadataFloat(key.Category(), key.Name(), metadataReadAccess->GetMetadataFloat(key.Category(), key.Name()));
SetMetadataFloat(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataFloat(key.GetCategory(), key.GetName()));
break;
case MetadataType::FloatVector2:
SetMetadataFloatVector2(key.Category(), key.Name(), metadataReadAccess->GetMetadataFloatVector2(key.Category(), key.Name()));
SetMetadataFloatVector2(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataFloatVector2(key.GetCategory(), key.GetName()));
break;
case MetadataType::FloatVector3:
SetMetadataFloatVector3(key.Category(), key.Name(), metadataReadAccess->GetMetadataFloatVector3(key.Category(), key.Name()));
SetMetadataFloatVector3(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataFloatVector3(key.GetCategory(), key.GetName()));
break;
case MetadataType::FloatVector4:
SetMetadataFloatVector4(key.Category(), key.Name(), metadataReadAccess->GetMetadataFloatVector4(key.Category(), key.Name()));
SetMetadataFloatVector4(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataFloatVector4(key.GetCategory(), key.GetName()));
break;
case MetadataType::Double:
SetMetadataDouble(key.Category(), key.Name(), metadataReadAccess->GetMetadataDouble(key.Category(), key.Name()));
SetMetadataDouble(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataDouble(key.GetCategory(), key.GetName()));
break;
case MetadataType::DoubleVector2:
SetMetadataDoubleVector2(key.Category(), key.Name(), metadataReadAccess->GetMetadataDoubleVector2(key.Category(), key.Name()));
SetMetadataDoubleVector2(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataDoubleVector2(key.GetCategory(), key.GetName()));
break;
case MetadataType::DoubleVector3:
SetMetadataDoubleVector3(key.Category(), key.Name(), metadataReadAccess->GetMetadataDoubleVector3(key.Category(), key.Name()));
SetMetadataDoubleVector3(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataDoubleVector3(key.GetCategory(), key.GetName()));
break;
case MetadataType::DoubleVector4:
SetMetadataDoubleVector4(key.Category(), key.Name(), metadataReadAccess->GetMetadataDoubleVector4(key.Category(), key.Name()));
SetMetadataDoubleVector4(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataDoubleVector4(key.GetCategory(), key.GetName()));
break;
case MetadataType::String:
SetMetadataString(key.Category(), key.Name(), metadataReadAccess->GetMetadataString(key.Category(), key.Name()));
SetMetadataString(key.GetCategory(), key.GetName(), metadataReadAccess->GetMetadataString(key.GetCategory(), key.GetName()));
break;
case MetadataType::BLOB:
std::vector<uint8_t> data;
metadataReadAccess->GetMetadataBLOB(key.Category(), key.Name(), data);
SetMetadataBLOB(key.Category(), key.Name(), data);
metadataReadAccess->GetMetadataBLOB(key.GetCategory(), key.GetName(), data);
SetMetadataBLOB(key.GetCategory(), key.GetName(), data);
break;
}
}
......@@ -350,7 +350,7 @@ public:
localKeys.reserve(m_keys.size());
for (auto &key : m_keys)
{
if (strcmp(category, key.Category()) == 0 && strcmp(name, key.Name()) == 0)
if (strcmp(category, key.GetCategory()) == 0 && strcmp(name, key.GetName()) == 0)
{
localKeys.push_back(key);
}
......@@ -367,7 +367,7 @@ public:
localKeys.reserve(m_keys.size());
for (auto &key : m_keys)
{
if (strcmp(category, key.Category()) == 0)
if (strcmp(category, key.GetCategory()) == 0)
{
localKeys.push_back(key);
}
......@@ -409,7 +409,7 @@ private:
void RemoveMetadataForKey(const MetadataKey &key)
{
switch(key.Type())
switch(key.GetType())
{
case MetadataType::Int:
m_intData.erase(key);
......
......@@ -867,7 +867,7 @@ Json::Value SerializeVector(T const &vector)
Json::Value SerializeBLOB(MetadataKey const &key, MetadataReadAccess const &readAccess)
{
std::vector<uint8_t> blob;
readAccess.GetMetadataBLOB(key.Category(), key.Name(), blob);
readAccess.GetMetadataBLOB(key.GetCategory(), key.GetName(), blob);
std::vector<char> base64;
Base64Encode(blob.data(), blob.size(), base64);
......@@ -883,27 +883,27 @@ Json::Value SerializeMetadata(MetadataContainer const &metadataContainer)
{
Json::Value metadataJson;
metadataJson["category"] = metadataKey.Category();
metadataJson["name"] = metadataKey.Name();
metadataJson["category"] = metadataKey.GetCategory();
metadataJson["name"] = metadataKey.GetName();
switch(metadataKey.Type())
switch(metadataKey.GetType())
{
case MetadataType::Int: metadataJson["type"] = "Int"; metadataJson["value"] = Json::Value(metadataContainer.GetMetadataInt(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::IntVector2: metadataJson["type"] = "IntVector2"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataIntVector2(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::IntVector3: metadataJson["type"] = "IntVector3"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataIntVector3(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::IntVector4: metadataJson["type"] = "IntVector4"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataIntVector4(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::Float: metadataJson["type"] = "Float"; metadataJson["value"] = Json::Value(metadataContainer.GetMetadataFloat(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::FloatVector2: metadataJson["type"] = "FloatVector2"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataFloatVector2(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::FloatVector3: metadataJson["type"] = "FloatVector3"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataFloatVector3(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::FloatVector4: metadataJson["type"] = "FloatVector4"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataFloatVector4(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::Double: metadataJson["type"] = "Double"; metadataJson["value"] = Json::Value(metadataContainer.GetMetadataDouble(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::DoubleVector2: metadataJson["type"] = "DoubleVector2"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataDoubleVector2(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::DoubleVector3: metadataJson["type"] = "DoubleVector3"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataDoubleVector3(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::DoubleVector4: metadataJson["type"] = "DoubleVector4"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataDoubleVector4(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::String: metadataJson["type"] = "String"; metadataJson["value"] = Json::Value(metadataContainer.GetMetadataString(metadataKey.Category(), metadataKey.Name())); break;
case MetadataType::Int: metadataJson["type"] = "Int"; metadataJson["value"] = Json::Value(metadataContainer.GetMetadataInt(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::IntVector2: metadataJson["type"] = "IntVector2"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataIntVector2(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::IntVector3: metadataJson["type"] = "IntVector3"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataIntVector3(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::IntVector4: metadataJson["type"] = "IntVector4"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataIntVector4(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::Float: metadataJson["type"] = "Float"; metadataJson["value"] = Json::Value(metadataContainer.GetMetadataFloat(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::FloatVector2: metadataJson["type"] = "FloatVector2"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataFloatVector2(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::FloatVector3: metadataJson["type"] = "FloatVector3"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataFloatVector3(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::FloatVector4: metadataJson["type"] = "FloatVector4"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataFloatVector4(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::Double: metadataJson["type"] = "Double"; metadataJson["value"] = Json::Value(metadataContainer.GetMetadataDouble(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::DoubleVector2: metadataJson["type"] = "DoubleVector2"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataDoubleVector2(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::DoubleVector3: metadataJson["type"] = "DoubleVector3"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataDoubleVector3(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::DoubleVector4: metadataJson["type"] = "DoubleVector4"; metadataJson["value"] = SerializeVector(metadataContainer.GetMetadataDoubleVector4(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::String: metadataJson["type"] = "String"; metadataJson["value"] = Json::Value(metadataContainer.GetMetadataString(metadataKey.GetCategory(), metadataKey.GetName())); break;
case MetadataType::BLOB: metadataJson["type"] = "BLOB"; metadataJson["value"] = SerializeBLOB(metadataKey, metadataContainer); break;
}
......
......@@ -87,27 +87,27 @@ TEST(IOTests, CreateSyntheticVDSAndVerifyUpload)
OpenVDS::MetadataContainer metadata;
for (auto &key : inMemoryLayout->GetMetadataKeys())
{
switch(key.Type())
switch(key.GetType())
{
case OpenVDS::MetadataType::Int: metadata.SetMetadataInt(key.Category(), key.Name(), inMemoryLayout->GetMetadataInt(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::IntVector2: metadata.SetMetadataIntVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataIntVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::IntVector3: metadata.SetMetadataIntVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataIntVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::IntVector4: metadata.SetMetadataIntVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataIntVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::Float: metadata.SetMetadataFloat(key.Category(), key.Name(), inMemoryLayout->GetMetadataFloat(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::FloatVector2: metadata.SetMetadataFloatVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataFloatVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::FloatVector3: metadata.SetMetadataFloatVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataFloatVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::FloatVector4: metadata.SetMetadataFloatVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataFloatVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::Double: metadata.SetMetadataDouble(key.Category(), key.Name(), inMemoryLayout->GetMetadataDouble(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::DoubleVector2: metadata.SetMetadataDoubleVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataDoubleVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::DoubleVector3: metadata.SetMetadataDoubleVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataDoubleVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::DoubleVector4: metadata.SetMetadataDoubleVector2(key.Category(), key.Name(), inMemoryLayout->GetMetadataDoubleVector2(key.Category(), key.Name())); break;
case OpenVDS::MetadataType::String: metadata.SetMetadataString(key.Category(), key.Name(), std::string(inMemoryLayout->GetMetadataString(key.Category(), key.Name()))); break;
case OpenVDS::MetadataType::Int: metadata.SetMetadataInt(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataInt(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::IntVector2: metadata.SetMetadataIntVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataIntVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::IntVector3: metadata.SetMetadataIntVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataIntVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::IntVector4: metadata.SetMetadataIntVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataIntVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::Float: metadata.SetMetadataFloat(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataFloat(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::FloatVector2: metadata.SetMetadataFloatVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataFloatVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::FloatVector3: metadata.SetMetadataFloatVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataFloatVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::FloatVector4: metadata.SetMetadataFloatVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataFloatVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::Double: metadata.SetMetadataDouble(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataDouble(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::DoubleVector2: metadata.SetMetadataDoubleVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataDoubleVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::DoubleVector3: metadata.SetMetadataDoubleVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataDoubleVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::DoubleVector4: metadata.SetMetadataDoubleVector2(key.GetCategory(), key.GetName(), inMemoryLayout->GetMetadataDoubleVector2(key.GetCategory(), key.GetName())); break;
case OpenVDS::MetadataType::String: metadata.SetMetadataString(key.GetCategory(), key.GetName(), std::string(inMemoryLayout->GetMetadataString(key.GetCategory(), key.GetName()))); break;
case OpenVDS::MetadataType::BLOB:
{
std::vector<uint8_t> blob;
inMemoryLayout->GetMetadataBLOB(key.Category(), key.Name(), blob);
metadata.SetMetadataBLOB(key.Category(), key.Name(), blob);
inMemoryLayout->GetMetadataBLOB(key.GetCategory(), key.GetName(), blob);
metadata.SetMetadataBLOB(key.GetCategory(), key.GetName(), blob);
break;
}
}
......
......@@ -102,49 +102,49 @@ Json::Value getJsonFromVector(const OpenVDS::Vector<T, N> &vec)
Json::Value getJsonFromMetadata(const OpenVDS::MetadataKey &key, OpenVDS::VolumeDataLayout *layout)
{
Json::Value value;
value["category"] = key.Category();
value["name"] = key.Name();
value["type"] = MetadataTypeToString(key.Type());
switch (key.Type())
value["category"] = key.GetCategory();
value["name"] = key.GetName();
value["type"] = MetadataTypeToString(key.GetType());
switch (key.GetType())
{
case OpenVDS::MetadataType::Int:
value["value"] = layout->GetMetadataInt(key.Category(), key.Name());
value["value"] = layout->GetMetadataInt(key.GetCategory(), key.GetName());
break;
case OpenVDS::MetadataType::IntVector2:
value["value"] = getJsonFromVector(layout->GetMetadataIntVector2(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataIntVector2(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::IntVector3:
value["value"] = getJsonFromVector(layout->GetMetadataIntVector3(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataIntVector3(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::IntVector4:
value["value"] = getJsonFromVector(layout->GetMetadataIntVector4(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataIntVector4(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::Float:
value["value"] = layout->GetMetadataFloat(key.Category(), key.Name());
value["value"] = layout->GetMetadataFloat(key.GetCategory(), key.GetName());
break;
case OpenVDS::MetadataType::FloatVector2:
value["value"] = getJsonFromVector(layout->GetMetadataFloatVector2(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataFloatVector2(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::FloatVector3:
value["value"] = getJsonFromVector(layout->GetMetadataFloatVector3(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataFloatVector3(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::FloatVector4:
value["value"] = getJsonFromVector(layout->GetMetadataFloatVector4(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataFloatVector4(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::Double:
value["value"] = layout->GetMetadataDouble(key.Category(), key.Name());
value["value"] = layout->GetMetadataDouble(key.GetCategory(), key.GetName());
break;
case OpenVDS::MetadataType::DoubleVector2:
value["value"] = getJsonFromVector(layout->GetMetadataDoubleVector2(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataDoubleVector2(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::DoubleVector3:
value["value"] = getJsonFromVector(layout->GetMetadataDoubleVector3(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataDoubleVector3(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::DoubleVector4:
value["value"] = getJsonFromVector(layout->GetMetadataDoubleVector4(key.Category(), key.Name()));
value["value"] = getJsonFromVector(layout->GetMetadataDoubleVector4(key.GetCategory(), key.GetName()));
break;
case OpenVDS::MetadataType::String:
value["value"] = layout->GetMetadataString(key.Category(), key.Name());
value["value"] = layout->GetMetadataString(key.GetCategory(), key.GetName());
break;
default:
break;
......@@ -315,9 +315,9 @@ int main(int argc, char **argv)
for (auto &key : layout->GetMetadataKeys())
{
Json::Value jsonKey;
jsonKey["type"] = MetadataTypeToString(key.Type());
jsonKey["category"] = key.Category();
jsonKey["name"] = key.Name();
jsonKey["type"] = MetadataTypeToString(key.GetType());
jsonKey["category"] = key.GetCategory();
jsonKey["name"] = key.GetName();
metaKeysInfo.append(jsonKey);
}
root["metaKeysInfo"] = metaKeysInfo;
......@@ -329,11 +329,11 @@ int main(int argc, char **argv)
std::vector<OpenVDS::MetadataKey> to_print_blobs;
for (auto &key : layout->GetMetadataKeys())
{
if (metadataPrintName.size() && metadataPrintName != key.Name())
if (metadataPrintName.size() && metadataPrintName != key.GetName())
continue;
if (metadataPrintCategory.size() && metadataPrintCategory != key.Category())
if (metadataPrintCategory.size() && metadataPrintCategory != key.GetCategory())
continue;
if (key.Type() == OpenVDS::MetadataType::BLOB)
if (key.GetType() == OpenVDS::MetadataType::BLOB)
to_print_blobs.push_back(key);
else
to_print.push_back(key);
......@@ -345,7 +345,7 @@ int main(int argc, char **argv)
{
auto &key = to_print_blobs.front();
std::vector<uint8_t> vector;
layout->GetMetadataBLOB(key.Category(), key.Name(), vector);
layout->GetMetadataBLOB(key.GetCategory(), key.GetName(), vector);
bool decodeEBCDIC = false;
if (metadataAutoDecodeEBCDIC)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment