Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TopologyClaimerFactory.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/topology_broker/TopologyClaimerFactory.hh
11 /// @author Oliver Lange
12 /// @author Christopher Miles (cmiles@uw.edu)
13 
14 #ifndef INCLUDED_protocols_topology_broker_TopologyClaimerFactory_hh
15 #define INCLUDED_protocols_topology_broker_TopologyClaimerFactory_hh
16 
17 // Project headers
19 
20 // External headers
21 #include <boost/utility.hpp>
22 
23 // C/C++ headers
24 #include <map>
25 
26 //Auto Headers
27 namespace protocols {
28 namespace topology_broker {
29 
30 /// @brief A non-copyable factory for instantiating TopologyClaimers by name.
31 /// Commonly used TopologyClaimers are registered in the constructor. Additional
32 /// claimers can be registered after the fact using the add_type() method.
33 class TopologyClaimerFactory : boost::noncopyable {
34  public:
35  /// @brief Returns an instance to the singleton
36  static TopologyClaimerFactory const& get_instance();
37 
38  /// @brief Returns a new instance of the TopologyClaimer identified by <name>
40 
41  /// @brief Registers the TopologyClaimer with name <name>. Instances of this
42  /// class can be retrieved by calling newTopologyClaimer(<name>).
43  void add_type(const std::string& name, TopologyClaimerOP claimer);
44 
45  /// @brief Registers the TopologyClaimer using the name returned by
46  /// claimer->type(). Instances of this class can be retrieved by calling
47  /// newTopologyClaimer(<name>).
48  void add_type(TopologyClaimerOP claimer);
49 
50  private:
51  /// @brief Constructs a new instance and initializes the lookup table
52  /// <claimers_> with commonly used types
54 
55  /// @brief Frees resources associated with this object
57 
58  /// @brief A map that associates claimer names with claimer types. Used by the
59  /// newTopologyClaimer() method to instantiate new claimers by name.
60  mutable std::map<std::string, TopologyClaimerOP> claimers_;
61 
62  /// @brief A pointer to the singleton instance of the factory object.
63  /// Resources associated with the object are released on destruction.
65 };
66 
67 }
68 }
69 
70 #endif // INCLUDED_protocols_topology_broker_TopologyClaimerFactory_hh