Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TopologyClaimerFactory.cc
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.cc
11 /// @author Oliver Lange
12 /// @author Christopher Miles (cmiles@uw.edu)
13 
14 // Unit Headers
16 
17 // Package Headers
37 
38 // Utility headers
39 #include <basic/Tracer.hh>
40 
41 // C/C++ headers
42 #include <sstream>
43 #include <string>
44 
45 #include <utility/vector1.hh>
46 
47 
48 static basic::Tracer tr("protocols.topo_broker", basic::t_info);
49 
50 namespace protocols {
51 namespace topology_broker {
52 
53 // Singleton initialization
54 TopologyClaimerFactory* TopologyClaimerFactory::instance_ = NULL;
55 
56 // Registers commonly used claimers with the name returned by claimer->type()
60  add_type(new JumpClaimer());
65  add_type(new MetalloClaimer());
69  add_type(new CutBiasClaimer());
76 }
77 
79  delete instance_;
80 }
81 
83  if (!instance_)
85 
86  return *instance_;
87 }
88 
90  add_type(claimer->type(), claimer);
91 }
92 
94  claimers_[name] = claimer;
95 }
96 
98  using std::stringstream;
99 
100  if (claimers_.find(name) != claimers_.end()) {
101  return claimers_[name]->clone();
102  } else {
103  stringstream ss;
104  ss << name
105  << " does not name a known TopologyClaimer -->"
106  << " check spelling or register the type via the add_type() method";
107  utility_exit_with_message(ss.str());
108 
109  // purely superficial return statement to quiet the compiler
110  return NULL;
111  }
112 }
113 
114 }
115 }