Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CheckPointer.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 CheckPointer
11 /// @brief Application-level code for Abrelax, fold_cst and JumpingFoldCst protocols
12 /// @detailed
13 /// use -help to see options
14 /// usage of class:
15 ///
16 /// @author Mike Tyka
17 /// @author Oliver Lange
18 
19 #ifndef INCLUDED_protocols_checkpoint_CheckPointer_hh
20 #define INCLUDED_protocols_checkpoint_CheckPointer_hh
21 
22 // Unit Headers
23 
24 // Package Headers
25 
26 // Project Headers
27 #include <core/pose/Pose.fwd.hh>
28 #include <core/types.hh>
29 
30 #ifdef WIN32
32 #endif
33 
35 #include <utility/pointer/ReferenceCount.hh>
36 
37 
38 // ObjexxFCL Headers
39 
40 // Utility headers
41 
42 //// C++ headers
43 // AUTO-REMOVED #include <string>
44 // AUTO-REMOVED #include <vector>
45 
47 #include <utility/vector1.hh>
48 #include <ostream>
49 
50 
51 namespace protocols {
52 namespace checkpoint {
53 
54 class FileBuffer {
55  public:
56  FileBuffer( const std::string filename, bool gzipped = false ):
57  filename_( filename ),
58  gzipped_( gzipped )
59  {
60 
61  }
62 
63 
64  void set_contents(const std::string &contents ){ contents_ = contents; }
65 
66  void dump();
67 
68  core::Size size(){ return contents_.length(); }
69 
70  private:
72  bool gzipped_;
74 };
75 
76 
77 
79 public:
80  CheckPointer( std::string const& type );
81 
82  virtual ~CheckPointer() {
84  }
85 
86  void clear_checkpoints();
87 
88  void flush_checkpoints();
89 
90  bool recover_checkpoint(
91  core::pose::Pose &pose,
93  std::string const& current_tag,
94  std::string const& id,
95  bool fullatom = false,
96  bool foldtree = false
97  );
98 
100  core::pose::Pose &pose,
102  std::string const& current_tag,
103  std::string const& id,
104  bool fullatom = false,
105  bool foldtree = false
106  )
107  {
108  return recover_checkpoint( pose, &(*mc), current_tag, id, fullatom, foldtree );
109  }
110 
112  core::pose::Pose &pose,
113  std::string const& current_tag,
114  std::string const& id,
115  bool fullatom = false,
116  bool foldtree = false
117  )
118  {
119  return recover_checkpoint( pose, NULL, current_tag, id, fullatom, foldtree );
120  }
121 
122  void checkpoint(
123  core::pose::Pose &pose,
124  moves::MonteCarlo *mc,
125  std::string const& current_tag,
126  std::string const& id,
127  bool foldtree = false
128  );
129 
131  core::pose::Pose &pose,
133  std::string const& current_tag,
134  std::string const& id,
135  bool foldtree = false
136  ){
137  checkpoint( pose, &(*mc), current_tag, id, foldtree );
138  }
139 
141  core::pose::Pose &pose,
142  std::string const& current_tag,
143  std::string const& id,
144  bool foldtree = false
145  ){
146  checkpoint( pose, NULL, current_tag, id, foldtree );
147  }
148 
149 
150 
151  std::string const& type() const {
152  return type_;
153  }
154 
155  void set_type( const std::string &new_type) {
156  type_ = new_type;
157  }
158 
159 
160  /// print checksum data
161  void debug( const std::string &tag, const std::string &label, core::Real data1, core::Real data2=0.0, core::Real data3=0.0 ) const;
162 
163  void set_disabled( bool value = true ){ disabled_ = value; }
164  bool get_disabled() const { return disabled_; }
165 
167 private:
169  std::vector< std::string > checkpoint_ids_;
170 
171  bool disabled_;
174 
175 
177 
178  std::vector < FileBuffer > file_buffer;
179 
180 
181 };
182 
183 }
184 }
185 
186 #endif