<
classTIn,
classTOut>
91 if(
sizeof(TOut) <
sizeof(TIn)) {
94 "Offset type does not span file length.");
102:m_UseLock (use_atlas_lock),
104m_SearchPath (GenerateSearchPath())
119it->second.get()->m_Count++;
121 returnit->second.get();
125 _TRACE(
"Open File: "<< fileName);
137it->second.get()->m_Count--;
140(it->second.get()->m_isIsam) && (it->second.get()->m_Count == 0)) {
142 LOG_POST(
Info<<
"Unmap max file descriptor reached: "<< fileName);
166length = it->second.second;
167 returnit->second.first;
171pair<bool, TIndx>
val;
175 if(file_length >= 0) {
177 val.second = SeqDB_CheckLength<Int8, TIndx>(file_length);
192length =
val.second;
205 void Set(
const char* x)
243newcp =
new char[length];
249 throwstd::bad_alloc();
253memset(newcp, 0, length);
256 catch(std::bad_alloc) {
258 "CSeqDBAtlas::Alloc: allocation failed.");
277 size_tbytes = memreg.
m_Bytes;
351: m_Atlas(atlas), m_Ptr(ptr)
CSeqDBAtlasHolder(CSeqDBLockHold *lockedp, bool use_atlas_lock)
Constructor.
static int m_Count
Count of users of the CSeqDBAtlas object.
~CSeqDBAtlasHolder()
Destructor.
CSeqDBAtlas & Get()
Get the CSeqDBAtlas object.
static CSeqDBAtlas * m_Atlas
The CSeqDBAtlas object itself.
static void RetRegion(const char *datap)
Free allocated memory.
bool GetFileSizeL(const string &fname, TIndx &length)
Get size of a file.
void RegisterExternal(CSeqDBMemReg &memreg, size_t bytes, CSeqDBLockHold &locked)
Register externally allocated memory.
int ChangeOpenedFilseCount(EFilesCount fc)
bool DoesFileExist(const string &fname)
Check if file exists.
CMemoryFile * ReturnMemoryFile(const string &fileName)
void UnregisterExternal(CSeqDBMemReg &memreg)
Unregister externally allocated memory.
Uint8 m_MaxFileSize
Maxium file size.
~CSeqDBAtlas()
The destructor unmaps and frees all associated memory.
bool GetFileSize(const string &fname, TIndx &length)
Get size of a file.
static char * Alloc(size_t length, bool clear=true)
Allocate memory that atlas will keep track of.
std::mutex m_FileMemMapMutex
CMemoryFile * GetMemoryFile(const string &fileName)
int m_MaxOpenedFilesCount
CSeqDBAtlas(bool use_atlas_lock)
Constructor.
map< string, unique_ptr< CAtlasMappedFile > > m_FileMemMap
void Lock(CSeqDBLockHold &locked)
Lock the atlas.
map< string, pair< bool, TIndx > > m_FileSize
std::mutex m_FileSizeMutex
Cache of file existence and length.
CNcbiStreamoff TIndx
The type used for file offsets.
int GetOpenedFilseCount(void)
void Unlock(CSeqDBLockHold &locked)
Unlock the atlas.
EErrCode
Errors are classified into one of two types.
@ eFileErr
Files were missing or contents were incorrect.
@ eArgErr
Argument validation failed.
class CSeqDBAtlas & m_Atlas
This reference allows unlock on exit.
~CSeqDBLockHold()
Destructor.
size_t m_Bytes
This object "owns" this many bytes of the atlas memory bound.
CSeqDBAtlas & m_Atlas
Reference to the memory management layer.
CSeqDB_AtlasRegionHolder(CSeqDBAtlas &atlas, const char *ptr)
Constructor.
const char * m_Ptr
Pointer to this object.
~CSeqDB_AtlasRegionHolder()
Destructor.
const_iterator end() const
const_iterator find(const key_type &key) const
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Info(CExceptionArgs_Base &args)
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is whole
const GenericPointer< typename T::ValueType > T2 value
DEFINE_CLASS_STATIC_FAST_MUTEX(CSeqDBAtlasHolder::m_Lock)
void SeqDB_ThrowException(CSeqDBException::EErrCode code, const string &msg)
Thow a SeqDB exception; this is seperated into a function primarily to allow a breakpoint to be set.
TOut SeqDB_CheckLength(TIn value)
Check the size of a number relative to the scope of a numeric type.
The SeqDB memory management layer.
#define CHECK_MARKER()
Assertion to verify the marker.
#define BREAK_MARKER()
Make the marker of this class invalid.
Defines exception class and several constants for SeqDB.
This file defines several SeqDB utility functions related to byte order and file system portability.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Simple idiom for RIIA with malloc + free.
const char * m_Array
Pointer to malloced memory.
CSeqDBAutoFree()
Constructor.
void Set(const char *x)
Specify a malloced area of memory.
~CSeqDBAutoFree()
Destructor will free that memory.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4