Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit ce012c8

Browse files
committed
Avoid ParameterManager inheritance to Element god class.
ParameterManager does not have to be a part of the Element tree. Indeed, it is not represented in any xml file. This patch avoids this inheritance and removes some "tricks" which was used to forget the ParameterMgr root element. Signed-off-by: Jules Clero <julesx.clero@intel.com>
1 parent b64f7c5 commit ce012c8

File tree

5 files changed

+173
-262
lines changed

5 files changed

+173
-262
lines changed

parameter/ConfigurableElement.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void CConfigurableElement::getListOfElementsWithMapping(
162162
{
163163
// Check parent
164164
const CElement* pParent = getParent();
165-
if (isOfConfigurableElementType(pParent)) {
165+
if (pParent != NULL) {
166166

167167
const CConfigurableElement* pConfigurableElement =
168168
static_cast<const CConfigurableElement*>(pParent);
@@ -242,7 +242,7 @@ ISyncer* CConfigurableElement::getSyncer() const
242242
// Check parent
243243
const CElement* pParent = getParent();
244244

245-
if (isOfConfigurableElementType(pParent)) {
245+
if (pParent != NULL) {
246246

247247
return static_cast<const CConfigurableElement*>(pParent)->getSyncer();
248248
}
@@ -311,7 +311,7 @@ void CConfigurableElement::getBelongingDomains(std::list<const CConfigurableDoma
311311
// Check parent
312312
const CElement* pParent = getParent();
313313

314-
if (isOfConfigurableElementType(pParent)) {
314+
if (pParent != NULL) {
315315

316316
static_cast<const CConfigurableElement*>(pParent)->getBelongingDomains(configurableDomainList);
317317
}
@@ -466,7 +466,7 @@ bool CConfigurableElement::belongsToDomainAscending(const CConfigurableDomain* p
466466
// Check parent
467467
const CElement* pParent = getParent();
468468

469-
if (isOfConfigurableElementType(pParent)) {
469+
if (pParent != NULL) {
470470

471471
return static_cast<const CConfigurableElement*>(pParent)->belongsTo(pConfigurableDomain);
472472
}
@@ -479,7 +479,7 @@ const CSubsystem* CConfigurableElement::getBelongingSubsystem() const
479479
const CElement* pParent = getParent();
480480

481481
// Stop at system class
482-
if (!pParent->getParent()) {
482+
if (pParent == NULL) {
483483

484484
return NULL;
485485
}
@@ -492,13 +492,3 @@ bool CConfigurableElement::isParameter() const
492492
{
493493
return false;
494494
}
495-
496-
497-
// Check parent is still of current type (by structure knowledge)
498-
bool CConfigurableElement::isOfConfigurableElementType(const CElement* pParent) const
499-
{
500-
assert(pParent);
501-
502-
// Up to system class
503-
return !!pParent->getParent();
504-
}

parameter/ConfigurableElement.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ class CConfigurableElement : public CElement
141141
void getBelongingDomains(std::list<const CConfigurableDomain*>& configurableDomainList) const;
142142
void listDomains(const std::list<const CConfigurableDomain*>& configurableDomainList, std::string& strResult, bool bVertical) const;
143143

144-
// Check parent is still of current type (by structure knowledge)
145-
bool isOfConfigurableElementType(const CElement* pParent) const;
146-
147144
// Offset in main blackboard
148145
uint32_t _uiOffset;
149146

parameter/Element.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,7 @@ const CElement* CElement::findChildOfKind(const string& strKind) const
531531

532532
string CElement::getPath() const
533533
{
534-
// Take out root element from the path
535-
if (_pParent && _pParent->_pParent) {
534+
if (_pParent != NULL) {
536535

537536
return _pParent->getPath() + "/" + getPathName();
538537
}

0 commit comments

Comments
 (0)