rpa::mmap_ctrl Class Reference

List of all members.

Public Member Functions

 mmap_ctrl (int aFilDes, const visitor &aVisit, size_t aPagSiz)
bool not_empty (void) const

Private Attributes

bool _notEmpty
 Tells whether data were copied or not.

Classes

class  segment

Detailed Description

The role of this class is to map the beginning of a file for reading only, and to handle the unmapping of memory, especially if an exception is thrown. It is very specific and used here only.


Constructor & Destructor Documentation

rpa::mmap_ctrl::mmap_ctrl ( int  aFilDes,
const visitor aVisit,
size_t  aPagSiz 
) [inline]

The size to be mapped in memory may be too big, so it is splitted in a loop, and the functor is called for each segment.

The length argument of mmap has no size or alignment constraints.

The offset argument is constrained to be aligned and sized according to the value returned by sysconf when passed _SC_PAGESIZE or _SC_PAGE_SIZE. Anyway, the data starts from the beginning.

If the segment size is too big, it would be wise to shrink it and retry. Conversely, it may be good to gradually increase it.

If an exception is thrown, the segment will be unmapped.


Member Function Documentation

bool rpa::mmap_ctrl::not_empty ( void   )  const [inline]


Member Data Documentation

bool rpa::mmap_ctrl::_notEmpty [private]

Tells whether data were copied or not.


The documentation for this class was generated from the following file:
Generated on Tue Sep 25 10:20:38 2007 for rpa by  doxygen 1.4.7