Go to the documentation of this file.
6 #ifndef OPENVDB_IO_FILE_HAS_BEEN_INCLUDED
7 #define OPENVDB_IO_FILE_HAS_BEEN_INCLUDED
33 using NameMap = std::multimap<Name, GridDescriptor>;
36 explicit File(
const std::string& filename);
128 template<
typename Gr
idPtrContainerT>
129 void write(
const GridPtrContainerT&,
const MetaMap& =
MetaMap())
const;
147 Name gridName()
const {
return GridDescriptor::nameAsString(mIter->second.uniqueName()); }
161 void readGridDescriptors(std::istream&);
188 void readGridPartial(
GridBase::Ptr, std::istream&,
bool isInstance,
bool readTopology)
const;
200 const NameMap& gridDescriptors()
const;
203 std::istream& inputStream()
const;
205 friend class ::TestFile;
206 friend class ::TestStream;
209 std::unique_ptr<Impl> mImpl;
219 this->writeGrids(grids, meta);
223 template<
typename Gr
idPtrContainerT>
225 File::write(
const GridPtrContainerT& container,
const MetaMap& meta)
const
228 std::copy(container.begin(), container.end(), std::back_inserter(grids));
229 this->writeGrids(grids, meta);
236 #endif // OPENVDB_IO_FILE_HAS_BEEN_INCLUDED
NameIterator(const NameMapCIter &iter)
Definition: File.h:136
MetaMap::Ptr getMetadata() const
Return (in a newly created MetaMap) the file-level metadata.
File(const std::string &filename)
SharedPtr< GridPtrVec > GridPtrVecPtr
Definition: Grid.h:512
std::vector< GridBase::ConstPtr > GridCPtrVec
Definition: Grid.h:514
Grid serializer/unserializer.
Definition: Archive.h:33
SharedPtr< Archive > copy() const override
Return a copy of this archive.
bool operator!=(const NameIterator &iter) const
Definition: File.h:143
GridType::Ptr createGrid(const typename GridType::ValueType &background)
Create a new grid of type GridType with a given background value.
Definition: Grid.h:1737
Grid archive associated with a file on disk.
Definition: File.h:31
Name operator*() const
Definition: File.h:145
File & operator=(const File &other)
Assignment.
NameIterator & operator++()
Definition: File.h:140
bool isOpen() const
Return true if the file has been opened for reading.
Library and file format version numbers.
NameIterator(const NameIterator &)=default
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:249
std::string Name
Definition: Name.h:17
bool hasGrid(const Name &) const
Return true if a grid of the given name exists in this file.
GridPtrVecPtr readAllGridMetadata()
Read just the grid metadata and transforms from the file and return a list of pointers to grids that ...
GridPtrVecPtr getGrids() const
Read the entire contents of the file and return a list of grid pointers.
Name gridName() const
Definition: File.h:147
~NameIterator()
Definition: File.h:138
uint64_t Index64
Definition: openvdb/Types.h:31
std::function< void(std::string)> Notifier
Definition: io.h:156
std::multimap< Name, GridDescriptor > NameMap
Definition: File.h:33
const std::string & filename() const
Return the name of the file with which this archive is associated.
SharedPtr< const GridBase > ConstPtr
Definition: Grid.h:81
NameMap::const_iterator NameMapCIter
Definition: File.h:34
NameIterator beginName() const
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:147
GridBase::Ptr readGrid(const Name &, const BBoxd &)
Read a grid, including its data blocks, but only where it intersects the given world-space bounding b...
Index64 getSize() const
Return this file's current size on disk in bytes.
Definition: GridDescriptor.h:20
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,...
GridBase::Ptr readGrid(const Name &)
Read an entire grid, including all of its data blocks.
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.
GridBase::Ptr readGridMetadata(const Name &)
Read a grid's metadata and transform only.
NameIterator endName() const
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:95
bool operator==(const NameIterator &iter) const
Definition: File.h:142
std::shared_ptr< T > SharedPtr
Definition: openvdb/Types.h:92
Definition: openvdb/Exceptions.h:13
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...
SharedPtr< GridBase > Ptr
Definition: Grid.h:80
void close()
Close the file once we are done reading from it.