Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SilentFileOptions.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 core/io/silent/SilentFileOptions.hh
11 /// @brief Options for constructing a pose from a silent file
12 /// @author Matthew O'Meara (mattjomeara@gmail.com)
13 
14 // Unit Headers
17 #include <utility/tag/Tag.hh>
18 
19 // Project Headers
21 
22 // Plaform Headers
23 #include <core/types.hh>
24 #include <utility/excn/Exceptions.hh>
25 
26 // C++ Headers
27 #include <string>
28 #include <sstream>
29 
30 namespace core {
31 namespace io {
32 namespace silent {
33 
34 using basic::resource_manager::ResourceOptionsOP;
35 using basic::resource_manager::ResourceOptions;
36 using std::endl;
37 using std::string;
38 using std::stringstream;
40 
41 ///// SilentFileOptionsCreator /////
43 
45 
46 ResourceOptionsOP
48  return new SilentFileOptions;
49 }
50 
51 string
53  return "SilentFileOptions";
54 }
55 
57  ResourceOptions(),
58  silent_struct_type_()
59 {}
60 
62  string const & name
63 ) :
64  ResourceOptions(name),
65  silent_struct_type_()
66 {}
67 
69 
71  SilentFileOptions const & src
72 ) :
73  ResourceOptions(src),
74  silent_struct_type_(src.silent_struct_type_)
75 {}
76 
79  return silent_struct_type_;
80 }
81 
82 void
84  string const & silent_struct_type
85 ) {
86  if(!SilentStructFactory::get_instance()->has_silent_struct_type(
87  silent_struct_type)){
88  stringstream err_msg;
89  err_msg
90  << "In SilentFileOptions,"
91  << " the silent_struct_type '" << silent_struct_type << "'"
92  << " was not recognized." << endl;
94  err_msg);
95  throw utility::excn::EXCN_BadInput(err_msg.str());
96  }
97 
98  silent_struct_type_ = silent_struct_type;
99 }
100 
101 void
103  TagPtr tag
104 ) {
105  if(!tag->hasOption("silent_struct_type")){
106  throw utility::excn::EXCN_BadInput(
107  "The SilentFileOptions requires the tag 'silent_struct_type',"
108  " but it was not provided.");
109  }
110 
111  silent_struct_type_ = tag->getOption<std::string>("silent_struct_type");
112 
115  stringstream err_msg;
116  err_msg
117  << "In the SilentFileOptions with tag name '" << tag->getName() << "',"
118  << " the silent_struct_type '" << silent_struct_type_ << "'"
119  << " was not recognized." << endl;
121  err_msg);
122  throw utility::excn::EXCN_BadInput(err_msg.str());
123  }
124 }
125 
126 
127 
128 } // namespace
129 } // namespace
130 } // namespace