VR-Forces 5.0.2 Developer's Guide
 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 
8 
9 #ifndef DtProxy_H_
10 #define DtProxy_H_
11 
12 #include <vrvUtil/vrvUtil.h>
13 #include <vlutil/vlSmartPointers.h>
14 #include <vlutil/vlExceptions.h>
15 
16 #include <map>
17 
18 namespace makVrv
19 {
20  class DtMessage;
21 
39  {
40  public:
41 
43  DtProxy();
44 
46  virtual void makeInvalid();
47 
51  inline bool isValid() const
52  {
53  return myValidFlag;
54  }
55 
60  inline void validate() const
61  {
62  if(!isValid())
63  {
64  DtTHROW_NEW(DtCorruptedState, "Interface is invalid.");
65  }
66  }
67 
68  protected:
69 
71  };
72 
73  typedef DtBoost::weak_ptr<DtProxy> DtProxyWP;
74  typedef DtBoost::shared_ptr<DtProxy> DtProxySP;
75 
79  template <typename K, typename V>
80  DtBoost::shared_ptr<V> DtFindProxyByName(std::map<K, DtBoost::weak_ptr<V> >& map, const std::string& name)
81  {
82  typedef DtBoost::weak_ptr<V> VWP;
83  typedef DtBoost::shared_ptr<V> VSP;
84 
85  typename std::map<K, DtBoost::weak_ptr<V> >::iterator iter = map.find(name);
86  if(iter != map.end())
87  {
88  VSP proctor = iter->second.lock();
89  if(proctor)
90  {
91  return proctor;
92  }
93  }
94  return VSP();
95  }
96 
97 }
98 
99 #endif
DtBoost::shared_ptr< DtProxy > DtProxySP
Definition: DtProxy.h:74
bool myValidFlag
Definition: DtProxy.h:70
#define DT_DLL_VRVUTIL
Definition: vrvUtil.h:34
void validate() const
Check to see if the proxy is valid. This function must be called at the beginning of any public funct...
Definition: DtProxy.h:60
DtBoost::weak_ptr< DtProxy > DtProxyWP
Definition: DtProxy.h:73
bool isValid() const
Return the valid state of the proxy.
Definition: DtProxy.h:51
Contains DLL export macros.
The Proxy base class. Proxies are objects that let users interact with objects that may or may not ex...
Definition: DtProxy.h:38
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. Typically used in the #...
Definition: DtProxy.h:80

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)