ddc
Public Member Functions | Public Attributes | List of all members
ddcFileOrMMap Class Reference

#include <ddcMMap.h>

Inheritance diagram for ddcFileOrMMap:
Inheritance graph
[legend]
Collaboration diagram for ddcFileOrMMap:
Collaboration graph
[legend]

Public Member Functions

 ddcFileOrMMap ()
 
 ~ddcFileOrMMap ()
 
bool opened () const
 check if file is currently mapped or opened More...
 
 operator bool () const
 implicit cast-to-bool wraps opened() More...
 
void Open (bool useMemoryMap, const std::string &filename)
 open or memory-map filename More...
 
void Close ()
 close or un-map current file More...
 
bool ReadBuffer (file_off_t offset, size_t nbytes, BYTE *buffer) const
 read nbytes of data at offset offset from file or memory-map into buffer More...
 
bool ReadFromFile (file_off_t start, size_t nbytes, BYTE *buffer) const
 guts for ReadBuffer() on m_File More...
 
- Public Member Functions inherited from ddcLockable
 ddcLockable ()
 
virtual ~ddcLockable ()
 
int lock () const
 
int unlock () const
 

Public Attributes

bool m_UseMemoryMap
 
ddcMMap< char > m_mmap
 
FILE * m_File
 
- Public Attributes inherited from ddcLockable
pthread_mutex_t m_Mutex
 

Constructor & Destructor Documentation

◆ ddcFileOrMMap()

ddcFileOrMMap::ddcFileOrMMap ( )
inline

◆ ~ddcFileOrMMap()

ddcFileOrMMap::~ddcFileOrMMap ( )
inline

Member Function Documentation

◆ opened()

bool ddcFileOrMMap::opened ( ) const
inline

check if file is currently mapped or opened

References ddcMMap< T >::opened().

Here is the call graph for this function:

◆ operator bool()

ddcFileOrMMap::operator bool ( ) const
inline

implicit cast-to-bool wraps opened()

References ddcMMap< T >::filename(), ddcMMap< T >::nbytes(), and ddcMMap< T >::opened().

Here is the call graph for this function:

◆ Open()

void ddcFileOrMMap::Open ( bool  useMemoryMap,
const std::string &  filename 
)

open or memory-map filename

References Format(), ddcLockable::lock(), m_File, m_mmap, m_UseMemoryMap, ddcMMap< T >::open(), and ddcLockable::unlock().

Referenced by CBiblIndex::LoadBibl(), CIndexSetForQueryingStage::LoadIndexSet(), and CStringIndexSet::OpenStorageFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Close()

void ddcFileOrMMap::Close ( )

close or un-map current file

References ddcMMap< T >::close(), ddcLockable::lock(), m_File, m_mmap, and ddcLockable::unlock().

Referenced by CStringIndexSet::CloseStorageFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadBuffer()

bool ddcFileOrMMap::ReadBuffer ( file_off_t  offset,
size_t  nbytes,
BYTE buffer 
) const

read nbytes of data at offset offset from file or memory-map into buffer

References ddcMMap< T >::m_data, m_mmap, and ReadFromFile().

Referenced by CBiblIndex::GetFullBibliographyOfHit(), CStringIndexSet::GetTokenIndexId(), CStringIndexSet::GetTokensFromStorage(), and CIndexSetForQueryingStage::ReadOccurrences().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadFromFile()

bool ddcFileOrMMap::ReadFromFile ( file_off_t  start,
size_t  nbytes,
BYTE buffer 
) const

guts for ReadBuffer() on m_File

References FSeek(), ddcLockable::lock(), m_File, and ddcLockable::unlock().

Referenced by ReadBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_UseMemoryMap

bool ddcFileOrMMap::m_UseMemoryMap

Referenced by Open().

◆ m_mmap

ddcMMap<char> ddcFileOrMMap::m_mmap

Referenced by Close(), Open(), and ReadBuffer().

◆ m_File

FILE* ddcFileOrMMap::m_File

Referenced by Close(), Open(), and ReadFromFile().


The documentation for this class was generated from the following files: