Uploaded image for project: 'OpenVDB'
  1. OpenVDB
  2. OVDB-144

Verifying Shared Descriptors

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • Points
    • None

      We've talked about this before. Most of the OpenVDB points tools currently assume that the Descriptor is shared and we don't even check to make sure.

      I propose we improve this by introducing points::isDescriptorShared() and points::checkDescriptorIsShared() with the latter looking something like this:

      template <typename TreeT>
      void checkDescriptorIsShared(const TreeT& tree)
      {
          // checks descriptorPtr.use_count() >= tree.leafCount()
          if (!points::isDescriptorShared(tree, /*strict=*/false)) {
              OPENVDB_THROW(RuntimeError, "This method requires a shared Descriptor.");
          }
          // checks leaf node pointers when asserts enabled       
          assert(points::isDescriptorShared(tree, /*strict=*/true));
      }
      

      The strict check will make sure that all the pointers are the same and the fast check will simply test the reference count.

            Unassigned Unassigned
            danrbailey danrbailey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: