Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CacheableObserver.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 core/pose/datacache/CacheableObserver.hh
11 /// @brief Base class for Pose/Conformation observers that are stored in
12 /// a Pose's ObserverCache.
13 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
14 
15 #ifndef INCLUDED_core_pose_datacache_CacheableObserver_hh
16 #define INCLUDED_core_pose_datacache_CacheableObserver_hh
17 
18 // unit headers
20 
21 // project headers
22 #include <core/pose/Pose.fwd.hh>
23 
24 // utility headers
25 #include <utility/pointer/ReferenceCount.hh>
26 
27 #include <utility/vector1.hh>
28 
29 
30 
31 namespace core {
32 namespace pose {
33 namespace datacache {
34 
35 
36 /// @brief Base class for Pose/Conformation observers that are stored in
37 /// a Pose's DataCache.
38 /// @details Classes derived from CacheableObserver whose instances are
39 /// stored inside a Pose's ObserverCache will be cloned and re-attached to the
40 /// new Pose instance upon Pose copy construction/assignment.
41 /// CacheableObservers should not need to attach themselves independently
42 /// unless necessary -- attach/detach should be done through the ObserverCache's
43 /// interface. For example, the ObserverCache can attach the observer upon
44 /// calling ObserverCache::set().
45 /// @warning When deriving from this class remember that Links or pointers to
46 /// subjects stored in classes are *not* to be copied when copy
47 /// constructor/assignment is called.
49 
50 
51 private: // typedefs
52 
53 
55 
56 
57 public: // construct/destruct
58 
59 
60  /// @brief default constructor
62 
63 
64  /// @brief copy constructor
65  /// @warning Subject being observed (represented by Link/pointer) is not copied!
66  CacheableObserver( CacheableObserver const & rval );
67 
68 
69  /// @brief default destructor
70  /// @warning Derived classes must remember to detach on destruction!
71  virtual
73 
74 
75 public: // assignment
76 
77 
78  /// @brief copy assignment
79  /// @warning Subject being observed (represented by Link/pointer) is not copied!
81 
82 
83 public: // virtual constructors
84 
85 
86  /// @brief clone this object
87  /// @warning Subject (represented by Link/pointer) is not copied!
88  virtual
90 
91 
92  /// @brief create a new instance of this object
93  virtual
95 
96 
97 public: // observer interface
98 
99 
100  /// @brief attach to Pose/Conformation
101  /// Derived classes do not overload this method -- see attach_impl()
102  /// instead.
103  void attach_to( Pose & pose );
104 
105 
106  /// @brief detach from Pose/Conformation
107  /// @remarks Derived classes do not overload this method -- see
108  /// detach_impl() instead.
109  void detach_from();
110 
111 
112 public: // virtual observer interface
113 
114 
115  /// @brief is this observer attached to a Pose/Conformation?
116  virtual
117  bool is_attached() const = 0;
118 
119 
120 protected: // virtual observer interface
121 
122 
123  /// @brief attach to Pose/Conformation
124  virtual
125  void attach_impl( Pose & pose ) = 0;
126 
127 
128  /// @brief detach from Pose/Conformation
129  virtual
130  void detach_impl() = 0;
131 
132 
133 };
134 
135 
136 } // namespace datacache
137 } // namespace pose
138 } // namespace core
139 
140 
141 #endif /* INCLUDED_core_pose_datacache_CacheableObserver_HH */