Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Filter.hh
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 src/protocols/filters/Filter.hh
11 /// @brief header file for Filter base class
12 /// @detailed
13 ///
14 ///
15 ///
16 /// @author Florian Richter, floric@u.washington.edu (feb 09 ), Sarel Fleishman sarelf@u.washington.edu
17 
18 #ifndef INCLUDED_protocols_filters_Filter_hh
19 #define INCLUDED_protocols_filters_Filter_hh
20 
21 // Unit Headers
24 
25 // Package Headers
27 
28 // Project Headers
29 #include <core/types.hh>
30 #include <core/pose/Pose.fwd.hh>
31 
32 // Utility headers
33 #include <utility/pointer/ReferenceCount.hh>
34 #include <utility/vector1.hh>
35 #include <utility/tag/Tag.fwd.hh>
36 
37 //// C++ headers
38 #include <string>
39 
40 #ifdef WIN32
41  #include <utility/tag/Tag.hh>
42 #endif
43 
44 #include <utility/lua/LuaObject.hh>
45 #include <utility/lua/LuaIterator.hh>
46 
47 // start elscripts support
49 #include <boost/unordered_map.hpp>
52 // end elscripts support
53 
54 namespace protocols {
55 namespace filters {
56 
57 #ifdef USELUA
58 void lregister_Filter( lua_State * lstate );
59 #endif
60 
62 public:
63  Filter();
64  Filter( std::string const & );
65  Filter( Filter const & );
66  virtual ~Filter();
67  // allows reporting of filter values to a stream
68  virtual void report( std::ostream &, core::pose::Pose const & ) const {}
69 
70  /// @brief used to report filter internals through a score or silent file
71  // to determine that derived class has not overridden }
72  virtual core::Real report_sm( core::pose::Pose const & ) const { return -99999; }
73 
74  virtual std::string get_type() const{ return type_; }
77 
78  /// @brief used to clear internal variables if needed. Using fresh_instance is preferred since it's a pure virtual
79  virtual void clear() {};
80  virtual void parse_my_tag(
83  Filters_map const &,
84  moves::Movers_map const &,
85  core::pose::Pose const &
86  );
87  virtual FilterOP clone() const = 0;
88 
89  virtual FilterOP fresh_instance() const = 0;
90 
91  /// @brief Returns true if the given pose passes the filter, false otherwise.
92  virtual bool apply( core::pose::Pose const & pose ) const = 0;
93  // start elscripts support
94  virtual void apply( core::io::serialization::PipeMap & pmap);
95  virtual void score( core::io::serialization::PipeMap & pmap);
96  virtual core::Real score( core::pose::Pose & pose);
97  virtual void parse_def( utility::lua::LuaObject const & def,
98  utility::lua::LuaObject const & score_fxns,
99  utility::lua::LuaObject const & tasks );
100 #ifdef USELUA
101  virtual void lregister( lua_State * lstate ){ lregister_Filter(lstate);}
102 #endif
103  // end elscripts support
104 
105  virtual
106  std::string name() const { return "BaseFilter"; };
107 
108 private:
109  std::string const type_;
111 protected:
113 };
114 
115 
116 /// @brief Wrapper-class that contains a vector1 of Filters
117 /// @brief apply function returns true if all member filters return true
119 public:
120 
121  virtual ~FilterCollection();
122 
123  /// @brief Returns true if the given pose passes all filters, false otherwise.
124  bool apply( core::pose::Pose const & pose ) const;
125 
126  void report( std::ostream & out, core::pose::Pose const & pose ) const;
127 
128  FilterCOP
129  get_filter( core::Size i ) { return filters_[i]; }
130 
131  void
132  add_filter( FilterCOP filter_in ){
133  filters_.push_back( filter_in ); }
134 
135  void
137  filters_.pop_back();
138  }
139 
140  void
141  clear(){
142  filters_.clear(); }
143 
144  Size
145  size() { return filters_.size(); }
146 
147 private:
148 
150 
151 };
152 
153 } // filters
154 } // protocols
155 
156 #endif