mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 14:22:33 +00:00
Allow inspection of rocskdb keys in python
This commit is contained in:
@@ -207,6 +207,23 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
|
|||||||
return $self->schema()->name();
|
return $self->schema()->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject* key_value_store_query(const std::string& key) const {
|
||||||
|
auto* storage = std::visit([](auto& m) -> IfcParse::impl::rocks_db_file_storage const * {
|
||||||
|
if constexpr (std::is_same_v<std::decay_t<decltype(m)>, IfcParse::impl::rocks_db_file_storage>) {
|
||||||
|
return &m;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}, $self->storage_);
|
||||||
|
if (!storage) {
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
std::string value;
|
||||||
|
if (storage->db->Get(storage->ropts, key, &value) != rocksdb::Status::OK()) {
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
return PyBytes_FromStringAndSize(value.data(), value.size());
|
||||||
|
}
|
||||||
|
|
||||||
%pythoncode %{
|
%pythoncode %{
|
||||||
# Hide the getters with read-only property implementations
|
# Hide the getters with read-only property implementations
|
||||||
header = property(header)
|
header = property(header)
|
||||||
@@ -593,6 +610,7 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
|
|||||||
%include "../ifcparse/file_open_status.h"
|
%include "../ifcparse/file_open_status.h"
|
||||||
%include "../ifcparse/IfcBaseClass.h"
|
%include "../ifcparse/IfcBaseClass.h"
|
||||||
%include "../ifcparse/IfcSchema.h"
|
%include "../ifcparse/IfcSchema.h"
|
||||||
|
%include "../serializers/RocksDbSerializer.h"
|
||||||
|
|
||||||
// The IfcFile* returned by open() is to be freed by SWIG/Python
|
// The IfcFile* returned by open() is to be freed by SWIG/Python
|
||||||
%newobject open;
|
%newobject open;
|
||||||
|
|||||||
@@ -201,6 +201,7 @@
|
|||||||
#include "../serializers/WavefrontObjSerializer.h"
|
#include "../serializers/WavefrontObjSerializer.h"
|
||||||
#include "../serializers/ColladaSerializer.h"
|
#include "../serializers/ColladaSerializer.h"
|
||||||
#include "../serializers/HdfSerializer.h"
|
#include "../serializers/HdfSerializer.h"
|
||||||
|
#include "../serializers/RocksDbSerializer.h"
|
||||||
|
|
||||||
#ifdef HAS_SCHEMA_2x3
|
#ifdef HAS_SCHEMA_2x3
|
||||||
#include "../ifcparse/Ifc2x3.h"
|
#include "../ifcparse/Ifc2x3.h"
|
||||||
@@ -301,6 +302,7 @@ constexpr bool is_std_vector_vector_v = is_std_vector_vector<T>::value;
|
|||||||
#include "../serializers/XmlSerializer.h"
|
#include "../serializers/XmlSerializer.h"
|
||||||
#include "../serializers/GltfSerializer.h"
|
#include "../serializers/GltfSerializer.h"
|
||||||
#include "../serializers/TtlWktSerializer.h"
|
#include "../serializers/TtlWktSerializer.h"
|
||||||
|
#include "../serializers/RocksDbSerializer.h"
|
||||||
|
|
||||||
#ifdef HAS_SCHEMA_2x3
|
#ifdef HAS_SCHEMA_2x3
|
||||||
#include "../ifcparse/Ifc2x3.h"
|
#include "../ifcparse/Ifc2x3.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user