blob: 3ff80e465ece1903506fc4cf31afb551c17d7473 [file] [log] [blame]
Kevin Rocardee7ceed2013-07-05 10:56:27 +02001/*
Patrick Benavoli68a91282011-08-31 11:23:23 +02002 * INTEL CONFIDENTIAL
Kevin Rocardee7ceed2013-07-05 10:56:27 +02003 * Copyright © 2011 Intel
Patrick Benavoli68a91282011-08-31 11:23:23 +02004 * Corporation All Rights Reserved.
Kevin Rocardee7ceed2013-07-05 10:56:27 +02005 *
Patrick Benavoli68a91282011-08-31 11:23:23 +02006 * The source code contained or described herein and all documents related to
7 * the source code ("Material") are owned by Intel Corporation or its suppliers
8 * or licensors. Title to the Material remains with Intel Corporation or its
9 * suppliers and licensors. The Material contains trade secrets and proprietary
10 * and confidential information of Intel or its suppliers and licensors. The
11 * Material is protected by worldwide copyright and trade secret laws and
12 * treaty provisions. No part of the Material may be used, copied, reproduced,
13 * modified, published, uploaded, posted, transmitted, distributed, or
14 * disclosed in any way without Intel’s prior express written permission.
Kevin Rocardee7ceed2013-07-05 10:56:27 +020015 *
Patrick Benavoli68a91282011-08-31 11:23:23 +020016 * No license under any patent, copyright, trade secret or other intellectual
17 * property right is granted to or conferred upon you by disclosure or delivery
18 * of the Materials, either expressly, by implication, inducement, estoppel or
19 * otherwise. Any license under such intellectual property rights must be
20 * express and approved by Intel in writing.
Kevin Rocardee7ceed2013-07-05 10:56:27 +020021 *
Patrick Benavoli68a91282011-08-31 11:23:23 +020022 * CREATED: 2011-06-01
23 * UPDATED: 2011-07-27
Patrick Benavoli68a91282011-08-31 11:23:23 +020024 */
25#pragma once
26
27#include "ConfigurableElement.h"
Guillaume Denneulina4ec15d2012-02-17 14:38:14 +010028#include "SubsystemPlugins.h"
Patrick Benavoli9bed7ce2011-11-20 20:04:35 +010029#include <list>
Patrick Benavoli68a91282011-08-31 11:23:23 +020030
31class CSubsystemLibrary;
32
33class CSystemClass : public CConfigurableElement
34{
35public:
Patrick Benavoli95ac0342011-11-07 20:32:51 +010036 CSystemClass();
Patrick Benavoli68a91282011-08-31 11:23:23 +020037 virtual ~CSystemClass();
38
Kevin Rocardee7ceed2013-07-05 10:56:27 +020039 /** Load subsystem plugin and fill the corresponding libraries.
40 *
41 * @param[out] strError is filled with new line separated errors if the function returns false,
42 * undefined otherwise.
43 * @param[in] pSubsystemPlugins The plugins to load.
44 * @param[in] bVirtualSubsystemFallback If a subsystem can not be found, use the virtual one.
45 *
46 * @return true if the plugins succesfully started or that a fallback is available,
47 false otherwise.
48 */
49 bool loadSubsystems(string& strError, const CSubsystemPlugins* pSubsystemPlugins,
50 bool bVirtualSubsystemFallback = false);
Guillaume Denneulina4ec15d2012-02-17 14:38:14 +010051 // Subsystem factory
Patrick Benavoli68a91282011-08-31 11:23:23 +020052 const CSubsystemLibrary* getSubsystemLibrary() const;
53
Kevin Rocard2fbe6e82013-03-26 17:09:29 +010054 /**
55 * Look for subsystems that need to be resynchronized.
56 * Consume the need to be resynchronized
57 * and fill a syncer set with all syncers that need to be resynchronized
58 *
59 * @param[out] syncerSet The syncer set to fill
60 */
Guillaume Denneulinf2fd15a2012-12-20 17:53:29 +010061 void checkForSubsystemsToResync(CSyncerSet& syncerSet);
62
Kevin Rocard2fbe6e82013-03-26 17:09:29 +010063 /**
64 * Reset subsystems need to resync flag.
65 */
66 void cleanSubsystemsNeedToResync();
67
Patrick Benavoli68a91282011-08-31 11:23:23 +020068 // base
69 virtual bool init(string& strError);
70 virtual string getKind() const;
71
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020072 // From IXmlSource
73 virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
74
Patrick Benavoli68a91282011-08-31 11:23:23 +020075private:
JhinX Lee4ebc0982012-07-12 17:50:07 +020076 CSystemClass(const CSystemClass&);
77 CSystemClass& operator=(const CSystemClass&);
Patrick Benavoli68a91282011-08-31 11:23:23 +020078 // base
79 virtual bool childrenAreDynamic() const;
80
Patrick Benavoli9bed7ce2011-11-20 20:04:35 +010081 // Plugin symbol computation
82 static string getPluginSymbol(const string& strPluginPath);
83
Kevin Rocardee7ceed2013-07-05 10:56:27 +020084 /** Load subsystem plugin shared libraries.
85 *
86 * @param[in:out] lstrPluginFiles is the path list of the plugins shared libraries to load.
87 * Successfully loaded plugins are removed from the list.
88 * @param[out] lstrError is the list of error that occured during loadings.
89 *
90 * @return true if at least one plugin has been succesfully loaded, false otherwise.
91 */
92 bool loadPlugins(list<string>& lstrPluginFiles, list<string>& lstrError);
Patrick Benavoli68a91282011-08-31 11:23:23 +020093
Guillaume Denneulina4ec15d2012-02-17 14:38:14 +010094 // Subsystem factory
Patrick Benavoli68a91282011-08-31 11:23:23 +020095 CSubsystemLibrary* _pSubsystemLibrary;
96};
97