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

The abstract IBootloader class provides a basic bootstrapping sequence and hooks that specific implementations can override. More...

#include <IBootloader.h>

Inherits QObject.

Inherited by BootloaderBase.

Public Member Functions

virtual void run ()=0
 
virtual IServiceLocatorserviceLocator () const =0
 
- 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

The abstract IBootloader class provides a basic bootstrapping sequence and hooks that specific implementations can override.

The bootloader instance is one of the first instances who starts Carousel mechanism. Mainly, is starts a registration phase.

It creates and registers an IServiceLocator itself and common services, like LoggerFacade, IComponentManager and, optionally, QMainWindow for the GUI applications. QMainWindow is just a shell or frame for the application, it is absolutely empty, but then new components could populate it with menus, toolbars, dock widgets and the central widget.

Usually an IBootloader is implemented (in BootloaderBase or in more specific CarouselBootloader class) as a sequence of pairs create<smth>() - configure<smth>() methods, and each of them could be overridden to replace default instantiation or default configuration. For example, to use your own logger system it is just needed to override BootloaderBase::createLoggerEngine() method.

After bootloading process the configured IServiceLocator is available through serviceLocator() method. Later it will be injected to the all components and other elements during configuration phase, when they will start or initialize. It is needed to register/locate to common services and your components' services.

To start new application you also should to override BootloaderBase::createComponentProvider() or BootloaderBase::configureComponentProvider() method to determine way in which your application will be populated by the components. For example, here is a component provider which will load components from the "./components" directory at the start-time and which also has four built-in components, configured statically at the compile-time:

* IComponentProvider *MyBootloader::createComponentProvider()
* {
* provider->addProvider(new DirectoryComponentProvider("./components"));
* provider->registerComponent(new UndoComponent());
* return provider;
* }
*

Then just pass bootloader to the application:

* #include "MyBootloader.h"
* #include <carousel/framework/AbstractApplication.h>
*
* int main(int argc, char *argv[])
* {
* AbstractApplication application(argc, argv);
*
* MyBootloader bootloader;
* return application.runApplicationLoop(bootloader);
* }
*

Member Function Documentation

virtual void IBootloader::run ( )
pure virtual

Runs the bootloading process.

Implemented in BootloaderBase.

virtual IServiceLocator* IBootloader::serviceLocator ( ) const
pure virtual

Gets the service locator, which should contains base objects after bootloading.

Note
You can use service locator instance only after running bootloading sequence.
See Also
run

Implemented in BootloaderBase.