Skip to content

Commit 20cd916

Browse files
authored
Merge pull request #2180 from danrbailey/remove_treebase_io
Remove TreeBase readTopology() and writeTopology()
2 parents d1438a1 + ea040c9 commit 20cd916

2 files changed

Lines changed: 11 additions & 21 deletions

File tree

openvdb/openvdb/tree/Tree.h

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ class OPENVDB_API TreeBase
151151
/// @brief Read the tree topology from a stream.
152152
///
153153
/// This will read the tree structure and tile values, but not voxel data.
154-
virtual void readTopology(std::istream&, bool saveFloatAsHalf = false);
154+
virtual void readTopology(std::istream&, bool saveFloatAsHalf = false) = 0;
155155
/// @brief Write the tree topology to a stream.
156156
///
157157
/// This will write the tree structure and tile values, but not voxel data.
158-
virtual void writeTopology(std::ostream&, bool saveFloatAsHalf = false) const;
158+
virtual void writeTopology(std::ostream&, bool saveFloatAsHalf = false) const = 0;
159159

160160
/// Read all data buffers for this tree.
161161
virtual void readBuffers(std::istream&, bool saveFloatAsHalf = false) = 0;
@@ -1130,23 +1130,6 @@ struct Tree5 {
11301130
////////////////////////////////////////
11311131

11321132

1133-
inline void
1134-
TreeBase::readTopology(std::istream& is, bool /*saveFloatAsHalf*/)
1135-
{
1136-
int32_t bufferCount;
1137-
is.read(reinterpret_cast<char*>(&bufferCount), sizeof(int32_t));
1138-
if (bufferCount != 1) OPENVDB_LOG_WARN("multi-buffer trees are no longer supported");
1139-
}
1140-
1141-
1142-
inline void
1143-
TreeBase::writeTopology(std::ostream& os, bool /*saveFloatAsHalf*/) const
1144-
{
1145-
int32_t bufferCount = 1;
1146-
os.write(reinterpret_cast<char*>(&bufferCount), sizeof(int32_t));
1147-
}
1148-
1149-
11501133
inline void
11511134
TreeBase::print(std::ostream& os, int /*verboseLevel*/) const
11521135
{
@@ -1273,7 +1256,9 @@ void
12731256
Tree<RootNodeType>::readTopology(std::istream& is, bool saveFloatAsHalf)
12741257
{
12751258
this->clearAllAccessors();
1276-
TreeBase::readTopology(is, saveFloatAsHalf);
1259+
int32_t bufferCount;
1260+
is.read(reinterpret_cast<char*>(&bufferCount), sizeof(int32_t));
1261+
if (bufferCount != 1) OPENVDB_LOG_WARN("multi-buffer trees are no longer supported");
12771262
mRoot.readTopology(is, saveFloatAsHalf);
12781263
}
12791264

@@ -1282,7 +1267,8 @@ template<typename RootNodeType>
12821267
void
12831268
Tree<RootNodeType>::writeTopology(std::ostream& os, bool saveFloatAsHalf) const
12841269
{
1285-
TreeBase::writeTopology(os, saveFloatAsHalf);
1270+
int32_t bufferCount = 1;
1271+
os.write(reinterpret_cast<char*>(&bufferCount), sizeof(int32_t));
12861272
mRoot.writeTopology(os, saveFloatAsHalf);
12871273
}
12881274

pendingchanges/treebaseio.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
OpenVDB:
2+
API changes:
3+
- TreeBase::readTopology() and TreeBase::writeTopology() are now pure virtual. Derived
4+
classes of TreeBase now need to read and write int32_t(1) to remain backwards-compatible.

0 commit comments

Comments
 (0)