Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SequenceFactory.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/sequence/SequenceFactory.hh
11 /// @brief Factory for creating various types of sequence.
12 /// @author James Thompson
13 
14 #ifndef INCLUDED_core_sequence_SequenceFactory_hh
15 #define INCLUDED_core_sequence_SequenceFactory_hh
16 
17 // AUTO-REMOVED #include <core/pose/Pose.fwd.hh>
20 
21 #include <utility/vector1.hh>
22 #include <utility/factory/WidgetRegistrator.hh>
23 
24 #include <map>
25 
26 namespace core {
27 namespace sequence {
28 
30 private:
32 
33  SequenceFactory(SequenceFactory const &); // unimplemented
34  SequenceFactory const & operator=( SequenceFactory const & ); // unimplemented
35 public:
36  static SequenceFactory * get_instance();
37 
38  void factory_register( SequenceCreatorCOP creator );
39  SequenceOP get_sequence( std::string const & type_name );
41  std::string const & fn,
42  std::string const & type_name
43  );
45 
46  /// @brief Replace the load-time SequenceCreator with another creator.
47  void replace_creator( SequenceCreatorCOP creator );
48 
50  get_creator( std::string const & type_name );
51 
52 private:
53 
55 
56  typedef std::map< std::string, SequenceCreatorCOP > SequenceCreatorMap;
58 };
59 
60 /// @brief This templated class will register an instance of an
61 /// SequenceCreator (class T) with the SequenceFactory. It will ensure
62 /// that no SequenceCreator is registered twice, and, centralizes
63 /// this registration logic so that thread safety issues can be handled in
64 /// one place
65 template < class T >
66 class SequenceRegistrator : public utility::factory::WidgetRegistrator< SequenceFactory, T >
67 {
68 public:
69  typedef utility::factory::WidgetRegistrator< SequenceFactory, T > parent;
70 public:
72 };
73 
74 
75 } //sequence
76 } //core
77 
78 #endif