CTK
0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Libs
Core
ctkAbstractLibraryFactory.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Library: CTK
4
5
Copyright (c) Kitware Inc.
6
7
Licensed under the Apache License, Version 2.0 (the "License");
8
you may not use this file except in compliance with the License.
9
You may obtain a copy of the License at
10
11
http://www.apache.org/licenses/LICENSE-2.0.txt
12
13
Unless required by applicable law or agreed to in writing, software
14
distributed under the License is distributed on an "AS IS" BASIS,
15
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
See the License for the specific language governing permissions and
17
limitations under the License.
18
19
=========================================================================*/
20
21
#ifndef __ctkAbstractLibraryFactory_h
22
#define __ctkAbstractLibraryFactory_h
23
24
// Qt includes
25
#include <QFileInfo>
26
#include <QLibrary>
27
#include <QStringList>
28
29
// CTK includes
30
#include "
ctkAbstractFileBasedFactory.h
"
31
32
//----------------------------------------------------------------------------
34
template
<
typename
BaseClassType>
35
class
ctkFactoryLibraryItem
:
public
ctkAbstractFactoryFileBasedItem
<BaseClassType>
36
{
37
38
public
:
39
40
#if QT_VERSION < 0x50000
41
typedef
void
*
SymbolAddressType
;
42
#else
43
typedef
QFunctionPointer
SymbolAddressType
;
44
#endif
45
46
protected
:
47
typedef
typename
QHash<QString, SymbolAddressType>::const_iterator
ConstIterator
;
48
typedef
typename
QHash<QString, SymbolAddressType>::iterator
Iterator
;
49
50
public
:
51
//explicit ctkFactoryLibraryItem(const QString& path);
52
53
virtual
bool
load
();
54
57
void
setSymbols
(
const
QStringList& symbols);
58
63
bool
resolve
();
64
67
SymbolAddressType
symbolAddress
(
const
QString& symbol)
const
;
68
69
protected
:
70
mutable
QLibrary
Library
;
71
QHash<QString, SymbolAddressType>
ResolvedSymbols
;
72
QStringList
Symbols
;
73
};
74
75
//----------------------------------------------------------------------------
77
template
<
typename
BaseClassType>
78
class
ctkAbstractLibraryFactory
79
:
public
ctkAbstractFileBasedFactory
<BaseClassType>
80
{
81
public
:
83
void
setSymbols
(
const
QStringList& symbols);
84
85
protected
:
86
virtual
bool
isValidFile(
const
QFileInfo& file)
const
;
87
virtual
void
initItem(
ctkAbstractFactoryItem<BaseClassType>
* item);
88
89
private
:
90
QStringList
Symbols
;
91
};
92
93
#include "ctkAbstractLibraryFactory.tpp"
94
95
#endif
ctkFactoryLibraryItem::resolve
bool resolve()
Resolve symbols.
ctkFactoryLibraryItem::load
virtual bool load()
ctkFactoryLibraryItem::setSymbols
void setSymbols(const QStringList &symbols)
Set list of required symbols.
QHash
Definition:
ctkCmdLineModuleFrontend.h:29
ctkFactoryLibraryItem::Iterator
QHash< QString, SymbolAddressType >::iterator Iterator
Definition:
ctkAbstractLibraryFactory.h:48
ctkFactoryLibraryItem::Library
QLibrary Library
Definition:
ctkAbstractLibraryFactory.h:70
ctkFactoryLibraryItem::Symbols
QStringList Symbols
Definition:
ctkAbstractLibraryFactory.h:72
ctkFactoryLibraryItem
Definition:
ctkAbstractLibraryFactory.h:35
ctkAbstractFileBasedFactory
Definition:
ctkAbstractFileBasedFactory.h:49
ctkFactoryLibraryItem::SymbolAddressType
void * SymbolAddressType
Definition:
ctkAbstractLibraryFactory.h:41
ctkAbstractFactoryFileBasedItem
Definition:
ctkAbstractFileBasedFactory.h:34
ctkAbstractFactoryItem
Definition:
ctkAbstractFactory.h:42
ctkFactoryLibraryItem::symbolAddress
SymbolAddressType symbolAddress(const QString &symbol) const
ctkFactoryLibraryItem::ResolvedSymbols
QHash< QString, SymbolAddressType > ResolvedSymbols
Definition:
ctkAbstractLibraryFactory.h:71
ctkAbstractFileBasedFactory.h
ctkAbstractLibraryFactory
Definition:
ctkAbstractLibraryFactory.h:78
ctkFactoryLibraryItem::ConstIterator
QHash< QString, SymbolAddressType >::const_iterator ConstIterator
Definition:
ctkAbstractLibraryFactory.h:47
Generated on Fri Feb 17 2017 21:53:40 for CTK by
1.8.13