arcslibmanager.h
1 /*
2  name: include/arcs/arcslibmanager.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 __ARCSLIBMANAGER_H__
30 #define __ARCSLIBMANAGER_H__
31 
32 #include <arcs/arcslibtoolkit.h>
33 #include <QLibrary>
34 
36 
51 {
52 public:
53  ARCSLibManager(QString libname);
54  ~ARCSLibManager();
55 
57  ARCSComponentMap getComponentMap() { return components;}
59  ARCSFamilyMap getFamilyMap() { return families; }
61  ARCSTypeMap getTypeMap() { return types;}
62 
64  void ref() { refcount++; }
66  void unref() { if (refcount > 0) refcount--; }
68  bool isRef() { return refcount > 0; }
70  bool isLoaded() { return loaded; }
72  QString getError() { return lib.errorString(); }
74  QString getName() { return name;}
75 
76 
77 private:
78  typedef void (*LibWrapper)(ARCSComponentMap* cmap, ARCSFamilyMap* fmap, ARCSTypeMap* type);
79 
80  LibWrapper libraryRegister ;
81  LibWrapper libraryUnregister;
82 
83  QLibrary lib;
84  ARCSComponentMap components;
85  ARCSFamilyMap families ;
86  ARCSTypeMap types;
87  bool loaded;
88 
89  int refcount;
90  QString name;
91 
92 };
93 
94 
95 
96 #endif //__ARCSLIBMANAGER_H__
This class is a dynamic library manager.
QHash< QString, ARCSNativeComponent * > ARCSComponentMap
ARCSTypeMap getTypeMap()
QString getError()
ARCSFamilyMap getFamilyMap()
ARCSComponentMap getComponentMap()
QString getName()