arcsfactory.h
1 /*
2  name: include/arcs/arcsfactory.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 __ARCSFACTORY_H__
30 #define __ARCSFACTORY_H__
31 
32 #include <arcs/arcslibmanager.h>
33 
34 #include <arcs/arcsnativefamily.h>
35 
36 #include <QString>
37 #include <QMap>
38 
58 class DLL_POINT ARCSFactory
59 {
60  public :
63  static ARCSFactory* getInstance(); // { return instance; }
64  ~ARCSFactory();
65 
68  bool loadLibrary(QString path);
71  void unLoadLibrary(QString path);
72 
75  QStringList getLibraryNames() { return libraries.keys(); }
76 
79  QStringList getTypeNames() { return types.keys(); }
80 
83  QStringList getFamilyNames() { return families.keys(); }
84 
87  QStringList getComponentNames() { return components; }
88 
91  ARCSAbstractComponent* createComponent(QString componentType);
94  void destroyComponent(ARCSAbstractComponent* aac);
95 
96 
102  QString getComponentLibrary(QString s);
103 
104 
110  QStringList getLibraryComponents(QString s); // { return QStringList(); }
111 
112 
117  QString getVariantType(QVariant var);
118 
119 
120  QString getInternalType(QString s);
121 
122 
128  QString getTypeLibrary(QString s);
129 
131  QString getFamilyLibrary(QString s);
132 
133 
135  QVariant dataDeserialize(QString type, QString representation);
136 
138  QString dataSerialize(QVariant var);
139 
140 private:
141  void registerInternalFamily(ARCSAbstractFamily* family);
142  void registerInternalType(ARCSTypeFactory* type);
143 
144 
145  void buildComponentLists();
146 
147  ARCSFactory();
148  static ARCSFactory* instance;
149 
150  // mauvais typage
151  //ARCSComponentMap components;
152  ARCSFamilyMap families;
153  ARCSTypeMap types;
154 
155  // mapping à mettre en place :
156  QMap<QString, QString> typeLibraryMap ;
157  QMap<QString, QString> nativeComponentLibraryMap ; // fait !!!
158  QMap<QString, QString> familyLibraryMap ;
159  QMap<QString, QString> variantTypeMap;
160 
161  QMap<QString, QString> componentFamilyMap ; // ne pas toucher !!!!
162  QStringList components; // ne devrait on pas regénérer ?
163 
164  QHash<QString,ARCSLibManager*> libraries;
165 
166  ARCSNativeFamily* nativeFamily;
167 
168 };
169 
170 #endif //__ARCSFACTORY_H__
QStringList getComponentNames()
Returns the class names of the components currently stored.
Definition: arcsfactory.h:87
QStringList getLibraryNames()
Returns the names of the currently loaded libraries.
Definition: arcsfactory.h:75
QStringList getFamilyNames()
Returns the names of the family currently stored.
Definition: arcsfactory.h:83
Class handling the generic description of a component.
A singleton handling all needed factories in ARCS runtime.
Definition: arcsfactory.h:58
Generic class describing how type factories should be implemented.
QStringList getTypeNames()
Returns the names of the types currently stored.
Definition: arcsfactory.h:79
Native family handling native components inside ARCS runtime.
Abstract class representing a family of components i.e. a factory of factories of components...