meta_object.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2012, Willow Garage, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of the Willow Garage, Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 #include "class_loader/meta_object.h"
00031 #include "class_loader/class_loader.h"
00032 
00033 namespace class_loader
00034 {
00035 namespace class_loader_private
00036 {
00037 
00038 AbstractMetaObjectBase::AbstractMetaObjectBase(const std::string& class_name, const std::string& base_class_name) :  
00039 associated_library_path_("Unknown"),
00040 base_class_name_(base_class_name),
00041 class_name_(class_name),
00042 typeid_base_class_name_("UNSET")
00043 /*****************************************************************************/
00044 {
00045     logDebug("class_loader::class_loader_private::AbstractMetaObjectBase: Creating MetaObject %p (base = %s, derived = %s, library path = %s)", this, baseClassName().c_str(), className().c_str(), getAssociatedLibraryPath().c_str());
00046 }
00047 
00048 AbstractMetaObjectBase::~AbstractMetaObjectBase()
00049 /*****************************************************************************/
00050 {
00051     logDebug("class_loader::class_loader_private::AbstractMetaObjectBase: Destroying MetaObject %p (base = %s, derived = %s, library path = %s)", this, baseClassName().c_str(), className().c_str(), getAssociatedLibraryPath().c_str());
00052 } 
00053 
00054 std::string AbstractMetaObjectBase::className() const
00055 /*****************************************************************************/
00056 {
00057   return class_name_;
00058 }
00059 
00060 std::string AbstractMetaObjectBase::baseClassName() const
00061 /*****************************************************************************/
00062 {
00063   return base_class_name_;
00064 }
00065 
00066 std::string AbstractMetaObjectBase::typeidBaseClassName() const 
00067 /*****************************************************************************/
00068 {
00069   return typeid_base_class_name_;
00070 }
00071 
00072 std::string AbstractMetaObjectBase::getAssociatedLibraryPath()
00073 /*****************************************************************************/
00074 {
00075   return(associated_library_path_);
00076 }
00077 
00078 void AbstractMetaObjectBase::setAssociatedLibraryPath(std::string library_path)
00079 /*****************************************************************************/
00080 {
00081   associated_library_path_ = library_path;
00082 }
00083 
00084 void AbstractMetaObjectBase::addOwningClassLoader(ClassLoader* loader)
00085 /*****************************************************************************/
00086 {
00087   ClassLoaderVector& v = associated_class_loaders_;
00088   if(std::find(v.begin(), v.end(), loader) == v.end())
00089     v.push_back(loader);
00090 }
00091 
00092 void AbstractMetaObjectBase::removeOwningClassLoader(const ClassLoader* loader)
00093 /*****************************************************************************/
00094 {
00095   ClassLoaderVector& v = associated_class_loaders_;
00096   ClassLoaderVector::iterator itr = std::find(v.begin(), v.end(), loader);
00097   if(itr != v.end())
00098     v.erase(itr);
00099 }
00100 
00101 bool AbstractMetaObjectBase::isOwnedBy(const ClassLoader* loader)
00102 /*****************************************************************************/
00103 {
00104   ClassLoaderVector& v = associated_class_loaders_;
00105   ClassLoaderVector::iterator itr = std::find(v.begin(), v.end(), loader);
00106   return(itr != v.end());
00107 }
00108 
00109 bool AbstractMetaObjectBase::isOwnedByAnybody()
00110 /*****************************************************************************/
00111 {
00112   return(associated_class_loaders_.size() > 0);
00113 }
00114 
00115 ClassLoaderVector AbstractMetaObjectBase::getAssociatedClassLoaders()
00116 /*****************************************************************************/
00117 {
00118   return(associated_class_loaders_);
00119 }
00120 
00121 }
00122 
00123 
00124 }


class_loader
Author(s): Mirza Shah
autogenerated on Sun Oct 5 2014 22:50:57