arcsinterface.cpp
1 /*
2  name: lib/arcsinterface.cpp
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 #include <arcs/arcsinterface.h>
30 #include <arcs/arcsabstractcomponent.h>
31 
32 ARCSInterface::ARCSInterface(const ARCSInterface& inf)
33 {
34  signalList= inf.signalList ;
35  slotList = inf.slotList ;
36  baseClass = inf.baseClass ;
37  className = inf.className ;
38 }
39 
40 
41 void ARCSInterface::importFromComponent(ARCSAbstractComponent* cmp)
42 {
43  clear();
44  signalList= cmp->getSignals() ;
45  slotList = cmp->getSlots() ;
46  className = cmp->getType() ;
47 }
48 
49 
50 bool ARCSInterface::checkComponentInterface(ARCSAbstractComponent* cmp)
51 {
52  int i;
53 
54  QStringList cmpSignals = cmp->getSignals();
55  QStringList cmpSlots = cmp->getSlots();
56 
57  for (i=0; i < signalList.count() ; i++)
58  if (!cmpSignals.contains(signalList.at(i)))
59  return false;
60 
61  for (i=0; i < slotList.count() ; i++)
62  if (!cmpSlots.contains(slotList.at(i)))
63  return false;
64 
65  return true;
66 }
67 
68 
69 QString ARCSInterface::getHeaderDeclaration()
70 {
71  QString res;
72 
73  res += "#ifndef __" + className.toUpper() + "_H__\n" ;
74  res += "#define __" + className.toUpper() + "_H__\n\n" ;
75  res += "class " + className + " : public " + baseClass + "\n";
76  res += "{\nQ_OBJECT\npublic:\n " + className + "\n";
77  //res +=
78 
79 
80 
81  return res;
82 }
A class describing interfaces of components.
Definition: arcsinterface.h:42
virtual QStringList getSlots()=0
Returns the names of the available slots.
Class handling the generic description of a component.
virtual QStringList getSignals()=0
Returns the names of the availables signals.