Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScoringSchemeFactory.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/sequence/ScoringSchemeFactory.cc
11 /// @brief Factory for creating various types of ScoringSchemes for use
12 /// in sequence alignment.
13 /// @author James Thompson
14 
15 // Unit headers
18 
19 // Package headers
28 
29 #include <utility/exit.hh>
30 
31 namespace core {
32 namespace sequence {
33 
34 void
36  std::string const type_name( new_scheme->type() );
37  scheme_types_[ type_name ] = new_scheme;
38 }
39 
42  std::string const & type
43 ) const {
44  ScoringSchemeTypes::const_iterator iter = scheme_types_.find( type );
45  if ( iter != scheme_types_.end() ) {
46  return iter->second->clone();
47  } else {
48  utility_exit_with_message(
49  "ScoringSchemeFactory: unknown ScoringScheme type: " + type
50  );
51  return NULL;
52  }
53 }
54 
56  // initialization of ScoringSchemes which this factory knows how to
57  // instantiate
60  add_type( new L1ScoringScheme() );
61  add_type( new DPScoringScheme() );
66 }
67 
68 } // namespace sequence
69 } // namespace core