Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <string>
00031
00032 #include "class_loader/meta_object.hpp"
00033 #include "class_loader/class_loader.hpp"
00034
00035 namespace class_loader
00036 {
00037 namespace class_loader_private
00038 {
00039
00040 AbstractMetaObjectBase::AbstractMetaObjectBase(
00041 const std::string & class_name, const std::string & base_class_name)
00042 : associated_library_path_("Unknown"),
00043 base_class_name_(base_class_name),
00044 class_name_(class_name),
00045 typeid_base_class_name_("UNSET")
00046
00047 {
00048 CONSOLE_BRIDGE_logDebug(
00049 "class_loader.class_loader_private.AbstractMetaObjectBase: "
00050 "Creating MetaObject %p (base = %s, derived = %s, library path = %s)",
00051 this, baseClassName().c_str(), className().c_str(), getAssociatedLibraryPath().c_str());
00052 }
00053
00054 AbstractMetaObjectBase::~AbstractMetaObjectBase()
00055
00056 {
00057 CONSOLE_BRIDGE_logDebug(
00058 "class_loader.class_loader_private.AbstractMetaObjectBase: "
00059 "Destroying MetaObject %p (base = %s, derived = %s, library path = %s)",
00060 this, baseClassName().c_str(), className().c_str(), getAssociatedLibraryPath().c_str());
00061 }
00062
00063 std::string AbstractMetaObjectBase::className() const
00064
00065 {
00066 return class_name_;
00067 }
00068
00069 std::string AbstractMetaObjectBase::baseClassName() const
00070
00071 {
00072 return base_class_name_;
00073 }
00074
00075 std::string AbstractMetaObjectBase::typeidBaseClassName() const
00076
00077 {
00078 return typeid_base_class_name_;
00079 }
00080
00081 std::string AbstractMetaObjectBase::getAssociatedLibraryPath()
00082
00083 {
00084 return associated_library_path_;
00085 }
00086
00087 void AbstractMetaObjectBase::setAssociatedLibraryPath(std::string library_path)
00088
00089 {
00090 associated_library_path_ = library_path;
00091 }
00092
00093 void AbstractMetaObjectBase::addOwningClassLoader(ClassLoader * loader)
00094
00095 {
00096 ClassLoaderVector & v = associated_class_loaders_;
00097 if (std::find(v.begin(), v.end(), loader) == v.end()) {
00098 v.push_back(loader);
00099 }
00100 }
00101
00102 void AbstractMetaObjectBase::removeOwningClassLoader(const ClassLoader * loader)
00103
00104 {
00105 ClassLoaderVector & v = associated_class_loaders_;
00106 ClassLoaderVector::iterator itr = std::find(v.begin(), v.end(), loader);
00107 if (itr != v.end()) {
00108 v.erase(itr);
00109 }
00110 }
00111
00112 bool AbstractMetaObjectBase::isOwnedBy(const ClassLoader * loader)
00113
00114 {
00115 ClassLoaderVector & v = associated_class_loaders_;
00116 ClassLoaderVector::iterator itr = std::find(v.begin(), v.end(), loader);
00117 return itr != v.end();
00118 }
00119
00120 bool AbstractMetaObjectBase::isOwnedByAnybody()
00121
00122 {
00123 return associated_class_loaders_.size() > 0;
00124 }
00125
00126 ClassLoaderVector AbstractMetaObjectBase::getAssociatedClassLoaders()
00127
00128 {
00129 return associated_class_loaders_;
00130 }
00131
00132 }
00133 }