ATLAS Offline Software
AthDsoUtils.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
11 // note: This, I believe, should be part of Reflex::SharedLibrary
12 
13 // STL includes
14 #include <string.h>
15 #include <string>
16 
17 #include "GaudiKernel/System.h"
19 
20 namespace Athena {
21 namespace DsoUtils {
22 
23 inline
24 std::string
25 libNativeName( const std::string& libName )
26 {
27 #if defined(_WIN32)
28  return libName+".dll";
29 #elif defined(__linux) || defined(__APPLE__)
30  return "lib"+libName+".so";
31 #else
32  // variant of the GIGO design pattern
33  return libName;
34 #endif
35 }
36 
37 static
38 std::string
39 dsoName( const RootDataMember& mem )
40 {
41  const char *lib = mem.GetSharedLibs();
42  return lib? lib : "";
43 }
44 
45 bool
46 inDso( const RootDataMember& mem,
47  const std::string& dsoname )
48 {
49 #ifdef _WIN32
50  char sep = '\\';
51 #else
52  char sep = '/';
53 #endif
54 
55  std::string srcname = dsoName(mem);
56  if (srcname.empty()) {
57  // we do not know the name of the library, let's guess it's OK
58  return true;
59  }
60 
61  std::string::size_type pos = dsoname.find_last_of(sep);
62  std::string curname;
63  if (std::string::npos == pos) {
64  curname = dsoname;
65  } else {
66  curname = dsoname.substr(pos+1);
67  }
68 
69  return srcname == curname;
70 }
71 
72 } // end namespace DsoUtils
73 
74 } // end namespace Athena
75 
76 
checkPlugins.libName
libName
Definition: checkPlugins.py:143
Athena::DsoUtils::libNativeName
std::string libNativeName(const std::string &libName)
Definition: AthDsoUtils.cxx:25
AthDsoUtils.h
Athena::DsoUtils::inDso
bool inDso(const RootDataMember &mem, const std::string &dsoname)
Definition: AthDsoUtils.cxx:46
TMemberAdapter
Definition: RootType.h:60
Athena
Some weak symbol referencing magic...
Definition: AthLegacySequence.h:21
grepfile.sep
sep
Definition: grepfile.py:38
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TMemberAdapter::GetSharedLibs
const char * GetSharedLibs() const
Definition: RootType.cxx:212