diff --git a/Core/Code/CppMicroServices/documentation/doxygen/doxygen.css b/Core/Code/CppMicroServices/documentation/doxygen/doxygen.css index d1046f765a..8d4e9bba34 100644 --- a/Core/Code/CppMicroServices/documentation/doxygen/doxygen.css +++ b/Core/Code/CppMicroServices/documentation/doxygen/doxygen.css @@ -1,1147 +1,1141 @@ /* The standard CSS for doxygen */ /* body, table, div, p, dl { font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; font-size: 13px; line-height: 1.3; } */ /* @group Heading Levels */ h1 { font-size: 150%; } .title { font-size: 150%; font-weight: bold; margin: 10px 2px; } h2 { font-size: 120%; } h3 { font-size: 100%; } h1, h2, h3, h4, h5, h6 { -webkit-transition: text-shadow 0.5s linear; -moz-transition: text-shadow 0.5s linear; -ms-transition: text-shadow 0.5s linear; -o-transition: text-shadow 0.5s linear; transition: text-shadow 0.5s linear; margin-right: 15px; } h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { text-shadow: 0 0 15px cyan; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ border: 1px solid #e6e6e6; text-align: center; } div.qindex, div.navpath { width: 100%; padding: 0 10px; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code, a.code:visited { - color: #4665A2; + color: #4665A2; } a.codeRef, a.codeRef:visited { - color: #4665A2; + color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } pre.fragment { border-top-style: solid; border-bottom-style: solid; border-width: 1px 0 1px 0; border-color: #e6e6e6; border-radius: 0; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; } div.fragment { padding: 4px 6px; margin: 4px 8px 4px 2px; border-top-style: solid; border-bottom-style: solid; border-width: 1px 0 1px 0; border-color: #e6e6e6; background-color: #F5F5F5; } div.line { font-family: monospace, fixed; font-size: 13px; min-height: 13px; line-height: 1.0; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ text-indent: -53px; padding-left: 53px; padding-bottom: 0px; margin: 0px; } span.lineno { padding-right: 4px; text-align: right; border-right: 2px solid #0F0; background-color: #E8E8E8; white-space: pre; } span.lineno a { background-color: #D8D8D8; } span.lineno a:hover { background-color: #C8C8C8; } div.ah { background-color: #f6f6f6; font-weight: bold; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #e6e6e6; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } div.contents { margin-top: 10px; margin-left: 12px; margin-right: 8px; } td.indexkey { font-weight: bold; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { - + } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } -span.vhdldigit { - color: #ff00ff +span.vhdldigit { + color: #ff00ff } -span.vhdlchar { - color: #000000 +span.vhdlchar { + color: #000000 } -span.vhdlkeyword { - color: #700070 +span.vhdlkeyword { + color: #700070 } -span.vhdllogic { - color: #ff0000 +span.vhdllogic { + color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #e6e6e6; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .memberdecls td { -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } .memberdecls td.glow { background-color: cyan; box-shadow: 0 0 15px cyan; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { /*background-color: #F9FAFC;*/ border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } /* .memItemLeft, .memItemRight, .memTemplParams { border-top: 1px solid #C4CFE5; } */ .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; -webkit-transition: box-shadow 0.5s linear; -moz-transition: box-shadow 0.5s linear; -ms-transition: box-shadow 0.5s linear; -o-transition: box-shadow 0.5s linear; transition: box-shadow 0.5s linear; } .memitem.glow { box-shadow: 0 0 15px cyan; } .memname { font-weight: bold; margin-left: 6px; } .memname td { vertical-align: bottom; } .memproto, dl.reflist dt { border-top: 1px solid #e6e6e6; border-left: 1px solid #e6e6e6; border-right: 1px solid #e6e6e6; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; /* opera specific markup */ border-top-right-radius: 8px; border-top-left-radius: 8px; /* firefox specific markup */ -moz-border-radius-topright: 8px; -moz-border-radius-topleft: 8px; /* webkit specific markup */ -webkit-border-top-right-radius: 8px; -webkit-border-top-left-radius: 8px; background-color: #f6f6f6; } .memdoc, dl.reflist dd { border-bottom: 1px solid #e6e6e6; border-left: 1px solid #e6e6e6; border-right: 1px solid #e6e6e6; padding: 2px 5px; border-top-width: 0; /* opera specific markup */ border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; /* firefox specific markup */ -moz-border-radius-bottomleft: 8px; -moz-border-radius-bottomright: 8px; /* webkit specific markup */ -webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px; } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .params, .retval, .exception, .tparams { margin-left: 0px; padding-left: 0px; -} +} -.params .paramname, .retval .paramname { +.params .paramname, .tparams .paramname, .retval .paramname { font-weight: bold; vertical-align: top; + padding-right: 10px; } - + .params .paramtype { font-style: italic; vertical-align: top; -} - +} + .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } table.mlabels { border-spacing: 0px; } td.mlabels-left { width: 100%; padding: 0px; } td.mlabels-right { vertical-align: bottom; padding: 0px; white-space: nowrap; } span.mlabels { margin-left: 8px; } span.mlabel { background-color: #728DC1; border-top:1px solid #405C93; border-left:1px solid #405C93; border-right:1px solid #C4CFE5; border-bottom:1px solid #C4CFE5; text-shadow: none; color: white; margin-right: 4px; padding: 2px 3px; border-radius: 3px; font-size: 7pt; white-space: nowrap; } /* @end */ /* these are for tree view when not used as main index */ div.directory { margin: 10px 0px; /*border-top: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9;*/ width: 100%; } .directory table { border-collapse:collapse; } .directory td { margin: 0px; padding: 0px; vertical-align: baseline; } .directory td.entry { white-space: nowrap; padding-right: 6px; } .directory td.entry a { outline:none; } .directory td.desc { width: 100%; padding-left: 6px; padding-right: 6px; border-left: 1px solid rgba(0,0,0,0.05); } .directory tr.even { padding-left: 6px; /*background-color: #F7F8FB;*/ } .directory img { vertical-align: -30%; } .directory .levels { white-space: nowrap; width: 100%; text-align: right; font-size: 9pt; } .directory .levels span { cursor: pointer; padding-left: 2px; padding-right: 2px; color: #3D578C; } div.dynheader { margin-top: 8px; } address { font-style: normal; margin: 0; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { width: 100%; margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; width: 100%; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; } .navpath li.navelem a { height:22px; display:block; text-decoration: none; outline: none; color: #999; } .navpath li.navelem a:hover { text-decoration: underline; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; -} +} div.summary a { white-space: nowrap; } div.ingroups { margin-left: 5px; font-size: 8pt; padding-left: 5px; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { margin: 0px; border-bottom: 1px solid #333333; } div.headertitle { padding: 0px 5px 0px 7px; } dl { padding: 0 0 0 10px; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ dl.section { margin-left: 0px; padding-left: 0px; } dl.note { - margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #D0C000; } dl.warning, dl.attention { - margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #FF0000; } dl.pre, dl.post, dl.invariant { - margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00D000; } dl.deprecated { - margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #505050; } dl.todo { - margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00C0E0; } dl.test { - margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #3030E0; } dl.bug { - margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } - + #projectlogo img -{ +{ border: 0px none; } - + #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } - + #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 20px 10px 10px; width: 200px; } div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; -} +} div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } .inherit_header { font-weight: bold; color: gray; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .inherit_header td { padding: 6px 0px 2px 5px; } .inherit { display: none; } tr.heading h2 { margin-top: 12px; margin-bottom: 4px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } } code { background-color: none; border: none; color: #333333; padding: 1; } .doxygen-header { background-color: #F5F5F5; margin: -20px -20px 20px; } .tabs, .tabs2, .tabs3 { width: 100%; font-size: 16px; position: relative; } .tabs2 { font-size: 14px; } .tabs3 { font-size: 12px; } .tablist { margin: 0; padding: 0; display: table; } .tablist li { float: left; display: table-cell; list-style: none; } .tablist a { display: block; padding: 10px 20px; font-weight: bold; color: #999999; text-decoration: none; outline: none; } .tabs3 .tablist a { padding: 0 10px; } .tablist a:hover { text-decoration: underline; } .tablist li.current a { color: #fff; background-color: #bbb; } diff --git a/Core/Code/CppMicroServices/src/module/usModuleActivator.h b/Core/Code/CppMicroServices/src/module/usModuleActivator.h index 90e120a41e..c131c70ed5 100644 --- a/Core/Code/CppMicroServices/src/module/usModuleActivator.h +++ b/Core/Code/CppMicroServices/src/module/usModuleActivator.h @@ -1,132 +1,137 @@ /*============================================================================= Library: CppMicroServices Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =============================================================================*/ #ifndef USMODULEACTIVATOR_H_ #define USMODULEACTIVATOR_H_ #include US_BEGIN_NAMESPACE class ModuleContext; /** * \ingroup MicroServices * * Customizes the starting and stopping of a CppMicroServices module. *

* %ModuleActivator is an interface that can be implemented by * CppMicroServices modules. The CppMicroServices library can create instances of a * module's %ModuleActivator as required. If an instance's * ModuleActivator::Load method executes successfully, it is * guaranteed that the same instance's %ModuleActivator::Unload * method will be called when the module is to be unloaded. The CppMicroServices * library does not concurrently call a %ModuleActivator object. * *

* %ModuleActivator is an abstract class interface whose implementations * must be exported via a special macro. Implementations are usually declared * and defined directly in .cpp files. * *

* \snippet uServices-activator/main.cpp 0 * *

* The class implementing the %ModuleActivator interface must have a public * default constructor so that a %ModuleActivator * object can be created by the CppMicroServices library. * */ struct ModuleActivator { virtual ~ModuleActivator() {} /** * Called when this module is loaded. This method * can be used to register services or to allocate any resources that this * module may need globally (during the whole module lifetime). * *

* This method must complete and return to its caller in a timely manner. * * @param context The execution context of the module being loaded. * @throws std::exception If this method throws an exception, this * module is marked as stopped and the framework will remove this * module's listeners, unregister all services registered by this * module, and release all services used by this module. */ virtual void Load(ModuleContext* context) = 0; /** * Called when this module is unloaded. In general, this * method should undo the work that the ModuleActivator::Load * method started. There should be no active threads that were started by * this module when this method returns. * *

* This method must complete and return to its caller in a timely manner. * * @param context The execution context of the module being unloaded. * @throws std::exception If this method throws an exception, the * module is still marked as unloaded, and the framework will remove * the module's listeners, unregister all services registered by the * module, and release all services used by the module. */ virtual void Unload(ModuleContext* context) = 0; }; US_END_NAMESPACE #define US_MODULE_ACTIVATOR_INSTANCE_FUNCTION(type) \ struct ScopedPointer \ { \ ScopedPointer(US_PREPEND_NAMESPACE(ModuleActivator)* activator = 0) : m_Activator(activator) {} \ ~ScopedPointer() { delete m_Activator; } \ US_PREPEND_NAMESPACE(ModuleActivator)* m_Activator; \ }; \ \ static ScopedPointer activatorPtr; \ if (activatorPtr.m_Activator == 0) activatorPtr.m_Activator = new type; \ return activatorPtr.m_Activator; /** * \ingroup MicroServices * * \brief Export a module activator class. * * \param _module_libname The physical name of the module, without prefix or suffix. * \param _activator_type The fully-qualified type-name of the module activator class. * * Call this macro after the definition of your module activator to make it * accessible by the CppMicroServices library. * * Example: * \snippet uServices-activator/main.cpp 0 + * + * \note If you use this macro in a source file compiled into an executable, additional + * requirements for the macro arguments apply: + * - The \c _module_libname argument must match the value of \c _module_name used in the + * \c #US_INITIALIZE_MODULE macro call. */ #define US_EXPORT_MODULE_ACTIVATOR(_module_libname, _activator_type) \ extern "C" US_ABI_EXPORT US_PREPEND_NAMESPACE(ModuleActivator)* _us_module_activator_instance_ ## _module_libname () \ { \ US_MODULE_ACTIVATOR_INSTANCE_FUNCTION(_activator_type) \ } #endif /* USMODULEACTIVATOR_H_ */ diff --git a/Core/Code/CppMicroServices/src/module/usModuleInitialization.h b/Core/Code/CppMicroServices/src/module/usModuleInitialization.h index a90c596c30..96b9a60b8f 100644 --- a/Core/Code/CppMicroServices/src/module/usModuleInitialization.h +++ b/Core/Code/CppMicroServices/src/module/usModuleInitialization.h @@ -1,164 +1,170 @@ /*============================================================================= Library: CppMicroServices Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =============================================================================*/ #include #include #include #include #include #include #ifndef USMODULEINITIALIZATION_H #define USMODULEINITIALIZATION_H /** * \ingroup MicroServices * * \brief Creates initialization code for a module. * * Each module which wants to register itself with the CppMicroServices library * has to put a call to this macro (or to #US_INITIALIZE_MODULE_WITH_CUSTOM_AUTOLOADDIR) * in one of its source files. * * Example call for a module with file-name "libmylibname.so". * \code * US_INITIALIZE_MODULE("My Service Implementation", "mylibname", "", "1.0.0") * \endcode * * This will initialize the module for use with the CppMicroServices library, using a default * auto-load directory named after the provided library name in \c _module_libname. * * \sa US_INITIALIZE_MODULE_WITH_CUSTOM_AUTOLOADDIR * * \remarks If you are using CMake, consider using the provided CMake macro * usFunctionGenerateModuleInit(). * * \param _module_name A human-readable name for the module. * If you use this macro in a source file for an executable, the module name must * be a valid C-identifier (no spaces etc.). * \param _module_libname The physical name of the module, withou prefix or suffix. * \param _module_depends A list of module dependencies. This is meta-data only. * \param _module_version A version string in the form of "...". + * + * \note If you use this macro in a source file compiled into an executable, additional + * requirements for the macro arguments apply: + * - The \c _module_name argument must be a valid C-identifier (no spaces etc.). + * - The \c _module_libname argument must be an empty string. + * */ #define US_INITIALIZE_MODULE(_module_name, _module_libname, _module_depends, _module_version) \ US_INITIALIZE_MODULE_WITH_CUSTOM_AUTOLOADDIR(_module_name, _module_libname, _module_libname, _module_depends, _module_version) /** * \ingroup MicroServices * * \brief Creates initialization code for a module using a custom auto-load directory. * * Each module which wants to register itself with the CppMicroServices library * has to put a call to this macro (or to #US_INITIALIZE_MODULE) in one of its source files. * * Example call for a module with file-name "libmylibname.so". * \code * US_INITIALIZE_MODULE_WITH_CUSTOM_AUTOLOADDIR("My Service Implementation", "mylibname", "autoload_mysublibs", "", "1.0.0") * \endcode * * \remarks If you are using CMake, consider using the provided CMake macro * usFunctionGenerateModuleInit(). * * \param _module_name A human-readable name for the module. * If you use this macro in a source file for an executable, the module name must * be a valid C-identifier (no spaces etc.). * \param _module_libname The physical name of the module, withou prefix or suffix. * \param _module_autoload_dir A directory name relative to this modules library location from which * modules will be auto-loaded during activation of this module. Provide an empty string to * disable auto-loading for this module. * \param _module_depends A list of module dependencies. This is meta-data only. * \param _module_version A version string in the form of "...". */ #define US_INITIALIZE_MODULE_WITH_CUSTOM_AUTOLOADDIR(_module_name, _module_libname, _module_autoload_dir, _module_depends, _module_version) \ US_BEGIN_NAMESPACE \ \ /* Declare a file scoped ModuleInfo object */ \ US_GLOBAL_STATIC_WITH_ARGS(ModuleInfo, moduleInfo, (_module_name, _module_libname, _module_autoload_dir, _module_depends, _module_version)) \ \ /* This class is used to statically initialize the library within the C++ Micro services \ library. It looks up a library specific C-style function returning an instance \ of the ModuleActivator interface. */ \ class US_ABI_LOCAL ModuleInitializer { \ \ public: \ \ ModuleInitializer() \ { \ std::string location = ModuleUtils::GetLibraryPath(moduleInfo()->libName, \ reinterpret_cast(moduleInfo)); \ std::string activator_func = "_us_module_activator_instance_"; \ if(moduleInfo()->libName.empty()) \ { \ activator_func.append(moduleInfo()->name); \ } \ else \ { \ activator_func.append(moduleInfo()->libName); \ } \ \ moduleInfo()->location = location; \ \ if (moduleInfo()->libName.empty()) \ { \ /* make sure we retrieve symbols from the executable, if "libName" is empty */ \ location.clear(); \ } \ moduleInfo()->activatorHook = reinterpret_cast(ModuleUtils::GetSymbol(location, activator_func.c_str())); \ \ Register(); \ } \ \ static void Register() \ { \ ModuleRegistry::Register(moduleInfo()); \ } \ \ ~ModuleInitializer() \ { \ ModuleRegistry::UnRegister(moduleInfo()); \ } \ \ }; \ \ US_ABI_LOCAL ModuleContext* GetModuleContext() \ { \ /* make sure the module is registered */ \ if (moduleInfo()->id == 0) \ { \ ModuleInitializer::Register(); \ } \ \ return ModuleRegistry::GetModule(moduleInfo()->id)->GetModuleContext(); \ } \ \ US_END_NAMESPACE \ \ static US_PREPEND_NAMESPACE(ModuleInitializer) _InitializeModule; // Static modules usually don't get initialization code. They are initialized within the // module importing the static module(s). #if defined(US_STATIC_MODULE) && !defined(US_FORCE_MODULE_INIT) #undef US_INITIALIZE_MODULE_WITH_CUSTOM_AUTOLOADDIR #define US_INITIALIZE_MODULE_WITH_CUSTOM_AUTOLOADDIR(_a,_b,_c,_d,_e) #endif #endif // USMODULEINITIALIZATION_H