1 // ***************************************************************************
2 // BamIndexFactory_p.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 10 October 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides interface for generating BamIndex implementations
8 // ***************************************************************************
10 #ifndef BAMINDEX_FACTORY_P_H
11 #define BAMINDEX_FACTORY_P_H
13 #include "api/BamIndex.h"
19 class BamIndexFactory {
21 // static interface methods
23 // creates a new BamIndex object, depending on extension of @indexFilename
24 static BamIndex* CreateIndexFromFilename(const std::string& indexFilename,
25 BamReaderPrivate* reader);
26 // creates a new BamIndex object, of requested @type
27 static BamIndex* CreateIndexOfType(const BamIndex::IndexType& type,
28 BamReaderPrivate* reader);
29 // returns name of existing index file that corresponds to @bamFilename
30 // will defer to @preferredType if possible
31 // if @preferredType not found, will attempt to load any supported index type
32 // returns empty string if no index file (of any type) is found
33 static const std::string FindIndexFilename(const std::string& bamFilename,
34 const BamIndex::IndexType& preferredType);
38 // generates index filename from BAM filename (depending on requested type)
39 // if type is unknown, returns empty string
40 static const std::string CreateIndexFilename(const std::string& bamFilename,
41 const BamIndex::IndexType& type);
42 // retrieves file extension (including '.')
43 static const std::string FileExtension(const std::string& filename);
46 } // namespace Internal
47 } // namespace BamTools
49 #endif // BAMINDEX_FACTORY_P_H