OpenMS
FASTAContainer< TFI_Vector > Class Reference

FASTAContainer<TFI_Vector> simply takes an existing vector of FASTAEntries and provides the same interface with a potentially huge speed benefit over FASTAContainer<TFI_File> since it does not need disk access, but at the cost of memory. More...

#include <OpenMS/DATASTRUCTURES/FASTAContainer.h>

Collaboration diagram for FASTAContainer< TFI_Vector >:
[legend]

Public Member Functions

 FASTAContainer ()=delete
 
 FASTAContainer (const std::vector< FASTAFile::FASTAEntry > &data)
 C'tor for already existing data (by reference). More...
 
size_t getChunkOffset () const
 always 0, since this specialization requires/supports no chunking More...
 
bool activateCache ()
 no-op (since data is already fully available as vector) More...
 
bool cacheChunk (int)
 no-op (since data is already fully available as vector) More...
 
size_t chunkSize () const
 active data spans the full range, i.e. size of container More...
 
const FASTAFile::FASTAEntrychunkAt (size_t pos) const
 fast access to chunked (i.e. all) entries More...
 
bool readAt (FASTAFile::FASTAEntry &protein, size_t pos) const
 fast access to an entry More...
 
bool empty () const
 calls empty() on underlying vector More...
 
size_t size () const
 calls size() on underlying vector More...
 
void reset ()
 required for template parameters! More...
 

Private Attributes

const std::vector< FASTAFile::FASTAEntry > & data_
 reference to existing data More...
 
int activate_count_ = 0
 
int cache_count_ = 0
 

Detailed Description

FASTAContainer<TFI_Vector> simply takes an existing vector of FASTAEntries and provides the same interface with a potentially huge speed benefit over FASTAContainer<TFI_File> since it does not need disk access, but at the cost of memory.

Constructor & Destructor Documentation

◆ FASTAContainer() [1/2]

FASTAContainer ( )
delete

◆ FASTAContainer() [2/2]

FASTAContainer ( const std::vector< FASTAFile::FASTAEntry > &  data)
inline

C'tor for already existing data (by reference).

An internal reference will be kept. Make sure the data is not deleted during the lifetime of FASTAContainer

Member Function Documentation

◆ activateCache()

bool activateCache ( )
inline

no-op (since data is already fully available as vector)

Returns
true only on the first call; false on subsequent calls

◆ cacheChunk()

bool cacheChunk ( int  )
inline

no-op (since data is already fully available as vector)

Returns
true only on the first call; false on subsequent calls

◆ chunkAt()

const FASTAFile::FASTAEntry& chunkAt ( size_t  pos) const
inline

fast access to chunked (i.e. all) entries

◆ chunkSize()

size_t chunkSize ( ) const
inline

active data spans the full range, i.e. size of container

Returns
the size of the underlying vector

◆ empty()

bool empty ( ) const
inline

calls empty() on underlying vector

◆ getChunkOffset()

size_t getChunkOffset ( ) const
inline

always 0, since this specialization requires/supports no chunking

◆ readAt()

bool readAt ( FASTAFile::FASTAEntry protein,
size_t  pos 
) const
inline

fast access to an entry

◆ reset()

void reset ( )
inline

required for template parameters!

◆ size()

size_t size ( ) const
inline

calls size() on underlying vector

Member Data Documentation

◆ activate_count_

int activate_count_ = 0
private

◆ cache_count_

int cache_count_ = 0
private

◆ data_

const std::vector<FASTAFile::FASTAEntry>& data_
private

reference to existing data