Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StepWiseCombineSampleGenerator.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 StepWiseCombineSampleGenerator
11 /// @brief Subclass of StepWisePoseSampleGenerator
12 /// @detailed
13 /// @author Rhiju Das
14 
15 
16 //////////////////////////////////
18 // AUTO-REMOVED #include <protocols/swa/StepWisePoseSetup.hh>
19 // AUTO-REMOVED #include <protocols/swa/InputStreamWithResidueInfo.hh>
20 #include <core/types.hh>
21 // AUTO-REMOVED #include <core/pose/Pose.hh>
22 #include <utility/exit.hh>
23 // AUTO-REMOVED #include <ObjexxFCL/string.functions.hh>
24 
25 //Auto Headers
26 #include <utility/vector1.hh>
27 using namespace core;
28 
29 namespace protocols {
30 namespace swa {
31 
32  //////////////////////////////////////////////////////////////////////////
33  //constructor!
34  StepWiseCombineSampleGenerator::StepWiseCombineSampleGenerator(
35  StepWisePoseSampleGeneratorOP first_generator,
36  StepWisePoseSampleGeneratorOP second_generator ):
37  first_generator_( first_generator ),
38  second_generator_( second_generator ),
39  need_to_initialize_( true )
40  {
41  reset();
42  }
43 
44  //////////////////////////////////////////////////////////////////////////
45  void
47  first_generator_->reset();
48  second_generator_->reset();
49  need_to_initialize_ = true;
50  }
51 
52  //////////////////////////////////////////////////////////////////////////
53  bool
55  return ( first_generator_->has_another_sample() ||
56  second_generator_->has_another_sample() );
57  }
58 
59  //////////////////////////////////////////////////////////////////////////
60  void
62  {
63 
64 
65  ////////////////////////////////////////////////////////////
66  if( second_generator_->has_another_sample() ) {
67 
68  // This logic doesn't seem totally robust:
69  if ( need_to_initialize_ ){
70  first_generator_->get_next_sample( pose );
71  need_to_initialize_ = false;
72  }
73 
74  second_generator_->get_next_sample( pose );
75 
76  } else {
77 
78  if ( !first_generator_->has_another_sample() ) utility_exit_with_message( "Asked CombineSampleGenerator for another sample, but it did not have one!" );
79 
80  second_generator_->reset();
81 
82  first_generator_->get_next_sample( pose );
83  second_generator_->get_next_sample( pose );
84 
85  }
86 
87  }
88 
89  ///////////////////////////////////////////////////////
90  Size
92  //we don't know a priori how many combinations there will be...
93  // yes, I guess we could precompute this by looking through both streams ahead of time.
94  return 0;
95  }
96 
97 
98 }
99 }