Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
ARCSAbstractComponent Class Referenceabstract

Class handling the generic description of a component. More...

#include <arcsabstractcomponent.h>

Inheritance diagram for ARCSAbstractComponent:
Inheritance graph
Collaboration diagram for ARCSAbstractComponent:
Collaboration graph

Public Member Functions

bool instanciate ()
 Instanciates the real component.
 
bool isInstanciated ()
 Determines wether the component is instanciated or not.
 
void destroy ()
 Destroys the real component.
 
ARCSAbstractComponentclone ()
 Kage bunshin no jutsu ! More...
 
virtual QStringList getSlots ()=0
 Returns the names of the available slots.
 
virtual QStringList getSignals ()=0
 Returns the names of the availables signals.
 
virtual bool connect (QString sig, ARCSAbstractComponent *dst, QString slt, bool queued=false)
 This method connects two components by the indicated signals and slots. More...
 
bool disconnect (QString sig, ARCSAbstractComponent *dst, QString slt)
 This method disconnects two components by the indicated signals and slots. More...
 
bool init (QString slt, QVariant *var)
 Initializes a component. More...
 
virtual QString toString ()=0
 Defines a basic seralization mechanism. More...
 
virtual bool parseString (QString s)=0
 Defines a basic seralization mechanism. More...
 
virtual bool loadFile (QString fn)
 Defines a way to load a component description from a file. More...
 
virtual bool saveFile (QString fn)
 Defines a way to save a component description inside a file. More...
 
void setProperty (QString name, QVariant value)
 Sets a meta-property on this component. More...
 
QVariant getProperty (QString name)
 Gets a meta-property from this component. More...
 
void removeProperty (QString name)
 Removes a meta-property from this component. More...
 
void resetProperties ()
 Sets the property list to a blank list.
 
QStringList getProperties ()
 
void setFamily (QString s)
 
QString getFamily ()
 
void setType (QString s)
 
QString getType ()
 
virtual QVariant getGenuineComponentInstance ()
 

Protected Member Functions

virtual void getProxySlot (QString slot, ObjectList &obj, QStringList &proxySlot)=0
 Creates a proxy slot to interface a component to native ARCS components. More...
 
virtual void getProxySignal (QString signal, ObjectList &obj, QStringList &proxySignal)=0
 Creates a proxy signal to interface a component to native ARCS components. More...
 
virtual bool genuineConnect (QString, ARCSAbstractComponent *, QString, bool=false)
 This method connects two components by the indicated signals and slots. More...
 
virtual bool genuineDisconnect (QString, ARCSAbstractComponent *, QString)
 This method disconnects two components by the indicated signals and slots. More...
 
virtual bool genuineInstanciate ()=0
 This method should implement the instanciation of the actual component. More...
 
virtual void genuineDestroy ()=0
 This method should implement the destruction of the actual component. More...
 

Static Protected Member Functions

static void getProxySlot (ARCSAbstractComponent *cmp, QString slot, ObjectList &obj, QStringList &proxySlot)
 Wrapper for getProxySlot()
 
static void getProxySignal (ARCSAbstractComponent *cmp, QString signal, ObjectList &obj, QStringList &proxySignal)
 Wrapper for getProxySignal()
 

Static Protected Attributes

static const QString slotPrefix = "1"
 
static const QString signalPrefix = "2"
 

Detailed Description

Class handling the generic description of a component.

The generic description of a component should contain the following topics that are adressed in this class:

For each subclasses of ARCSAbstractComponent, the following methods should be overloaded :

To implement a new component following this guideline, you should have a header like this :

#ifndef __MYCOMPONENT_H__
#define __MYCOMPONENT_H__
#include <arcs/arcsabstractcomponent.h>
class MyComponent : public ARCSAbstractComponent
{
public:
MyComponent();
~MyComponent();
virtual QString toString();
virtual bool parseString(QString s);
virtual QStringList getSignals();
virtual QStringList getSlots();
protected:
virtual void getProxySlot (QString slot, ObjectList &obj, QStringList &proxySlot);
virtual void getProxySignal (QString signal, ObjectList &obj, QStringList &proxySignal);
virtual bool genuineConnect (QString sig, ARCSAbstractComponent *dst, QString slt, bool queued=false);
virtual bool genuineDisconnect (QString sig, ARCSAbstractComponent *dst, QString slt);
virtual bool genuineInstanciate ();
virtual void genuineDestroy ();
virtual QVariant getGenuineComponentInstance() { return QVariant(); }
};
#endif //__MYCOMPONENT_H__
Author
Jean-Yves Didier
Date
October, 2007

Definition at line 102 of file arcsabstractcomponent.h.

Member Function Documentation

ARCSAbstractComponent * ARCSAbstractComponent::clone ( )

Kage bunshin no jutsu !

This methods intends to clone an abstract component. It also takes care of meta-properties like: type, family and so on.

Definition at line 53 of file arcsabstractcomponent.cpp.

Here is the call graph for this function:

bool ARCSAbstractComponent::connect ( QString  sig,
ARCSAbstractComponent dst,
QString  slt,
bool  queued = false 
)
virtual

This method connects two components by the indicated signals and slots.

In order to lessen the burden of managing connections between components of the same family, it is possible to implement a direct connection between them in the method genuineConnection(). If it is not possible, the component abstraction must wrap it to the native format of ARCS components using a QObject intermediate acting as a proxy (see also getProxySlot() and getProxySignal()).

Parameters
sigthe signal name of the current component
dsta pointer to the component to connect to
sltthe slot name of the component to connect to
queuedif set to false the parameter transmission will not be delayed.
Returns
true if successful, false otherwise.
Todo:
bug probable sur slotNames qui devrait être indicé sur j !!!!

Definition at line 187 of file arcsabstractcomponent.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ARCSAbstractComponent::disconnect ( QString  sig,
ARCSAbstractComponent dst,
QString  slt 
)

This method disconnects two components by the indicated signals and slots.

In order to lessen the burden of managing connections between components of the same family, it is possible to implement a direct connection between them in the method genuineDisconnection(). If it is not possible, the component abstraction must wrap it to the native format of ARCS components using a QObject intermediate acting as a proxy (see also getProxySlot() and getProxySignal()).

Parameters
sigthe signal name of the current component
dsta pointer to the component to connect to
sltthe slot name of the component to connect to
Returns
true if successful, false otherwise.

Definition at line 263 of file arcsabstractcomponent.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool ARCSAbstractComponent::genuineConnect ( QString  ,
ARCSAbstractComponent ,
QString  ,
bool  = false 
)
inlineprotectedvirtual

This method connects two components by the indicated signals and slots.

In order to lessen the burden of managing connections between components of the same family, this method should implement a direct connection between them.

Parameters
sigthe signal name of the current component
dsta pointer to the component to connect to
sltthe slot name of the component to connect to
queuedif set to false the parameter transmission will not be delayed.
Returns
true if direct connection has been performed, false otherwise.

Reimplemented in ARCSProxyComponent.

Definition at line 294 of file arcsabstractcomponent.h.

Here is the caller graph for this function:

virtual void ARCSAbstractComponent::genuineDestroy ( )
protectedpure virtual

This method should implement the destruction of the actual component.

Should be overloaded by each subclasses.

Implemented in ARCSApplicationComponent, ARCSScriptComponent, ARCSCompositeComponent, ARCSProxyComponent, ARCSControllerComponent, and ARCSNativeComponent.

Here is the caller graph for this function:

virtual bool ARCSAbstractComponent::genuineDisconnect ( QString  ,
ARCSAbstractComponent ,
QString   
)
inlineprotectedvirtual

This method disconnects two components by the indicated signals and slots.

In order to lessen the burden of managing connections between components of the same family, this method should implement a direct disconnection between them.

Parameters
sigthe signal name of the current component
dsta pointer to the component to connect to
sltthe slot name of the component to connect to
Returns
true if direct connection has been performed, false otherwise.

Reimplemented in ARCSProxyComponent.

Definition at line 304 of file arcsabstractcomponent.h.

Here is the caller graph for this function:

virtual bool ARCSAbstractComponent::genuineInstanciate ( )
protectedpure virtual

This method should implement the instanciation of the actual component.

Should be overloaded by each subclasses.

Implemented in ARCSApplicationComponent, ARCSScriptComponent, ARCSCompositeComponent, ARCSProxyComponent, ARCSControllerComponent, and ARCSNativeComponent.

Here is the caller graph for this function:

QString ARCSAbstractComponent::getFamily ( )
inline

Gets the family name to which this component belongs.

Definition at line 240 of file arcsabstractcomponent.h.

Here is the caller graph for this function:

virtual QVariant ARCSAbstractComponent::getGenuineComponentInstance ( )
inlinevirtual

Allows to get the genuine component instance.

This method purpose is to help in invocating nested objects.

Reimplemented in ARCSApplicationComponent, and ARCSNativeComponent.

Definition at line 254 of file arcsabstractcomponent.h.

Here is the caller graph for this function:

QStringList ARCSAbstractComponent::getProperties ( )

Recovers the list of properties stored inside the component.

Definition at line 135 of file arcsabstractcomponent.cpp.

Here is the caller graph for this function:

QVariant ARCSAbstractComponent::getProperty ( QString  name)

Gets a meta-property from this component.

Parameters
namename of the property
Returns
a QVariant representing the value of the property.

Definition at line 112 of file arcsabstractcomponent.cpp.

Here is the caller graph for this function:

virtual void ARCSAbstractComponent::getProxySignal ( QString  signal,
ObjectList &  obj,
QStringList &  proxySignal 
)
protectedpure virtual

Creates a proxy signal to interface a component to native ARCS components.

This function should be overriden by subclasses. It is used in the case the abstracted component is not from the same family as another component to connect to. In this case, the abstracted component should offer a wrapper using a QObject to communicate with other components as if it was a native component of the ARCS runtime.

Parameters
sigthe signal name of the current component
obja list of QObject wrappers returned by this method
proxySignalthe list of the real slot names associated to the QObjects returned by this method.

Implemented in ARCSApplicationComponent, ARCSScriptComponent, ARCSCompositeComponent, ARCSProxyComponent, ARCSNativeComponent, and ARCSControllerComponent.

Here is the caller graph for this function:

virtual void ARCSAbstractComponent::getProxySlot ( QString  slot,
ObjectList &  obj,
QStringList &  proxySlot 
)
protectedpure virtual

Creates a proxy slot to interface a component to native ARCS components.

This function should be overriden by subclasses. It is used in the case the abstracted component is not from the same family as another component to connect to. In this case, the abstracted component should offer a wrapper using a QObject to communicate with other components as if it was a native component of the ARCS runtime.

Parameters
slotthe slot name of the current component
obja list of QObject wrappers returned by this method
proxySlotthe list of the real slot names associated to the QObjects returned by this method.

Implemented in ARCSApplicationComponent, ARCSScriptComponent, ARCSCompositeComponent, ARCSProxyComponent, ARCSNativeComponent, and ARCSControllerComponent.

Here is the caller graph for this function:

QString ARCSAbstractComponent::getType ( )
inline

Gets the class name of this component.

Definition at line 248 of file arcsabstractcomponent.h.

Here is the caller graph for this function:

bool ARCSAbstractComponent::init ( QString  slt,
QVariant *  var 
)

Initializes a component.

Each slot of a component can be used to give values to alter its behaviour. This is the role of this method.

Parameters
sltthe slot name of this component.
vara QVariant representing the value to give to this slot.

Definition at line 141 of file arcsabstractcomponent.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool ARCSAbstractComponent::loadFile ( QString  fn)
virtual

Defines a way to load a component description from a file.

This method has a default implementation. Optimizations might require to rewrite it.

Parameters
fna filename where component description is stored
Returns
true if loading and parsing was a success, false otherwise.

Reimplemented in ARCSApplicationComponent, and ARCSCompositeComponent.

Definition at line 74 of file arcsabstractcomponent.cpp.

Here is the call graph for this function:

virtual bool ARCSAbstractComponent::parseString ( QString  s)
pure virtual

Defines a basic seralization mechanism.

This should parse a string and affect the internal representation of the component.

Returns
true if parsing was a success, false otherwise.

Implemented in ARCSScriptComponent, ARCSApplicationComponent, ARCSCompositeComponent, ARCSNativeComponent, ARCSControllerComponent, and ARCSProxyComponent.

Here is the caller graph for this function:

void ARCSAbstractComponent::removeProperty ( QString  name)

Removes a meta-property from this component.

Parameters
namename of the property

Definition at line 123 of file arcsabstractcomponent.cpp.

bool ARCSAbstractComponent::saveFile ( QString  fn)
virtual

Defines a way to save a component description inside a file.

This method has a default implementation. Optimizations might require to rewrite it.

Parameters
fna filename where component description will be stored.
Returns
true if saving a success, false otherwise.

Reimplemented in ARCSCompositeComponent.

Definition at line 90 of file arcsabstractcomponent.cpp.

Here is the call graph for this function:

void ARCSAbstractComponent::setFamily ( QString  s)
inline

Sets the family name to which this component belongs.

Definition at line 237 of file arcsabstractcomponent.h.

Here is the caller graph for this function:

void ARCSAbstractComponent::setProperty ( QString  name,
QVariant  value 
)

Sets a meta-property on this component.

Parameters
namename of the property
valuea QVariant representing the value of the property.

Definition at line 106 of file arcsabstractcomponent.cpp.

Here is the caller graph for this function:

void ARCSAbstractComponent::setType ( QString  s)
inline

Sets the class name of this component.

Definition at line 244 of file arcsabstractcomponent.h.

Here is the caller graph for this function:

virtual QString ARCSAbstractComponent::toString ( )
pure virtual

Defines a basic seralization mechanism.

This should return a string representation of the component.

Implemented in ARCSScriptComponent, ARCSApplicationComponent, ARCSCompositeComponent, ARCSNativeComponent, ARCSControllerComponent, and ARCSProxyComponent.

Here is the caller graph for this function:


The documentation for this class was generated from the following files: