pid
rpath_resolver.h
Go to the documentation of this file.
1 /* File: rpath_resolver.h
2  * This file is part of the program pid-rpath
3  * Program description : Default package of PID, used to manage runtime
4  * path of executables
5  * Copyright (C) 2015 - Robin Passama (LIRMM). All Right reserved.
6  *
7  * This software is free software: you can redistribute it and/or modify
8  * it under the terms of the CeCILL-C license as published by
9  * the CEA CNRS INRIA, either version 1
10  * of the License, or (at your option) any later version.
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * CeCILL-C License for more details.
15  *
16  * You should have received a copy of the CeCILL-C License
17  * along with this software. If not, it can be found on the official
18  * website
19  * of the CeCILL licenses family (http://www.cecill.info/index.en.html).
20  */
21 
29 #pragma once
30 
31 #include <map>
32 #include <pid/pid_path.h>
33 #include <string>
34 
38 namespace pid {
39 
47 private:
48  RpathResolver();
50  static RpathResolver* instance();
51 
52  std::string absolute_path_to_current_exe_; // path to the executable on disk
53  std::string
54  absolute_path_to_container_folder_; // path to the folder containing exe
55  std::string exe_name_; // name of the executable
56  std::map< std::string, std::string > modules_in_use_;
57  static bool resolve_exe_path(const std::string& name_of_exe);
58  static bool resolve_Symlinks();
59 
61 
62  static std::string internal_Resolve_Dynamic(const PidPath& pp,
63  bool prefer_debug);
64  static std::string internal_Resolve_Static(const PidPath& pp,
65  bool prefer_debug);
66  static std::string get_Path_To_Resource(const std::string& final_filename,
67  bool is_written);
68 
69 public:
75  static bool configure(const std::string& exe_name);
76 
89  static bool configure_Module(bool toload, const std::string& module_path,
90  bool prefer_debug);
91 
106  static std::string resolve(const std::string& resource,
107  bool prefer_debug = false);
108 
122  static std::string resolve(const PidPath& pp, bool prefer_debug = false);
123 
130  static std::string execution_Path();
131 };
132 } // namespace pid
pid::RpathResolver::absolute_path_to_current_exe_
std::string absolute_path_to_current_exe_
Definition: rpath_resolver.h:52
pid_path.h
a class for describing path that can be managed by configuration files at runtime.
pid::RpathResolver::modules_in_use_
std::map< std::string, std::string > modules_in_use_
Definition: rpath_resolver.h:56
pid::RpathResolver::execution_Path
static std::string execution_Path()
get the path to the current executable.
pid
root namespace for pid packages.
Definition: bitmask.h:51
pid::PidPath
defines a runtime path to a resource.
Definition: pid_path.h:166
pid::RpathResolver::absolute_path_to_container_folder_
std::string absolute_path_to_container_folder_
Definition: rpath_resolver.h:54
pid::RpathResolver::exe_name_
std::string exe_name_
Definition: rpath_resolver.h:55
pid::RpathResolver::~RpathResolver
~RpathResolver()
pid::RpathResolver::resolve
static std::string resolve(const std::string &resource, bool prefer_debug=false)
resolve the path to the resource.
pid::RpathResolver::RpathResolver
RpathResolver()
pid::RpathResolver::configure_Module
static bool configure_Module(bool toload, const std::string &module_path, bool prefer_debug)
configure the PID runtime path management system when a new module is to be loaded.
pid::RpathResolver::resolve_Symlinks
static bool resolve_Symlinks()
pid::RpathResolver::configure
static bool configure(const std::string &exe_name)
configure the PID runtime path management system.
pid::RpathResolver
Singleton object to resolve runtime path in a PID system.
Definition: rpath_resolver.h:46
pid::RpathResolver::resolver_instance_
static RpathResolver * resolver_instance_
Definition: rpath_resolver.h:49
pid::RpathResolver::internal_Resolve_Dynamic
static std::string internal_Resolve_Dynamic(const PidPath &pp, bool prefer_debug)
pid::RpathResolver::internal_Resolve_Static
static std::string internal_Resolve_Static(const PidPath &pp, bool prefer_debug)
pid::RpathResolver::instance
static RpathResolver * instance()
pid::RpathResolver::get_Path_To_Resource
static std::string get_Path_To_Resource(const std::string &final_filename, bool is_written)
pid::RpathResolver::resolve_exe_path
static bool resolve_exe_path(const std::string &name_of_exe)