torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DirectoryTree.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Header for the DirectoryTree class.
18 
19 #ifndef TORC_COMMON_DIRECTORYTREE_HPP
20 #define TORC_COMMON_DIRECTORYTREE_HPP
21 
22 #include <boost/filesystem/convenience.hpp>
23 
24 namespace torc {
25 namespace common {
26 
27  /// \brief Encapsulation of filesystem paths that are used by the library.
28  class DirectoryTree {
29  protected:
30  // static variables
31  /// \brief Relative path from the working directory to the executable home.
33  /// \brief Absolute path to the working directory.
35  /// \brief Absolute path to the executable directory.
37  /// \brief Absolute path to the EDA libraries directory.
39  /// \brief Absolute path to the family and device database directory.
41  /// \brief Absolute path to the log files directory.
43  public:
44  // constructors
45  /// \brief Mandatory constructor.
46  /// \param argv0 The zero-th argument passed to main in argv[]. DirectoryTree needs this
47  /// to derive the relative path from the working directory to the executable, until
48  /// such a time as Boost provides a better approach.
49  /// \details Extracts the zero-th argument, and builds the various static paths used by the
50  /// executable.
51  DirectoryTree(const char* argv0);
52  // static functions
53  /// \brief Returns the relative path from the working directory to the executable home.
54  static const boost::filesystem::path& getRelativePath(void) { return sRelativePath; }
55  /// \brief Returns the absolute path to the working directory.
56  static const boost::filesystem::path& getWorkingPath(void) { return sWorkingPath; }
57  /// \brief Returns the absolute path to the executable directory.
59  /// \brief Returns the absolute path to the family and device database directory.
60  static const boost::filesystem::path& getDevicesPath(void) { return sDevicesPath; }
61  /// \brief Returns the absolute path to the log files directory.
62  static const boost::filesystem::path& getLogPath(void) { return sLogPath; }
63  };
64 
65 } // namespace common
66 } // namespace torc
67 
68 #endif // TORC_COMMON_DIRECTORYTREE_HPP
static const boost::filesystem::path & getDevicesPath(void)
Returns the absolute path to the family and device database directory.
static const boost::filesystem::path & getLogPath(void)
Returns the absolute path to the log files directory.
DirectoryTree(const char *argv0)
Mandatory constructor.
static boost::filesystem::path sEdaPath
Absolute path to the EDA libraries directory.
static boost::filesystem::path sWorkingPath
Absolute path to the working directory.
Encapsulation of filesystem paths that are used by the library.
boost::filesystem::path path
static boost::filesystem::path sExecutablePath
Absolute path to the executable directory.
static const boost::filesystem::path & getRelativePath(void)
Returns the relative path from the working directory to the executable home.
static boost::filesystem::path sLogPath
Absolute path to the log files directory.
static const boost::filesystem::path & getWorkingPath(void)
Returns the absolute path to the working directory.
static boost::filesystem::path sRelativePath
Relative path from the working directory to the executable home.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.
static boost::filesystem::path sDevicesPath
Absolute path to the family and device database directory.