VR-Exchange 2.9 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pReflectedObject.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2016 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <portal/pEntity.h>
13 #include <portal/pGenericObject.h>
14 #include <portal/pAggregate.h>
15 #include <vlutil/vlString.h>
16 #include <iosfwd>
17 #include <list>
18 
19 namespace MAKVrExchange
20 {
21 
22  class DtPortalConnection;
23 
32  {
33  public:
34 
38 
41  virtual ~DtPortalReflectedObject();
42 
45  virtual std::ostream& printDataToStream( std::ostream& str ) const = 0;
46 
48  virtual const DtPortalObject* baseObject() const = 0;
49 
50  };
51 
57  template<class T_PortalObject>
59  {
60  public:
61 
62  typedef void (*ObjectUpdateCallback)(
64 
65  public:
66 
68  DtPortalReflectedObjectTemplate( const T_PortalObject& obj );
69 
72 
75 
76  // ! Assignment operator.
79 
82  virtual void processUpdate( const T_PortalObject& obj );
83 
85  virtual const T_PortalObject* sr() const;
86 
89  virtual const DtPortalObject* baseObject() const;
90 
92  virtual void addUpdateCallback( ObjectUpdateCallback cb, void* uData ) const;
93 
95  virtual void removeUpdateCallback( ObjectUpdateCallback cb, void* uData ) const;
96 
98  virtual std::ostream& printDataToStream( std::ostream& str ) const;
99 
100  public:
101 
102  typedef T_PortalObject TheTypeOfThisObject;
103 
104  protected:
105 
107  {
109  void* userData;
110  };
111 
112  typedef std::list<CallbackPair> CallbackPairList;
114 
115  T_PortalObject myObject;
116 
117  };
118 
119  std::ostream& operator << ( std::ostream& str, const DtPortalReflectedObject& refObj );
120 
121 }
122 
123 #define _pReflectedObject_INL_
124 #include <portal/pReflectedObject.inl>
125 #undef _pReflectedObject_INL_
virtual ~DtPortalReflectedObjectTemplate()
Virtual DTOR.
#define DT_DLL_LIBPORTAL
Definition: include/portal/dllExport.h:20
std::list< CallbackPair > CallbackPairList
Definition: pReflectedObject.h:112
DtPortalReflectedObjectTemplate(const T_PortalObject &obj)
Copy CTOR takes a portal object for the initial state.
ObjectUpdateCallback fcn
Definition: pReflectedObject.h:108
void(* ObjectUpdateCallback)(const DtPortalReflectedObjectTemplate< T_PortalObject > &obj, void *usr)
Definition: pReflectedObject.h:62
DtPortalObject are messages which also serve as state repositories for simulated objects.
Definition: pObject.h:23
virtual void processUpdate(const T_PortalObject &obj)
Called when the reflected object is updated.
virtual std::ostream & printDataToStream(std::ostream &str) const
Prints the internal state of the reflected object to the stream specified.
virtual const T_PortalObject * sr() const
Returns a pointer to the reflected object.
CallbackPairList myCallbackList
Definition: pReflectedObject.h:113
An abstract interface for reflected objects.
Definition: pReflectedObject.h:31
void * userData
Definition: pReflectedObject.h:109
Contains the DtPortalGenericObject class declaration.
T_PortalObject TheTypeOfThisObject
Definition: pReflectedObject.h:102
DT_DLL_LIBPORTAL std::ostream & operator<<(std::ostream &stream, const DtActiveSonarBeamData &data)
const DtPortalReflectedObjectTemplate< T_PortalObject > & operator=(const DtPortalReflectedObjectTemplate< T_PortalObject > &other)
Contains the DtPortalAggregate class declaration.
A template to create reflected object types for each type of object message.
Definition: pReflectedObject.h:58
Contains the DtPortalEntity class declaration.
virtual const DtPortalObject * baseObject() const
Returns a pointer to the actual reflected object using a DtPortalObject pointer.
virtual void removeUpdateCallback(ObjectUpdateCallback cb, void *uData) const
Removes a function from the callback list.
virtual void addUpdateCallback(ObjectUpdateCallback cb, void *uData) const
Adds a function to call when this reflected object&#39;s state changes.
T_PortalObject myObject
Definition: pReflectedObject.h:115

Document ID: Generated on Tue Jun 25 16:45:35 EDT 2024 from SVN revision 267383
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)