Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoopsDefinerLoader.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/loops_definers/LoopsDefinerLoader.cc
11 /// @brief Implementation the LoopsDefinerLoader class which implements the DataLoader interface
12 /// @author Matthew O'Meara (mattjomeara@gmail.com)
13 
14 // Unit Headers
18 
19 // Project Headers
22 #include <basic/Tracer.hh>
23 #include <core/pose/Pose.hh>
25 
26 
27 // Utility headers
28 #include <utility/tag/Tag.hh>
29 
30 // Boost Headers
31 #include <boost/foreach.hpp>
32 
33 #include <utility/vector0.hh>
34 #include <utility/vector1.hh>
35 
36 #define foreach BOOST_FOREACH
37 
38 using std::string;
39 using std::endl;
40 using core::pose::Pose;
43 using utility::vector0;
46 
47 namespace protocols {
48 namespace loops {
49 namespace loops_definers {
50 
51 static basic::Tracer TR( "protocols.loops.loops_definers.LoopsDefinerLoader" );
52 
55 
57  Pose const & pose,
58  TagPtr const tag,
59  DataMap & data
60 ) const
61 {
62  typedef vector0< TagPtr > TagPtrs;
63 
64  foreach(TagPtr tag, tag->getTags()){
65  string const type( tag->getName() );
66  if ( ! tag->hasOption("name") ) {
67  utility_exit_with_message( "Can't create unnamed Loops definition (type: " + type + ")" );
68  }
69  string const name( tag->getOption<string>("name") );
70  if ( data.has( "loops_definers", name ) ) {
71  TR.Error << "Error LoopsDefiner of name \"" << name
72  << "\" (with type " << type << ") already exists. \n" << tag << endl;
73  utility_exit_with_message("Duplicate definition of LoopsDefiner with name " + name);
74  }
75  LoopsDefinerOP loops_definer( LoopsDefinerFactory::get_instance()->create_loops_definer( type ) );
76  loops_definer->parse_my_tag(tag, data, pose);
77  data.add("loops_definers", name, loops_definer );
78  TR << "Created LoopsDefiner named \"" << name << "\" of type " << type << endl;
79  }
80  TR.flush();
81 }
82 
85 
86 string
87 LoopsDefinerLoaderCreator::keyname() const { return "LOOP_DEFINITIONS"; }
88 
89 
90 } //namespace
91 } //namespace
92 } //namespace