arcscompositecomponent.h
1 /*
2  name: include/arcs/arcscompositecomponent.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 __ARCSCOMPOSITECOMPONENT_H__
30 #define __ARCSCOMPOSITECOMPONENT_H__
31 
32 #include <arcs/arcssheet.h>
33 #include <arcs/arcsmethod.h>
34 #include <arcs/arcsdll.h>
35 
37 
45 {
46 public:
49 
50  virtual QStringList getSlots();
51 
52  virtual QStringList getSignals();
53 
54 
55  virtual QString toString();
56  virtual bool parseString(QString s);
57 
58  virtual bool loadFile(QString fn);
59  virtual bool saveFile(QString fn);
60 
62  void setSheet(ARCSSheet ref)
63  {
64  sheet = ref;
65  context = *(sheet.getContext());
66  }
67 
69  ARCSSheet* getSheet() { return &sheet; }
70 
72  ARCSContext getContext() { return context; }
73 
75 
79  bool addProxySignal(QString proxy, QString id, QString signal)
80  {
81  return addMethod(proxySignals, proxy,id, signal);
82  }
83 
85 
89  bool addProxySlot(QString proxy, QString id, QString slot)
90  {
91  return addMethod(proxySlots, proxy, id, slot);
92  }
93 
94 
96  void getProxySlots(QStringList& proxies, QStringList& objects, QStringList& slotNames)
97  {
98  getProxyMethods(proxySlots, proxies, objects, slotNames);
99  }
100 
102  void getProxySignals(QStringList& proxies, QStringList& objects, QStringList& signalNames)
103  {
104  getProxyMethods(proxySignals, proxies, objects, signalNames);
105  }
106 
107 
108 protected:
109  virtual void getProxySlot(QString slot, ObjectList & obj, QStringList & proxySlot);
110  virtual void getProxySignal(QString signal, ObjectList & obj, QStringList & proxySignal);
111  virtual bool genuineInstanciate() ;
112  virtual void genuineDestroy();
113 
114 private:
115  bool addMethod(QMap<QString, ARCSMethod> & list, QString proxy, QString id, QString method);
116  void getProxyMethods(QMap<QString, ARCSMethod> & list, QStringList & proxies, QStringList & objects, QStringList& methodNames);
117 
118  ARCSContext context;
119  ARCSSheet sheet;
120  QMap<QString, ARCSMethod> proxySlots;
121  QMap<QString, ARCSMethod> proxySignals;
122 };
123 
124 
125 
126 #endif //__ARCSCOMPOSITECOMPONENT_H__
void getProxySignals(QStringList &proxies, QStringList &objects, QStringList &signalNames)
void getProxySlots(QStringList &proxies, QStringList &objects, QStringList &slotNames)
Class defining a composite component i.e. a component made of components.
virtual QString toString()=0
Defines a basic seralization mechanism.
void setSheet(ARCSSheet ref)
Sets the sheet to use as an internal description of embedded components.
virtual void getProxySignal(QString signal, ObjectList &obj, QStringList &proxySignal)=0
Creates a proxy signal to interface a component to native ARCS components.
bool addProxySlot(QString proxy, QString id, QString slot)
Adds a wrapper to an internal component and its slot.
ARCSSheet * getSheet()
Returns the internal structure of this composite component described as a sheet.
virtual void getProxySlot(QString slot, ObjectList &obj, QStringList &proxySlot)=0
Creates a proxy slot to interface a component to native ARCS components.
virtual QStringList getSlots()=0
Returns the names of the available slots.
ARCSContext getContext()
Returns the internal context of the composite component.
Class handling the generic description of a component.
virtual bool loadFile(QString fn)
Defines a way to load a component description from a file.
virtual bool saveFile(QString fn)
Defines a way to save a component description inside a file.
This class manages components and constants in a given context.
Definition: arcscontext.h:45
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.
Maintains connections between objects.
Definition: arcssheet.h:48
virtual QStringList getSignals()=0
Returns the names of the availables signals.
bool addProxySignal(QString proxy, QString id, QString signal)
Adds a wrapper to an internal component and its signal.