Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WorkUnitList.hh
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 protocols/loops/WorkUnitList.hh
11 /// @brief
12 /// @author Mike Tyka
13 
14 #ifndef INCLUDED_protocols_wum_WorkUnitList_hh
15 #define INCLUDED_protocols_wum_WorkUnitList_hh
16 
17 
18 #include <core/types.hh>
20 #include <map>
21 
22 #include <utility/vector1.hh>
23 
24 
25 
26 namespace protocols {
27 namespace wum {
28 
30 
31 /// @ brief just a prettier name for a pointer to a work unitlist.
32 typedef const WorkUnitList* WorkUnitListCAP;
33 
34 /// @brief WOrkUnitList is a store for WorkUnitCOPs. THe purpose of this class is to store all the possible WorkUnits
35 /// that a protocol might need. When needed these are cloned and then used. THis class acts like a library of WorkUnit blueprints.
37  public:
39 
40  /// @brief Add a WorkUnit to the list, each workunit must be named with a string that is used later to retrieve it !
41  void register_work_unit( const std::string &name, WorkUnitBaseOP the_work_unit );
42 
43  /// @brief Return a COP to a workunit with a given name. If multiple WUs were registered with the same name, the first is returned.
44  const WorkUnitBaseCOP get_work_unit( const std::string &name ) const;
45 
46  /// @brief Return an OP to a workunit with a given name but clone it.
47  const WorkUnitBaseOP get_work_unit_clone( const std::string &name ) const { return get_work_unit( name )->clone(); }
48 
49  /// @brief Return an OP to a workunit with the same name as the one given as a parameter.
50  const WorkUnitBaseCOP get_work_unit( const WorkUnitBase &wu ) const { return get_work_unit( wu.get_wu_type() ); }
51 
52  /// @brief Return an OP to a workunit with the same name as the one given as a parameter, but as a clone
53  const WorkUnitBaseOP get_work_unit_clone( const WorkUnitBase &wu ) const { return get_work_unit( wu.get_wu_type() )->clone(); }
54 
55  void merge( const WorkUnitList & source );
56  protected:
57 
58  /// An STL map is used to associate the WUs with strings.
59  std::map< std::string, WorkUnitBaseCOP > work_unit_list_;
60 };
61 
62 
63 
64 
65 }
66 }
67 
68 #endif
69