4#ifndef OPENVDB_METADATA_HAS_BEEN_INCLUDED
5#define OPENVDB_METADATA_HAS_BEEN_INCLUDED
46 virtual std::string
str()
const = 0;
61 void read(std::istream&);
63 void write(std::ostream&)
const;
80 static Index32 readSize(std::istream&);
82 void writeSize(std::ostream&)
const;
102 std::string
str()
const override {
return (mBytes.empty() ?
"" :
"<binary data>"); }
103 bool asBool()
const override {
return !mBytes.empty(); }
132 Name typeName()
const override;
134 void copy(
const Metadata& other)
override;
135 std::string str()
const override;
136 bool asBool()
const override;
140 void setValue(
const T&);
143 const T& value()
const;
152 static void registerType();
153 static void unregisterType();
154 static bool isRegisteredType();
157 void readValue(std::istream&,
Index32 numBytes)
override;
158 void writeValue(std::ostream&)
const override;
172Metadata::writeSize(std::ostream& os)
const
174 const Index32 n = this->size();
175 os.write(
reinterpret_cast<const char*
>(&n),
sizeof(
Index32));
180Metadata::readSize(std::istream& is)
183 is.read(
reinterpret_cast<char*
>(&n),
sizeof(
Index32));
189Metadata::read(std::istream& is)
191 const Index32 numBytes = this->readSize(is);
192 this->readValue(is, numBytes);
197Metadata::write(std::ostream& os)
const
200 this->writeValue(os);
266 metadata->copy(*
this);
285 is.read(
reinterpret_cast<char*
>(&mValue), this->size());
292 os.write(
reinterpret_cast<const char*
>(&mValue), this->size());
299 std::ostringstream ostr;
346 return (mValue ?
"true" :
"false");
353 ostr << metadata.
str();
384 return static_cast<Index32>(mValue.size());
400 mValue.resize(
size,
'\0');
401 is.read(&mValue[0],
size);
408 os.write(
reinterpret_cast<const char*
>(&mValue[0]), this->
size());
OPENVDB_API std::ostream & operator<<(std::ostream &os, half h)
Output h to os, formatted as a float.
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Definition Exceptions.h:64
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition Math.h:337
std::string Name
Definition Name.h:19
std::ostream & operator<<(std::ostream &ostr, const Metadata &metadata)
Write a Metadata to an output stream.
Definition Metadata.h:351
uint32_t Index32
Definition Types.h:52
std::shared_ptr< T > SharedPtr
Definition Types.h:114
Definition Exceptions.h:13
#define OPENVDB_THROW(exception, message)
Definition Exceptions.h:74
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:212