-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure. Remove common_ekf. Load libs at runtime
- Loading branch information
Showing
13 changed files
with
75 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "ekf_load.h" | ||
#include <dlfcn.h> | ||
|
||
std::vector<const EKF*>& ekf_get_all() { | ||
static std::vector<const EKF*> vec; | ||
return vec; | ||
} | ||
|
||
void ekf_register(const EKF* ekf) { | ||
ekf_get_all().push_back(ekf); | ||
} | ||
|
||
const EKF* ekf_lookup(const std::string& ekf_name) { | ||
for (const auto& ekfi : ekf_get_all()) { | ||
if (ekf_name == ekfi->name) { | ||
return ekfi; | ||
} | ||
} | ||
return NULL; | ||
} | ||
|
||
void ekf_load_and_register(const std::string& ekf_directory, const std::string& ekf_name) { | ||
if (ekf_lookup(ekf_name)) { | ||
return; | ||
} | ||
|
||
#ifdef __APPLE__ | ||
std::string dylib_ext = ".dylib"; | ||
#else | ||
std::string dylib_ext = ".so"; | ||
#endif | ||
std::string ekf_path = ekf_directory + "/lib" + ekf_name + dylib_ext; | ||
void* handle = dlopen(ekf_path.c_str(), RTLD_NOW); | ||
assert(handle); | ||
void* (*ekf_get)() = (void*(*)())dlsym(handle, "ekf_get"); | ||
assert(ekf_get != NULL); | ||
const EKF* ekf = (const EKF*)ekf_get(); | ||
ekf_register(ekf); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <vector> | ||
#include <string> | ||
|
||
#include "ekf.h" | ||
|
||
std::vector<const EKF*>& ekf_get_all(); | ||
const EKF* ekf_lookup(const std::string& ekf_name); | ||
void ekf_register(const EKF* ekf); | ||
void ekf_load_and_register(const std::string& ekf_directory, const std::string& ekf_name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters