blob: 7b8829adc6ba11db0c8023c894234eb846ab7442 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Celix: libs/framework/include/celix_bundle_activator.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Celix
&#160;<span id="projectnumber">2.2.1</span>
</div>
<div id="projectbrief">An implementation of the OSGi specification adapted to C and C++</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_6719ab1f1f7655efc2fa43f7eb574fd1.html">libs</a></li><li class="navelem"><a class="el" href="dir_edbb2ffdc3e165978e68de3a46f2e8a0.html">framework</a></li><li class="navelem"><a class="el" href="dir_bc286dd6b945a73064974dfd7e40f558.html">include</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">celix_bundle_activator.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stdlib.h&gt;</code><br />
<code>#include &quot;<a class="el" href="celix__bundle__context_8h_source.html">celix_bundle_context.h</a>&quot;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for celix_bundle_activator.h:</div>
<div class="dyncontent">
<div class="center"><img src="celix__bundle__activator_8h__incl.png" border="0" usemap="#libs_2framework_2include_2celix__bundle__activator_8h" alt=""/></div>
<map name="libs_2framework_2include_2celix__bundle__activator_8h" id="libs_2framework_2include_2celix__bundle__activator_8h">
<area shape="rect" title=" " alt="" coords="220,5,385,47"/>
<area shape="rect" title=" " alt="" coords="204,95,268,121"/>
<area shape="rect" href="celix__bundle__context_8h.html" title=" " alt="" coords="292,95,447,121"/>
<area shape="rect" title=" " alt="" coords="5,169,104,196"/>
<area shape="rect" title=" " alt="" coords="128,169,283,196"/>
<area shape="rect" title=" " alt="" coords="307,169,431,196"/>
<area shape="rect" title=" " alt="" coords="456,169,576,196"/>
<area shape="rect" title=" " alt="" coords="600,169,691,196"/>
</map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dyncontent">
<div class="center"><img src="celix__bundle__activator_8h__dep__incl.png" border="0" usemap="#libs_2framework_2include_2celix__bundle__activator_8hdep" alt=""/></div>
<map name="libs_2framework_2include_2celix__bundle__activator_8hdep" id="libs_2framework_2include_2celix__bundle__activator_8hdep">
<area shape="rect" title=" " alt="" coords="5,5,171,47"/>
<area shape="rect" href="celix__api_8h.html" title=" " alt="" coords="13,95,163,136"/>
</map>
</div>
</div>
<p><a href="celix__bundle__activator_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a47b446e557ecaff78dafa19ba3e340c2"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="celix__bundle__activator_8h.html#a47b446e557ecaff78dafa19ba3e340c2">CELIX_GEN_BUNDLE_ACTIVATOR</a>(actType, actStart, actStop)</td></tr>
<tr class="separator:a47b446e557ecaff78dafa19ba3e340c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a57025ac322aecc8acfac832748c780e6"><td class="memItemLeft" align="right" valign="top">celix_status_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="celix__bundle__activator_8h.html#a57025ac322aecc8acfac832748c780e6">celix_bundleActivator_create</a> (celix_bundle_context_t *ctx, void **userData)</td></tr>
<tr class="separator:a57025ac322aecc8acfac832748c780e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ac12a9b8d321ee1c1feee5bf047b666"><td class="memItemLeft" align="right" valign="top">celix_status_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="celix__bundle__activator_8h.html#a8ac12a9b8d321ee1c1feee5bf047b666">celix_bundleActivator_start</a> (void *userData, celix_bundle_context_t *ctx)</td></tr>
<tr class="separator:a8ac12a9b8d321ee1c1feee5bf047b666"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae650439680848e3e3f7fc71b9e4dd213"><td class="memItemLeft" align="right" valign="top">celix_status_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="celix__bundle__activator_8h.html#ae650439680848e3e3f7fc71b9e4dd213">celix_bundleActivator_stop</a> (void *userData, celix_bundle_context_t *ctx)</td></tr>
<tr class="separator:ae650439680848e3e3f7fc71b9e4dd213"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8d7cd41a721060d28c6ce8d94f9f0ca9"><td class="memItemLeft" align="right" valign="top">celix_status_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="celix__bundle__activator_8h.html#a8d7cd41a721060d28c6ce8d94f9f0ca9">celix_bundleActivator_destroy</a> (void *userData, celix_bundle_context_t *ctx)</td></tr>
<tr class="separator:a8d7cd41a721060d28c6ce8d94f9f0ca9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a47b446e557ecaff78dafa19ba3e340c2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a47b446e557ecaff78dafa19ba3e340c2">&#9670;&nbsp;</a></span>CELIX_GEN_BUNDLE_ACTIVATOR</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define CELIX_GEN_BUNDLE_ACTIVATOR</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">actType, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">actStart, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">actStop&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">celix_status_t <a class="code" href="celix__bundle__activator_8h.html#a57025ac322aecc8acfac832748c780e6">celix_bundleActivator_create</a>(celix_bundle_context_t *ctx __attribute__((unused)), <span class="keywordtype">void</span> **userData) { \</div>
<div class="line"> celix_status_t status = CELIX_SUCCESS; \</div>
<div class="line"> actType *data = (actType*)calloc(1, <span class="keyword">sizeof</span>(*data)); \</div>
<div class="line"> if (data != NULL) { \</div>
<div class="line"> *userData = data; \</div>
<div class="line"> } <span class="keywordflow">else</span> { \</div>
<div class="line"> status = CELIX_ENOMEM; \</div>
<div class="line"> } \</div>
<div class="line"> return status; \</div>
<div class="line">} \</div>
<div class="line"> \</div>
<div class="line">celix_status_t <a class="code" href="celix__bundle__activator_8h.html#a8ac12a9b8d321ee1c1feee5bf047b666">celix_bundleActivator_start</a>(<span class="keywordtype">void</span> *userData, celix_bundle_context_t *ctx) { \</div>
<div class="line"> return actStart((actType*)userData, ctx); \</div>
<div class="line">} \</div>
<div class="line"> \</div>
<div class="line">celix_status_t <a class="code" href="celix__bundle__activator_8h.html#ae650439680848e3e3f7fc71b9e4dd213">celix_bundleActivator_stop</a>(<span class="keywordtype">void</span> *userData, celix_bundle_context_t *ctx) { \</div>
<div class="line"> return actStop((actType*)userData, ctx); \</div>
<div class="line">} \</div>
<div class="line"> \</div>
<div class="line">celix_status_t <a class="code" href="celix__bundle__activator_8h.html#a8d7cd41a721060d28c6ce8d94f9f0ca9">celix_bundleActivator_destroy</a>(<span class="keywordtype">void</span> *userData, celix_bundle_context_t *ctx __attribute__((unused))) { \</div>
<div class="line"> free(userData); \</div>
<div class="line"> return CELIX_SUCCESS; \</div>
<div class="line">}</div>
</div><!-- fragment --><p>This macro generates the required bundle activator functions for C. This can be used to more type safe bundle activator entries.</p>
<p>The macro will create the following bundle activator functions:</p><ul>
<li>bundleActivator_create which allocates a pointer to the provided type.</li>
<li>bundleActivator_start/stop which will call the respectively provided typed start/stop functions.</li>
<li>bundleActivator_destroy will free the allocated for the provided type.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">type</td><td>The activator type (e.g. 'struct shell_activator'). </td></tr>
<tr><td class="paramname">start</td><td>the activator actStart function with the following signature: celix_status_t (*)(&lt;actType&gt;*, celix_bundle_context_t*). </td></tr>
<tr><td class="paramname">stop</td><td>the activator actStop function with the following signature: celix_status_t (*)(&lt;actType&gt;*, celix_bundle_context_t*). </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a57025ac322aecc8acfac832748c780e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a57025ac322aecc8acfac832748c780e6">&#9670;&nbsp;</a></span>celix_bundleActivator_create()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">celix_status_t celix_bundleActivator_create </td>
<td>(</td>
<td class="paramtype">celix_bundle_context_t *&#160;</td>
<td class="paramname"><em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void **&#160;</td>
<td class="paramname"><em>userData</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Called when this bundle is started so the bundle can create an instance for its activator. The framework does not assume any type for the activator instance, this is implementation specific. The activator instance is handle as a void pointer by the framework, the implementation must cast it to the implementation specific type.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir"></td><td class="paramname">ctx</td><td>The execution context of the bundle being started. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">userData</td><td>A pointer to the specific activator instance used by this bundle.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Status code indication failure or success:<ul>
<li>CELIX_SUCCESS when no errors are encountered.</li>
<li>Any other status code will mark the bundle as stopped and the framework will remove this bundle's listeners, unregister all services, and release all services used by this bundle. </li>
</ul>
</dd></dl>
</div>
</div>
<a id="a8d7cd41a721060d28c6ce8d94f9f0ca9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8d7cd41a721060d28c6ce8d94f9f0ca9">&#9670;&nbsp;</a></span>celix_bundleActivator_destroy()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">celix_status_t celix_bundleActivator_destroy </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>userData</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">celix_bundle_context_t *&#160;</td>
<td class="paramname"><em>ctx</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Called when this bundle is stopped so the bundle can destroy the instance of its activator. In general, this method should undo the work that the <code>bundleActivator_create()</code> function initialized.</p>
<p>This method must complete and return to its caller in a timely manner.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">userData</td><td>The activator instance to be used. </td></tr>
<tr><td class="paramname">ctx</td><td>The execution context of the bundle being stopped.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Status code indication failure or success:<ul>
<li>CELIX_SUCCESS when no errors are encountered.</li>
<li>Any other status code will mark the bundle as stopped and the framework will remove this bundle's listeners, unregister all services, and release all services used by this bundle. </li>
</ul>
</dd></dl>
</div>
</div>
<a id="a8ac12a9b8d321ee1c1feee5bf047b666"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ac12a9b8d321ee1c1feee5bf047b666">&#9670;&nbsp;</a></span>celix_bundleActivator_start()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">celix_status_t celix_bundleActivator_start </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>userData</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">celix_bundle_context_t *&#160;</td>
<td class="paramname"><em>ctx</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Called when this bundle is started so the Framework can perform the bundle-specific activities necessary to start this bundle. This method can be used to register services or to allocate any resources that this bundle needs.</p>
<p>This method must complete and return to its caller in a timely manner.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">userData</td><td>The activator instance to be used. </td></tr>
<tr><td class="paramname">ctx</td><td>The execution context of the bundle being started.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Status code indication failure or success:<ul>
<li>CELIX_SUCCESS when no errors are encountered.</li>
<li>Any other status code will mark the bundle as stopped and the framework will remove this bundle's listeners, unregister all services, and release all services used by this bundle. </li>
</ul>
</dd></dl>
</div>
</div>
<a id="ae650439680848e3e3f7fc71b9e4dd213"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae650439680848e3e3f7fc71b9e4dd213">&#9670;&nbsp;</a></span>celix_bundleActivator_stop()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">celix_status_t celix_bundleActivator_stop </td>
<td>(</td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>userData</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">celix_bundle_context_t *&#160;</td>
<td class="paramname"><em>ctx</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary to stop the bundle. In general, this method should undo the work that the <code>bundleActivator_start()</code> function started. There should be no active threads that were started by this bundle when this bundle returns. A stopped bundle must not call any Framework objects.</p>
<p>This method must complete and return to its caller in a timely manner.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">userData</td><td>The activator instance to be used. </td></tr>
<tr><td class="paramname">ctx</td><td>The execution context of the bundle being stopped.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Status code indication failure or success:<ul>
<li>CELIX_SUCCESS when no errors are encountered.</li>
<li>Any other status code will mark the bundle as stopped and the framework will remove this bundle's listeners, unregister all services, and release all services used by this bundle. </li>
</ul>
</dd></dl>
</div>
</div>
</div><!-- contents -->
<div class="ttc" id="acelix__bundle__activator_8h_html_ae650439680848e3e3f7fc71b9e4dd213"><div class="ttname"><a href="celix__bundle__activator_8h.html#ae650439680848e3e3f7fc71b9e4dd213">celix_bundleActivator_stop</a></div><div class="ttdeci">celix_status_t celix_bundleActivator_stop(void *userData, celix_bundle_context_t *ctx)</div></div>
<div class="ttc" id="acelix__bundle__activator_8h_html_a57025ac322aecc8acfac832748c780e6"><div class="ttname"><a href="celix__bundle__activator_8h.html#a57025ac322aecc8acfac832748c780e6">celix_bundleActivator_create</a></div><div class="ttdeci">celix_status_t celix_bundleActivator_create(celix_bundle_context_t *ctx, void **userData)</div></div>
<div class="ttc" id="acelix__bundle__activator_8h_html_a8ac12a9b8d321ee1c1feee5bf047b666"><div class="ttname"><a href="celix__bundle__activator_8h.html#a8ac12a9b8d321ee1c1feee5bf047b666">celix_bundleActivator_start</a></div><div class="ttdeci">celix_status_t celix_bundleActivator_start(void *userData, celix_bundle_context_t *ctx)</div></div>
<div class="ttc" id="acelix__bundle__activator_8h_html_a8d7cd41a721060d28c6ce8d94f9f0ca9"><div class="ttname"><a href="celix__bundle__activator_8h.html#a8d7cd41a721060d28c6ce8d94f9f0ca9">celix_bundleActivator_destroy</a></div><div class="ttdeci">celix_status_t celix_bundleActivator_destroy(void *userData, celix_bundle_context_t *ctx)</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>