Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Filter.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/filters/Filter.cc
11 /// @brief
12 /// @detailed
13 /// Contains currently:
14 ///
15 ///
16 /// @author Florian Richter, Sarel Fleishman (sarelf@uw.edu)
17 
18 // Unit Headers
20 
21 // Project Headers
22 // AUTO-REMOVED #include <utility/tag/Tag.hh>
23 #include <basic/Tracer.hh>
24 
25 // Boost Headers
26 #include <boost/foreach.hpp>
27 
28 #include <utility/vector0.hh>
29 #include <utility/vector1.hh>
30 #include <core/pose/util.hh>
31 
32 #define foreach BOOST_FOREACH
33 
34 
35 static basic::Tracer TR("protocols.filters.Filter");
36 
37 namespace protocols {
38 namespace filters {
39 
40 #ifdef USELUA
41 void lregister_Filter( lua_State * lstate ) {
42  luabind::module(lstate, "protocols")
43  [
44  luabind::namespace_("filters")
45  [
46  luabind::class_<Filter>("Filter")
47  .def("apply", ( void (Filter::*)( core::io::serialization::PipeMap & )) &Filter::apply)
48  .def("score", ( void (Filter::*)( core::io::serialization::PipeMap & )) &Filter::score)
49  .def("score", ( core::Real (Filter::*)( core::pose::Pose & )) &Filter::score)
50  ]
51  ];
52 }
53 #endif
54 
55 using namespace core;
56 typedef std::pair< std::string const, FilterCOP > StringFilter_pair;
58 
60 
61 bool
63 {
64  foreach(protocols::filters::FilterCOP filter, filters_){
65  if( ! filter->apply( pose ) ){
66  return false;
67  }
68  }
69 
70  return true;
71 }
72 
73 void
74 FilterCollection::report( std::ostream & out, core::pose::Pose const & pose ) const
75 {
76  foreach(protocols::filters::FilterCOP filter, filters_){
77  filter->report( out, pose );
78  }
79 }
80 
82  : utility::pointer::ReferenceCount(),
83  type_( "UNDEFINED TYPE" ),
84  scorename_("defaultscorename")
85 {}
86 
87 Filter::Filter( std::string const & type )
88  : utility::pointer::ReferenceCount(),
89  type_( type ),
90  scorename_("defaultscorename")
91 {}
92 
94  : utility::pointer::ReferenceCount(),
95  type_( init.type_ ),
96  user_defined_name_( init.user_defined_name_ ),
97  scorename_("defaultscorename")
98 
99 {}
100 
102 
103 void
105  TagPtr const,
106  moves::DataMap &,
107  Filters_map const &,
108  moves::Movers_map const &,
109  core::pose::Pose const & )
110 {}
111 
112 // start mpr support
114  core::io::serialization::Pipe::iterator itr = pmap["input"]->begin();
115  while( itr != pmap["input"]->end() ) {
116  if( !apply ( **itr ) ) {
117  itr = pmap["input"]->erase( itr );
118  } else {
119  itr++;
120  }
121  clear();
122  }
123 }
125  core::Real score = report_sm( pose );
127  return score;
128 }
130  for( core::io::serialization::Pipe::iterator itr = pmap["input"]->begin(); itr != pmap["input"]->end(); itr++ ) {
131  score( **itr );
132  clear();
133  }
134 }
135 void Filter::parse_def( utility::lua::LuaObject const & /*def*/,
136  utility::lua::LuaObject const & /*score_fxns*/,
137  utility::lua::LuaObject const & /*tasks*/ ){
138  utility_exit_with_message("This Filter has not implemented parse_def()");
139 }
140 // end mpr support
141 
142 } // filters
143 } // protocols