File: DynamicLoader.h

package info (click to toggle)
thepeg 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 9,312 kB
  • ctags: 11,509
  • sloc: cpp: 57,129; sh: 11,315; java: 3,212; lisp: 1,402; makefile: 830; ansic: 58; perl: 3
file content (127 lines) | stat: -rw-r--r-- 3,118 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// -*- C++ -*-
//
// DynamicLoader.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_DynamicLoader_H
#define ThePEG_DynamicLoader_H
// This is the declaration of the DynamicLoader class.

#include "ThePEG/Config/ThePEG.h"

namespace ThePEG {

/**
 * <code>DynamicLoader</code> is the general interface to the dynamic
 * loader functions of the underlying operating system. Currently it
 * only works on Linux.
 *
 * @see ClassTraits
 * @see ClassDescription
 * @see DescriptionList
 * @see PersistentIStream
 */
class DynamicLoader {

public:

  /**
   * The actual load command used on the current platform.
   */
  static bool loadcmd(string);

  /**
   * Try to load the file given as argument. If the filename does not
   * begin with a '/', try to prepend the paths one at the time until
   * success.  If all fail try without prepending a path.
   * @return true if the loading succeeded, false otherwise.
   */
  static bool load(string file);

  /**
   * Add a path to the bottom of the list of directories to seach for
   * dynaically linkable libraries.
   */
  static void appendPath(string);

  /**
   * Add a path to the top of the list of directories to seach for
   * dynaically linkable libraries.
   */
  static void prependPath(string);

  /**
   * Return the last error message issued from the platforms loader.
   */
  static string lastErrorMessage;

  /**
   * Insert the name of the given library with correct version numbers
   * appended, in the corresponding map.
   */
  static void dlname(string);

  /**
   * Given a list of generic library names, return the same list with
   * appended version numbers where available.
   */
  static string dlnameversion(string libs);

  /**
   * Return the full list of directories to seach for dynaically
   * linkable libraries.
   */
  static const vector<string> & allPaths();

  /**
   * Return the list of appended directories to seach for dynaically
   * linkable libraries.
   */
  static const vector<string> & appendedPaths();

  /**
   * Return the list of prepended directories to seach for dynaically
   * linkable libraries.
   */
  static const vector<string> & prependedPaths();

private:

  /**
   * The list of directories to seach for dynaically linkable
   * libraries.
   */
  static vector<string> paths;

  /**
   * The list of prepended directories to seach for dynaically linkable
   * libraries.
   */
  static vector<string> prepaths;

  /**
   * The list of appended directories to seach for dynaically linkable
   * libraries.
   */
  static vector<string> apppaths;

  /**
   * Used to initialize the paths vector from the ThePEG_PATH
   * environment.
   */
  static vector<string> defaultPaths();

  /**
   * Map of names of dynamic libraries with correct version numbers
   * indexed by their generic names.
   */
  static map<string,string> versionMap;

};

}

#endif /* ThePEG_DynamicLoader_H */