|
From: <tf...@us...> - 2009-08-25 01:38:42
|
Revision: 22804
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=22804&view=rev
Author: tfoote
Date: 2009-08-25 01:38:34 +0000 (Tue, 25 Aug 2009)
Log Message:
-----------
switching to new pluginlib api as per review #2531
Modified Paths:
--------------
pkg/trunk/sandbox/pluginlib_tutorials/pluginlib_tutorial_user/example.cpp
pkg/trunk/stacks/common/pluginlib/include/pluginlib/class_loader.h
pkg/trunk/stacks/common/pluginlib/include/pluginlib/class_loader_imp.h
Modified: pkg/trunk/sandbox/pluginlib_tutorials/pluginlib_tutorial_user/example.cpp
===================================================================
--- pkg/trunk/sandbox/pluginlib_tutorials/pluginlib_tutorial_user/example.cpp 2009-08-25 01:36:49 UTC (rev 22803)
+++ pkg/trunk/sandbox/pluginlib_tutorials/pluginlib_tutorial_user/example.cpp 2009-08-25 01:38:34 UTC (rev 22804)
@@ -48,7 +48,7 @@
}
- if (cl.loadClass("square"))
+ if (cl.loadLibraryForClass("square"))
{
ROS_INFO("Loaded library with plugin square inside");
}
@@ -79,12 +79,12 @@
else ROS_INFO("Triangle Class not loaded");
- if (!cl.loadClass("line"))
+ if (!cl.loadLibraryForClass("line"))
ROS_ERROR("Correctly failed to load line in polygon loader");
pluginlib::ClassLoader<shape> ph("pluginlib_tutorial_interfaces", "shape");
- if (!ph.loadClass("line"))
+ if (!ph.loadLibraryForClass("line"))
ROS_ERROR("Failed to load line");
if (ph.isClassLoaded("line"))
Modified: pkg/trunk/stacks/common/pluginlib/include/pluginlib/class_loader.h
===================================================================
--- pkg/trunk/stacks/common/pluginlib/include/pluginlib/class_loader.h 2009-08-25 01:36:49 UTC (rev 22803)
+++ pkg/trunk/stacks/common/pluginlib/include/pluginlib/class_loader.h 2009-08-25 01:38:34 UTC (rev 22804)
@@ -97,10 +97,9 @@
/**
* @brief Given the lookup name of a class, returns the type of the associated base class
- * @param lookup_name The lookup name of the class
* @return The type of the associated base class
*/
- std::string getBaseClassType(const std::string& lookup_name);
+ std::string getBaseClassType() const;
/**
* @brief Given the name of a class, returns name of the containing package
@@ -130,7 +129,7 @@
* @param lookup_name The lookup name of the class to load
* @return True if the class and its associated library were successfully loaded, false otherwise
*/
- bool loadClass(const std::string & lookup_name);
+ bool loadLibraryForClass(const std::string & lookup_name);
private:
/**
Modified: pkg/trunk/stacks/common/pluginlib/include/pluginlib/class_loader_imp.h
===================================================================
--- pkg/trunk/stacks/common/pluginlib/include/pluginlib/class_loader_imp.h 2009-08-25 01:36:49 UTC (rev 22803)
+++ pkg/trunk/stacks/common/pluginlib/include/pluginlib/class_loader_imp.h 2009-08-25 01:38:34 UTC (rev 22804)
@@ -148,7 +148,7 @@
}
template <class T>
- bool ClassLoader<T>::loadClass(const std::string & lookup_name)
+ bool ClassLoader<T>::loadLibraryForClass(const std::string & lookup_name)
{
std::string library_path;
ClassMapIterator it = classes_available_.find(lookup_name);
@@ -235,12 +235,9 @@
}
template <class T>
- std::string ClassLoader<T>::getBaseClassType(const std::string& lookup_name)
+ std::string ClassLoader<T>::getBaseClassType() const
{
- ClassMapIterator it = classes_available_.find(lookup_name);
- if (it != classes_available_.end())
- return it->second.base_class_;
- return "";
+ return base_class_;
}
template <class T>
@@ -265,7 +262,7 @@
T* ClassLoader<T>::createClassInstance(const std::string& lookup_name, bool auto_load)
{
if ( auto_load && !isClassLoaded(lookup_name))
- if(!loadClass(lookup_name))
+ if(!loadLibraryForClass(lookup_name))
{
ROS_ERROR("Failed to auto load library");
throw std::runtime_error("Failed to auto load library for class " + lookup_name + ".");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|