VR-Exchange 2.4 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rprTrans.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2015 VT MAK
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 <rprBroker/dllExport.h>
19 
22 
25 
26 // All RPR 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 RPR Object class
31 // The reflected list of objects
32 // The state repository class of the RPR Object
33 // The publisher class of the RPR Object
34 #define RPR_TEMPLATE_LIST \
35  template \
36  < class T_PortalObject \
37  , class T_PortalReflectedObject \
38  , class T_RprReflectedObject \
39  , class T_RprReflectedObjectList \
40  , class T_RprObjectStateRepository \
41  , class T_RprObjectPublisher>
42 
43 #define RPR_TEMPLATE_FUNCTION \
44  T_PortalObject, T_PortalReflectedObject, \
45  T_RprReflectedObject, T_RprReflectedObjectList, \
46  T_RprObjectStateRepository, T_RprObjectPublisher
47 
49 #define DtVrxCATCH_AND_WARN( exception ) \
50  catch ( exception ) \
51  { \
52  DtWarn << this->name() << " Translator caught " << #exception \
53  << " when sending interaction." << std::endl; \
54  }
55 
56 class DtInteraction;
57 class DtReflectedObject;
58 class DtStateRepository;
59 
60 namespace MAKVrExchange
61 {
62 
63  class DtRequestTranslationDiagnosticMessage;
64 
65  namespace DtRprBroker
66  {
67 
68  class DtRprBroker;
69 
94  : public DtBaseObjectTranslator<T_PortalObject,T_PortalReflectedObject>
95  {
96  public:
97 
99  typedef enum
100  {
101  none = 0,
102  discover = 1,
103  update = 2,
104  remove = 3
105  } UpdateType;
106 
109 
110  public:
111 
114  const DtString& name, DtPortalMessageKind kind );
115 
117  virtual ~DtRprObjectTranslator();
118 
120  virtual void enableReflectTranslator( bool enabled );
121 
124  virtual void forceUpdateAll();
125 
127  virtual void tick();
128 
129  virtual DtRprBroker* rprBroker();
130  virtual const DtRprBroker* rprBroker() const;
131 
133  virtual void shutdown();
134 
135  protected:
136 
139 
140  virtual void initializeRprCallbacks();
141  virtual void removeRprCallbacks();
142 
144 
147 
149  virtual DtBrokerObject* createBrokerObject( const DtReflectedObject* refObj );
151 
154  virtual DtBrokerObject* findBrokerObject( const DtReflectedObject* refObj );
155  virtual DtBrokerObject* findBrokerObject( const DtPortalReflectedObject* refObj );
156 
160  virtual DtBrokerObject* releaseBrokerObject( const DtReflectedObject* refObj );
162 
164 
167 
170  static bool rprDiscoveryCriteria( DtReflectedObject* refObj, void* usr );
171 
173  static void rprObjectAddedCb( T_RprReflectedObject* refObj, void* usr );
174 
176  static void rprObjectUpdatedCb( T_RprReflectedObject* refObj, void* usr );
177 
179  static void rprObjectDeletedCb( T_RprReflectedObject* refObj, void* usr );
180 
182 
185 
188  virtual bool isPortalDiscoverable( const DtPortalReflectedObject* refObj );
189 
192  virtual bool isRprPublishable( const DtBrokerObject* brokerObj,
193  const T_PortalReflectedObject* refObj );
194 
196 
199 
202  virtual bool isRprDiscoverable( const DtReflectedObject* refObj );
203 
205 
214 
215  virtual void discoverRprObject( T_RprReflectedObject& obj );
216  virtual void discoverPortalObject( const T_PortalReflectedObject& obj );
217 
219 
227 
228  virtual void createRprPublisher( DtBrokerObject* brokerObj );
229 
235  virtual DtString rprObjectName( const T_PortalReflectedObject* refObj ) const;
236 
245  virtual T_RprObjectPublisher* instantiateRprPublisher(
246  const T_PortalReflectedObject* refObj, const DtString& name );
247 
253  virtual void fillOutgoingIds( T_RprObjectPublisher* publisher,
254  const DtString& name );
255 
256  virtual void createPortalPublisher( DtBrokerObject* brokerObj );
257 
259 
268 
269  virtual void receiveRprUpdate( T_RprReflectedObject& obj );
270  virtual void receivePortalUpdate( const T_PortalReflectedObject& obj );
271 
273 
282 
283  virtual void updateRprBrokerObject( DtBrokerObject* brokerObj,
284  const T_RprObjectStateRepository& sr );
285  virtual void updatePortalBrokerObject( DtBrokerObject* brokerObj,
286  const T_PortalObject& sr );
287 
296  virtual void updateFilteredState( DtBrokerObject* brokerObj,
298  T_RprReflectedObject* refObj );
299 
304  virtual bool filterLocation( const DtReflectedObject& refObj,
305  const DtVector& location );
306 
308 
312 
313  virtual void removeRprObject( const DtReflectedObject& refObj );
314  virtual void removePortalObject( const T_PortalReflectedObject& refObj );
315 
317 
322 
323  virtual void deleteRprPublisher( DtBrokerObject* brokerObj );
324  virtual void deletePortalPublisher( DtBrokerObject* brokerObj );
325 
327 
329  static void requestTransDiagCb( const DtRequestTranslationDiagnosticMessage& msg, void* usr );
330 
333 
335  virtual void printIncomingOutgoingStateReps(
336  const DtPortalObject& incoming, const DtStateRepository& outgoing ) const;
337 
339  virtual void printIncomingOutgoingStateReps(
340  const DtStateRepository& incoming, const DtPortalObject& outgoing ) const;
341 
343  virtual void performPortalDebugging( const DtPortalObject& incoming,
344  const DtStateRepository& outgoing );
345 
347  virtual void performPortalDebugging( const DtStateRepository& incoming,
348  const DtPortalObject& outgoing );
349 
351  virtual unsigned int numObjects() const;
352 
353  public:
354 
357  virtual T_PortalObject* translate( T_PortalObject* destination,
358  const T_RprObjectStateRepository& source,
359  const T_RprReflectedObject& refObj ) = 0;
360 
363  virtual T_RprObjectStateRepository* translate(
364  T_RprObjectStateRepository* destination, const T_PortalObject& source,
365  const T_PortalReflectedObject& refObj ) = 0;
366 
367  private:
368 
371 
374 
376  bool operator == ( const DtRprObjectTranslator& rightOperand ) const;
377 
379  bool operator != ( const DtRprObjectTranslator& rightOperand ) const;
380 
381  protected:
382 
383  T_RprReflectedObjectList* myRprReflectedList;
384 
385  typedef std::pair<DtTime,bool> LocationFilteringInfo;
386  typedef std::map<const DtReflectedObject*,LocationFilteringInfo> LocationFilteringMap;
388 
389  typedef std::map<const DtReflectedObject*,DtBrokerObject*> RprToPortalReflectedMap;
390  typedef std::map<const DtPortalReflectedObject*,DtBrokerObject*> PortalToRprReflectedMap;
391 
394 
395  typedef std::set<DtString> TransDebugObjectNamesSet;
397 
399 
400  };
401 
402 
419  template <class PortalInterType,class RprInterType>
421  : public DtBaseInteractionTranslator<PortalInterType>
422  {
423  public:
424 
427 
428  public:
429 
432  const DtString& name, DtPortalMessageKind kind );
433 
435  virtual ~DtRprInteractionTranslator();
436 
438  virtual void enableReflectTranslator( bool enabled );
439 
440  virtual DtRprBroker* rprBroker();
441  virtual const DtRprBroker* rprBroker() const;
442 
444  virtual void shutdown();
445 
446  protected:
447 
450 
451  virtual void initializeRprCallbacks();
452  virtual void removeRprCallbacks();
453 
455 
459 
460  static void receiveRprInteraction( RprInterType* inter, void* usr );
461 
463 
471 
472  virtual void createInteraction( const PortalInterType& inter );
473  virtual void createPortalInteraction( const RprInterType& inter );
474 
476 
479  virtual PortalInterType* translate( PortalInterType* destination,
480  const RprInterType& source ) = 0;
481 
484  virtual RprInterType* translate( RprInterType* destination,
485  const PortalInterType& source ) = 0;
486 
488  virtual void printIncomingOutgoingInteractions( const DtPortalInteraction& incoming,
489  const DtInteraction& outgoing ) const;
490 
492  virtual void printIncomingOutgoingInteractions( const DtInteraction& incoming,
493  const DtPortalInteraction& outgoing ) const;
494 
495  private:
496 
499 
502 
504  bool operator == ( const DtRprInteractionTranslator& rightOperand ) const;
505 
507  bool operator != ( const DtRprInteractionTranslator& rightOperand ) const;
508 
509  };
510 
511  }
512 }
513 
514 #define rprTrans_INL_
515 #include "rprTrans.inl"
516 #undef rprTrans_INL_

Document ID: Generated on Thu Jul 23 10:25:22 EDT 2015 from SVN revision 155065
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)