Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:32

0001 // -*- C++ -*-
0002 //
0003 // DynamicLoader.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef ThePEG_DynamicLoader_H
0010 #define ThePEG_DynamicLoader_H
0011 // This is the declaration of the DynamicLoader class.
0012 
0013 #include "ThePEG/Config/ThePEG.h"
0014 
0015 namespace ThePEG {
0016 
0017 /**
0018  * <code>DynamicLoader</code> is the general interface to the dynamic
0019  * loader functions of the underlying operating system. Currently it
0020  * only works on Linux.
0021  *
0022  * @see ClassTraits
0023  * @see ClassDescription
0024  * @see DescriptionList
0025  * @see PersistentIStream
0026  */
0027 class DynamicLoader {
0028 
0029 public:
0030 
0031   /**
0032    * The actual load command used on the current platform.
0033    */
0034   static bool loadcmd(string);
0035 
0036   /**
0037    * Try to load the file given as argument. If the filename does not
0038    * begin with a '/', try to prepend the paths one at the time until
0039    * success.  If all fail try without prepending a path.
0040    * @return true if the loading succeeded, false otherwise.
0041    */
0042   static bool load(string file);
0043 
0044   /**
0045    * Add a path to the bottom of the list of directories to seach for
0046    * dynaically linkable libraries.
0047    */
0048   static void appendPath(string);
0049 
0050   /**
0051    * Add a path to the top of the list of directories to seach for
0052    * dynaically linkable libraries.
0053    */
0054   static void prependPath(string);
0055 
0056   /**
0057    * Return the last error message issued from the platforms loader.
0058    */
0059   static string lastErrorMessage;
0060 
0061   /**
0062    * Insert the name of the given library with correct version numbers
0063    * appended, in the corresponding map.
0064    */
0065   static void dlname(string);
0066 
0067   /**
0068    * Given a list of generic library names, return the same list with
0069    * appended version numbers where available.
0070    */
0071   static string dlnameversion(string libs);
0072 
0073   /**
0074    * Return the full list of directories to seach for dynaically
0075    * linkable libraries.
0076    */
0077   static const vector<string> & allPaths();
0078 
0079   /**
0080    * Return the list of appended directories to seach for dynaically
0081    * linkable libraries.
0082    */
0083   static const vector<string> & appendedPaths();
0084 
0085   /**
0086    * Return the list of prepended directories to seach for dynaically
0087    * linkable libraries.
0088    */
0089   static const vector<string> & prependedPaths();
0090 
0091 private:
0092 
0093   /**
0094    * The list of directories to seach for dynaically linkable
0095    * libraries.
0096    */
0097   static vector<string> paths;
0098 
0099   /**
0100    * The list of prepended directories to seach for dynaically linkable
0101    * libraries.
0102    */
0103   static vector<string> prepaths;
0104 
0105   /**
0106    * The list of appended directories to seach for dynaically linkable
0107    * libraries.
0108    */
0109   static vector<string> apppaths;
0110 
0111   /**
0112    * Used to initialize the paths vector from the ThePEG_PATH
0113    * environment.
0114    */
0115   static vector<string> defaultPaths();
0116 
0117   /**
0118    * Map of names of dynamic libraries with correct version numbers
0119    * indexed by their generic names.
0120    */
0121   static map<string,string> versionMap;
0122 
0123 };
0124 
0125 }
0126 
0127 #endif /* ThePEG_DynamicLoader_H */