WebLVC 1.8 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
disTranslator.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 <disBroker/dllExport.h>
19 
22 
25 
26 // All DIS Translators must have the following template arguments:
27 // The integer define of the DtPortalMessageKind,
28 // The PortalObject this message translates,
29 // The Reflected Portal Object class the message translates
30 // The Reflected DIS Object class
31 // The reflected list of objects
32 // The state repository class of the DIS Object
33 // The publisher class of the DIS Object
34 #define DIS_TEMPLATE_LIST \
35  template \
36  < class T_PortalObject \
37  , class T_PortalReflectedObject \
38  , class T_DisReflectedObject \
39  , class T_DisReflectedObjectList \
40  , class T_DisObjectStateRepository \
41  , class T_DisObjectPublisher>
42 
43 #define DIS_TEMPLATE_FUNCTION \
44  T_PortalObject, T_PortalReflectedObject, \
45  T_DisReflectedObject, T_DisReflectedObjectList, \
46  T_DisObjectStateRepository, T_DisObjectPublisher
47 
48 class DtInteraction;
49 class DtObjectPublisher;
50 class DtStateRepository;
51 class DtReflectedObject;
52 
53 namespace MAKVrExchange
54 {
55 
56  class DtRequestTranslationDiagnosticMessage;
57 
58  namespace DtDisBroker
59  {
60 
61  class DtDisBroker;
62 
87  : public DtBaseObjectTranslator<T_PortalObject,T_PortalReflectedObject>
88  {
89  public:
90 
92  typedef enum
93  {
94  none = 0,
95  discover = 1,
96  update = 2,
97  remove = 3
98  } UpdateType;
99 
102 
105 
106  public:
107 
110  const DtString& name, DtPortalMessageKind kind );
111 
113  virtual ~DtDisObjectTranslator();
114 
116  virtual void enableReflectTranslator( bool enabled );
117 
119  virtual void forceUpdateAll();
120 
122  virtual void tick();
123 
124  virtual DtDisBroker* disBroker();
125  virtual const DtDisBroker* disBroker() const;
126 
127  protected:
128 
131 
132  virtual void initializeDisCallbacks();
133  virtual void removeDisCallbacks();
134 
136 
139 
141  virtual DtBrokerObject* createBrokerObject( const DtReflectedObject* refObj );
143 
146  virtual DtBrokerObject* findBrokerObject( const DtReflectedObject* refObj );
147  virtual DtBrokerObject* findBrokerObject( const DtPortalReflectedObject* refObj );
148 
151  virtual DtBrokerObject* findBrokerObject( const DtString& objectName );
152 
156  virtual DtBrokerObject* releaseBrokerObject( const DtReflectedObject* refObj );
158 
160 
163 
166  static bool disDiscoveryCriteria( DtReflectedObject* refObj, void* usr );
167 
169  static void disObjectAddedCb( T_DisReflectedObject* refObj, void* usr );
170 
172  static void disObjectUpdatedCb( T_DisReflectedObject* refObj, void* usr );
173 
175  static void disObjectDeletedCb( T_DisReflectedObject* refObj, void* usr );
176 
178 
181 
184  virtual bool isPortalDiscoverable( const DtPortalReflectedObject* refObj );
185 
188  virtual bool isDisPublishable( DtBrokerObject* brokerObj,
189  const T_PortalReflectedObject* refObj );
190 
192 
195 
198  virtual bool isDisDiscoverable( const DtReflectedObject* refObj );
199 
201 
205 
206  virtual void callObjectDiscoverCallbacks( const DtBrokerObject* obj );
207  virtual void callObjectUpdateCallbacks( const DtBrokerObject* obj );
208  virtual void callObjectRemoveCallbacks( const DtBrokerObject* obj );
209 
211 
220 
221  virtual void discoverDisObject( T_DisReflectedObject& obj );
222  virtual void discoverPortalObject( const T_PortalReflectedObject& obj );
223 
225 
233 
234  virtual void createDisPublisher( DtBrokerObject* brokerObj );
235 
241  virtual DtString disObjectName( const T_PortalReflectedObject* refObj ) const;
242 
244  virtual DtEntityIdentifier mapIdentifier( const T_PortalReflectedObject* refObj,
245  const DtString& identifier );
246 
248  virtual DtEntityIdentifier mapObjectId( const DtEntityIdentifier& identifier );
249 
258  virtual DtObjectPublisher* instantiateDisPublisher(
259  const T_PortalReflectedObject* refObj, const DtEntityIdentifier& name );
260 
265  virtual bool performDisGlobalIdMapping( const DtObjectPublisher* publisher,
266  const T_PortalReflectedObject& refObj,
268  int systemId = DtGlobalIdMapper::NoSystemId,
269  int beamId = DtGlobalIdMapper::NoBeamId );
270 
271  virtual void createPortalPublisher( DtBrokerObject* brokerObj );
272 
278  virtual DtString portalObjectName( const T_DisReflectedObject* refObj ) const;
279 
284  virtual bool performPortalGlobalIdMapping(
286  const T_DisReflectedObject& refObj,
288  int systemId = DtGlobalIdMapper::NoSystemId,
289  int beamId = DtGlobalIdMapper::NoBeamId );
290 
292 
301 
302  virtual void receiveDisUpdate( T_DisReflectedObject& obj );
303  virtual void receivePortalUpdate( const T_PortalReflectedObject& obj );
304 
306 
315 
316  virtual void updateDisBrokerObject( DtBrokerObject* brokerObj,
317  const T_DisObjectStateRepository& sr );
318  virtual void updatePortalBrokerObject( DtBrokerObject* brokerObj,
319  const T_PortalObject& sr );
320 
322 
331  virtual void updateFilteredState( DtBrokerObject* brokerObj,
333  T_DisReflectedObject* refObj );
334 
338  virtual void updateFilteredState( DtBrokerObject* brokerObj,
339  const T_PortalReflectedObject* refObj );
340 
345  virtual bool filterLocation( const DtReflectedObject& refObj,
346  const DtVector& location );
347 
349  virtual bool filterLocation( const DtPortalReflectedObject& refObj,
350  const DtVector& location );
351 
355 
356  virtual void removeDisObject( const DtReflectedObject& refObj );
357  virtual void removePortalObject( const T_PortalReflectedObject& refObj );
358 
360 
365 
366  virtual void deleteDisPublisher( DtBrokerObject* brokerObj );
367  virtual void deletePortalPublisher( DtBrokerObject* brokerObj );
368 
370 
372  static void requestTransDiagCb( const DtRequestTranslationDiagnosticMessage& msg, void* usr );
373 
376 
378  virtual void printIncomingOutgoingStateReps(
379  const DtPortalObject& incoming, const DtStateRepository& outgoing ) const;
380 
382  virtual void printIncomingOutgoingStateReps(
383  const DtStateRepository& incoming, const DtPortalObject& outgoing ) const;
384 
388  virtual void performPortalDebugging( const DtString& objectName );
389 
391  virtual void performPortalDebugging( const DtPortalObject& incoming,
392  const DtStateRepository& outgoing );
393 
395  virtual void performPortalDebugging( const DtStateRepository& incoming,
396  const DtPortalObject& outgoing );
397 
398  virtual void printDumpGuiToText( const DtBrokerObject& brokerObj,
399  UpdateType ut ) const;
400 
402  virtual unsigned int numObjects() const;
403 
406  virtual void shutdown();
407 
408  public:
409 
412  virtual T_PortalObject* translate( T_PortalObject* destination,
413  const T_DisObjectStateRepository& source,
414  const T_DisReflectedObject& refObj ) = 0;
415 
418  virtual T_DisObjectStateRepository* translate(
419  T_DisObjectStateRepository* destination, const T_PortalObject& source,
420  const T_PortalReflectedObject& refObj ) = 0;
421 
422  private:
423 
426 
429 
431  bool operator == ( const DtDisObjectTranslator& rightOperand ) const;
432 
434  bool operator != ( const DtDisObjectTranslator& rightOperand ) const;
435 
436  protected:
437 
438  T_DisReflectedObjectList* myDisReflectedList;
439 
440  typedef std::pair<DtTime,bool> LocationFilteringInfo;
441  typedef std::map<const DtReflectedObject*,LocationFilteringInfo> LocationFilteringMap;
443 
444  typedef std::map<const DtReflectedObject*,DtBrokerObject*> DisToPortalReflectedMap;
445  typedef std::map<const DtPortalReflectedObject*,DtBrokerObject*> PortalToDisReflectedMap;
446 
449 
450  typedef std::set<DtString> TransDebugObjectNamesSet;
452 
453  };
454 
455 
472  template <class PortalInterType,class DisInterType>
474  : public DtBaseInteractionTranslator<PortalInterType>
475  {
476  public:
477 
480 
481  public:
482 
485  const DtString& name, DtPortalMessageKind kind );
486 
488  virtual ~DtDisInteractionTranslator();
489 
491  virtual void enableReflectTranslator( bool enabled );
492 
493  virtual DtDisBroker* disBroker();
494  virtual const DtDisBroker* disBroker() const;
495 
497  virtual void tick();
498 
499  protected:
500 
503 
504  virtual void initializeDisCallbacks();
505  virtual void removeDisCallbacks();
506 
508 
512 
513  static void receiveDisInteraction( DisInterType* inter, void* usr );
514  virtual void receiveDisInteraction( const DisInterType& inter );
515 
517 
520  virtual void receivePortalInteraction( const PortalInterType& inter );
521 
529 
530  virtual void createInteraction( const PortalInterType& inter );
531  virtual void createPortalInteraction( const DisInterType& inter );
532 
534 
537  virtual PortalInterType* translate( PortalInterType* destination,
538  const DisInterType& source ) = 0;
539 
542  virtual DisInterType* translate( DisInterType* destination,
543  const PortalInterType& source ) = 0;
544 
546  virtual void printIncomingOutgoingInteractions( const DtPortalInteraction& incoming,
547  const DtInteraction& outgoing ) const;
548 
550  virtual void printIncomingOutgoingInteractions( const DtInteraction& incoming,
551  const DtPortalInteraction& outgoing ) const;
552 
555  virtual bool testGlobalIdMapping( const DtString& idName, const DtString& id );
556 
559  virtual void shutdown();
560 
561  private:
562 
565 
568 
570  bool operator == ( const DtDisInteractionTranslator& rightOperand ) const;
571 
573  bool operator != ( const DtDisInteractionTranslator& rightOperand ) const;
574 
575  protected:
576 
577  typedef std::vector<PortalInterType> InteractionWaitList;
579 
580  };
581 
582  }
583 }
584 
585 #define _disTranslator_INL_
586 #include <disBroker/disTranslator.inl>
587 #undef _disTranslator_INL_
virtual void performPortalDebugging(const DtString &objectName)
Build and send debugging message for GUI debugging.
virtual bool performPortalGlobalIdMapping(const DtPortalObjectPublisherTemplate< T_PortalObject > *publisher, const T_DisReflectedObject &refObj, DtGlobalIdMapper::ObjectType type=DtGlobalIdMapper::EntityType, int systemId=DtGlobalIdMapper::NoSystemId, int beamId=DtGlobalIdMapper::NoBeamId)
Maps the publisher&#39;s global ID to the reflected object&#39;s identifier.
ObjectType
Definition: disBroker/disBroker/globalIdMapper.h:65
TransDebugObjectNamesSet myTransDebugNames
Definition: disTranslator.h:451
Contains the templated DtPortalReflectedObjectManager types.
Base class for all DIS object translators.
Definition: disTranslator.h:86
virtual void callObjectRemoveCallbacks(const DtBrokerObject *obj)
virtual void tick()
Checks the waitlist for postponed interaction discoveries.
virtual T_PortalObject * translate(T_PortalObject *destination, const T_DisObjectStateRepository &source, const T_DisReflectedObject &refObj)=0
Translates the given DIS object to a Portal object (abstract).
Implements a DtBroker for the DIS Protocol.
Definition: disBroker.h:38
static void requestTransDiagCb(const DtRequestTranslationDiagnosticMessage &msg, void *usr)
Static translation diagnostic request callback.
virtual void enableReflectTranslator(bool enabled)
Enables or disables the translator reflecting objects from DIS.
virtual void callObjectUpdateCallbacks(const DtBrokerObject *obj)
DtDisObjectTranslator(DtBroker *broker, const DtString &name, DtPortalMessageKind kind)
CTOR.
virtual void deletePortalPublisher(DtBrokerObject *brokerObj)
Used to request that brokers send translation diagnostic reports.
Definition: requestTransDiagnosticMessage.h:21
#define DIS_TEMPLATE_LIST
Definition: disTranslator.h:34
virtual void tick()
Ticks the publishers for the translated DIS and Portal objects.
Definition: disBroker/disBroker/globalIdMapper.h:67
Definition: disBroker/disBroker/globalIdMapper.h:63
This callback is regarding an object Discovery.
Definition: disTranslator.h:96
virtual void printIncomingOutgoingInteractions(const DtPortalInteraction &incoming, const DtInteraction &outgoing) const
Prints incoming and outgoing interactions (before and after translation) to DtInfo.
static void disObjectAddedCb(T_DisReflectedObject *refObj, void *usr)
Callback called when an object is added to the reflected list.
static void receiveDisInteraction(DisInterType *inter, void *usr)
Provides container to hold pointers to Protocol/Portal objects.
Definition: brokerObject.h:24
UpdateType
Enums used with the ObjectAction callback.
Definition: disTranslator.h:92
bool operator!=(const DtDisInteractionTranslator &rightOperand) const
Private Comparison Operator (Not implemented – Do Not Compare).
virtual void discoverDisObject(T_DisReflectedObject &obj)
virtual bool isPortalDiscoverable(const DtPortalReflectedObject *refObj)
Creates broker object for reflected Portal object.
virtual DtObjectPublisher * instantiateDisPublisher(const T_PortalReflectedObject *refObj, const DtEntityIdentifier &name)
Instantiates the publisher for the given reflected object.
virtual void enableReflectTranslator(bool enabled)
Enables or disables the translator reflecting from DIS.
std::map< const DtPortalReflectedObject *, DtBrokerObject * > PortalToDisReflectedMap
Definition: disTranslator.h:445
static void disObjectUpdatedCb(T_DisReflectedObject *refObj, void *usr)
Callback called when an object in the reflected list is updated.
virtual void shutdown()
Performs any virtual shutdown logic prior to deletion.
virtual void forceUpdateAll()
Tells all publishers to send an update next tick.
DtPortalObject are messages which also serve as state repositories for simulated objects.
Definition: pObject.h:23
Definition: disBroker/disBroker/globalIdMapper.h:62
T_DisReflectedObjectList * myDisReflectedList
Definition: disTranslator.h:438
A simple template class to hold different types of State Repositories.
Definition: pObjectPublisher.h:68
virtual DtEntityIdentifier mapIdentifier(const T_PortalReflectedObject *refObj, const DtString &identifier)
Maps the reflected object&#39;s global or entity identifier to a DIS id.
DtBaseInteractionTranslator are responsible for translating messages for things that do not have stat...
Definition: baseInteractionTranslator.h:60
std::pair< DtTime, bool > LocationFilteringInfo
Definition: disTranslator.h:440
PortalToDisReflectedMap myDisPublisherMap
Definition: disTranslator.h:448
An abstract interface for reflected objects.
Definition: pReflectedObject.h:31
virtual DtEntityIdentifier mapObjectId(const DtEntityIdentifier &identifier)
Maps the entity IDs with respect to the remapDisIds setting.
DtBroker * broker() const
Broker Accessor.
Definition: translator.h:80
DtPortalInteractions are a special type of DtPortalMessages which are used to transmit simulation dat...
Definition: pInteraction.h:21
virtual void createPortalPublisher(DtBrokerObject *brokerObj)
Determines the name to use for the given reflected object.
bool operator==(const DtDisObjectTranslator &rightOperand) const
Private Comparison Operator (Not implemented – Do Not Compare).
bool operator!=(const DtDisObjectTranslator &rightOperand) const
Private Comparison Operator (Not implemented – Do Not Compare).
Contains the DtInteractionTranslator and DtBaseInteractionTranslator class declarations.
virtual void deleteDisPublisher(DtBrokerObject *brokerObj)
DtDisObjectTranslator< DIS_TEMPLATE_FUNCTION > ParentClass
Typedef for the templated class type.
Definition: disTranslator.h:101
virtual bool testGlobalIdMapping(const DtString &idName, const DtString &id)
Checks whether a valid global id mapping exists for the given ID.
virtual DtString disObjectName(const T_PortalReflectedObject *refObj) const
Determines the name to use for the given reflected object.
static bool disDiscoveryCriteria(DtReflectedObject *refObj, void *usr)
The DIS reflected list&#39;s discovery condition callback.
virtual void discoverPortalObject(const T_PortalReflectedObject &obj)
virtual void updateFilteredState(DtBrokerObject *brokerObj, DtPortalObjectPublisherTemplate< T_PortalObject > *publisher, T_DisReflectedObject *refObj)
Ensures the given object is properly filtered.
std::map< const DtReflectedObject *, DtBrokerObject * > DisToPortalReflectedMap
Definition: disTranslator.h:444
virtual bool isDisDiscoverable(const DtReflectedObject *refObj)
Creates broker object for reflected DIS object.
virtual bool isDisPublishable(DtBrokerObject *brokerObj, const T_PortalReflectedObject *refObj)
Tests whether the object is publishable as a DIS object.
std::set< DtString > TransDebugObjectNamesSet
Definition: disTranslator.h:450
Base class for all broker objects.
Definition: broker.h:58
DtBaseObjectTranslators provide common logic for translating objects.
Definition: baseObjectTranslator.h:106
virtual void shutdown()
Performs any virtual shutdown logic prior to deletion.
virtual DtBrokerObject * findBrokerObject(const DtReflectedObject *refObj)
Find the broker object for the given reflected object.
Contains the DtObjectTranslator and DtBaseObjectTranslator class declarations.
virtual void printIncomingOutgoingStateReps(const DtPortalObject &incoming, const DtStateRepository &outgoing) const
Print debug info for the given state reps.
virtual bool performDisGlobalIdMapping(const DtObjectPublisher *publisher, const T_PortalReflectedObject &refObj, DtGlobalIdMapper::ObjectType type=DtGlobalIdMapper::EntityType, int systemId=DtGlobalIdMapper::NoSystemId, int beamId=DtGlobalIdMapper::NoBeamId)
Maps the publisher&#39;s global ID to the reflected object&#39;s identifier.
virtual PortalInterType * translate(PortalInterType *destination, const DisInterType &source)=0
Translates the given DIS interaction to a Portal interaction (abstract).
virtual unsigned int numObjects() const
Returns the current number of objects.
virtual bool filterLocation(const DtReflectedObject &refObj, const DtVector &location)
Checks location filtering and returns the filtered state.
virtual void receiveDisUpdate(T_DisReflectedObject &obj)
virtual void createInteraction(const PortalInterType &inter)
This function is required for a translator to correctly publish objects from the portal to your proto...
DtDisInteractionTranslator(DtBroker *broker, const DtString &name, DtPortalMessageKind kind)
CTOR.
Template Instances of DtPortalObjectPublisherTemplate.
InteractionWaitList myInteractionWaitList
Definition: disTranslator.h:578
DisToPortalReflectedMap myPortalPublisherMap
Definition: disTranslator.h:447
virtual void createDisPublisher(DtBrokerObject *brokerObj)
Determines the name to use for the given reflected object.
virtual void createPortalInteraction(const DisInterType &inter)
DtDisObjectTranslator & operator=(const DtDisObjectTranslator &other)
Private Assignment Operator (Not implemented – Do Not Copy).
DtDisInteractionTranslator & operator=(const DtDisInteractionTranslator &other)
Private Assignment Operator (Not implemented – Do Not Copy).
virtual void receivePortalUpdate(const T_PortalReflectedObject &obj)
virtual DtBrokerObject * createBrokerObject(const DtReflectedObject *refObj)
Creates a broker object for the given reflected object.
DtPortalMessageKind
A List of message kinds distributed with the Portal.
Definition: pMessageKinds.h:23
virtual void removeDisObject(const DtReflectedObject &refObj)
virtual void callObjectDiscoverCallbacks(const DtBrokerObject *obj)
virtual void printDumpGuiToText(const DtBrokerObject &brokerObj, UpdateType ut) const
virtual DtString portalObjectName(const T_DisReflectedObject *refObj) const
Determines the name to use for the given reflected object.
static void disObjectDeletedCb(T_DisReflectedObject *refObj, void *usr)
Callback called when an object in the reflected list is deleted.
virtual void removePortalObject(const T_PortalReflectedObject &refObj)
LocationFilteringMap myLocationFilteringMap
Definition: disTranslator.h:442
Base class for all DIS interaction translators.
Definition: disTranslator.h:473
virtual void updateDisBrokerObject(DtBrokerObject *brokerObj, const T_DisObjectStateRepository &sr)
DtBaseObjectTranslator< T_PortalObject, T_PortalReflectedObject > BaseTranslatorClass
Typedef for the templated base class type.
Definition: disTranslator.h:104
std::vector< PortalInterType > InteractionWaitList
Definition: disTranslator.h:577
bool operator==(const DtDisInteractionTranslator &rightOperand) const
Private Comparison Operator (Not implemented – Do Not Compare).
virtual void updatePortalBrokerObject(DtBrokerObject *brokerObj, const T_PortalObject &sr)
virtual void receivePortalInteraction(const PortalInterType &inter)
Portal interaction processing callback.
virtual DtBrokerObject * releaseBrokerObject(const DtReflectedObject *refObj)
Find the broker object for the given reflected object.
std::map< const DtReflectedObject *, LocationFilteringInfo > LocationFilteringMap
Definition: disTranslator.h:441
virtual DtString name() const
Accessor for the translator&#39;s name.
DtDisInteractionTranslator< PortalInterType, DisInterType > ParentClass
Typedef for the templated class type.
Definition: disTranslator.h:479

Document ID: Generated on Wed Mar 12 15:05:17 EDT 2025 from SVN revision 274272
Copyright © 2005-2025 MAK Technologies. All Rights Reserved (www.mak.com)