Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResLvlTaskOperationFactory.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/pack/task/operation/ResLvlTaskOperationFactory.cc
11 /// @brief
12 /// @author ashworth
13 
15 
16 #ifdef WIN32
19 
20 #endif
21 
22 #include <utility/exit.hh> // runtime_assert, utility_exit_with_message
23 // AUTO-REMOVED #include <utility/tag/Tag.hh> // REQUIRED FOR WINDOWS
24 
27 #include <utility/vector0.hh>
28 #include <utility/vector1.hh>
29 #include <iostream>
30 
31 
32 namespace core {
33 namespace pack {
34 namespace task {
35 namespace operation {
36 
37 // special singleton functions
38 // initialize
39 ResLvlTaskOperationFactory * ResLvlTaskOperationFactory::instance_( 0 );
40 // get pointer to singleton
42 {
43  if ( ! instance_ ) {
45  }
46  return instance_;
47 }
48 
49 void
51 {
52  add_creator( creator );
53 }
54 
56 
58 
59 ///@brief add a ResLvlTaskOperation prototype, using its default type name as the map key
60 void
62 {
63  runtime_assert( rltoc );
64  rltoc_map_[ rltoc->keyname() ] = rltoc;
65 }
66 
68 {
69  return ( rltoc_map_.find( type ) != rltoc_map_.end() );
70 }
71 
72 ///@brief return new ResLvlTaskOperation by key lookup in rltoc_map_ (new ResLvlTaskOperation parses Tag if provided)
75 {
76  RLTOC_Map::const_iterator iter( rltoc_map_.find( type ) );
77  if ( iter != rltoc_map_.end() ) {
78  ResLvlTaskOperationOP rlto( iter->second->create_res_level_task_operation() );
79  return rlto;
80  } else {
81  utility_exit_with_message( type + " is not known to the ResLvlTaskOperationFactory. Was its ResLvlTaskOperationCreator class registered at initialization?" );
82  return NULL;
83  }
84 }
85 
86 } //namespace operation
87 } //namespace task
88 } //namespace pack
89 } //namespace core