MAK Data Logger API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
observeConnection.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2025 MAK Technologies, Inc
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>
24 
25  template <typename SubjectType>
26  class DtObserver;
27 
29  typedef std::shared_ptr<DtObserveConnection> DtObserveConnectionSP;
30 
32 
33 
38  {
39  public:
40 
45  template <typename SubjectType>
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 
DtObserveConnectionComponent * myEvent
Pointer to the event component.
Definition: observeConnection.h:75
DtObserveConnectionComponent * myObserver
Pointer to the observer component.
Definition: observeConnection.h:78
DtObserveConnection is responsible for maintaining a connection between an event and an observer...
Definition: observeConnection.h:37
virtual bool isConnected(DtObserveConnectionComponent *component)
#define DT_DLL_LGRUTIL
Definition: lgrUtil.h:19
Necessary Predefinitions.
Definition: observeConnection.h:23
ConnectionList myConnections
Definition: observeConnection.h:119
Contains IMPORT/EXPORT macros for lgrUtil library.
static void connect(DtObserveEvent< SubjectType > *event, DtObserver< SubjectType > *observer)
Templated static connect function which will create a connection object between an event and an obser...
Definition: observeConnection.h:46
DtObserveConnectionComponent object which is the base class for events and observers which can be con...
Definition: observeConnection.h:84
std::list< DtObserveConnectionSP > ConnectionList
Definition: observeConnection.h:88
virtual void connect(DtObserveConnectionSP con)
DtObserver is the abstract interface for the observer object.
Definition: lgrDataViewFilter.h:19
std::shared_ptr< DtObserveConnection > DtObserveConnectionSP
Definition: observeConnection.h:28

Document ID: Generated on Thu Dec 18 15:35:09 EST 2025 from SVN revision 282494
Copyright © 2024 MAK Technologies. All Rights Reserved (www.mak.com)