arcsnativecomponent.h
1 /*
2  name: include/arcs/arcsnativecomponent.h
3 
4  This file is part of ARCS - Augmented Reality Component System
5  (version 2-current), written by Jean-Yves Didier
6  for IBISC Laboratory (http://www.ibisc.univ-evry.fr)
7 
8  Copyright (C) 2013 Université d'Evry-Val d'Essonne
9 
10  This program is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 
24  Please send bugreports with examples or suggestions to
25  jean-yves.didier__at__ibisc.univ-evry.fr
26 */
27 
28 
29 #ifndef __ARCSNATIVECOMPONENT_H__
30 #define __ARCSNATIVECOMPONENT_H__
31 
32 #include <arcs/arcsabstractcomponent.h>
33 
34 #include <QMetaType>
35 #include <QMetaMethod>
36 Q_DECLARE_METATYPE(QObject*)
37 #include <iostream>
38 
39 class QStringList;
40 
47 {
48 public:
50  virtual ~ARCSNativeComponent();
51 
52  virtual QStringList getSlots();
53  virtual QStringList getSignals();
54  virtual QString toString();
55  virtual bool parseString(QString );
56  virtual QVariant getGenuineComponentInstance() { QVariant var; var.setValue(realObject); return var; }
58 
62  virtual ARCSNativeComponent* genuineClone() =0;
63 
64 
65 protected:
66  virtual void getProxySlot(QString slot, ObjectList & obj, QStringList & proxySlot)
67  {
68  obj << realObject ; proxySlot << slot;
69  }
70  virtual void getProxySignal(QString signal, ObjectList & obj, QStringList & proxySignal) { obj << realObject ; proxySignal << signal; }
71  virtual bool genuineInstanciate();
72  virtual void genuineDestroy();
73 
74 
75  virtual QObject* createObject(QObject* parent)=0;
76  virtual void destroyObject(QObject* obj) = 0;
77  virtual QMetaObject getDescription() = 0;
78  virtual QString getName() { return QString( getDescription().className()); }
79 
80 private:
81  QObject* realObject;
82  static QObject* father;
83 };
84 
85 
86 
87 
88 #endif //__ARCSNATIVECOMPONENT_H__
virtual QString toString()=0
Defines a basic seralization mechanism.
virtual QVariant getGenuineComponentInstance()
virtual QStringList getSlots()=0
Returns the names of the available slots.
Class handling the generic description of a component.
virtual void getProxySlot(QString slot, ObjectList &obj, QStringList &proxySlot)
Creates a proxy slot to interface a component to native ARCS components.
virtual void getProxySignal(QString signal, ObjectList &obj, QStringList &proxySignal)
Creates a proxy signal to interface a component to native ARCS components.
virtual void genuineDestroy()=0
This method should implement the destruction of the actual component.
virtual bool genuineInstanciate()=0
This method should implement the instanciation of the actual component.
virtual bool parseString(QString s)=0
Defines a basic seralization mechanism.
virtual QStringList getSignals()=0
Returns the names of the availables signals.
Component representation of ARCS Native components.