Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 1 | /* |
David Wagner | b76c9d6 | 2014-02-05 18:30:24 +0100 | [diff] [blame] | 2 | * Copyright (c) 2011-2014, Intel Corporation |
| 3 | * All rights reserved. |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 4 | * |
David Wagner | b76c9d6 | 2014-02-05 18:30:24 +0100 | [diff] [blame] | 5 | * Redistribution and use in source and binary forms, with or without modification, |
| 6 | * are permitted provided that the following conditions are met: |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 7 | * |
David Wagner | b76c9d6 | 2014-02-05 18:30:24 +0100 | [diff] [blame] | 8 | * 1. Redistributions of source code must retain the above copyright notice, this |
| 9 | * list of conditions and the following disclaimer. |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 10 | * |
David Wagner | b76c9d6 | 2014-02-05 18:30:24 +0100 | [diff] [blame] | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 | * this list of conditions and the following disclaimer in the documentation and/or |
| 13 | * other materials provided with the distribution. |
| 14 | * |
| 15 | * 3. Neither the name of the copyright holder nor the names of its contributors |
| 16 | * may be used to endorse or promote products derived from this software without |
| 17 | * specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 29 | */ |
| 30 | #include <dlfcn.h> |
| 31 | #include <dirent.h> |
Patrick Benavoli | ec0f84e | 2011-10-27 14:34:38 +0200 | [diff] [blame] | 32 | #include <algorithm> |
| 33 | #include <ctype.h> |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 34 | #include "SystemClass.h" |
| 35 | #include "SubsystemLibrary.h" |
| 36 | #include "AutoLog.h" |
Patrick Benavoli | 6ccab9d | 2011-11-10 23:21:01 +0100 | [diff] [blame] | 37 | #include "VirtualSubsystem.h" |
| 38 | #include "NamedElementBuilderTemplate.h" |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 39 | #include <assert.h> |
Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 40 | #include "PluginLocation.h" |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 41 | #include "Utility.h" |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 42 | |
| 43 | #define base CConfigurableElement |
| 44 | |
Frédéric Boisnard | d5679ac | 2013-07-31 17:40:57 +0200 | [diff] [blame] | 45 | /** |
| 46 | * A plugin file name is of the form: |
| 47 | * lib<type>-subsystem.so or lib<type>-subsystem._host.so |
| 48 | * |
| 49 | * The plugin symbol is of the form: |
| 50 | * get<TYPE>SubsystemBuilder |
| 51 | */ |
Patrick Benavoli | ec0f84e | 2011-10-27 14:34:38 +0200 | [diff] [blame] | 52 | // Plugin file naming |
Frédéric Boisnard | d5679ac | 2013-07-31 17:40:57 +0200 | [diff] [blame] | 53 | const char* gpcPluginSuffix = "-subsystem"; |
| 54 | const char* gpcPluginPrefix = "lib"; |
Patrick Benavoli | ec0f84e | 2011-10-27 14:34:38 +0200 | [diff] [blame] | 55 | |
| 56 | // Plugin symbol naming |
| 57 | const char* gpcPluginSymbolPrefix = "get"; |
Frédéric Boisnard | 487ce85 | 2013-07-19 17:17:52 +0200 | [diff] [blame] | 58 | const char* gpcPluginSymbolSuffix = "SubsystemBuilder"; |
Patrick Benavoli | ec0f84e | 2011-10-27 14:34:38 +0200 | [diff] [blame] | 59 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 60 | // Used by subsystem plugins |
Frédéric Boisnard | 487ce85 | 2013-07-19 17:17:52 +0200 | [diff] [blame] | 61 | typedef void (*GetSubsystemBuilder)(CSubsystemLibrary*); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 62 | |
Patrick Benavoli | 95ac034 | 2011-11-07 20:32:51 +0100 | [diff] [blame] | 63 | CSystemClass::CSystemClass() : _pSubsystemLibrary(new CSubsystemLibrary) |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 64 | { |
| 65 | } |
| 66 | |
| 67 | CSystemClass::~CSystemClass() |
| 68 | { |
| 69 | delete _pSubsystemLibrary; |
Renaud de Chivre | 1b8b3ca | 2013-12-13 15:09:44 +0100 | [diff] [blame] | 70 | |
| 71 | // Close all previously opened libraries |
| 72 | while (!_subsystemLibraries.empty()) |
| 73 | { |
| 74 | dlclose(_subsystemLibraries.back()); |
| 75 | _subsystemLibraries.pop_back(); |
| 76 | } |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | bool CSystemClass::childrenAreDynamic() const |
| 80 | { |
| 81 | return true; |
| 82 | } |
| 83 | |
| 84 | string CSystemClass::getKind() const |
| 85 | { |
| 86 | return "SystemClass"; |
| 87 | } |
| 88 | |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 89 | bool CSystemClass::loadSubsystems(string& strError, |
Kevin Rocard | 6be8035 | 2013-07-11 12:42:23 +0200 | [diff] [blame] | 90 | const CSubsystemPlugins* pSubsystemPlugins, |
| 91 | bool bVirtualSubsystemFallback) |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 92 | { |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 93 | CAutoLog autoLog_info(this, "Loading subsystem plugins"); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 94 | |
Kevin Rocard | 6be8035 | 2013-07-11 12:42:23 +0200 | [diff] [blame] | 95 | // Start clean |
| 96 | _pSubsystemLibrary->clean(); |
| 97 | |
| 98 | // Add virtual subsystem builder |
| 99 | _pSubsystemLibrary->addElementBuilder("Virtual", |
| 100 | new TNamedElementBuilderTemplate<CVirtualSubsystem>()); |
| 101 | // Set virtual subsytem as builder fallback if required |
| 102 | _pSubsystemLibrary->enableDefaultMechanism(bVirtualSubsystemFallback); |
| 103 | |
| 104 | // Add subsystem defined in shared libraries |
| 105 | list<string> lstrError; |
| 106 | bool bLoadPluginsSuccess = loadSubsystemsFromSharedLibraries(lstrError, pSubsystemPlugins); |
| 107 | |
| 108 | if (bLoadPluginsSuccess) { |
| 109 | log_info("All subsystem plugins successfully loaded"); |
| 110 | } else { |
| 111 | // Log plugin as warning if no fallback available |
| 112 | log_table(!bVirtualSubsystemFallback, lstrError); |
| 113 | } |
| 114 | |
| 115 | if (!bVirtualSubsystemFallback) { |
| 116 | // Any problem reported is an error as there is no fallback. |
| 117 | // Fill strError for caller. |
| 118 | CUtility::asString(lstrError, strError); |
| 119 | } |
| 120 | |
| 121 | return bLoadPluginsSuccess || bVirtualSubsystemFallback; |
| 122 | } |
| 123 | |
| 124 | bool CSystemClass::loadSubsystemsFromSharedLibraries(list<string>& lstrError, |
| 125 | const CSubsystemPlugins* pSubsystemPlugins) |
| 126 | { |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 127 | // Plugin list |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 128 | list<string> lstrPluginFiles; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 129 | |
Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 130 | uint32_t uiPluginLocation; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 131 | |
Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 132 | for (uiPluginLocation = 0; uiPluginLocation < pSubsystemPlugins->getNbChildren(); uiPluginLocation++) { |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 133 | |
Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 134 | // Get Folder for current Plugin Location |
| 135 | const CPluginLocation* pPluginLocation = static_cast<const CPluginLocation*>(pSubsystemPlugins->getChild(uiPluginLocation)); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 136 | |
Guillaume Denneulin | a4ec15d | 2012-02-17 14:38:14 +0100 | [diff] [blame] | 137 | const string& strFolder = pPluginLocation->getFolder(); |
| 138 | |
| 139 | // Iterator on Plugin List: |
| 140 | list<string>::const_iterator it; |
| 141 | |
| 142 | const list<string>& pluginList = pPluginLocation->getPluginList(); |
| 143 | |
| 144 | for (it = pluginList.begin(); it != pluginList.end(); ++it) { |
| 145 | |
| 146 | // Fill Plugin files list |
| 147 | lstrPluginFiles.push_back(strFolder + "/" + *it); |
| 148 | } |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 149 | } |
| 150 | |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 151 | // Actually load plugins |
Kevin Rocard | 6be8035 | 2013-07-11 12:42:23 +0200 | [diff] [blame] | 152 | while (!lstrPluginFiles.empty()) { |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 153 | |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 154 | // Because plugins might depend on one another, loading will be done |
| 155 | // as an iteration process that finishes successfully when the remaining |
| 156 | // list of plugins to load gets empty or unsuccessfully if the loading |
| 157 | // process failed to load at least one of them |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 158 | |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 159 | // Attempt to load the complete list |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 160 | if (!loadPlugins(lstrPluginFiles, lstrError)) { |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 161 | |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 162 | // Unable to load at least one plugin |
| 163 | break; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 164 | } |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 165 | } |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 166 | |
Kevin Rocard | 6be8035 | 2013-07-11 12:42:23 +0200 | [diff] [blame] | 167 | if (!lstrPluginFiles.empty()) { |
| 168 | // Unable to load at least one plugin |
| 169 | string strPluginUnloaded; |
| 170 | CUtility::asString(lstrPluginFiles, strPluginUnloaded, ", "); |
| 171 | |
Frédéric Boisnard | ecddaa3 | 2013-11-04 18:26:01 +0100 | [diff] [blame] | 172 | lstrError.push_back("Unable to load the following plugins: " + strPluginUnloaded + "."); |
Kevin Rocard | 6be8035 | 2013-07-11 12:42:23 +0200 | [diff] [blame] | 173 | return false; |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 174 | } |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 175 | |
Kevin Rocard | 6be8035 | 2013-07-11 12:42:23 +0200 | [diff] [blame] | 176 | return true; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 177 | } |
| 178 | |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 179 | // Plugin symbol computation |
| 180 | string CSystemClass::getPluginSymbol(const string& strPluginPath) |
| 181 | { |
| 182 | // Extract plugin type out of file name |
Frédéric Boisnard | d5679ac | 2013-07-31 17:40:57 +0200 | [diff] [blame] | 183 | string strPluginSuffix = gpcPluginSuffix; |
| 184 | string strPluginPrefix = gpcPluginPrefix; |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 185 | |
Frédéric Boisnard | d5679ac | 2013-07-31 17:40:57 +0200 | [diff] [blame] | 186 | // Remove folder and library prefix |
| 187 | size_t iPluginTypePos = strPluginPath.rfind('/') + 1 + strPluginPrefix.length(); |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 188 | |
Frédéric Boisnard | d5679ac | 2013-07-31 17:40:57 +0200 | [diff] [blame] | 189 | // Get index of -subsystem.so or -subsystem_host.so suffix |
| 190 | size_t iSubsystemPos = strPluginPath.find(strPluginSuffix, iPluginTypePos); |
| 191 | |
| 192 | // Get type (between iPluginTypePos and iSubsystemPos) |
| 193 | string strPluginType = strPluginPath.substr(iPluginTypePos, iSubsystemPos - iPluginTypePos); |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 194 | |
| 195 | // Make it upper case |
| 196 | std::transform(strPluginType.begin(), strPluginType.end(), strPluginType.begin(), ::toupper); |
| 197 | |
| 198 | // Get plugin symbol |
| 199 | return gpcPluginSymbolPrefix + strPluginType + gpcPluginSymbolSuffix; |
| 200 | } |
| 201 | |
| 202 | // Plugin loading |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 203 | bool CSystemClass::loadPlugins(list<string>& lstrPluginFiles, list<string>& lstrError) |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 204 | { |
| 205 | assert(lstrPluginFiles.size()); |
| 206 | |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 207 | bool bAtLeastOneSubsystemPluginSuccessfullyLoaded = false; |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 208 | |
| 209 | list<string>::iterator it = lstrPluginFiles.begin(); |
| 210 | |
| 211 | while (it != lstrPluginFiles.end()) { |
| 212 | |
| 213 | string strPluginFileName = *it; |
| 214 | |
Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 215 | log_info("Attempting to load subsystem plugin path \"%s\"", strPluginFileName.c_str()); |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 216 | |
| 217 | // Load attempt |
| 218 | void* lib_handle = dlopen(strPluginFileName.c_str(), RTLD_LAZY); |
| 219 | |
| 220 | if (!lib_handle) { |
| 221 | |
| 222 | // Failed |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 223 | lstrError.push_back("Plugin load failed: " + string(dlerror())); |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 224 | |
| 225 | // Next plugin |
| 226 | ++it; |
| 227 | |
| 228 | continue; |
| 229 | } |
| 230 | |
Renaud de Chivre | 1b8b3ca | 2013-12-13 15:09:44 +0100 | [diff] [blame] | 231 | // Store libraries handles |
| 232 | _subsystemLibraries.push_back(lib_handle); |
| 233 | |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 234 | // Get plugin symbol |
| 235 | string strPluginSymbol = getPluginSymbol(strPluginFileName); |
| 236 | |
| 237 | // Load symbol from library |
Frédéric Boisnard | 487ce85 | 2013-07-19 17:17:52 +0200 | [diff] [blame] | 238 | GetSubsystemBuilder pfnGetSubsystemBuilder = (GetSubsystemBuilder)dlsym(lib_handle, strPluginSymbol.c_str()); |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 239 | |
Frédéric Boisnard | 487ce85 | 2013-07-19 17:17:52 +0200 | [diff] [blame] | 240 | if (!pfnGetSubsystemBuilder) { |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 241 | |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 242 | lstrError.push_back("Subsystem plugin " + strPluginFileName + |
| 243 | " does not contain " + strPluginSymbol + " symbol."); |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 244 | |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 245 | continue; |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 246 | } |
| 247 | |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 248 | // Account for this success |
| 249 | bAtLeastOneSubsystemPluginSuccessfullyLoaded = true; |
| 250 | |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 251 | // Fill library |
Frédéric Boisnard | 487ce85 | 2013-07-19 17:17:52 +0200 | [diff] [blame] | 252 | pfnGetSubsystemBuilder(_pSubsystemLibrary); |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 253 | |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 254 | // Remove successfully loaded plugin from list and select next |
| 255 | lstrPluginFiles.erase(it++); |
| 256 | } |
| 257 | |
Kevin Rocard | ee7ceed | 2013-07-05 10:56:27 +0200 | [diff] [blame] | 258 | return bAtLeastOneSubsystemPluginSuccessfullyLoaded; |
Patrick Benavoli | 9bed7ce | 2011-11-20 20:04:35 +0100 | [diff] [blame] | 259 | } |
| 260 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 261 | const CSubsystemLibrary* CSystemClass::getSubsystemLibrary() const |
| 262 | { |
| 263 | return _pSubsystemLibrary; |
| 264 | } |
| 265 | |
Guillaume Denneulin | f2fd15a | 2012-12-20 17:53:29 +0100 | [diff] [blame] | 266 | void CSystemClass::checkForSubsystemsToResync(CSyncerSet& syncerSet) |
| 267 | { |
| 268 | uint32_t uiNbChildren = getNbChildren(); |
| 269 | uint32_t uiChild; |
| 270 | |
| 271 | for (uiChild = 0; uiChild < uiNbChildren; uiChild++) { |
| 272 | |
| 273 | CSubsystem* pSubsystem = static_cast<CSubsystem*>(getChild(uiChild)); |
| 274 | |
| 275 | // Collect and consume the need for a resync |
| 276 | if (pSubsystem->needResync(true)) { |
| 277 | |
| 278 | log_info("Resynchronizing subsystem: %s", pSubsystem->getName().c_str()); |
| 279 | // get all subsystem syncers |
| 280 | pSubsystem->fillSyncerSet(syncerSet); |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | |
Kevin Rocard | 2fbe6e8 | 2013-03-26 17:09:29 +0100 | [diff] [blame] | 285 | void CSystemClass::cleanSubsystemsNeedToResync() |
| 286 | { |
| 287 | uint32_t uiNbChildren = getNbChildren(); |
| 288 | uint32_t uiChild; |
| 289 | |
| 290 | for (uiChild = 0; uiChild < uiNbChildren; uiChild++) { |
| 291 | |
| 292 | CSubsystem* pSubsystem = static_cast<CSubsystem*>(getChild(uiChild)); |
| 293 | |
| 294 | // Consume the need for a resync |
| 295 | pSubsystem->needResync(true); |
| 296 | } |
| 297 | } |
| 298 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 299 | bool CSystemClass::init(string& strError) |
| 300 | { |
| 301 | return base::init(strError); |
| 302 | } |
| 303 | |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 304 | // From IXmlSource |
| 305 | void CSystemClass::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const |
| 306 | { |
| 307 | // Set the name of system class |
| 308 | xmlElement.setNameAttribute(getName()); |
| 309 | |
| 310 | base::toXml(xmlElement, serializingContext); |
| 311 | } |