Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EnergyMethodRegistrator.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/methods/EnergyMethodRegistrator.hh
11 /// @brief Declaration of the base class for EnergyMethod factory registration and creation
12 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13 
14 
15 #ifndef INCLUDED_core_scoring_methods_EnergyMethodRegistrator_hh
16 #define INCLUDED_core_scoring_methods_EnergyMethodRegistrator_hh
17 
18 // Package headers
20 #include <utility/factory/WidgetRegistrator.hh>
21 
22 namespace core {
23 namespace scoring {
24 namespace methods {
25 
26 /// @brief This templated class will register an instance of an
27 /// EnergyMethodCreator (class T) with the ScoringManager. It will ensure
28 /// that no energy method creator is registered twice, and, centralizes
29 /// this registration logic so that thread safety issues can be handled in
30 /// one place
31 template < class T >
32 class EnergyMethodRegistrator : public utility::factory::WidgetRegistrator< ScoringManager, T >
33 {
34 public:
35  typedef utility::factory::WidgetRegistrator< ScoringManager, T > parent;
36 public:
38 /*
39  {
40  register_with_scoring_manager();
41  }
42 
43 private:
44 
45  static bool registered_;
46  static void register_with_scoring_manager() {
47  if ( registered_ ) return;
48  /// NOT THREADSAFE!
49  registered_ = true;
50  ScoringManager::get_instance()->factory_register( new T );
51  }
52 */
53 };
54 
55 /*template < class T >
56 bool EnergyMethodRegistrator< T >::registered_( false );*/
57 
58 }
59 }
60 }
61 
62 #endif