Carousel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Pages
Public Member Functions | List of all members
ComponentDependencies Class Reference

It is the default implementation of the IComponentDependencies. More...

#include <ComponentDependencies.h>

Inherits QObject, and IComponentDependencies.

Public Member Functions

 ComponentDependencies (QObject *parent=nullptr)
 
bool addComponent (IComponent *component)
 
DependenciesSolvingResult completeListWithChild (IComponent *forChild) const
 
DependenciesSolvingResult completeListWithChildren (const QList< IComponent * > &forChildren) const
 
DependenciesSolvingResult completeListWithParent (IComponent *forParent) const
 
DependenciesSolvingResult completeListWithParents (const QList< IComponent * > &forParents) const
 
IComponentcomponentByName (const QString &byName) const
 
const ObservableList
< IComponent * > & 
components () const
 
DependenciesSolvingResult getChildComponents (const IComponent *forParent) const
 
QList< IComponent * > getParentDefinitions (const IComponent *forChild) const
 
DependenciesSolvingResult orderedComponents () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

It is the default implementation of the IComponentDependencies.

ComponentManager uses this class by default.

Each component (described in a IComponent and IComponentDescriptionExtension classes, stores the name, description and availability of the component) that statically registered or dynamically discovered by providers will be added to the IComponentDependencies through IComponentManager after boot loading sequence in CarouselBootloader::configureComponentManager() method.

Also ComponentDependencies uses DependencySolver for components sorting and finding components dependencies.

Then you can get any dependnecies between the components using specified methods.

Note
it does not take ownership for added components.

Member Function Documentation

bool ComponentDependencies::addComponent ( IComponent component)
virtual

Adds a new component. Component with same name should not already exists in.

Parameters
componentIf IComponentDependencies already has component with same name as component
  • the last one will not be added. The same for the null pointer - it will be ignored.

Returns true if component was succesfully added. If it is a null point or already existed one - returns false.

Implements IComponentDependencies.

DependenciesSolvingResult ComponentDependencies::completeListWithChild ( IComponent forChild) const
virtual

Returns a dependencies solving result, that contains a list of distinct components and a list of components, those dependencies were not found. The component list will contains all immediate and extended parents for specified child component.

The components are ordered in such way, that parents are firsts and child is last. E.g. if you have following graph

* E
* v
* A <- B <- C <- D
*

and you call completeListWithChild() for the C component, the A, B and C components will be returned in that order.

Note
Incompatible components will not be added to the DependenciesSolvingResult::ordered() list.
Parameters
forChildThe component to get the dependencies (or parents) for.

Implements IComponentDependencies.

DependenciesSolvingResult ComponentDependencies::completeListWithChildren ( const QList< IComponent * > &  forChildren) const
virtual

Returns a dependencies solving result, that contains a list of distinct components and a list of components, those dependencies were not found. The component list will contains all immediate and extended parents for specified children components.

The components are ordered in such way, that parents are firsts and children are last.

Note
Incompatible components will not be added to the DependenciesSolvingResult::ordered() list.
Parameters
forChildrenThe components to get the dependencies (or parents) for.

Implements IComponentDependencies.

DependenciesSolvingResult ComponentDependencies::completeListWithParent ( IComponent forParent) const
virtual

Returns a dependencies solving result, that contains a list of distinct components and a list of components, those dependencies were not found. The component list will contains all immediate and extended children for specified parent component.

The components are ordered in such way, that children are firsts and parent is last. E.g. if you have following graph

* E
* v
* A <- B <- C <- D
*

and you call completeListWithParent() for the C component, the E, D and C components will be returned in such order, where indexOf(E) < indexOf(C) and indexOf(D) < indexOf(C).

Parameters
forParentThe component to get the components that depend on it (or its implicit children).

Implements IComponentDependencies.

DependenciesSolvingResult ComponentDependencies::completeListWithParents ( const QList< IComponent * > &  forParents) const
virtual

Returns a dependencies solving result, that contains a list of distinct components and a list of components, those dependencies were not found. The component list will contains all immediate and extended children for specified parents components.

The components are ordered in such way, that children are firsts and parents are last. E.g. if you have following graph

* E
* v
* A <- B <- C <- D
*

and you call completeListWithParents() for the C component, the E, D and C components will be returned in such order, where indexOf(E) < indexOf(C) and indexOf(D) < indexOf(C).

Parameters
forParentsThe components to get the other components that depend on they (or their implicit children).

Implements IComponentDependencies.

IComponent* ComponentDependencies::componentByName ( const QString byName) const
virtual

Finds the component by its name. Null pointer, if list is empty, or if component with specified name was not added.

Implements IComponentDependencies.

const ObservableList<IComponent *>& ComponentDependencies::components ( ) const
virtual

Returns a list of added components.

Implements IComponentDependencies.

QList<IComponent *> ComponentDependencies::getParentDefinitions ( const IComponent forChild) const
virtual

Returns a list of all parents (direct and indirect) for the specified child component.

* A <- B <- C <- E
* D <──┘
*

then, getParentDefinitions(E) will return {A, B, C, D} components.

Parameters
forChildThe component to get the dependencies (or parents) for. If forChild is null - result with empty collections will be returned.

Implements IComponentDependencies.

DependenciesSolvingResult ComponentDependencies::getChildComponents ( const IComponent forParent) const
virtual

Returns a dependencies solving result for cpecified parent, that contains a list of distinct components and a list of components, those dependencies were not found. E.g. if we have components

* A <- B <- C <- E
* ^
* └─── D
*

then, getChildComponents(C) will return {E, D} components.

Parameters
forParentThe component to get the other components that depend on it (or its implicit children). If forParent is null or component with such name does not exists - result with empty collections will be returned.

Implements IComponentDependencies.

DependenciesSolvingResult ComponentDependencies::orderedComponents ( ) const
virtual

Returns a dependencies solving result for all components, that contains a list of distinct components and a list of components, those dependencies were not found. The component list will contains all immediate and extended parents for specified children components.

The components are ordered in such way, that parents are firsts and children are lasts.

It is a shortkey for the

Implements IComponentDependencies.