Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConnectionEvent.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 // (C) 199x-2009 University of Washington
10 // (C) 199x-2009 University of California Santa Cruz
11 // (C) 199x-2009 University of California San Francisco
12 // (C) 199x-2009 Johns Hopkins University
13 // (C) 199x-2009 University of North Carolina, Chapel Hill
14 // (C) 199x-2009 Vanderbilt University
15 
16 /// @file core/conformation/signals/ConnectionEvent.hh
17 /// @brief signal a change in the connection with a Conformation object,
18 /// e.g. destruction or transfer
19 /// @author Yih-En Andrew Ban (yab@u.washington.edu)
20 
21 #ifndef INCLUDED_core_conformation_signals_ConnectionEvent_hh
22 #define INCLUDED_core_conformation_signals_ConnectionEvent_hh
23 
24 
25 // unit headers
27 
28 // package headers
30 
31 
32 namespace core {
33 namespace conformation {
34 namespace signals {
35 
36 
37 /// @brief signal a change in the connection with a Conformation object, e.g.
38 /// destruction or transfer
39 /// @remarks SUGGESTION: Try to use the Link management provided by the
40 /// SignalHub instead of listening to this event, as it typically makes
41 /// managing connections much easier.
42 struct ConnectionEvent { // do not derive from GeneralEvent
43 
44 
45  // typedefs
47 
48 
49  /// @brief the type of Conformation lifetime event
50  /// @details Current tags are as follows:
51  /// <ul>
52  /// <li> 'EMPTY' - null event for default ConnectionEvent constructor (no point
53  /// in watching for this non-event)
54  /// <li> 'DISCONNECT' - force disconnect (e.g. the Conformation is getting destroyed)
55  /// <li> 'TRANSFER' - the connection is getting transferred to a
56  /// new Conformation, so if any observers are storing Conformation
57  /// pointers (e.g. those not using Link management) then they
58  /// should discard the existing Conformation pointer and swap it
59  /// with the one provided by the Event.
60  /// </ul>
61  enum Tag {
62  EMPTY, // empty event for default constructor
63  DISCONNECT, // force disconnect (e.g. the Conformation is getting destroyed)
64  TRANSFER // if observer stores a Conformation pointer
65  };
66 
67 
68  /// @brief default constructor
69  inline
71  conformation( NULL ),
72  tag( EMPTY )
73  {}
74 
75 
76  /// @brief constructor
77  /// @param[in] conf The Conformation firing the signal.
78  /// @param[in] t The tag specifying the type of signal.
79  inline
81  Conformation const * conf,
82  Tag const t
83  ) :
84  conformation( conf ),
85  tag( t )
86  {}
87 
88 
89  /// @brief copy constructor
90  inline
91  ConnectionEvent( ConnectionEvent const & rval ) :
92  conformation( rval.conformation ),
93  tag( rval.tag )
94  {}
95 
96 
97  /// @brief default destructor
98  inline
99  virtual
101 
102 
103  /// @brief copy assignment
104  inline
106  operator =( ConnectionEvent const & rval ) {
107  if ( this != &rval ) {
108  conformation = rval.conformation;
109  tag = rval.tag;
110  }
111  return *this;
112  }
113 
114 
115  /// @brief the Conformation firing the signal
117 
118 
119  /// @brief tag indicating type of connection change
121 
122 
123 };
124 
125 
126 } // namespace signals
127 } // namespace conformation
128 } // namespace core
129 
130 
131 #endif /* INCLUDED_core_conformation_signals_ConnectionEvent_HH */