| soma-io
    5.1.2
    | 
Determination of the allocation type depending of the buffer size to allocate and the disk format of data. More...
#include <soma-io/allocator/allocator.h>
| Public Types | |
| enum | DataAccess { InternalModif , ReadOnly , ReadWrite , NotOwner } | 
| Data access modes, they describe what you intend to do with data to be read.  More... | |
| enum | MappingMode { Memory , MEM = Memory , MAP , CopyMap , MAP_COPY = CopyMap , ReadOnlyMap , MAP_RO = ReadOnlyMap , ReadWriteMap , MAP_RW = ReadWriteMap , Unallocated } | 
| Static Public Member Functions | |
| static MappingMode | mappingMode (DataAccess mode, offset_t buflen, const DataSource *datasource, bool isDiskformatOK, float usefactor=1) | 
| Determines optimal allocator for a data file.  More... | |
| static bool | isMMapCompatible (bool ascii, int byteorder, bool scalefactored=false, int border=0) | 
| helper function, tells if memory mapping is directly possible  More... | |
| static void | memSizes (offset_t &ram, offset_t &freeram, offset_t &swap) | 
| same as above but uses a Header attributed object  More... | |
| static AllocatorContext | allocator (MappingMode mode, carto::rc_ptr< DataSource > ds) | 
| static const LowLevelAllocator & | lowLevelAllocator (MappingMode m) | 
Determination of the allocation type depending of the buffer size to allocate and the disk format of data.
The optimal allocation mode depends on:
Definition at line 150 of file allocator.h.
Data access modes, they describe what you intend to do with data to be read.
Definition at line 155 of file allocator.h.
| Enumerator | |
|---|---|
| Memory | |
| MEM | |
| MAP | |
| CopyMap | |
| MAP_COPY | |
| ReadOnlyMap | |
| MAP_RO | |
| ReadWriteMap | |
| MAP_RW | |
| Unallocated | |
Definition at line 173 of file allocator.h.
| 
 | static | 
| 
 | static | 
helper function, tells if memory mapping is directly possible
| 
 | static | 
Referenced by soma::AllocatorContext::allocate().
| 
 | static | 
Determines optimal allocator for a data file.
| mode | what you intend to do tith the data: read only, read/write or read/internally modify it. read/write mode is dangerous: it will allow modifying the original file. | 
| buflen | size in bytes of the data to allocate | 
| datasource | data source to map (file, buffer, stream, ...) | 
| isDiskformatOK | true if the disk format is exactly the same as the internal memory format (allowing direct memory mapping) | 
| usefactor | rate of usage you intend to do with the data, from 0 if you will only use a few bytes of it, to 1 if you intend to make intensive usage of all data. A small value will allow memory mapping on smaller files, and a higher value will avoid it. | 
Referenced by soma::AllocatorContext::allocate().
| 
 | static | 
same as above but uses a Header attributed object
Try to detect memory amounts and fills referenced params. Params are set to 0 if thezy cannor be determined.
| ram | physical RAM amount | 
| freeram | free RAM amount | 
| swap | free RAM+swap amount |