]> git.donarmstrong.com Git - bamtools.git/blob - src/api/internal/BamIndexFactory_p.h
f060d2cd4e766179cf81162897727ec06a0236a5
[bamtools.git] / src / api / internal / BamIndexFactory_p.h
1 // ***************************************************************************
2 // BamIndexFactory_p.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 5 April 2011 (DB)
7 // ---------------------------------------------------------------------------
8 // Provides interface for generating BamIndex implementations
9 // ***************************************************************************
10
11 #ifndef BAMINDEX_FACTORY_P_H
12 #define BAMINDEX_FACTORY_P_H
13
14 #include <api/BamIndex.h>
15 #include <string>
16
17 namespace BamTools {
18 namespace Internal {
19
20 class BamIndexFactory {
21
22     // static interface methods
23     public:
24         // creates a new BamIndex object, depending on extension of @indexFilename
25         static BamIndex* CreateIndexFromFilename(const std::string& indexFilename,
26                                                  BamReaderPrivate* reader);
27         // creates a new BamIndex object, of requested @type
28         static BamIndex* CreateIndexOfType(const BamIndex::IndexType& type,
29                                            BamReaderPrivate* reader);
30         // returns name of existing index file that corresponds to @bamFilename
31         // will defer to @preferredType if possible
32         // if @preferredType not found, will attempt to load any supported index type
33         // returns empty string if no index file (of any type) is found
34         static const std::string FindIndexFilename(const std::string& bamFilename,
35                                                    const BamIndex::IndexType& preferredType);
36
37     // internal methods
38     public:
39         // generates index filename from BAM filename (depending on requested type)
40         // if type is unknown, returns empty string
41         static const std::string CreateIndexFilename(const std::string& bamFilename,
42                                                      const BamIndex::IndexType& type);
43         // retrieves file extension (including '.')
44         static const std::string FileExtension(const std::string& filename);
45 };
46
47 } // namespace Internal
48 } // namespace BamTools
49
50 #endif // BAMINDEX_FACTORY_P_H