1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <title>Pluma - Plug-in Management Framework</title>
5 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
6 <link href="doxygen.css" rel="stylesheet" type="text/css" />
7 <link href="tabs.css" rel="stylesheet" type="text/css" />
11 <img src="./logo.png" title="Pluma home" alt="Pluma logo" />
13 <!-- Generated by Doxygen 1.8.6 -->
14 <div id="navrow1" class="tabs">
16 <li class="current"><a href="index.htm"><span>Main Page</span></a></li>
17 <li><a href="annotated.htm"><span>Classes</span></a></li>
18 <li><a href="files.htm"><span>Files</span></a></li>
23 <div class="headertitle">
24 <div class="title">Pluma Documentation</div> </div>
26 <div class="contents">
27 <div class="textblock"><h1><a class="anchor" id="welcome"></a>
29 <p>Welcome to Pluma documentation. Here you will find a detailed view of all Pluma <a href="./annotated.htm">classes</a>.<br/>
30 If you are looking for support, you can visit the official website at <a href="http://pluma-framework.sourceforge.net/">http://pluma-framework.sourceforge.net/</a>.<br/>
33 <p>CSS based on <a href="http://www.sfml-dev.org/documentation/1.6/">SFML1.6 documentation</a><br/>
35 <h1><a class="anchor" id="example"></a>
37 <p>A short example to demonstrate Pluma usage:<br/>
38 A host application define a Device interface. A certain plugin defines a Keyboard, witch is a Device. The host will use DeviceProviders to create objects of type Device. The plugin will provide host specifically with a KeyboardProvider.<br/>
40 <p>Device hpp (shared): </p>
41 <div class="fragment"><div class="line"><span class="preprocessor">#include <Pluma/Pluma.hpp></span></div>
42 <div class="line"><span class="keyword">class </span>Device{</div>
43 <div class="line"><span class="keyword">public</span>:</div>
44 <div class="line"> <span class="keyword">virtual</span> std::string getDescription() <span class="keyword">const</span> = 0;</div>
45 <div class="line">};</div>
46 <div class="line"><span class="comment">// create DevicedProvider class</span></div>
47 <div class="line">PLUMA_PROVIDER_HEADER(Device);</div>
48 </div><!-- fragment --><p>Device cpp (shared): </p>
49 <div class="fragment"><div class="line"><span class="preprocessor">#include "Device.hpp"</span></div>
50 <div class="line">generate DevicedProvider with version 6, and compatible with at least v.3</div>
51 <div class="line">PLUMA_PROVIDER_SOURCE(Device, 6, 3);</div>
52 </div><!-- fragment --><p><br/>
53 Keyboard code on the plugin side: </p>
54 <div class="fragment"><div class="line"><span class="preprocessor">#include <Pluma/Pluma.hpp></span></div>
55 <div class="line"><span class="preprocessor">#include "Device.hpp"</span></div>
56 <div class="line"></div>
57 <div class="line"><span class="keyword">class </span>Keyboard: <span class="keyword">public</span> Device{</div>
58 <div class="line"><span class="keyword">public</span>:</div>
59 <div class="line"> std::string getDescription()<span class="keyword"> const</span>{</div>
60 <div class="line"> <span class="keywordflow">return</span> <span class="stringliteral">"keyboard"</span>;</div>
61 <div class="line"> }</div>
62 <div class="line">};</div>
63 <div class="line"></div>
64 <div class="line"><span class="comment">// create KeyboardProvider, it implements DeviceProvider</span></div>
65 <div class="line">PLUMA_INHERIT_PROVIDER(Keyboard, Device);</div>
66 </div><!-- fragment --><p>plugin connector: </p>
67 <div class="fragment"><div class="line"><span class="preprocessor">#include <Pluma/Connector.hpp></span></div>
68 <div class="line"><span class="preprocessor">#include "Keyboard.hpp"</span></div>
69 <div class="line"></div>
70 <div class="line">PLUMA_CONNECTOR</div>
71 <div class="line"><span class="keywordtype">bool</span> connect(<a class="code" href="classpluma_1_1Host.htm">pluma::Host</a>& host){</div>
72 <div class="line"> <span class="comment">// add a keyboard provider to host</span></div>
73 <div class="line"> host.<a class="code" href="classpluma_1_1Host.htm#ab673ba94ff56a12cdf2a7a25ebb8cc36">add</a>( <span class="keyword">new</span> KeyboardProvider() );</div>
74 <div class="line"> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
75 <div class="line">}</div>
76 </div><!-- fragment --><p>Host application code: </p>
77 <div class="fragment"><div class="line"><span class="preprocessor">#include <Pluma/Pluma.hpp></span></div>
78 <div class="line"></div>
79 <div class="line"><span class="preprocessor">#include "Device.hpp"</span></div>
80 <div class="line"><span class="preprocessor">#include <iostream></span></div>
81 <div class="line"><span class="preprocessor">#include <vector></span></div>
82 <div class="line"></div>
83 <div class="line"><span class="keywordtype">int</span> main(){</div>
84 <div class="line"></div>
85 <div class="line"> <a class="code" href="classpluma_1_1Pluma.htm">pluma::Pluma</a> plugins;</div>
86 <div class="line"> <span class="comment">// Tell plugins manager to accept providers of the type DeviceProvider</span></div>
87 <div class="line"> plugins.<a class="code" href="classpluma_1_1Pluma.htm#a200c59b0983c7ca53d11b03cf8220bc7">acceptProviderType</a><DeviceProvider>();</div>
88 <div class="line"> <span class="comment">// Load library "standard_devices" from folder "plugins"</span></div>
89 <div class="line"> plugins.<a class="code" href="classpluma_1_1PluginManager.htm#aa00400d23efa8a8f94e44dd1c5bf54e6">load</a>(<span class="stringliteral">"plugins"</span>, <span class="stringliteral">"standard_devices"</span>);</div>
90 <div class="line"></div>
91 <div class="line"> <span class="comment">// Get device providers into a vector</span></div>
92 <div class="line"> std::vector<DeviceProvider*> providers;</div>
93 <div class="line"> plugins.<a class="code" href="classpluma_1_1Pluma.htm#a49fa0b2b4497885c4e978259be0a7abe">getProviders</a>(providers);</div>
94 <div class="line"></div>
95 <div class="line"> <span class="comment">// create a Device from the first provider</span></div>
96 <div class="line"> <span class="keywordflow">if</span> (!providers.empty()){</div>
97 <div class="line"> Device* myDevice = providers.first()->create();</div>
98 <div class="line"> <span class="comment">// do something with myDevice</span></div>
99 <div class="line"> std::cout << device->getDescription() << std::endl;</div>
100 <div class="line"> <span class="comment">// and delete it in the end</span></div>
101 <div class="line"> <span class="keyword">delete</span> myDevice;</div>
102 <div class="line"> }</div>
103 <div class="line"> <span class="keywordflow">return</span> 0;</div>
104 <div class="line">}</div>
105 </div><!-- fragment --> </div></div><!-- contents -->
108 :: Copyright © 2011 Gil Costa, all rights reserved ::
109 Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.7.4</a> ::