Loading...
Searching...
No Matches
Name.h
Go to the documentation of this file.
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
#ifndef OPENVDB_UTIL_NAME_HAS_BEEN_INCLUDED
#define OPENVDB_UTIL_NAME_HAS_BEEN_INCLUDED
#include <openvdb/Platform.h>
#include <openvdb/version.h>
#include <string>
#include <iostream>
#include <vector>
namespace openvdb {
OPENVDB_USE_VERSION_NAMESPACE
namespace OPENVDB_VERSION_NAME {
typedef std::string Name;
inline Name
readString(std::istream& is)
{
uint32_t size;
is.read(reinterpret_cast<char*>(&size), sizeof(uint32_t));
std::string buffer(size, ' ');
if (size>0) is.read(&buffer[0], size);
return buffer;
}
inline void
writeString(std::ostream& os, const Name& name)
{
uint32_t size = uint32_t(name.size());
os.write(reinterpret_cast<char*>(&size), sizeof(uint32_t));
os.write(&name[0], size);
}
} // namespace OPENVDB_VERSION_NAME
} // namespace openvdb
#endif // OPENVDB_UTIL_NAME_HAS_BEEN_INCLUDED
Platform.h
openvdb::v10_0::Name
std::string Name
Definition Name.h:17
openvdb::v10_0::readString
Name readString(std::istream &is)
Definition Name.h:20
openvdb::v10_0::writeString
void writeString(std::ostream &os, const Name &name)
Definition Name.h:31
openvdb
Definition Exceptions.h:13
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:212