meta_object.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #include <string>
31 
34 
35 namespace class_loader
36 {
37 namespace class_loader_private
38 {
39 
41  const std::string & class_name, const std::string & base_class_name)
42 : associated_library_path_("Unknown"),
43  base_class_name_(base_class_name),
44  class_name_(class_name),
45  typeid_base_class_name_("UNSET")
46 /*****************************************************************************/
47 {
49  "class_loader.class_loader_private.AbstractMetaObjectBase: "
50  "Creating MetaObject %p (base = %s, derived = %s, library path = %s)",
51  this, baseClassName().c_str(), className().c_str(), getAssociatedLibraryPath().c_str());
52 }
53 
55 /*****************************************************************************/
56 {
58  "class_loader.class_loader_private.AbstractMetaObjectBase: "
59  "Destroying MetaObject %p (base = %s, derived = %s, library path = %s)",
60  this, baseClassName().c_str(), className().c_str(), getAssociatedLibraryPath().c_str());
61 }
62 
64 /*****************************************************************************/
65 {
66  return class_name_;
67 }
68 
70 /*****************************************************************************/
71 {
72  return base_class_name_;
73 }
74 
76 /*****************************************************************************/
77 {
79 }
80 
82 /*****************************************************************************/
83 {
85 }
86 
88 /*****************************************************************************/
89 {
90  associated_library_path_ = library_path;
91 }
92 
94 /*****************************************************************************/
95 {
97  if (std::find(v.begin(), v.end(), loader) == v.end()) {
98  v.push_back(loader);
99  }
100 }
101 
103 /*****************************************************************************/
104 {
106  ClassLoaderVector::iterator itr = std::find(v.begin(), v.end(), loader);
107  if (itr != v.end()) {
108  v.erase(itr);
109  }
110 }
111 
113 /*****************************************************************************/
114 {
116  ClassLoaderVector::iterator itr = std::find(v.begin(), v.end(), loader);
117  return itr != v.end();
118 }
119 
121 /*****************************************************************************/
122 {
123  return associated_class_loaders_.size() > 0;
124 }
125 
127 /*****************************************************************************/
128 {
130 }
131 
132 } // namespace class_loader_private
133 } // namespace class_loader
std::string baseClassName() const
gets the base class for the class this factory represents
Definition: meta_object.cpp:69
~AbstractMetaObjectBase()
Destructor for the class. THIS MUST NOT BE VIRTUAL AND OVERRIDDEN BY TEMPLATE SUBCLASSES, OTHERWISE THEY WILL PULL IN A REDUNDANT METAOBJECT DESTRUCTOR OUTSIDE OF libclass_loader WITHIN THE PLUGIN LIBRARY! T.
Definition: meta_object.cpp:54
#define CONSOLE_BRIDGE_logDebug(fmt,...)
bool isOwnedByAnybody()
Indicates if the factory is within the usable scope of any ClassLoader.
void removeOwningClassLoader(const ClassLoader *loader)
Removes a ClassLoader that is an owner of this factory.
This class allows loading and unloading of dynamically linked libraries which contain class definitio...
std::string className() const
Gets the literal name of the class.
Definition: meta_object.cpp:63
void addOwningClassLoader(ClassLoader *loader)
Associates a ClassLoader owner with this factory,.
Definition: meta_object.cpp:93
bool isOwnedBy(const ClassLoader *loader)
Indicates if the factory is within the usable scope of a ClassLoader.
AbstractMetaObjectBase(const std::string &class_name, const std::string &base_class_name)
Constructor for the class.
Definition: meta_object.cpp:40
std::vector< class_loader::ClassLoader * > ClassLoaderVector
Definition: meta_object.hpp:53
void setAssociatedLibraryPath(std::string library_path)
Sets the path to the library associated with this factory.
Definition: meta_object.cpp:87
std::string typeidBaseClassName() const
Gets the name of the class as typeid(BASE_CLASS).name() would return it.
Definition: meta_object.cpp:75
std::string getAssociatedLibraryPath()
Gets the path to the library associated with this factory.
Definition: meta_object.cpp:81


class_loader
Author(s): Mirza Shah
autogenerated on Wed Jun 5 2019 22:08:15