arcscontext.h
1 /*
2  name: include/arcs/arcscontext.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 __ARCSCONTEXT_H__
30 #define __ARCSCONTEXT_H__
31 
32 #include <arcs/arcsfactory.h>
33 #include <iostream>
34 //#include <QHash>
35 
36 
45 class DLL_EXPORT ARCSContext
46 {
47 public:
49  ARCSContext();
51  ARCSContext(const ARCSContext& ctx); //{ std::cout << "###### Attempt to use the copy constructor !" << std::endl;}
52  virtual ~ARCSContext();
53 
55  void reset();
56 
58 
63  bool addComponent(QString name, QString className, QString contents = QString::null );
64 
65 
66  bool renameComponent(QString oldName, QString newName);
67 
68 
69  ARCSAbstractComponent* createComponent(QString name, QString className);
70 
72 
74  void removeComponent(QString name);
75 
77 
79  ARCSAbstractComponent* getComponent(QString name);
80 
82  QStringList getComponentList();
84  QStringList getConstantList();
85 
86 
88 
92  bool addConstant(QString name, QString type, QString representation);
93 
95 
98  bool modifyConstant(QString name, QString representation);
99 
100  bool modifyConstant(QString name, QString type, QString representation)
101  {
102  removeConstant(name);
103  addConstant(name, type, representation);
104  return true;
105  }
106 
108 
110  void removeConstant(QString name);
111 
112 
113  bool isInstanciated() { return instanciated;}
114 
116 
118  QVariant getConstant(QString name);
119 
120 
122  bool instanciatePool();
123 
124 
125  QVariant createValue(QString type, QString representation);
126 
127 
129  QStringList computeLibraryList();
130 
131 
133 
139  bool serializeConstant(QString name, QString & type, QString & representation);
140 
141 
142  typedef bool (ARCSContext::*AddPoolMethod) (QString, QString, QString);
143 
144 private:
145  QHash<QString, ARCSAbstractComponent*> componentPool;
146  QHash<QString, QVariant> constantPool;
147  ARCSFactory* factory;
148  bool instanciated;
149 };
150 
151 
152 
153 
154 
155 #endif //__ARCSCONTEXT_H__
Class handling the generic description of a component.
A singleton handling all needed factories in ARCS runtime.
Definition: arcsfactory.h:58
This class manages components and constants in a given context.
Definition: arcscontext.h:45