Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoopMoverFactory.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/loops/LoopMoverFactoryFactory.cc
11 /// @brief Factory for creating LoopMovers objects
12 /// @author Matthew O'Meara (mattjomeara@gmail.com)
13 
14 // Unit Headers
16 
17 // Package headers
21 
22 // Project Headers
23 #include <protocols/loops/Loops.hh>
24 #include <utility/vector0.hh>
25 #include <utility/exit.hh>
26 
27 // Basic headers
28 #include <basic/Tracer.hh>
29 
30 
31 // C++ Headers
32 #include <sstream>
33 
34 //Auto Headers
35 #include <utility/vector1.hh>
36 
37 namespace protocols {
38 namespace loops {
39 
40 using std::endl;
41 using std::string;
42 using std::pair;
43 using std::stringstream;
44 using core::pose::Pose;
45 
46 static basic::Tracer tr("protocols.loops.LoopMoverFactory");
47 
48 LoopMoverFactory * LoopMoverFactory::instance_( 0 );
49 
50 /// @details Private constructor insures correctness of singleton.
52 
54  const LoopMoverFactory &
55 ) {}
56 
58 
59 
62 {
63  if ( instance_ == 0 ) {
65  }
66  return instance_;
67 }
68 
69 
72  std::string const & type_name_in,
73  LoopsOP const loops
74 )
75 {
76  loop_mover::LoopMoverOP loop_mover = create_loop_mover( type_name_in );
77 
78  loop_mover->set_guarded_loops_not_in_charge(); // <-- tell the loop mover someone else has already resolved the loop indices.
79  loop_mover->loops(loops);
80  return loop_mover;
81 }
82 
83 /// @details Set the LoopsFileData for the LoopMover leaving it in an "in
84 /// charge" state. It will, upon a future call to apply, resolve the loop
85 /// indices, which may have been provided as PDB indices, into Pose indices.
88  std::string const & type_name_in,
89  LoopsFileData const & loops
90 ) {
91  loop_mover::LoopMoverOP loop_mover = create_loop_mover( type_name_in );
92  loop_mover->loops(loops); // <-- this call leaves the loops_mover "in charge" of index resolution.
93  return loop_mover;
94 }
95 
98  std::string const & type_name_in,
99  GuardedLoopsFromFileOP guarded_loops
100 ) {
101  loop_mover::LoopMoverOP loop_mover = create_loop_mover( type_name_in );
102  loop_mover->loops(guarded_loops); // <-- this call makes a pointer assignment.
103  return loop_mover;
104 }
105 
106 
109  std::string const & type_name_in
110 )
111 {
112  std::string type_name;
113  // deprecated names
114  if(type_name_in == "quick_ccd"){
115  type_name = "LoopMover_Perturb_QuickCCD";
116  } else if(type_name_in == "sdwindow"){
117  type_name = "LoopMover_SlidingWindow";
118  } else if(type_name_in == "quick_ccd_moves"){
119  type_name = "LoopMover_Perturb_QuickCCD_Moves";
120  } else if(type_name_in == "perturb_ccd"){
121  type_name = "LoopMover_Perturb_CCD";
122  } else if(type_name_in == "perturb_kic"){
123  type_name = "LoopMover_Perturb_KIC";
124  } else {
125  type_name = type_name_in;
126  }
127 
128  tr.Trace << "generate LoopMover of type " << type_name << std::endl;
129  loop_mover::LoopMoverOP loop_mover( dynamic_cast<loop_mover::LoopMover *>((moves::MoverFactory::get_instance()->newMover(type_name)).get()));
130  if(!loop_mover){
131  stringstream error_msg;
132  error_msg
133  << "Attempting to create Mover "
134  << "'" << type_name << "' that is not a LoopMover." << endl
135  << "check spelling or "
136  << "register a new LoopMover in the MoverFactory" << endl;
137  utility_exit_with_message(error_msg.str());
138  }
139  return loop_mover;
140 }
141 
142 } // namespace
143 } // namespace