sample.h
1 /*
2  name: sample/sample.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 __SAMPLE_H__
30 #define __SAMPLE_H__
31 
32 #include <QObject>
33 #include <arcs/arcsinternaltypes.h>
44 class Loop: public QObject
45 {
46 Q_OBJECT
47  public:
49 Loop(QObject* parent = 0) : QObject(parent) {}
50 
51 public slots:
53  void setIterations(int n);
54 
55 signals:
57 void newIteration(int i);
59 void sendToken(QString s);
60 void finished();
61 };
62 
68 class DisplayInt: public QObject
69 {
70 Q_OBJECT
71  public:
73 DisplayInt(QObject* parent = 0) : QObject(parent) {}
74 
75 public slots:
77  void display(int i);
78  void display(intArray ia);
79 };
80 
88 class StackExploder: public QObject
89 {
90 Q_OBJECT
91  public:
92  StackExploder(QObject* parent = 0) : QObject(parent), calls(0) {}
93 
94  public slots:
95  void tic();
96 
97 signals:
98  void toc();
99 
100 private:
101  int calls;
102 };
103 
104 
110 class ComponentNester : public QObject
111 {
112 Q_OBJECT
113  public :
114  ComponentNester(QObject* parent=0);
115 
116  public slots:
117  void setComponent(QObject* cmp);
118  void setIterations(int);
119 
120  private:
121  Loop* nestedComponent;
122 };
123 
129 class Sleeper : public QObject
130 {
131  Q_OBJECT
132  public:
133  Sleeper(QObject* parent=0) : QObject(parent) {}
134  public slots:
135  void setSeconds(int);
136  void setText(QString s) { text = s; }
137 
138  signals:
139  void sendToken(QString);
140 
141  private:
142  QString text;
143 };
144 
145 
146 #endif //__SAMPLE_H__
Displays every integer sent to itself.
Definition: sample.h:68
void display(int i)
Displays in the console the number passed as a parameter.
Definition: sample.cpp:50
void setIterations(int n)
Gives the number of iterations.
Definition: sample.cpp:39
DisplayInt(QObject *parent=0)
Default constructor.
Definition: sample.h:73
Template class to implement arrays.
Definition: arcsarray.h:50
This class is a loop sending as much iterations as needed.
Definition: sample.h:44
Component triggering stack explosions This component intends to demonstrate how to circumvent stack e...
Definition: sample.h:88
void newIteration(int i)
Sends an iteration.
Loop(QObject *parent=0)
Default contructor.
Definition: sample.h:49
void sendToken(QString s)
Sends a token once the number of iterations have been reached.