Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConstraintFactory.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 core/scoring/constraints/ConstraintFactory.hh
11 /// @brief Factory for creating various types of constraints.
12 /// @author Greg Taylor <gktaylor@u.washington.edu>
13 
14 #ifndef INCLUDED_core_scoring_constraints_ConstraintFactory_hh
15 #define INCLUDED_core_scoring_constraints_ConstraintFactory_hh
16 
17 // Unit headers
18 
19 // Package headers
22 
23 // Utility headers
24 #include <utility/factory/WidgetRegistrator.hh>
25 
26 // C++ Headers
27 #include <map>
28 
29 namespace core {
30 namespace scoring {
31 namespace constraints {
32 
34 private:
36 
37  ConstraintFactory(ConstraintFactory const &); // unimplemented
38  ConstraintFactory const & operator=( ConstraintFactory const & ); // unimplemented
39 public:
41 
42  //void add_type( std::string const & type_name, ConstraintOP new_cst );
43  //void add_type( ConstraintOP new_cst );
44 
45  void factory_register( ConstraintCreatorCOP creator );
48 
49  /// @brief Replace the load-time ConstraintCreator with another creator.
50  void replace_creator( ConstraintCreatorCOP creator );
51 
53  get_creator( std::string const & type_name );
54 private:
55 
57 
58  typedef std::map< std::string, scoring::constraints::ConstraintCreatorCOP > ConstraintCreatorMap;
60 };
61 
62 /// @brief This templated class will register an instance of an
63 /// ConstraintCreator (class T) with the ConstraintFactory. It will ensure
64 /// that no ConstraintCreator is registered twice, and, centralizes
65 /// this registration logic so that thread safety issues can be handled in
66 /// one place
67 template < class T >
68 class ConstraintRegistrator : public utility::factory::WidgetRegistrator< ConstraintFactory, T >
69 {
70 public:
71  typedef utility::factory::WidgetRegistrator< ConstraintFactory, T > parent;
72 public:
74 };
75 
76 
77 } //constraints
78 } //scoring
79 } //core
80 
81 #endif