Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
a6d764bd
Commit
a6d764bd
authored
5 years ago
by
Joaquim Casals Buñuel
Browse files
Options
Downloads
Patches
Plain Diff
Split loader.hpp -> {.h, .cpp}
parent
409fdcf1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#5067
passed
5 years ago
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+2
-1
2 additions, 1 deletion
CMakeLists.txt
include/core/utils/loader.h
+32
-0
32 additions, 0 deletions
include/core/utils/loader.h
src/problem/problem.cpp
+1
-1
1 addition, 1 deletion
src/problem/problem.cpp
src/utils/loader.cpp
+37
-0
37 additions, 0 deletions
src/utils/loader.cpp
with
72 additions
and
2 deletions
CMakeLists.txt
+
2
−
1
View file @
a6d764bd
...
...
@@ -185,7 +185,7 @@ SET(HDRS_UTILS
include/core/utils/converter.h
include/core/utils/eigen_assert.h
include/core/utils/eigen_predicates.h
include/core/utils/loader.h
pp
include/core/utils/loader.h
include/core/utils/logging.h
include/core/utils/make_unique.h
include/core/utils/params_server.h
...
...
@@ -322,6 +322,7 @@ SET(SRCS_MATH
SET
(
SRCS_UTILS
src/utils/converter_utils.cpp
src/utils/params_server.cpp
src/utils/loader.cpp
)
SET
(
SRCS_CAPTURE
...
...
This diff is collapsed.
Click to expand it.
include/core/utils/loader.h
pp
→
include/core/utils/loader.h
+
32
−
0
View file @
a6d764bd
#ifndef LOADER_H
PP
#define LOADER_H
PP
#include
<dlfcn.h>
#ifndef LOADER_H
#define LOADER_H
#include
<string>
#include
<stdexcept>
class
Loader
{
protected:
std
::
string
path_
;
public:
Loader
(
std
::
string
_file
){
this
->
path_
=
_file
;
}
Loader
(
std
::
string
_file
);
virtual
void
load
()
=
0
;
virtual
void
close
()
=
0
;
};
class
LoaderRaw
:
public
Loader
{
void
*
resource_
;
public:
LoaderRaw
(
std
::
string
_file
)
:
Loader
(
_file
)
{
//
}
~
LoaderRaw
(){
this
->
close
();
}
void
load
(){
this
->
resource_
=
dlopen
(
this
->
path_
.
c_str
(),
RTLD_LAZY
);
if
(
not
this
->
resource_
)
throw
std
::
runtime_error
(
"Couldn't load resource with path "
+
this
->
path_
+
"
\n
"
+
"Error info: "
+
dlerror
());
}
void
close
(){
if
(
this
->
resource_
)
dlclose
(
this
->
resource_
);
}
LoaderRaw
(
std
::
string
_file
);
~
LoaderRaw
();
void
load
();
void
close
();
};
// class LoaderPlugin: public Loader{
// ClassLoader* resource_;
...
...
@@ -42,4 +29,4 @@ public:
// delete this->resource_;
// }
// };
#endif
\ No newline at end of file
#endif
This diff is collapsed.
Click to expand it.
src/problem/problem.cpp
+
1
−
1
View file @
a6d764bd
...
...
@@ -13,7 +13,7 @@
#include
"core/state_block/state_block.h"
#include
"core/utils/logging.h"
#include
"core/utils/params_server.h"
#include
"core/utils/loader.h
pp
"
#include
"core/utils/loader.h"
#include
"core/utils/check_log.hpp"
...
...
This diff is collapsed.
Click to expand it.
src/utils/loader.cpp
0 → 100644
+
37
−
0
View file @
a6d764bd
#include
"core/utils/loader.h"
#include
<dlfcn.h>
#include
<stdexcept>
Loader
::
Loader
(
std
::
string
_file
)
{
path_
=
_file
;
}
LoaderRaw
::
LoaderRaw
(
std
::
string
_file
)
:
Loader
(
_file
)
{
//
}
LoaderRaw
::~
LoaderRaw
()
{
close
();
}
void
LoaderRaw
::
load
()
{
resource_
=
dlopen
(
path_
.
c_str
(),
RTLD_LAZY
);
if
(
not
resource_
)
throw
std
::
runtime_error
(
"Couldn't load resource with path "
+
path_
+
"
\n
"
+
"Error info: "
+
dlerror
());
}
void
LoaderRaw
::
close
()
{
if
(
resource_
)
dlclose
(
resource_
);
}
// class LoaderPlugin: public Loader{
// ClassLoader* resource_;
// void load(){
// resource_ = new ClassLoader(path_);
// }
// void close(){
// delete resource_;
// }
// };
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