Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TaskOperationLoader.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/jd2/parser/DataLoader.cc
11 /// @brief Implementation of the XML parser's DataLoader base class (ctor & dstor)
12 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13 
14 // Unit Headers
17 
18 // Project Headers
21 #include <basic/Tracer.hh>
22 
23 // Utility headers
24 #include <utility/tag/Tag.hh>
25 
26 // Boost Headers
27 #include <boost/foreach.hpp>
28 
30 #include <utility/vector0.hh>
31 #include <utility/vector1.hh>
32 
33 #define foreach BOOST_FOREACH
34 
35 namespace protocols {
36 namespace jd2 {
37 namespace parser {
38 
39 static basic::Tracer TR( "protocols.jd2.parser.TaskOperationLoader" );
40 
43 
45  core::pose::Pose const &,
46  utility::tag::TagPtr const tag,
47  moves::DataMap & data
48 ) const
49 {
50  using namespace core::pack::task::operation;
52 
53  foreach(utility::tag::TagPtr tag, tag->getTags()){
54  std::string const type( tag->getName() );
55  if ( ! tag->hasOption("name") ) {
56  utility_exit_with_message( "Can't create unnamed TaskOperation (type: " + type + ")" );
57  }
58  std::string const name( tag->getOption<std::string>("name") );
59  if ( data.has( "task_operations", name ) ) {
60  TR.Error << "Error TaskOperation of name \"" << name
61  << "\" (with type " << type << ") already exists. \n" << tag << std::endl;
62  utility_exit_with_message("Duplicate definition of TaskOperation with name " + name);
63  }
64  TaskOperationOP new_t_o( TaskOperationFactory::get_instance()->newTaskOperation( type, tag ) );
65  runtime_assert( new_t_o );
66  data.add("task_operations", name, new_t_o );
67  TR << "Defined TaskOperation named \"" << name << "\" of type " << type << std::endl;
68  }
69  TR.flush();
70 }
71 
74 
76 TaskOperationLoaderCreator::keyname() const { return "TASKOPERATIONS"; }
77 
78 
79 } //namespace parser
80 } //namespace jd2
81 } //namespace protocols