22 #include "pAcommsHandler.h" 24 std::vector<void*> plugin_handles_;
29 int main(
int argc,
char* argv[])
34 char* plugins = getenv(
"PACOMMSHANDLER_PLUGINS");
37 std::string s_plugins(plugins);
38 std::vector<std::string> plugin_vec;
39 boost::split(plugin_vec, s_plugins, boost::is_any_of(
";:,"));
41 for (
int i = 0, n = plugin_vec.size(); i < n; ++i)
43 std::cout <<
"Loading pAcommsHandler plugin library: " << plugin_vec[i] << std::endl;
44 void* handle = dlopen(plugin_vec[i].c_str(), RTLD_LAZY);
47 plugin_handles_.push_back(handle);
50 std::cerr <<
"Failed to open library: " << plugin_vec[i] << std::endl;
54 const char* (*name_function)(void) =
55 (
const char* (*)(void))dlsym(handle, "goby_driver_name");
57 CpAcommsHandler::driver_plugins_.insert(
58 std::make_pair(
std::
string((*name_function)()), handle));
62 int return_value =
goby::moos::
run<CpAcommsHandler>(argc, argv);
64 goby::transitional::DCCLAlgorithmPerformer::deleteInstance();
65 CpAcommsHandler::delete_instance();
66 goby::util::DynamicProtobufManager::protobuf_shutdown();
68 for (
int i = 0, n = plugin_handles_.size(); i < n; ++i) dlclose(plugin_handles_[i]);
int run(int argc, char *argv[], Config *cfg)
Run a Goby application derived from MinimalApplicationBase. blocks caller until MinimalApplicationBas...
void add_group(const std::string &name, Colors::Color color=Colors::nocolor, const std::string &description="")
Add another group to the logger. A group provides related manipulator for categorizing log messages...
common::FlexOstream glog
Access the Goby logger through this object.
The global namespace for the Goby project.