Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:34

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_PATHRESOLVER_H
0012 #define GAUDIKERNEL_PATHRESOLVER_H
0013 
0014 #include "GaudiKernel/Kernel.h"
0015 #include <string>
0016 
0017 namespace System {
0018 
0019   class GAUDI_API PathResolver
0020 
0021   {
0022   public:
0023     typedef enum { Ok, EnvironmentVariableUndefined, UnknownDirectory } SearchPathStatus;
0024 
0025     typedef enum { LocalSearch, RecursiveSearch } SearchType;
0026 
0027     /**
0028 
0029       @arg @c logical_file_name the name of the file to locate in the search path
0030       @arg @c search_path the name of a path-like environment variable
0031       @arg @c search_type characterizes the type of search. Can be either @c LocalSearch or @c RecursiveSearch
0032 
0033       @return the physical name of the located file or empty string if not found
0034 
0035      */
0036     static std::string find_file( const std::string& logical_file_name, const std::string& search_path,
0037                                   SearchType search_type = LocalSearch );
0038 
0039     /**
0040 
0041       @arg @c logical_file_name the name of the file to locate in the search path
0042       @arg @c search_list the prioritized list of possible locations separated by the usual path separator
0043       @arg @c search_type characterizes the type of search. Can be either @c LocalSearch or @c RecursiveSearch
0044 
0045       @return the physical name of the located file or empty string if not found
0046 
0047      */
0048     static std::string find_file_from_list( const std::string& logical_file_name, const std::string& search_list,
0049                                             SearchType search_type = LocalSearch );
0050 
0051     /**
0052 
0053       @arg @c logical_file_name the name of the directory to locate in the search path
0054       @arg @c search_path the name of a path-like environment variable
0055       @arg @c search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
0056 
0057       @return the physical name of the located directory or empty string if not found
0058 
0059      */
0060     static std::string find_directory( const std::string& logical_file_name, const std::string& search_path,
0061                                        SearchType search_type = LocalSearch );
0062 
0063     /**
0064 
0065       @arg @c logical_file_name the name of the directory to locate in the search path
0066       @arg @c search_list the prioritized list of possible locations separated by the usual path separator
0067       @arg @c search_type characterizes the type of search. Can be either LocalSearch or RecursiveSearch
0068 
0069       @return the physical name of the located directory or empty string if not found
0070 
0071      */
0072     static std::string find_directory_from_list( const std::string& logical_file_name, const std::string& search_list,
0073                                                  SearchType search_type = LocalSearch );
0074 
0075     /**
0076 
0077     @arg @c search_path the name of a path-like environment variable
0078 
0079     @return the result of the verification. Can be one of @c Ok, @c EnvironmentVariableUndefined, @c UnknownDirectory
0080 
0081      */
0082     static SearchPathStatus check_search_path( const std::string& search_path );
0083   };
0084 
0085   GAUDI_API std::string PathResolverFindXMLFile( const std::string& logical_file_name );
0086   GAUDI_API std::string PathResolverFindDataFile( const std::string& logical_file_name );
0087 } // namespace System
0088 
0089 #endif