Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ElectronDensityLoader.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/scoring/methods/electron_density/ElectronDensityLoader.cc
11 /// @brief Options for constructing an electron density map
12 /// @author Matthew O'Meara (mattjomeara@gmail.com)
13 
14 // Unit Headers
17 #include <basic/resource_manager/ResourceOptions.hh>
18 
19 // Project Headers
22 
23 // Platform Headers
24 #include <core/types.hh>
25 #include <utility/excn/Exceptions.hh>
26 
27 // C++ Headers
28 #include <string>
29 
30 namespace core {
31 namespace scoring {
32 namespace electron_density {
33 
34 using basic::resource_manager::ResourceOP;
35 using basic::resource_manager::ResourceLoaderOP;
36 using basic::resource_manager::ResourceOptions;
37 using basic::resource_manager::ResourceOptionsOP;
38 using basic::resource_manager::LocatorID;
39 using std::istream;
40 using std::string;
41 
42 ///// ElectronDensityLoaderCreator /////
44 
46 
47 ResourceLoaderOP
49  return new ElectronDensityLoader;
50 }
51 
52 string
54  return "ElectronDensity";
55 }
56 
57 //// ElectronDensityLoader /////
59 
61 
63  ElectronDensityLoader const &) {}
64 
65 ResourceOP
67  ResourceOptions const & options,
68  LocatorID const & locator_id,
69  istream & istream
70 ) const {
71 
72  if ( ! dynamic_cast< ElectronDensityOptions const * >( &options ) ) {
73  throw utility::excn::EXCN_Msg_Exception(
74  "ElectronDensityLoader expected to get a ElectronDensityOptions object, "
75  "but was given a ResourceOptions of type '" + options.type() + "', "
76  "which has the name '" + options.name() + "'." );
77  }
78  ElectronDensityOptions const & resource_options(
79  static_cast< ElectronDensityOptions const & >( options ));
80 
81  ElectronDensityOP electron_density(new ElectronDensity());
82 
83  electron_density->readMRCandResize(
84  istream,
85  locator_id,
86  resource_options.get_mapreso(),
87  resource_options.get_grid_spacing());
88 
89  return electron_density;
90 }
91 
92 ResourceOptionsOP
94 ) const {
95  return new ElectronDensityOptions();
96 }
97 
98 } // namespace
99 } // namespace
100 } // namespace
101