VR-Exchange 2.9 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ddsTranslator.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 // Disable warning about missing operators.
13 // Comparison and assignment operators are declared but not defined
14 // to prevent their usage, but this causes a warning in template classes.
15 #pragma warning( disable : 4661 )
16 
17 #include <ddsBroker/dllExport.h>
18 
21 
24 
25 #ifdef DtDDS_OPENSPLICE
26 #include <vlDds/simpleOM.h>
27 #else
28 #include <vlDds/simpleOMdds.h>
29 #endif
30 #include <vlutil/vlString.h>
31 
32 // ************************************************************************ //
33 // Use the DIS implementation from VR-Link by temporarily defining DtDIS.
34 // ************************************************************************ //
35 #ifndef DtDIS
36 # define MUST_UNDEF_DTDIS
37 # define DtDIS 1
38 #endif
39 
40 #include <vl/globalObjectDesignator.h>
41 
42 #ifdef MUST_UNDEF_DTDIS
43 # undef DtDIS
44 #endif
45 // ************************************************************************ //
46 
47 #define DDS_TEMPLATE_LIST \
48  template \
49  < class T_PortalObject \
50  , class T_PortalReflectedObject \
51  , class T_DdsReflectedObject \
52  , class T_DdsObjectStateRepository \
53  , class T_DdsObjectPublisher>
54 
55 #define DDS_TEMPLATE_FUNCTION \
56  T_PortalObject, T_PortalReflectedObject, \
57  T_DdsReflectedObject, T_DdsObjectStateRepository, \
58  T_DdsObjectPublisher
59 
60 class DtInteraction;
61 class DtObjectPublisher;
62 class DtStateRepository;
63 
64 namespace MAKVrExchange
65 {
66 
67  class DtRequestTranslationDiagnosticMessage;
68 
69  namespace DtDdsBroker
70  {
71 
72  class DtDdsBroker;
73  class DtReflectedObject;
74 
80  : public DtBaseObjectTranslator<T_PortalObject,T_PortalReflectedObject>
81  {
82  public:
83 
85  typedef enum
86  {
87  none = 0,
88  discover = 1,
89  update = 2,
90  remove = 3
91  } UpdateType;
92 
95 
98 
99  public:
100 
103  const DtString& name, DtPortalMessageKind kind );
104 
106  virtual ~DtDdsObjectTranslator();
107 
109  virtual void enableReflectTranslator( bool enabled );
110 
112  virtual void forceUpdateAll();
113 
115  virtual void tick();
116 
117  virtual DtDdsBroker* ddsBroker();
118  virtual const DtDdsBroker* ddsBroker() const;
119 
121  virtual void shutdown();
122 
123  protected:
124 
127 
128  virtual void initializeDdsCallbacks();
129  virtual void removeDdsCallbacks();
130 
132 
135 
137  virtual DtBrokerObject* createBrokerObject( const DtReflectedObject* refObj );
139 
142  virtual DtBrokerObject* findBrokerObject( const DtReflectedObject* refObj );
143  virtual DtBrokerObject* findBrokerObject( const DtPortalReflectedObject* refObj );
144 
147  virtual DtBrokerObject* findBrokerObject( const DtString& objectName );
148 
152  virtual DtBrokerObject* releaseBrokerObject( const DtReflectedObject* refObj );
154 
156 
159 
162  static bool ddsDiscoveryCriteria( DtReflectedObject* refObj, void* usr );
163 
165  static void ddsObjectAddedCb( void* refObj, void* usr );
166 
168  static void ddsObjectUpdatedCb( void* refObj, void* usr );
169 
171  static void ddsObjectDeletedCb( void* refObj, void* usr );
172 
174 
177 
181  virtual bool isPortalDiscoverable( const DtPortalReflectedObject* refObj );
182 
185  virtual bool isDdsPublishable( DtBrokerObject* brokerObj,
186  const T_PortalReflectedObject* refObj );
187 
189 
192 
196  virtual bool isDdsDiscoverable( const T_DdsReflectedObject* reflectedObj );
197 
199 
203 
204  virtual void callObjectDiscoverCallbacks( const DtBrokerObject* obj );
205  virtual void callObjectUpdateCallbacks( const DtBrokerObject* obj );
206  virtual void callObjectRemoveCallbacks( const DtBrokerObject* obj );
207 
209 
217 
218  virtual void discoverDdsObject( T_DdsReflectedObject& refObj );
219  virtual void discoverPortalObject( const T_PortalReflectedObject& refObj );
220 
222 
230 
231  virtual void createDdsPublisher( DtBrokerObject* brokerObj );
232 
238  virtual DtString ddsObjectName( const T_PortalReflectedObject* refObj ) const;
239 
248  virtual T_DdsObjectPublisher* instantiateDdsPublisher(
249  const T_PortalReflectedObject* refObj, const DtString& name );
250 
253  virtual bool performDdsGlobalIdMapping( const T_DdsObjectPublisher* publisher,
254  const T_PortalReflectedObject& refObj );
255 
256  virtual void createPortalPublisher( DtBrokerObject* brokerObj );
257 
263  virtual DtString portalObjectName( const T_DdsReflectedObject* refObj ) const;
264 
267  virtual bool performPortalGlobalIdMapping(
269  const T_DdsReflectedObject& refObj );
270 
272 
281 
282  virtual void receiveDdsUpdate( T_DdsReflectedObject& obj );
283  virtual void receivePortalUpdate( const T_PortalReflectedObject& obj );
284 
286 
295 
296  virtual void updateDdsBrokerObject( DtBrokerObject* brokerObj,
297  const T_DdsObjectStateRepository& sr );
298  virtual void updatePortalBrokerObject( DtBrokerObject* brokerObj,
299  const T_PortalObject& sr );
300 
302 
311  virtual void updateFilteredState( DtBrokerObject* brokerObj,
313  T_DdsReflectedObject* refObj );
314 
319  virtual bool filterLocation( const DtReflectedObject& refObj,
320  const DtVector& location );
321 
325 
326  virtual void removeDdsObject( const DtReflectedObject& refObj );
327  virtual void removePortalObject( const T_PortalReflectedObject& refObj );
328 
330 
335 
336  virtual void deleteDdsPublisher( DtBrokerObject* brokerObj );
337  virtual void deletePortalPublisher( DtBrokerObject* brokerObj );
338 
340 
342  static void requestTransDiagCb( const DtRequestTranslationDiagnosticMessage& msg, void* usr );
343 
346 
348  virtual void printIncomingOutgoingStateReps(
349  const T_PortalObject& incoming, const T_DdsObjectStateRepository& outgoing ) const;
350 
352  virtual void printIncomingOutgoingStateReps(
353  const T_DdsObjectStateRepository& incoming, const T_PortalObject& outgoing ) const;
354 
358  virtual void performPortalDebugging( const DtString& objectName );
359 
361  virtual void performPortalDebugging( const T_PortalObject& incoming,
362  const T_DdsObjectStateRepository& outgoing );
363 
365  virtual void performPortalDebugging( const T_DdsObjectStateRepository& incoming,
366  const T_PortalObject& outgoing );
367 
368  virtual void printDumpGuiToText( const DtBrokerObject& brokerObj,
369  UpdateType ut ) const;
370 
372  virtual unsigned int numObjects() const;
373 
374  public:
375 
378  virtual T_PortalObject* translate( T_PortalObject* destination,
379  const T_DdsObjectStateRepository& source,
380  const T_DdsReflectedObject& refObj ) = 0;
381 
384  virtual T_DdsObjectStateRepository* translate(
385  T_DdsObjectStateRepository* destination, const T_PortalObject& source,
386  const T_PortalReflectedObject& refObj ) = 0;
387 
388  private:
389 
392 
395 
397  bool operator == ( const DtDdsObjectTranslator& rightOperand ) const;
398 
400  bool operator != ( const DtDdsObjectTranslator& rightOperand ) const;
401 
402  protected:
403 
404  typedef std::pair<DtTime,bool> LocationFilteringInfo;
405  typedef std::map<const DtReflectedObject*,LocationFilteringInfo> LocationFilteringMap;
407 
408  typedef std::map<const DtReflectedObject*,DtBrokerObject*> DdsToPortalReflectedMap;
409  typedef std::map<const DtPortalReflectedObject*,DtBrokerObject*> PortalToDdsReflectedMap;
410 
413 
414  typedef std::set<DtString> TransDebugObjectNamesSet;
416 
417  };
418 
419 
422  template <typename T_PortalInteraction,typename T_DDSInteraction>
424  : public DtBaseInteractionTranslator<T_PortalInteraction>
425  {
426  public:
427 
430 
431  public:
432 
435  DtPortalMessageKind kind );
436 
438  virtual ~DtDdsInteractionTranslator();
439 
441  virtual void enableReflectTranslator( bool enabled );
442 
443  virtual DtDdsBroker* ddsBroker();
444  virtual const DtDdsBroker* ddsBroker() const;
445 
447  virtual void shutdown();
448 
449  protected:
450 
453 
454  virtual void initializeDdsCallbacks();
455  virtual void removeDdsCallbacks();
456 
458 
462 
463  static void receiveDdsInteraction( void* interaction, void* userData );
464 
466 
474 
475  virtual void createInteraction( const T_PortalInteraction& incoming );
476  virtual void createPortalInteraction( const T_DDSInteraction& incoming );
477 
479 
480 
483  virtual T_PortalInteraction* translate( T_PortalInteraction* destination,
484  const T_DDSInteraction& source ) = 0;
485 
488  virtual T_DDSInteraction* translate( T_DDSInteraction* destination,
489  const T_PortalInteraction& source ) = 0;
490 
492  virtual void printIncomingOutgoingInteractions( const T_PortalInteraction& incoming,
493  const T_DDSInteraction& outgoing ) const;
494 
496  virtual void printIncomingOutgoingInteractions( const T_DDSInteraction& incoming,
497  const T_PortalInteraction& outgoing ) const;
498 
499  virtual void printDumpGuiToText( const DtString& protocol, const DtString& description ) const;
500 
501  virtual void printDDSInteraction( const T_DDSInteraction& inter ) const = 0;
502 
503  private:
504 
507 
510 
512  bool operator == ( const DtDdsInteractionTranslator& rightOperand ) const;
513 
515  bool operator != ( const DtDdsInteractionTranslator& rightOperand ) const;
516 
517  };
518 
519  }
520 }
521 
522 #define _ddsTranslator_INL_
523 #include <ddsBroker/ddsTranslator.inl>
524 #undef _ddsTranslator_INL_
virtual void enableReflectTranslator(bool enabled)
Enables or disables the translator reflecting from DIS.
virtual bool performDdsGlobalIdMapping(const T_DdsObjectPublisher *publisher, const T_PortalReflectedObject &refObj)
Maps the publisher&#39;s global ID to the reflected object&#39;s identifier.
virtual void updateFilteredState(DtBrokerObject *brokerObj, DtPortalObjectPublisherTemplate< T_PortalObject > *publisher, T_DdsReflectedObject *refObj)
Ensures the given object is properly filtered.
Contains the templated DtPortalReflectedObjectManager types.
virtual void deleteDdsPublisher(DtBrokerObject *brokerObj)
Base class for Interaction Translators.
Definition: ddsTranslator.h:423
#define DDS_TEMPLATE_LIST
Definition: ddsTranslator.h:47
Used to request that brokers send translation diagnostic reports.
Definition: requestTransDiagnosticMessage.h:21
virtual bool performPortalGlobalIdMapping(const DtPortalObjectPublisherTemplate< T_PortalObject > *publisher, const T_DdsReflectedObject &refObj)
Maps the publisher&#39;s global ID to the reflected object&#39;s identifier.
virtual void removeDdsObject(const DtReflectedObject &refObj)
Provides a common base class for DDS reflected objects.
Definition: ddsBroker/vlDds/reflectedObject.h:23
static void ddsObjectDeletedCb(void *refObj, void *usr)
Callback called when an object in the reflected list is deleted.
Provides container to hold pointers to Protocol/Portal objects.
Definition: brokerObject.h:24
static void requestTransDiagCb(const DtRequestTranslationDiagnosticMessage &msg, void *usr)
Static translation diagnostic request callback.
virtual void discoverDdsObject(T_DdsReflectedObject &refObj)
virtual void receiveDdsUpdate(T_DdsReflectedObject &obj)
DtBaseObjectTranslator< T_PortalObject, T_PortalReflectedObject > BaseTranslatorClass
Typedef for the templated base class type.
Definition: ddsTranslator.h:97
virtual void updatePortalBrokerObject(DtBrokerObject *brokerObj, const T_PortalObject &sr)
virtual bool isDdsPublishable(DtBrokerObject *brokerObj, const T_PortalReflectedObject *refObj)
Tests whether the object is publishable as a DDS object.
static void ddsObjectAddedCb(void *refObj, void *usr)
Callback called when an object is added to the reflected list.
virtual void removePortalObject(const T_PortalReflectedObject &refObj)
DtDdsInteractionTranslator & operator=(const DtDdsInteractionTranslator &other)
Private Assignment Operator (Not implemented – Do Not Copy).
virtual DtBrokerObject * findBrokerObject(const DtReflectedObject *refObj)
Find the broker object for the given reflected object.
std::map< const DtPortalReflectedObject *, DtBrokerObject * > PortalToDdsReflectedMap
Definition: ddsTranslator.h:409
bool operator==(const DtDdsInteractionTranslator &rightOperand) const
Private Comparison Operator (Not implemented – Do Not Compare).
A simple template class to hold different types of State Repositories.
Definition: pObjectPublisher.h:68
virtual bool isDdsDiscoverable(const T_DdsReflectedObject *reflectedObj)
Checks if this DDS object is discoverable.
DtBaseInteractionTranslator are responsible for translating messages for things that do not have stat...
Definition: baseInteractionTranslator.h:60
virtual DtString ddsObjectName(const T_PortalReflectedObject *refObj) const
Determines the name to use for the given reflected object.
DtDdsInteractionTranslator< T_PortalInteraction, T_DDSInteraction > ParentClass
Typedef for the templated class type.
Definition: ddsTranslator.h:429
TransDebugObjectNamesSet myTransDebugNames
Definition: ddsTranslator.h:415
bool operator==(const DtDdsObjectTranslator &rightOperand) const
Private Comparison Operator (Not implemented – Do Not Compare).
An abstract interface for reflected objects.
Definition: pReflectedObject.h:31
DtBroker * broker() const
Broker Accessor.
Definition: translator.h:80
static void receiveDdsInteraction(void *interaction, void *userData)
DtDdsObjectTranslator< DDS_TEMPLATE_FUNCTION > ParentClass
Typedef for the templated class type.
Definition: ddsTranslator.h:94
std::pair< DtTime, bool > LocationFilteringInfo
Definition: ddsTranslator.h:404
Contains the DtInteractionTranslator and DtBaseInteractionTranslator class declarations.
virtual void receivePortalUpdate(const T_PortalReflectedObject &obj)
PortalToDdsReflectedMap myDdsPublisherMap
Definition: ddsTranslator.h:412
std::map< const DtReflectedObject *, LocationFilteringInfo > LocationFilteringMap
Definition: ddsTranslator.h:405
virtual DtString portalObjectName(const T_DdsReflectedObject *refObj) const
Determines the name to use for the given reflected object.
virtual void shutdown()
Performs any virtual shutdown logic prior to deletion.
bool operator!=(const DtDdsInteractionTranslator &rightOperand) const
Private Comparison Operator (Not implemented – Do Not Compare).
virtual void performPortalDebugging(const DtString &objectName)
Build and send debugging message for GUI debugging.
virtual void callObjectRemoveCallbacks(const DtBrokerObject *obj)
UpdateType
Enums used with the ObjectAction callback.
Definition: ddsTranslator.h:85
virtual void deletePortalPublisher(DtBrokerObject *brokerObj)
DdsToPortalReflectedMap myPortalPublisherMap
Definition: ddsTranslator.h:411
This callback is regarding an object Discovery.
Definition: ddsTranslator.h:89
std::set< DtString > TransDebugObjectNamesSet
Definition: ddsTranslator.h:414
virtual DtBrokerObject * createBrokerObject(const DtReflectedObject *refObj)
Creates a broker object for the given reflected object.
virtual void createDdsPublisher(DtBrokerObject *brokerObj)
Determines the name to use for the given reflected object.
DtDdsObjectTranslator & operator=(const DtDdsObjectTranslator &other)
Private Assignment Operator (Not implemented – Do Not Copy).
virtual DtBrokerObject * releaseBrokerObject(const DtReflectedObject *refObj)
Find the broker object for the given reflected object.
DtDdsInteractionTranslator(DtBroker *broker, const DtString &name, DtPortalMessageKind kind)
CTOR.
virtual void printDumpGuiToText(const DtBrokerObject &brokerObj, UpdateType ut) const
Base class for all broker objects.
Definition: broker.h:58
virtual void enableReflectTranslator(bool enabled)
Enables or disables the translator reflecting objects from DDS.
DtBaseObjectTranslators provide common logic for translating objects.
Definition: baseObjectTranslator.h:106
virtual void createPortalInteraction(const T_DDSInteraction &incoming)
std::map< const DtReflectedObject *, DtBrokerObject * > DdsToPortalReflectedMap
Definition: ddsTranslator.h:408
virtual bool filterLocation(const DtReflectedObject &refObj, const DtVector &location)
Checks location filtering and returns the filtered state.
Contains the DtObjectTranslator and DtBaseObjectTranslator class declarations.
virtual void createPortalPublisher(DtBrokerObject *brokerObj)
Determines the name to use for the given reflected object.
bool operator!=(const DtDdsObjectTranslator &rightOperand) const
Private Comparison Operator (Not implemented – Do Not Compare).
static void ddsObjectUpdatedCb(void *refObj, void *usr)
Callback called when an object in the reflected list is updated.
virtual void createInteraction(const T_PortalInteraction &incoming)
This function is required for a translator to correctly publish objects from the portal to your proto...
virtual void callObjectDiscoverCallbacks(const DtBrokerObject *obj)
virtual void updateDdsBrokerObject(DtBrokerObject *brokerObj, const T_DdsObjectStateRepository &sr)
virtual unsigned int numObjects() const
Returns the current number of objects.
Template Instances of DtPortalObjectPublisherTemplate.
virtual void printIncomingOutgoingStateReps(const T_PortalObject &incoming, const T_DdsObjectStateRepository &outgoing) const
Print debug info for the given state reps.
virtual T_DdsObjectPublisher * instantiateDdsPublisher(const T_PortalReflectedObject *refObj, const DtString &name)
Instantiates the publisher for the given reflected object.
virtual void printDDSInteraction(const T_DDSInteraction &inter) const =0
virtual void discoverPortalObject(const T_PortalReflectedObject &refObj)
DtObjectTranslator instances are responsible for translating between DDS and the Portal for objects...
Definition: ddsTranslator.h:79
DtPortalMessageKind
A List of message kinds distributed with the Portal.
Definition: pMessageKinds.h:23
LocationFilteringMap myLocationFilteringMap
Definition: ddsTranslator.h:406
virtual void shutdown()
Performs any virtual shutdown logic prior to deletion.
virtual void tick()
Ticks the publishers for the translated DDS and Portal objects.
virtual void printIncomingOutgoingInteractions(const T_PortalInteraction &incoming, const T_DDSInteraction &outgoing) const
Prints incoming and outgoing interactions (before and after translation) to DtInfo.
Implements a DtBroker for the DDS Architecture.
Definition: ddsBroker.h:50
virtual void forceUpdateAll()
Tells all publishers to send an update next tick.
virtual T_PortalObject * translate(T_PortalObject *destination, const T_DdsObjectStateRepository &source, const T_DdsReflectedObject &refObj)=0
Translates the given DDS object to a Portal object (abstract).
DtDdsObjectTranslator(DtBroker *broker, const DtString &name, DtPortalMessageKind kind)
The Default CTOR.
virtual void printDumpGuiToText(const DtString &protocol, const DtString &description) const
static bool ddsDiscoveryCriteria(DtReflectedObject *refObj, void *usr)
The DIS reflected list&#39;s discovery condition callback.
virtual T_PortalInteraction * translate(T_PortalInteraction *destination, const T_DDSInteraction &source)=0
Translates the given DDS interaction to a Portal interaction (abstract).
virtual void callObjectUpdateCallbacks(const DtBrokerObject *obj)
virtual bool isPortalDiscoverable(const DtPortalReflectedObject *refObj)
Checks if this portalObject is discoverable.
virtual DtString name() const
Accessor for the translator&#39;s name.

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)