OpenASIP  2.0
Environment.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2019 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file Environment.hh
26  *
27  * Declaration of Environment class.
28  *
29  * @author Atte Oksman 2003 (oksman-no.spam-cs.tut.fi)
30  * @author Viljami Korhonen 2007 (viljami.korhonen-no.spam-tut.fi)
31  * @author Pekka Jääskeläinen 2011
32  * @note reviewed 19 May 2004 by ao, jn, ml, am
33  * @note rating: red
34  */
35 
36 #ifndef TTA_ENVIRONMENT_HH
37 #define TTA_ENVIRONMENT_HH
38 
39 #include <string>
40 #include <vector>
41 #include "TCEString.hh"
42 
43 /**
44  * A class to get the environmental variable values as well as to find files
45  * or directories from the project's directory structure.
46  */
47 class Environment {
48 
49 public:
50  static void initialize();
51 
52  static std::string schemaDirPath(const std::string& prog);
53  static std::string dataDirPath(const std::string& prog);
54  static std::string bitmapsDirPath(const std::string& prog);
55  static std::string manDirPath(const std::string& prog);
56  static TCEString confPath(const std::string& fileName);
57  static TCEString userConfPath(const std::string& fileName);
58 
59  static std::string errorLogFilePath();
60  static std::string iconDirPath();
61  static std::vector<std::string> includeDirPaths();
62  static std::vector<std::string> opsetIncludeDir();
63 
64  static void setNewSchemaFileDir(const std::string& path);
65  static void setNewDataFileDir(const std::string& path);
66  static void setNewBitmapsFileDir(const std::string& path);
67  static void setNewManFileDir(const std::string& path);
68  static void setNewErrorLogFileDir(const std::string& path);
69 
70  static std::string environmentVariable(const std::string& variable);
71  static std::vector<std::string> osalPaths();
72  static std::vector<std::string> codeCompressorPaths(
73  bool libraryPathsOnly = false);
74  static std::vector<std::string> schedulerPluginPaths();
75  static std::vector<std::string> icDecoderPluginPaths(
76  bool libraryPathsOnly = false);
77  static std::vector<std::string> hwModulePaths();
78  static std::vector<std::string> hdbPaths(
79  bool libraryPathsOnly = false);
80  static TCEString shortHDBPath(const TCEString& hdbPath);
81  static TCEString longHDBPath(const TCEString& hdbPath);
82  static std::vector<std::string> vhdlPaths(const std::string& hdbPath);
83  static std::vector<std::string> decompressorPaths(
84  bool libraryPathsOnly = false);
85  static std::vector<std::string> explorerPluginPaths();
86  static std::vector<std::string> estimatorPluginPaths();
87 
88  static std::string pdfManual();
89  static std::string minimalADF();
90  static std::string tceCompiler();
91  static std::string defaultSchedulerConf();
92  static std::string oldGccSchedulerConf();
93  static std::string defaultICDecoderPlugin();
94  static std::string defaultTextEditorPath();
95 
96  static std::string llvmtceCachePath();
97 
98  static std::vector<std::string> implementationTesterTemplatePaths();
99  static std::string simTraceDirPath();
100 
101  static bool developerMode();
102 
103 private:
104  Environment();
105  ~Environment();
106 
107  static std::string pathTo(const std::string& name);
108  static inline void parsePathEnvVariable(std::vector<std::string>& paths);
109  static std::string findExecutableFromPATH(
110  const std::vector<std::string>& file);
111 
112  /// Name of the XML Schema directory.
113  static const std::string SCHEMA_DIR_NAME_;
114  /// Name of the data directory.
115  static const std::string DATA_DIR_NAME_;
116  /// Name of the bitmaps directory.
117  static const std::string BITMAPS_DIR_NAME_;
118  /// Name of the manual directory.
119  static const std::string MAN_DIR_NAME_;
120  /// Name of the configuration directory.
121  static const std::string CONF_DIR_NAME_;
122  /// Name of the toolbar icon directory.
123  static const std::string ICON_DIR_NAME_;
124  /// Name of the system error log file.
125  static const std::string ERROR_LOG_FILE_NAME_;
126  /// Flag indicating whether class has been initialized.
127  static bool initialized_;
128  /// Flag indicating whether TCE is executing in developer mode.
129  static bool developerMode_;
130 
131  /// Schema directory search paths.
132  static std::vector<std::string> schemaPaths_;
133  /// Data directory search paths.
134  static std::vector<std::string> dataPaths_;
135  /// Bitmaps directory search paths.
136  static std::vector<std::string> bitmapsPaths_;
137  /// Man directory search paths.
138  static std::vector<std::string> manPaths_;
139  /// Toolbar icon search paths.
140  static std::vector<std::string> iconPaths_;
141  /// Error file search paths.
142  static std::vector<std::string> errorPaths_;
143  /// Paths used in a particular search.
144  static std::vector<std::string> pathsToUse_;
145 
146  /// Directory for new schema file.
147  static std::string newSchemaFileDir_;
148  /// Directory for new data file.
149  static std::string newDataFileDir_;
150  /// Directory for new bitmaps file.
151  static std::string newBitmapsFileDir_;
152  /// Directory for new icon file.
153  static std::string newIconFileDir_;
154  /// Directory for new manual file.
155  static std::string newManFileDir_;
156  /// Directory for new configure file.
157  static std::string newConfFile_;
158  /// Directory for new error log file.
159  static std::string newErrorLogFileDir_;
160  /// Directory to store ttasim traces
161  static std::string simTraceDir_;
162 
163  /// Relative path to the installed TCE .pdf manual.
164  static const std::string PDF_MANUAL_INSTALLED;
165  /// Relative path to the TCE .pdf manual in source tree.
166  static const std::string PDF_MANUAL_SRC;
167  /// Relative path to the installed minimal.adf.
168  static const std::string MINIMAL_ADF_INSTALLED;
169  /// Relative path to the minimal.adf in source tree.
170  static const std::string MINIMAL_ADF_SRC;
171 
172 };
173 
174 #endif
Environment::simTraceDir_
static std::string simTraceDir_
Directory to store ttasim traces.
Definition: Environment.hh:161
Environment::newBitmapsFileDir_
static std::string newBitmapsFileDir_
Directory for new bitmaps file.
Definition: Environment.hh:151
Environment::oldGccSchedulerConf
static std::string oldGccSchedulerConf()
Definition: Environment.cc:986
Environment::CONF_DIR_NAME_
static const std::string CONF_DIR_NAME_
Name of the configuration directory.
Definition: Environment.hh:121
Environment::manDirPath
static std::string manDirPath(const std::string &prog)
Definition: Environment.cc:250
Environment::PDF_MANUAL_INSTALLED
static const std::string PDF_MANUAL_INSTALLED
Relative path to the installed TCE .pdf manual.
Definition: Environment.hh:164
Environment::setNewDataFileDir
static void setNewDataFileDir(const std::string &path)
Definition: Environment.cc:475
Environment::developerMode_
static bool developerMode_
Flag indicating whether TCE is executing in developer mode.
Definition: Environment.hh:129
Environment::schemaPaths_
static std::vector< std::string > schemaPaths_
Schema directory search paths.
Definition: Environment.hh:132
Environment::initialize
static void initialize()
Definition: Environment.cc:95
Environment::minimalADF
static std::string minimalADF()
Definition: Environment.cc:901
Environment::newSchemaFileDir_
static std::string newSchemaFileDir_
Directory for new schema file.
Definition: Environment.hh:147
Environment::icDecoderPluginPaths
static std::vector< std::string > icDecoderPluginPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:635
Environment::schedulerPluginPaths
static std::vector< std::string > schedulerPluginPaths()
Definition: Environment.cc:601
Environment::iconPaths_
static std::vector< std::string > iconPaths_
Toolbar icon search paths.
Definition: Environment.hh:140
Environment::decompressorPaths
static std::vector< std::string > decompressorPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:793
Environment::pathTo
static std::string pathTo(const std::string &name)
Definition: Environment.cc:444
Environment::PDF_MANUAL_SRC
static const std::string PDF_MANUAL_SRC
Relative path to the TCE .pdf manual in source tree.
Definition: Environment.hh:166
Environment::errorLogFilePath
static std::string errorLogFilePath()
Definition: Environment.cc:323
Environment::implementationTesterTemplatePaths
static std::vector< std::string > implementationTesterTemplatePaths()
Definition: Environment.cc:1129
Environment::newDataFileDir_
static std::string newDataFileDir_
Directory for new data file.
Definition: Environment.hh:149
Environment::setNewErrorLogFileDir
static void setNewErrorLogFileDir(const std::string &path)
Definition: Environment.cc:505
Environment::tceCompiler
static std::string tceCompiler()
Definition: Environment.cc:928
Environment::bitmapsDirPath
static std::string bitmapsDirPath(const std::string &prog)
Definition: Environment.cc:201
Environment::defaultICDecoderPlugin
static std::string defaultICDecoderPlugin()
Definition: Environment.cc:1012
Environment::userConfPath
static TCEString userConfPath(const std::string &fileName)
Definition: Environment.cc:303
Environment::bitmapsPaths_
static std::vector< std::string > bitmapsPaths_
Bitmaps directory search paths.
Definition: Environment.hh:136
Environment::MAN_DIR_NAME_
static const std::string MAN_DIR_NAME_
Name of the manual directory.
Definition: Environment.hh:119
Environment::DATA_DIR_NAME_
static const std::string DATA_DIR_NAME_
Name of the data directory.
Definition: Environment.hh:115
TCEString.hh
Environment::codeCompressorPaths
static std::vector< std::string > codeCompressorPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:571
Environment::defaultTextEditorPath
static std::string defaultTextEditorPath()
Definition: Environment.cc:1034
Environment::setNewManFileDir
static void setNewManFileDir(const std::string &path)
Definition: Environment.cc:495
Environment::opsetIncludeDir
static std::vector< std::string > opsetIncludeDir()
Definition: Environment.cc:384
Environment::setNewSchemaFileDir
static void setNewSchemaFileDir(const std::string &path)
Definition: Environment.cc:465
Environment::ERROR_LOG_FILE_NAME_
static const std::string ERROR_LOG_FILE_NAME_
Name of the system error log file.
Definition: Environment.hh:125
Environment::hdbPaths
static std::vector< std::string > hdbPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:683
Environment::includeDirPaths
static std::vector< std::string > includeDirPaths()
Definition: Environment.cc:348
Environment::MINIMAL_ADF_INSTALLED
static const std::string MINIMAL_ADF_INSTALLED
Relative path to the installed minimal.adf.
Definition: Environment.hh:168
Environment::shortHDBPath
static TCEString shortHDBPath(const TCEString &hdbPath)
Definition: Environment.cc:707
Environment::dataPaths_
static std::vector< std::string > dataPaths_
Data directory search paths.
Definition: Environment.hh:134
Environment::defaultSchedulerConf
static std::string defaultSchedulerConf()
Definition: Environment.cc:957
Environment::parsePathEnvVariable
static void parsePathEnvVariable(std::vector< std::string > &paths)
Definition: Environment.cc:1077
Environment::schemaDirPath
static std::string schemaDirPath(const std::string &prog)
Definition: Environment.cc:151
Environment::newIconFileDir_
static std::string newIconFileDir_
Directory for new icon file.
Definition: Environment.hh:153
Environment::newManFileDir_
static std::string newManFileDir_
Directory for new manual file.
Definition: Environment.hh:155
Environment::Environment
Environment()
Definition: Environment.cc:420
Environment::newErrorLogFileDir_
static std::string newErrorLogFileDir_
Directory for new error log file.
Definition: Environment.hh:159
Environment::osalPaths
static std::vector< std::string > osalPaths()
Definition: Environment.cc:519
Environment::MINIMAL_ADF_SRC
static const std::string MINIMAL_ADF_SRC
Relative path to the minimal.adf in source tree.
Definition: Environment.hh:170
Environment::pathsToUse_
static std::vector< std::string > pathsToUse_
Paths used in a particular search.
Definition: Environment.hh:144
Environment::longHDBPath
static TCEString longHDBPath(const TCEString &hdbPath)
Definition: Environment.cc:731
Environment::confPath
static TCEString confPath(const std::string &fileName)
Definition: Environment.cc:277
Environment::manPaths_
static std::vector< std::string > manPaths_
Man directory search paths.
Definition: Environment.hh:138
Environment::iconDirPath
static std::string iconDirPath()
Definition: Environment.cc:225
Environment::simTraceDirPath
static std::string simTraceDirPath()
Definition: Environment.cc:1149
Environment::vhdlPaths
static std::vector< std::string > vhdlPaths(const std::string &hdbPath)
Definition: Environment.cc:760
Environment::llvmtceCachePath
static std::string llvmtceCachePath()
Definition: Environment.cc:1087
Environment::findExecutableFromPATH
static std::string findExecutableFromPATH(const std::vector< std::string > &file)
Definition: Environment.cc:1109
Environment::setNewBitmapsFileDir
static void setNewBitmapsFileDir(const std::string &path)
Definition: Environment.cc:485
TCEString
Definition: TCEString.hh:53
Environment::SCHEMA_DIR_NAME_
static const std::string SCHEMA_DIR_NAME_
Name of the XML Schema directory.
Definition: Environment.hh:113
Environment::explorerPluginPaths
static std::vector< std::string > explorerPluginPaths()
Definition: Environment.cc:809
Environment::ICON_DIR_NAME_
static const std::string ICON_DIR_NAME_
Name of the toolbar icon directory.
Definition: Environment.hh:123
Environment::initialized_
static bool initialized_
Flag indicating whether class has been initialized.
Definition: Environment.hh:127
Environment::hwModulePaths
static std::vector< std::string > hwModulePaths()
Definition: Environment.cc:669
Environment::newConfFile_
static std::string newConfFile_
Directory for new configure file.
Definition: Environment.hh:157
Environment::developerMode
static bool developerMode()
Definition: Environment.cc:1166
Environment::environmentVariable
static std::string environmentVariable(const std::string &variable)
Definition: Environment.cc:406
Environment::errorPaths_
static std::vector< std::string > errorPaths_
Error file search paths.
Definition: Environment.hh:142
Environment::estimatorPluginPaths
static std::vector< std::string > estimatorPluginPaths()
Definition: Environment.cc:842
Environment::BITMAPS_DIR_NAME_
static const std::string BITMAPS_DIR_NAME_
Name of the bitmaps directory.
Definition: Environment.hh:117
Environment::~Environment
~Environment()
Definition: Environment.cc:427
Environment::pdfManual
static std::string pdfManual()
Definition: Environment.cc:877
Environment::dataDirPath
static std::string dataDirPath(const std::string &prog)
Definition: Environment.cc:176
Environment
Definition: Environment.hh:47