arcsinit.h
1 /*
2  name: include/arcs/arcsinit.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 __ARCSINIT_H__
30 #define __ARCSINIT_H__
31 
32 #include <arcs/arcsabstractcomponent.h>
33 #include <QBitArray>
34 #include <arcs/arcsdll.h>
35 
36 class ARCSFactory;
37 
39 
46 class DLL_POINT ARCSInit
47 {
48 public:
49  ARCSInit();
50  ARCSInit(const ARCSInit& i);
51 
58  ARCSInit(ARCSAbstractComponent* d, QString slt, QVariant v);
59  ~ARCSInit();
60 
62  void setDestination(ARCSAbstractComponent* d) { destination = d; }
64  void setSlotName(QString slt) { slotName = slt; }
66  void setValue(QVariant v) { value = v; }
67 
69  ARCSAbstractComponent* getDestination() { return destination; }
70 
71  QString getDestinationName() { return destination->getProperty("id").toString(); }
73  QString getSlotName() { return slotName; }
75  QVariant getValue() { return value; }
76 
78  QString getValueType();
80  QString getValueString();
81 
88  bool init();
95  bool init(QVariant var);
102  bool init(ARCSAbstractComponent* cmp);
103 
104 
106  bool isConstant() { return constant;}
108  bool isComponent() { return component; }
109 
110  bool isComplete() { return destination && !slotName.isEmpty() ;}
111 
113 
116  {
117  return ((destination == i.destination) && (slotName == i.slotName) && (getValueString() == i.getValueString()) );
118  }
119 
120  static ARCSInit null;
121 
122 private:
123  ARCSAbstractComponent* destination;
124  QString slotName;
125  QVariant value;
126  static ARCSFactory* factory;
127  bool constant;
128  bool component ;
129 
130 };
131 
132 #endif //__ARCSINIT_H__
ARCSAbstractComponent * getDestination()
Definition: arcsinit.h:69
Desribes an initialization over a component.
Definition: arcsinit.h:46
QString getValueString()
Definition: arcsinit.cpp:110
QVariant getProperty(QString name)
Gets a meta-property from this component.
Class handling the generic description of a component.
bool isConstant()
Definition: arcsinit.h:106
bool isComponent()
Definition: arcsinit.h:108
A singleton handling all needed factories in ARCS runtime.
Definition: arcsfactory.h:58
QVariant getValue()
Definition: arcsinit.h:75
QString getSlotName()
Definition: arcsinit.h:73
void setDestination(ARCSAbstractComponent *d)
Definition: arcsinit.h:62
void setSlotName(QString slt)
Definition: arcsinit.h:64
void setValue(QVariant v)
Definition: arcsinit.h:66
bool operator==(ARCSInit i)
Definition: arcsinit.h:115