Commit 95d036c2 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Expose the verid attribute as a stringized UUID in OpenZGY/C++ and the zgydump tool.

parent 5a60bdeb
......@@ -27,6 +27,7 @@
#include "impl/histogramdata.h"
#include "impl/genlod.h"
#include "impl/compression.h"
#include "impl/guid.h"
#ifdef _MSC_VER
#pragma warning(push)
......@@ -278,6 +279,23 @@ public:
return _meta->ih().nlods();
}
// Currently not needed by any client.
//virtual std::string dataid() const override
//{
// return InternalZGY::GUID(_meta->ih().dataid()).toString();
//}
virtual std::string verid() const override
{
return InternalZGY::GUID(_meta->ih().verid()).toString();
}
// Currently not needed by any client.
//virtual std::string previd() const override
//{
// return InternalZGY::GUID(_meta->ih().previd()).toString();
//}
virtual void
dump(std::ostream& os) const override
{
......
......@@ -898,6 +898,13 @@ public:
virtual size3i_t bricksize() const = 0; /**< \brief Size of one brick. Almost always (64,64,64), change at your own peril. */
virtual std::vector<size3i_t> brickcount() const = 0; /**< \brief Number of bricks at each resolution (LOD) level. */
virtual int32_t nlods() const = 0; /**< \brief Number of resolution (LOD) levels. */
// Only expose the guids we think the application will need.
// Note that OpenZGY doesn't really support updates,
// so dataid() and previd() are not very useful.
//virtual std::string dataid() const = 0; /**< GUID set on file creation. */
virtual std::string verid() const = 0; /**< GUID set each time the file is changed. */
//virtual std::string previd() const = 0; /**< GUID before last change. */
// The Python version has meta() as a dict holding all the meta data,
// this isn't really useful in C++ and just makes it harder to see which
// metadata is being used. [set_]numthreads is N/A in this accessor.
......
......@@ -194,6 +194,29 @@ public:
return writer_->nlods();
}
// Currently not needed by any client.
//virtual std::string dataid() const override
//{
// // Not allowed to change after file is opened.
// // std::lock_guard<std::mutex> lk(mutex_);
// return writer_->dataid();
//}
virtual std::string verid() const override
{
// Not allowed to change after file is opened.
// std::lock_guard<std::mutex> lk(mutex_);
return writer_->verid();
}
// Currently not needed by any client.
//virtual std::string previd() const override
//{
// // Not allowed to change after file is opened.
// // std::lock_guard<std::mutex> lk(mutex_);
// return writer_->previd();
//}
virtual void dump(std::ostream& os) const override
{
std::lock_guard<std::mutex> lk(mutex_);
......
......@@ -61,6 +61,9 @@ public:
virtual size3i_t bricksize() const {return size3i_t{64,64,64};}
virtual std::vector<size3i_t> brickcount() const {throw std::runtime_error("brickcount() has not been mocked");}
virtual int32_t nlods() const {throw std::runtime_error("nlods() has not been mocked");}
virtual std::string dataid() const {return "0000000a-000b-000c-000d-333333333333";}
virtual std::string verid() const {return "0000000a-000b-000c-000d-222222222222";}
virtual std::string previd() const {return "0000000a-000b-000c-000d-111111111111";}
virtual void meta() const {throw std::runtime_error("meta() has not been mocked");}
virtual int32_t numthreads() const {throw std::runtime_error("numthreads() has not been mocked");}
virtual void set_numthreads(int32_t) {throw std::runtime_error("set_numthreads() has not been mocked");}
......
......@@ -284,6 +284,9 @@ dump_basic(std::shared_ptr<OpenZGY::IZgyReader> r, const std::string& filename,
os << "File name = '" << filename << "'\n"
<< "File size (bytes) = " << filestats.fileSize() << "\n"
<< "File format and version = " << r->datatype() << " ZGY version " << filestats.fileVersion() << "\n"
//<< "Data identifier = " << r->dataid() << "\n"
<< "Current data Version = " << r->verid() << "\n"
//<< "Previous data version = " << r->previd() << "\n"
<< "Brick size I,J,K = " << "(" << r->bricksize()[0] << ", " << r->bricksize()[1] << ", " << r->bricksize()[2] << ")\n"
<< "Number of bricks I,J,K = " << "(" << r->brickcount()[0][0] << ", " << r->brickcount()[0][1] << ", " << r->brickcount()[0][2] << ")\n"
<< "Number of LODs = " << r->nlods() << "\n"
......
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