File: Poco.ClassLoader.html

package info (click to toggle)
poco-doc 1.3.6-1.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 10,080 kB
  • sloc: makefile: 31
file content (163 lines) | stat: -rw-r--r-- 15,544 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::ClassLoader</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="template">template &lt; class Base &gt;</h1>
<h1 class="symbol">class ClassLoader</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> SharedLibrary<br />
<b>Header:</b> Poco/ClassLoader.h</p>
<h2>Description</h2>
<div class="description">
<p>The <a href="Poco.ClassLoader.html" title="class Poco::ClassLoader">ClassLoader</a> loads C++ classes from shared libraries at runtime. It must be instantiated with a root class of the loadable classes. For a class to be loadable from a library, the library must provide a <a href="Poco.Manifest.html" title="class Poco::Manifest">Manifest</a> of all the classes it contains. The <a href="Poco.Manifest.html" title="class Poco::Manifest">Manifest</a> for a shared library can be easily built with the help of the macros in the header file &quot;Foundation/ClassLibrary.h&quot;. </p>
<p>Starting with POCO release 1.3, a class library can export multiple manifests. In addition to the default (unnamed) manifest, multiple named manifests can be exported, each having a different base class. </p>
<p>There is one important restriction: one instance of <a href="Poco.ClassLoader.html" title="class Poco::ClassLoader">ClassLoader</a> can only load one manifest from a class library. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.ClassLoader.html#4239" title="Poco::ClassLoader::begin()">begin</a>, <a href="Poco.ClassLoader.html#4225" title="Poco::ClassLoader::canCreate()">canCreate</a>, <a href="Poco.ClassLoader.html#4219" title="Poco::ClassLoader::classFor()">classFor</a>, <a href="Poco.ClassLoader.html#4221" title="Poco::ClassLoader::create()">create</a>, <a href="Poco.ClassLoader.html#4227" title="Poco::ClassLoader::destroy()">destroy</a>, <a href="Poco.ClassLoader.html#4240" title="Poco::ClassLoader::end()">end</a>, <a href="Poco.ClassLoader.html#4217" title="Poco::ClassLoader::findClass()">findClass</a>, <a href="Poco.ClassLoader.html#4233" title="Poco::ClassLoader::findManifest()">findManifest</a>, <a href="Poco.ClassLoader.html#4223" title="Poco::ClassLoader::instance()">instance</a>, <a href="Poco.ClassLoader.html#4230" title="Poco::ClassLoader::isAutoDelete()">isAutoDelete</a>, <a href="Poco.ClassLoader.html#4237" title="Poco::ClassLoader::isLibraryLoaded()">isLibraryLoaded</a>, <a href="Poco.ClassLoader.html#4210" title="Poco::ClassLoader::loadLibrary()">loadLibrary</a>, <a href="Poco.ClassLoader.html#4235" title="Poco::ClassLoader::manifestFor()">manifestFor</a>, <a href="Poco.ClassLoader.html#4215" title="Poco::ClassLoader::unloadLibrary()">unloadLibrary</a></p>
<h2>Nested Classes</h2>
<h3><a href="Poco.ClassLoader.Iterator.html" class="class">class Iterator</a></h3>
<p> The <a href="Poco.ClassLoader.html" title="class Poco::ClassLoader">ClassLoader</a>'s very own iterator class.&nbsp;<a href="Poco.ClassLoader.Iterator.html"><img src="images/arrow.gif" alt="more..." style="vertical-align:baseline;" border="0" /> </a></p>
<h3><a href="Poco.ClassLoader.LibraryInfo.html" class="class">struct LibraryInfo</a></h3>
<p>&nbsp;<a href="Poco.ClassLoader.LibraryInfo.html"><img src="images/arrow.gif" alt="more..." style="vertical-align:baseline;" border="0" /> </a></p>
<h2>Types</h2>
<h3><a name="4187">LibraryMap</a></h3>
<p class="decl">typedef std::map &lt; std::string, <a href="Poco.ClassLoader.LibraryInfo.html" title="struct Poco::ClassLoader::LibraryInfo">LibraryInfo</a> &gt; <a href="Poco.ClassLoader.html#4187" title="Poco::ClassLoader::LibraryMap">LibraryMap</a>;</p>
<div class="description">
<p></p>
</div>
<h3><a name="4179">Manif</a></h3>
<p class="decl">typedef <a href="Poco.Manifest.html" title="class Poco::Manifest">Manifest</a> &lt; Base &gt; <a href="Poco.ClassLoader.html#4179" title="Poco::ClassLoader::Manif">Manif</a>;</p>
<div class="description">
<p></p>
</div>
<h3><a name="4178">Meta</a></h3>
<p class="decl">typedef <a href="Poco.AbstractMetaObject.html" title="class Poco::AbstractMetaObject">AbstractMetaObject</a> &lt; Base &gt; <a href="Poco.ClassLoader.html#4178" title="Poco::ClassLoader::Meta">Meta</a>;</p>
<div class="description">
<p></p>
</div>
<h3><a name="4182">bool</a></h3>
<p class="decl">typedef bool (* BuildManifestFunc)(<a href="Poco.ManifestBase.html" title="class Poco::ManifestBase">ManifestBase</a> *);</p>
<div class="description">
<p></p>
</div>
<h3><a name="4180">void</a></h3>
<p class="decl">typedef void (* InitializeLibraryFunc)();</p>
<div class="description">
<p></p>
</div>
<h3><a name="4181">void</a></h3>
<p class="decl">typedef void (* UninitializeLibraryFunc)();</p>
<div class="description">
<p></p>
</div>
<h2>Constructors</h2>
<h3><a name="4208">ClassLoader</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.ClassLoader.html" title="class Poco::ClassLoader">ClassLoader</a>();</p>
<div class="description">
<p>Creates the <a href="Poco.ClassLoader.html" title="class Poco::ClassLoader">ClassLoader</a>. </p>
</div>
<h2>Destructor</h2>
<h3><a name="4209">~ClassLoader</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" />  <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">virtual ~<a href="Poco.ClassLoader.html" title="class Poco::ClassLoader">ClassLoader</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.ClassLoader.html" title="class Poco::ClassLoader">ClassLoader</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="4239">begin</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.ClassLoader.Iterator.html" title="class Poco::ClassLoader::Iterator">Iterator</a> begin() const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="4225">canCreate</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool canCreate(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; className<br />) const;</p>
<div class="description">
<p>Returns true if <a href="Poco.ClassLoader.html#4221" title="Poco::ClassLoader::create()">create</a>() can create new instances of the class. </p>
</div>
<h3><a name="4219">classFor</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.ClassLoader.html#4178" title="Poco::ClassLoader::Meta">Meta</a> &amp; classFor(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; className<br />) const;</p>
<div class="description">
<p>Returns a reference to the <a href="Poco.MetaObject.html" title="class Poco::MetaObject">MetaObject</a> for the given class. Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the class is not known. </p>
</div>
<h3><a name="4221">create</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">Base * create(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; className<br />) const;</p>
<div class="description">
<p>Creates an instance of the given class. Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the class is not known. </p>
</div>
<h3><a name="4227">destroy</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void destroy(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; className,<br />&nbsp;&nbsp;&nbsp;&nbsp;Base * pObject<br />) const;</p>
<div class="description">
<p>Destroys the object pObject points to. Does nothing if object is not found. </p>
</div>
<h3><a name="4240">end</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.ClassLoader.Iterator.html" title="class Poco::ClassLoader::Iterator">Iterator</a> end() const;</p>
<div class="description">
<p></p>
</div>
<h3><a name="4217">findClass</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.ClassLoader.html#4178" title="Poco::ClassLoader::Meta">Meta</a> * findClass(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; className<br />) const;</p>
<div class="description">
<p>Returns a pointer to the <a href="Poco.MetaObject.html" title="class Poco::MetaObject">MetaObject</a> for the given class, or a null pointer if the class is not known. </p>
</div>
<h3><a name="4233">findManifest</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.ClassLoader.html#4179" title="Poco::ClassLoader::Manif">Manif</a> * findManifest(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; path<br />) const;</p>
<div class="description">
<p>Returns a pointer to the <a href="Poco.Manifest.html" title="class Poco::Manifest">Manifest</a> for the given library, or a null pointer if the library has not been loaded. </p>
</div>
<h3><a name="4223">instance</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">Base &amp; instance(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; className<br />) const;</p>
<div class="description">
<p>Returns a reference to the sole instance of the given class. The class must be a singleton, otherwise an <a href="Poco.InvalidAccessException.html" title="class Poco::InvalidAccessException">InvalidAccessException</a> will be thrown. Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the class is not known. </p>
</div>
<h3><a name="4230">isAutoDelete</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool isAutoDelete(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; className,<br />&nbsp;&nbsp;&nbsp;&nbsp;Base * pObject<br />) const;</p>
<div class="description">
<p>Returns true if the object is automatically deleted by its meta object. </p>
</div>
<h3><a name="4237">isLibraryLoaded</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool isLibraryLoaded(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; path<br />) const;</p>
<div class="description">
<p>Returns true if the library with the given name has already been loaded. </p>
</div>
<h3><a name="4210">loadLibrary</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void loadLibrary(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; path,<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; manifest<br />);</p>
<div class="description">
<p>Loads a library from the given path, using the given manifest.  Does nothing if the library is already loaded. Throws a <a href="Poco.LibraryLoadException.html" title="class Poco::LibraryLoadException">LibraryLoadException</a> if the library cannot be loaded or does not have a <a href="Poco.Manifest.html" title="class Poco::Manifest">Manifest</a>. If the library exports a function named &quot;pocoInitializeLibrary&quot;, this function is executed. If called multiple times for the same library, the number of calls to <a href="Poco.ClassLoader.html#4215" title="Poco::ClassLoader::unloadLibrary()">unloadLibrary</a>() must be the same for the library to become unloaded. </p>
</div>
<h3><a name="4213">loadLibrary</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void loadLibrary(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; path<br />);</p>
<div class="description">
<p>Loads a library from the given path. Does nothing if the library is already loaded. Throws a <a href="Poco.LibraryLoadException.html" title="class Poco::LibraryLoadException">LibraryLoadException</a> if the library cannot be loaded or does not have a <a href="Poco.Manifest.html" title="class Poco::Manifest">Manifest</a>. If the library exports a function named &quot;pocoInitializeLibrary&quot;, this function is executed. If called multiple times for the same library, the number of calls to <a href="Poco.ClassLoader.html#4215" title="Poco::ClassLoader::unloadLibrary()">unloadLibrary</a>() must be the same for the library to become unloaded. </p>
<p>Equivalent to <a href="Poco.ClassLoader.html#4210" title="Poco::ClassLoader::loadLibrary()">loadLibrary</a>(path, &quot;&quot;). </p>
</div>
<h3><a name="4235">manifestFor</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">const <a href="Poco.ClassLoader.html#4179" title="Poco::ClassLoader::Manif">Manif</a> &amp; manifestFor(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; path<br />) const;</p>
<div class="description">
<p>Returns a reference to the <a href="Poco.Manifest.html" title="class Poco::Manifest">Manifest</a> for the given library Throws a <a href="Poco.NotFoundException.html" title="class Poco::NotFoundException">NotFoundException</a> if the library has not been loaded. </p>
</div>
<h3><a name="4215">unloadLibrary</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">void unloadLibrary(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; path<br />);</p>
<div class="description">
<p>Unloads the given library.  Be extremely cautious when unloading shared libraries. If objects from the library are still referenced somewhere, a total crash is very likely. If the library exports a function named &quot;pocoUninitializeLibrary&quot;, this function is executed before it is unloaded. If <a href="Poco.ClassLoader.html#4210" title="Poco::ClassLoader::loadLibrary()">loadLibrary</a>() has been called multiple times for the same library, the number of calls to <a href="Poco.ClassLoader.html#4215" title="Poco::ClassLoader::unloadLibrary()">unloadLibrary</a>() must be the same for the library to become unloaded. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>