VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dynamicFeaturesManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
14 
15 #include <features/featureSet.h>
16 #include <features/feature.h>
19 
20 #include <vrfExtProtocol/objectType.h>
21 
22 #include <vrfutil/callbackQueue.h>
23 
24 #include <tbb/spin_mutex.h>
25 #include <tbb/spin_rw_mutex.h>
26 
27 #include <boost/optional.hpp>
28 #include <boost/shared_ptr.hpp>
29 #include <boost/signals2.hpp>
30 
31 class DtSimManager;
32 class DtVrfObject;
34 
35 namespace MAKVRinTerra
36 {
37  class DtVrfObjectFeatureSet;
38 }
39 
45 {
46 public:
48 
49  typedef std::vector<DtObjectType> ObjectTypes;
50 
52  static DtDynamicFeaturesManager* create(DtSimManager*);
53 
56 
58  virtual ~DtDynamicFeaturesManager();
59 
61  virtual MAKVRinTerra::DtFeatureSet* root();
62 
64  virtual void init();
65 
68  virtual void setObjectTypes(const ObjectTypes&);
69 
71  virtual void tick();
72 
75  virtual void objectAddedCallback(DtVrfObject*);
76  virtual void objectDeletedCallback(DtVrfObject*);
78 
79 protected:
80  static void objectAddedCallbackFunc(DtVrfObject*, void*);
81  static void objectDeletedCallbackFunc(DtVrfObject*, void*);
82 
83 private:
85 
86  boost::shared_ptr<MAKVRinTerra::DtVrfObjectFeatureSet> myFeatureSet;
88 };
89 
90 namespace MAKVRinTerra
91 {
94  : public DtFeature
95  , public boost::enable_shared_from_this<DtVrfObjectFeature>
96  , public DtObjectDebugger<DtVrfObjectFeature>
97  {
98  public:
99  typedef boost::shared_ptr<DtVrfObjectFeature> Ptr;
100  typedef boost::shared_ptr<const DtVrfObjectFeature> CPtr;
101 
103 
105 
106  DtFeature* clone() const;
107 
108  DtFeatureGeometry geometry() const;
109 
110  void forEachAttribute(ForEachFunction f) const;
111 
112  unsigned numberOfAttributes(const Key::String &) const;
113 
114  bool hasAttribute(const Key & k) const;
115 
116  boost::optional<Attribute> attribute(const Key &) const;
117 
118  DetachCallback addDeleteCallback(const DeleteCallback&) const;
119  bool isDeleted() const;
120 
122  virtual bool isChanged() const;
123 
125  virtual void removeFromVrf();
126 
127  DtObjectType objectType() const;
128  std::string objectName() const;
129  DtVector position() const;
130  boost::optional<double> percentComplete() const;
131  boost::optional<bool> isBreached() const;
132 
133  protected:
134  typedef tbb::spin_rw_mutex Mutex;
135  mutable Mutex myMutex;
136 
137  typedef boost::signals2::signal<void ()> DeleteSignal;
139 
141  DtObjectType myObjectType;
142  std::string myObjectTypeString;
144 
146 
147  typedef std::map<Key, Attribute> AttributeMap;
149 
150  private:
151  };
152 
155  : public DtFeatureSet::Source
156  , public DtObjectDebugger<DtVrfObjectFeatureSet>
157  {
158  public:
159  friend class ::DtDynamicFeaturesManager;
160 
161  typedef boost::shared_ptr<DtVrfObjectFeatureSet> Ptr;
162  typedef boost::shared_ptr<const DtVrfObjectFeatureSet> CPtr;
163 
166  {
167  public:
168  explicit CallbackQueue();
169 
170  void queueAdd(const DtVrfObjectFeature::Ptr&, DtVrfObjectFeatureSet&);
171  void queueRemove(const DtVrfObjectFeature::Ptr&);
172  void queueChange(
173  const DtVrfObjectFeature::Ptr& from, const DtVrfObjectFeature::Ptr& to,
175 
176  private:
178  };
179 
180  Ptr shared_from_this();
181 
182  std::string label() const;
183  DtFeatureSet* filter(const DtQuery&, const boost::optional<DtFeatureGeometry>&, DtLoadType) const;
184  DetachCallback addLoadedCallback(const LoadedCallback&) const;
185 
186  FeaturePtr addFeaturePtr(Feature* feature);
187 
189  void remove(DtVrfObject*);
190  void changed(DtVrfObject*);
191 
192  void tick();
193 
194  protected:
195  static void verticesChangedCallback(DtVrfObject*, void*);
196 
198  explicit DtVrfObjectFeatureSet(const DtVrfObjectFeatureSet& from);
199 
201 
202  typedef std::map<DtVrfObject*, DtVrfObjectFeature::Ptr> ObjectMap;
204 
206 
207  typedef boost::signals2::signal<void ()> LoadedSignal;
209  };
210 }
211 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)