Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
protocols
jd2
parser
DataLoaderFactory.hh
Go to the documentation of this file.
1
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2
// vi: set ts=2 noet:
3
//
4
// (c) Copyright Rosetta Commons Member Institutions.
5
// (c) This file is part of the Rosetta software suite and is made available under license.
6
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9
10
/// @file protocols/jd2/parser/DataLoaderFactory.hh
11
/// @brief Factory class for the parser's DataLoader classes
12
/// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13
14
#ifndef INCLUDED_protocols_jd2_parser_DataLoaderFactory_hh
15
#define INCLUDED_protocols_jd2_parser_DataLoaderFactory_hh
16
17
// Package Headers
18
#include <
protocols/jd2/parser/DataLoader.fwd.hh
>
19
#include <
protocols/jd2/parser/DataLoaderCreator.hh
>
20
21
// Utility Headers
22
#include <utility/factory/WidgetRegistrator.hh>
23
#include <utility/pointer/ReferenceCount.hh>
24
25
// c++ headers
26
#include <map>
27
28
namespace
protocols {
29
namespace
jd2 {
30
namespace
parser {
31
32
/// @brief A factory for creating DataLoaders, which are able to load
33
/// arbitrary data into the DataMap used in the XML-based parser.
34
/// This factory supports the load-time registration scheme allowing
35
/// DataLoaders to be defined in libraries outside of protocols.lib
36
class
DataLoaderFactory
37
{
38
public
:
39
typedef
std::map< std::string, DataLoaderCreatorOP >
LoaderMap
;
40
41
public
:
42
virtual
~DataLoaderFactory
();
43
44
static
45
DataLoaderFactory
*
get_instance
();
46
47
void
factory_register
(
DataLoaderCreatorOP
creator );
48
49
/// @brief Create a DataLoader given its identifying string
50
DataLoaderOP
newDataLoader
(
std::string
const
& )
const
;
51
52
private
:
53
DataLoaderFactory
();
54
55
// Unimplemented -- uncopyable
56
DataLoaderFactory
(
DataLoaderFactory
const
& );
57
DataLoaderFactory
const
&
operator =
(
DataLoaderFactory
const
& );
58
59
private
:
60
/// Singleton instance pointer
61
static
DataLoaderFactory
*
instance_
;
62
63
LoaderMap
dataloader_creator_map_
;
64
65
};
66
67
/// @brief This templated class will register an instance of an
68
/// DataLoaderCreator (class T) with the DataLoaderFactory. It will ensure
69
/// that no DataLoaderCreator is registered twice, and, centralizes
70
/// this registration logic so that thread safety issues can be handled in
71
/// one place
72
template
<
class
T >
73
class
DataLoaderRegistrator
:
public
utility::factory::WidgetRegistrator< DataLoaderFactory, T >
74
{
75
public
:
76
typedef
utility::factory::WidgetRegistrator< DataLoaderFactory, T >
parent
;
77
public
:
78
DataLoaderRegistrator
() :
parent
() {}
79
};
80
81
}
//namespace parser
82
}
//namespace jd2
83
}
//namespace protocols
84
85
#endif
Generated on Sat Jun 1 2013 11:55:09 for Rosetta 3.5 by
1.8.4