]> git.donarmstrong.com Git - bamtools.git/blob - src/api/internal/BamIndexFactory_p.h
Major update to BamTools version 1.0
[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: 26 January 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         // creates a new BamIndex object, of requested @type
27         static BamIndex* CreateIndexOfType(const BamIndex::IndexType& type);
28         // returns name of existing index file that corresponds to @bamFilename
29         // will defer to @preferredType if possible
30         // if @preferredType not found, will attempt to load any supported index type
31         // returns empty string if no index file (of any type) is found
32         static const std::string FindIndexFilename(const std::string& bamFilename,
33                                                    const BamIndex::IndexType& preferredType);
34
35     // internal methods
36     public:
37         // generates index filename from BAM filename (depending on requested type)
38         // if type is unknown, returns empty string
39         static const std::string CreateIndexFilename(const std::string& bamFilename,
40                                                      const BamIndex::IndexType& type);
41         // retrieves file extension (including '.')
42         static const std::string FileExtension(const std::string& filename);
43 };
44
45 } // namespace Internal
46 } // namespace BamTools
47
48 #endif // BAMINDEX_FACTORY_P_H