Go to the documentation of this file.
33 #ifndef OPENVDB_IO_FILE_HAS_BEEN_INCLUDED
34 #define OPENVDB_IO_FILE_HAS_BEEN_INCLUDED
36 #include <openvdb/version.h>
60 using NameMap = std::multimap<Name, GridDescriptor>;
63 explicit File(
const std::string& filename);
143 #if OPENVDB_ABI_VERSION_NUMBER >= 3
157 template<
typename Gr
idPtrContainerT>
158 void write(
const GridPtrContainerT&,
const MetaMap& =
MetaMap())
const;
176 Name gridName()
const {
return GridDescriptor::nameAsString(mIter->second.uniqueName()); }
190 void readGridDescriptors(std::istream&);
208 #if OPENVDB_ABI_VERSION_NUMBER >= 3
219 void readGridPartial(
GridBase::Ptr, std::istream&,
bool isInstance,
bool readTopology)
const;
231 const NameMap& gridDescriptors()
const;
234 std::istream& inputStream()
const;
236 friend class ::TestFile;
237 friend class ::TestStream;
240 std::unique_ptr<Impl> mImpl;
250 this->writeGrids(grids, meta);
254 template<
typename Gr
idPtrContainerT>
256 File::write(
const GridPtrContainerT& container,
const MetaMap& meta)
const
259 std::copy(container.begin(), container.end(), std::back_inserter(grids));
260 this->writeGrids(grids, meta);
267 #endif // OPENVDB_IO_FILE_HAS_BEEN_INCLUDED
void setCopyMaxBytes(Index64 bytes)
If this file is opened with delayed loading enabled, make a private copy of the file if its size in b...
File(const std::string &filename)
SharedPtr< Archive > copy() const override
Return a copy of this archive.
MetaMap::Ptr getMetadata() const
Return (in a newly created MetaMap) the file-level metadata.
Grid serializer/unserializer.
Definition: Archive.h:60
NameIterator & operator++()
Definition: File.h:169
bool operator!=(const NameIterator &iter) const
Definition: File.h:172
bool isOpen() const
Return true if the file has been opened for reading.
File & operator=(const File &other)
Assignment.
Grid archive associated with a file on disk.
Definition: File.h:58
Name operator*() const
Definition: File.h:174
GridPtrVecPtr readAllGridMetadata()
Read just the grid metadata and transforms from the file and return a list of pointers to grids that ...
~NameIterator()
Definition: File.h:167
std::vector< GridBase::ConstPtr > GridCPtrVec
Definition: Grid.h:442
std::shared_ptr< T > SharedPtr
Definition: Types.h:139
std::function< void(std::string)> Notifier
Definition: io.h:172
bool hasGrid(const Name &) const
Return true if a grid of the given name exists in this file.
std::multimap< Name, GridDescriptor > NameMap
Definition: File.h:60
const std::string & filename() const
Return the name of the file with which this archive is associated.
NameIterator(const NameIterator &)=default
GridPtrVecPtr getGrids() const
Read the entire contents of the file and return a list of grid pointers.
SharedPtr< const GridBase > ConstPtr
Definition: Grid.h:108
Name gridName() const
Definition: File.h:176
NameMap::const_iterator NameMapCIter
Definition: File.h:61
GridType::Ptr createGrid(const typename GridType::ValueType &background)
Create a new grid of type GridType with a given background value.
Definition: Grid.h:1582
NameIterator beginName() const
GridBase::Ptr readGrid(const Name &)
Read an entire grid, including all of its data blocks.
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
GridBase::Ptr readGridMetadata(const Name &)
Read a grid's metadata and transform only.
Index64 getSize() const
Return this file's current size on disk in bytes.
bool operator==(const NameIterator &iter) const
Definition: File.h:171
uint64_t Index64
Definition: Types.h:60
bool open(bool delayLoad=true, const MappedFile::Notifier &=MappedFile::Notifier())
Open the file, read the file header and the file-level metadata, and populate the grid descriptors,...
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:265
Index64 copyMaxBytes() const
Return the size in bytes above which this file will not be automatically copied during delayed loadin...
File(const File &other)
Copy constructor.
SharedPtr< GridPtrVec > GridPtrVecPtr
Definition: Grid.h:440
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
std::string Name
Definition: Name.h:44
NameIterator endName() const
Definition: GridDescriptor.h:47
SharedPtr< GridBase > Ptr
Definition: Grid.h:107
Definition: Exceptions.h:40
NameIterator(const NameMapCIter &iter)
Definition: File.h:165
void close()
Close the file once we are done reading from it.