Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModelCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
GeoModelDev
GeoModelCore
Commits
136eb515
Commit
136eb515
authored
5 years ago
by
Joseph Boudreau
Browse files
Options
Downloads
Patches
Plain Diff
Added a new plugin loader
parent
f19ff1e6
No related branches found
No related tags found
No related merge requests found
Pipeline
#1389732
passed
5 years ago
Stage: build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GeoModelKernel/GeoModelKernel/GeoGeometryPluginLoader.h
+29
-0
29 additions, 0 deletions
GeoModelKernel/GeoModelKernel/GeoGeometryPluginLoader.h
GeoModelKernel/src/GeoGeometryPluginLoader.cxx
+49
-0
49 additions, 0 deletions
GeoModelKernel/src/GeoGeometryPluginLoader.cxx
with
78 additions
and
0 deletions
GeoModelKernel/GeoModelKernel/GeoGeometryPluginLoader.h
0 → 100755
+
29
−
0
View file @
136eb515
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef GEOGEOMETRYPLUGINLOADER_H_
#define GEOGEOMETRYPLUGINLOADER_H_
#include
<string>
class
GeoVGeometryPlugin
;
class
GeoGeometryPluginLoader
{
public:
// Constructor:
GeoGeometryPluginLoader
();
// Destructor:
~
GeoGeometryPluginLoader
();
// load Geometry plugin
GeoVGeometryPlugin
*
load
(
const
std
::
string
&
path
)
const
;
private:
GeoGeometryPluginLoader
(
const
GeoGeometryPluginLoader
&
)
=
delete
;
GeoGeometryPluginLoader
&
operator
=
(
const
GeoGeometryPluginLoader
&
)
=
delete
;
};
#endif
This diff is collapsed.
Click to expand it.
GeoModelKernel/src/GeoGeometryPluginLoader.cxx
0 → 100644
+
49
−
0
View file @
136eb515
#include
"GeoModelKernel/GeoGeometryPluginLoader.h"
#include
"GeoModelKernel/GeoVGeometryPlugin.h"
#include
<string>
#include
<iostream>
#include
<dlfcn.h>
#include
<libgen.h>
GeoGeometryPluginLoader
::
GeoGeometryPluginLoader
()
{
}
GeoGeometryPluginLoader
::~
GeoGeometryPluginLoader
()
{
}
GeoVGeometryPlugin
*
GeoGeometryPluginLoader
::
load
(
const
std
::
string
&
pString
)
const
{
std
::
string
bNameString
=
basename
((
char
*
)
pString
.
c_str
());
// Strip off the directory
bNameString
=
bNameString
.
substr
(
3
);
// Strip off leading "lib"
bNameString
=
bNameString
.
substr
(
0
,
bNameString
.
find
(
"."
));
// Strip off extensions
std
::
string
createFunctionName
=
std
::
string
(
"create"
)
+
bNameString
;
//
// Loads the library:
//
void
*
handle
=
dlopen
(
pString
.
c_str
(),
RTLD_NOW
);
if
(
!
handle
)
{
std
::
cerr
<<
dlerror
()
<<
std
::
endl
;
return
nullptr
;
}
//
// Gets the function
//
void
*
f
=
dlsym
(
handle
,
createFunctionName
.
c_str
());
if
(
!
f
)
{
std
::
cerr
<<
dlerror
()
<<
std
::
endl
;
return
nullptr
;
}
typedef
void
*
(
*
CreationMethod
)
();
CreationMethod
F
=
(
CreationMethod
)
f
;
//
//
//
GeoVGeometryPlugin
*
factory
=
(
GeoVGeometryPlugin
*
)
F
();
return
factory
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment