VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtProxy.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2007 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtProxy.h,v $ $Revision: 1.31 $ $State: Exp $
7 ******************************************************************************/
8 
11 
12 #ifndef DtProxy_H_
13 #define DtProxy_H_
14 
15 #include <vrvUtil/vrvUtil.h>
16 #include <vlutil/vlSmartPointers.h>
17 #include <vlutil/vlExceptions.h>
18 
19 #include <map>
20 
21 namespace makVrv
22 {
23  class DtMessage;
24 
42  {
43  public:
44 
46  DtProxy();
47 
49  virtual void makeInvalid();
50 
54  inline bool isValid() const
55  {
56  return myValidFlag;
57  }
58 
63  inline void validate() const
64  {
65  if(!isValid())
66  {
67  DtTHROW_NEW(DtCorruptedState, "Interface is invalid.");
68  }
69  }
70 
71  protected:
72 
74  };
75 
76  typedef DtBoost::weak_ptr<DtProxy> DtProxyWP;
77  typedef DtBoost::shared_ptr<DtProxy> DtProxySP;
78 
82  template <typename K, typename V>
83  DtBoost::shared_ptr<V> DtFindProxyByName(std::map<K, DtBoost::weak_ptr<V> >& map, const std::string& name)
84  {
85  typedef DtBoost::weak_ptr<V> VWP;
86  typedef DtBoost::shared_ptr<V> VSP;
87 
88  typename std::map<K, DtBoost::weak_ptr<V> >::iterator iter = map.find(name);
89  if(iter != map.end())
90  {
91  VSP proctor = iter->second.lock();
92  if(proctor)
93  {
94  return proctor;
95  }
96  }
97  return VSP();
98  }
99 
100 }
101 
102 #endif
DtBoost::shared_ptr< DtProxy > DtProxySP
Definition: DtProxy.h:77
bool myValidFlag
Definition: DtProxy.h:73
#define DT_DLL_VRVUTIL
Definition: vrvUtil.h:34
void validate() const
Check to see if the proxy is valid.
Definition: DtProxy.h:63
DtBoost::weak_ptr< DtProxy > DtProxyWP
Definition: DtProxy.h:76
bool isValid() const
Return the valid state of the proxy.
Definition: DtProxy.h:54
Contains DLL export macros.
The Proxy base class.
Definition: DtProxy.h:41
DtBoost::shared_ptr< V > DtFindProxyByName(std::map< K, DtBoost::weak_ptr< V > > &map, const std::string &name)
Utility function to look up a proxy object by name in a map of weak pointers.
Definition: DtProxy.h:83

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)