MAK Data Logger API Documentation for HLA
observeConnection.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #ifndef observeConnection_H_
11 #define observeConnection_H_
12 
13 #include "lgrUtil.h"
14 
15 #include <list>
16 #include <vlutil/vlSmartPointers.h>
17 
18 namespace MAKLogger
19 {
20 
22  template <typename SubjectType>
23  class DtObserveEvent;
24 
25  template <typename SubjectType>
26  class DtObserver;
27 
29  typedef DtBoost::shared_ptr<DtObserveConnection> DtObserveConnectionSP;
30 
32 
33 
38  {
39  public:
40 
45  template <typename SubjectType>
46  static void connect(DtObserveEvent<SubjectType>* event,
47  DtObserver<SubjectType>* observer)
48  {
50  if(event->isConnected(observer)) return;
51  DtObserveConnection* connection =
52  new DtObserveConnection(event,observer);
53  DtObserveConnectionSP sharedCon(connection);
54  event->connect(sharedCon);
55  observer->connect(sharedCon);
56  }
57 
59  void disconnect(DtObserveConnectionSP);
60 
63 
65  DtObserveConnectionComponent* observer();
66 
67  protected:
68 
73 
76 
79  };
80 
85  {
86  public:
87 
88  typedef std::list<DtObserveConnectionSP> ConnectionList;
89 
91 
92  virtual void connect(DtObserveConnectionSP con);
93 
94  virtual void disconnect(DtObserveConnectionSP con);
95 
96  virtual void disconnect(DtObserveConnectionComponent* component);
97 
98  virtual bool isConnected(DtObserveConnectionComponent* component);
99 
101  void disconnectAll();
102 
103  protected:
104 
107 
110 
112  DtObserveConnectionComponent& operator=(
114 
115  DtObserveConnectionSP findEventObserverConnection(
117  DtObserveConnectionComponent* observer);
118 
120  };
121 
122 }
123 
124 #endif
125 

Document ID: Generated on Thu Apr 11 12:13:00 EDT 2013 from SVN revision 126011
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)