OpenVDB 9.0.0
Public Types | Public Member Functions | Friends | List of all members
MappedFile Class Reference

Handle to control the lifetime of a memory-mapped .vdb file. More...

#include <openvdb/io/io.h>

Public Types

using Ptr = SharedPtr< MappedFile >
 
using Notifier = std::function< void(std::string)>
 

Public Member Functions

 ~MappedFile ()
 
 MappedFile (const MappedFile &)=delete
 
MappedFileoperator= (const MappedFile &)=delete
 
std::string filename () const
 Return the filename of the mapped file. More...
 
SharedPtr< std::streambuf > createBuffer () const
 Return a new stream buffer for the mapped file. More...
 
void setNotifier (const Notifier &)
 Register a function that will be called with this file's name when the file is unmapped. More...
 
void clearNotifier ()
 Deregister the notifier. More...
 

Friends

class File
 
class ::TestMappedFile
 

Detailed Description

Handle to control the lifetime of a memory-mapped .vdb file.

Member Typedef Documentation

◆ Notifier

using Notifier = std::function<void(std::string )>

◆ Ptr

Constructor & Destructor Documentation

◆ ~MappedFile()

~MappedFile ( )

◆ MappedFile()

MappedFile ( const MappedFile )
delete

Member Function Documentation

◆ clearNotifier()

void clearNotifier ( )

Deregister the notifier.

◆ createBuffer()

SharedPtr< std::streambuf > createBuffer ( ) const

Return a new stream buffer for the mapped file.

Typical usage is

openvdb::io::MappedFile::Ptr mappedFile = ...;
auto buf = mappedFile->createBuffer();
std::istream istrm{buf.get()};
// Read from istrm...

The buffer must persist as long as the stream is open.

◆ filename()

std::string filename ( ) const

Return the filename of the mapped file.

◆ operator=()

MappedFile & operator= ( const MappedFile )
delete

◆ setNotifier()

void setNotifier ( const Notifier )

Register a function that will be called with this file's name when the file is unmapped.

Friends And Related Function Documentation

◆ ::TestMappedFile

friend class ::TestMappedFile
friend

◆ File

friend class File
friend