Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PcsInputCenterManager.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  //////////////////////////////////////////////
11  /// @begin
12  ///
13  /// @file protocols/scoring/methods/pcs2/PcsInputCenterManager.cc
14  ///
15  /// @brief Singleton that hold everything about the input PCS
16  /// This avoid multiple reading of the input file.
17  ///
18  /// @detailed
19  ///
20  /// @param
21  ///
22  /// @return
23  ///
24  /// @remarks
25  ///
26  /// @references
27  ///
28  /// @authorsv Christophe Schmitz
29  ///
30  /// @last_modified February 2010
31  ////////////////////////////////////////////////
32 
33 
34 // Unit headers
36 // AUTO-REMOVED #include <protocols/scoring/methods/pcs2/PcsInputCenter.fwd.hh>
37 //#include <protocols/scoring/methods/pcs2/PcsGridSearchParameterManager.hh>
38 //#include <protocols/scoring/methods/pcs2/PcsEnergyParameterManager.hh>
39 
40 // Package headers
41 
42 // Project headers
43 #include <basic/Tracer.hh>
44 
45 // Utility headers
46 
47 // Numeric headers
48 
49 // Objexx headers
50 
51 // C++ headers
52 // AUTO-REMOVED #include <iostream>
53 
54 #include <utility/vector1.hh>
55 
56 
57 namespace protocols{
58 namespace scoring{
59 namespace methods{
60 namespace pcs2{
61 
62 basic::Tracer TR_PcsInputCenterManager("protocols.scoring.methods.pcs.PcsInputCenterManager");
63 
65  TR_PcsInputCenterManager << "Empty constructor called" << std::endl;
66 }
67 
70  if ( instance_ == 0 ){
72  }
73  return instance_;
74 }
75 
76 std::ostream &
77 operator<<(std::ostream& out, const PcsInputCenterManager &me){
78 
79  core::Size i, n;
80  std::map<std::string, PcsInputCenter> junk = me.PcsInputCenter_all_;
81  std::map< std::string, PcsInputCenter >::iterator it;
82  n = me.PcsInputCenter_all_.size();
83 
84  out << "Number of paramagnetic center: "<< n << std::endl;
85 
86  i = 1;
87  for ( it = junk.begin(); it != junk.end(); ++it) {
88  out << "Paramagnetic center " << i << " / " << n << std::endl;
89  out << "Filename(s) " << it->first <<std::endl;
90  out << it->second ;
91  i++;
92  }
93  // out << std::endl;
94 
95  return out;
96 }
97 
98 
99 void
101 
102  // core::Size n(PcsInputCenter_all_.size());
103  // core::Size i(1);
104 
105  PcsInputCenter_all_.clear();
106  // std::cerr <<"CHECKING aa 0 = " << PcsInputCenter_all_.size();
107 
108 }
109 
110  //TODO Why don't I give back a reference?
113  std::string id;
114  core::Size i;
115 
116  for(i = 1; i <= filenames.size(); ++i){
117  id += filenames[i];
118  }
119 
120  std::map< std::string, PcsInputCenter >::iterator it;
121 
122  for ( it = PcsInputCenter_all_.begin(); it != PcsInputCenter_all_.end(); ++it ) {
123  if(it->first == id){
124  return(it->second);
125  }
126  }
127 
128  // PcsInputCenter pcs_i_c;
129  // pcs_i_c = new PcsInputCenter(filenames, weight);
130 
131  PcsInputCenter pcs_i_c(filenames, weight);
132 
133  // PcsInputCenter pcs_i_c = new PcsInputCenter(filenames, weight);
134 
135  it = PcsInputCenter_all_.begin();
136  PcsInputCenter_all_.insert(it, std::pair< std::string , PcsInputCenter >( id ,pcs_i_c));
137 
138  // TR_PcsInputCenterManager << pcs_i_c << std::endl;
139 
140  return(pcs_i_c);
141 }
142 
144 
145 }//namespace pcs2
146 }//namespace methods
147 }//namespace scoring
148 }//namespace protocols