File: ClustalWResources.h

package info (click to toggle)
clustalx 2.1%2Blgpl-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,324 kB
  • sloc: cpp: 40,050; sh: 163; xml: 102; makefile: 16
file content (67 lines) | stat: -rw-r--r-- 1,654 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
 * Implements a singleton that maintains program resources.
 * The single instance is (re)instantiated on demand like:
 *     Resources *res = Resources::Instance();
 *
 * 24-05-07,Nigel Brown(EMBL): created.
 * 3-7-07, Mark Larkin, modified this class for clustalw
 */

#ifndef RESOURCESCLUSTALW_H
#define RESOURCESCLUSTALW_H

#include <string>

using namespace std;

namespace clustalw
{


enum ClustalWResourcePathType {
    DefaultPath,
    InstallPath,
    ExecutablePath,
    HomePath
};

class ClustalWResources 
{

public:
    /* return the Resources singleton */
    static ClustalWResources *Instance();

    /* setters */
    void setPathToExecutable(std::string pathToFiles);
    
    /* getters */
    std::string getDefaultPath()    { return defaultPath; }
    std::string getInstallPath()    { return installPath; }
    std::string getExecutablePath() { return executablePath; }
    std::string getHomePath()       { return homePath; }

    std::string findFile(const char *file, const ClustalWResourcePathType where = DefaultPath) const;
    std::string findFile(const std::string file, const ClustalWResourcePathType where = DefaultPath) const;
    std::string searchPathsForFile(const std::string fileName) const;

    /* debug */
    void dump();

protected:
    /* hide the constructors */
    ClustalWResources();
    ClustalWResources(const ClustalWResources&);
    ClustalWResources& operator= (const ClustalWResources&);
    
    std::string dirname(std::string path);    

private:
    std::string defaultPath;
    std::string installPath;
    std::string executablePath;
    std::string homePath;
};

}
#endif //RESOURCES_H