14 #include <tbb/tbb_thread.h>
15 #include <tbb/spin_rw_mutex.h>
16 #include <tbb/atomic.h>
18 #include <boost/optional.hpp>
19 #include <boost/shared_ptr.hpp>
20 #include <boost/weak_ptr.hpp>
21 #include <boost/scoped_ptr.hpp>
22 #include <boost/noncopyable.hpp>
31 namespace MAKVRinTerra
44 #ifdef DtObjectDebugger_Enable
52 typedef boost::shared_ptr<DtUnusedFeatureTileTracker>
Ptr;
53 typedef boost::weak_ptr<DtUnusedFeatureTileTracker>
WeakPtr;
62 const std::string& name =
"tracker");
75 unsigned size()
const;
78 unsigned totalLength()
const;
81 void setMaxSize(
unsigned max);
84 unsigned maxSize()
const;
87 void setMinUnusedTime(
double);
90 double minUnusedTime()
const;
93 unsigned long unloadUntilSize(
unsigned maxSize,
double minTime);
94 unsigned long unloadUntilSize(
unsigned maxSize);
97 void addSubtracker(
const Ptr& subtracker);
100 void info(std::ostream&)
const;
103 void print(std::ostream&)
const;
113 bool add(
const boost::shared_ptr<Trackable>&);
146 :
private boost::noncopyable
147 #ifdef DtObjectDebugger_Enable
159 virtual std::string
label()
const = 0;
162 virtual void load() = 0;
165 virtual bool unload() = 0;
168 virtual bool loading()
const = 0;
171 virtual bool loaded()
const = 0;
176 virtual unsigned size()
const = 0;
183 virtual boost::shared_ptr<Trackable>
getPtr()
const = 0;
187 boost::shared_ptr<Sentinel>
getSentinel(
bool loadIfNotPresent=
true)
const;
229 :
private boost::noncopyable
230 #ifdef DtObjectDebugger_Enable
235 typedef boost::shared_ptr<Sentinel>
Ptr;
242 explicit Sentinel(
const boost::shared_ptr<Trackable>&);
virtual bool loaded() const =0
Has this object completed loading.
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:41
std::list< TrackablePtr > TrackableList
Definition: unusedFeatureTileTracker.h:55
boost::weak_ptr< Sentinel > mySentinel
weak ptr to sentinel otherwise it would never be destroyed
Definition: unusedFeatureTileTracker.h:220
boost::shared_ptr< Sentinel > getSentinel(bool loadIfNotPresent=true) const
Returns the sentinel. If the sentinel does not exist then this function will cause loading to start...
tbb::spin_rw_mutex Mutex
Definition: unusedFeatureTileTracker.h:108
unsigned useCount() const
Number of references to the sentinel in existence.
const DtUnusedFeatureTileTracker::WeakPtr myTracker
Definition: unusedFeatureTileTracker.h:217
boost::weak_ptr< DtUnusedFeatureTileTracker > WeakPtr
Definition: unusedFeatureTileTracker.h:53
Definition: unusedFeatureTileTracker.h:228
Trackable(const DtUnusedFeatureTileTracker::Ptr &)
Tracks objects so they can be deleted at a later time.
Definition: unusedFeatureTileTracker.h:43
TrackableList::iterator iterator() const
Definition: unusedFeatureTileTracker.h:213
voidpf void uLong size
Definition: ioapi.h:39
boost::shared_ptr< Sentinel > Ptr
Definition: unusedFeatureTileTracker.h:235
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
void sentinelDestroyed()
called by sentinel destructor
boost::optional< TrackableList::iterator > myIterator
Definition: unusedFeatureTileTracker.h:221
This is a class which maintains a list of string command names and the callback functions that are to...
Definition: consoleCommandManager.h:56
boost::scoped_ptr< tbb::tbb_thread > myPageOutThread
Definition: unusedFeatureTileTracker.h:128
virtual bool unload()=0
Called by the tracker when it's time to unload.
boost::scoped_ptr< DtConsoleCommandManager > myCommandManager
Definition: unusedFeatureTileTracker.h:140
boost::shared_ptr< DtUnusedFeatureTileTracker > Ptr
Definition: unusedFeatureTileTracker.h:52
std::vector< Ptr > SubTrackerList
clear on exit
Definition: unusedFeatureTileTracker.h:134
Mixin interface for classes which wish to be tracked.
Definition: unusedFeatureTileTracker.h:145
virtual bool loading() const =0
Has this set been requested to load.
void addToUnusedList()
Add this object to the unused list, does not cause loading Use this to prevent an object from being d...
bool myDoneFlag
Definition: unusedFeatureTileTracker.h:127
virtual boost::shared_ptr< Trackable > getPtr() const =0
Trackable must be managed by a shared pointer, boost::enable_shared_from_this is encouraged for use i...
A utility class for use with DtConsoleCommandManager. This class takes ownership of an arbitrary numb...
Definition: consoleCommandManager.h:168
Mutex myTotalListMutex
Definition: unusedFeatureTileTracker.h:137
virtual std::string label() const =0
Only used for output, won't change operation.
boost::shared_ptr< Trackable > TrackablePtr
Definition: unusedFeatureTileTracker.h:54
std::list< Trackable * > TrackableRawPtrList
Definition: unusedFeatureTileTracker.h:56
bool notInList() const
keeps an iterator to itself in the unused list so we can quickly remove
Definition: unusedFeatureTileTracker.h:212
tbb::spin_rw_mutex Mutex
Definition: unusedFeatureTileTracker.h:206
tbb::atomic< unsigned > myMaxSize
Definition: unusedFeatureTileTracker.h:130
tbb::tick_count unusedTime() const
Time at which object became unused.
TrackableRawPtrList myTrackables
Definition: unusedFeatureTileTracker.h:138
virtual ~Trackable()
Virtual destructor.
DT_DLL_VRVCORE double length(const makVrv::DtCoordinateSystem &, const std::vector< DtVector > &vertices)
Returns the total distance of a segmented line defined by the provided vector of vertices. Coordinates are in local database coordinates. The coordinate system is used to convert between the local database coordinates and geocentric. All distance is in 2D – the Z value is ignored.
Sentinel(const boost::shared_ptr< Trackable > &)
boost::optional< TrackableRawPtrList::iterator > myTrackableListIterator
Definition: unusedFeatureTileTracker.h:222
SubTrackerList mySubtrackers
Definition: unusedFeatureTileTracker.h:135
boost::scoped_ptr< DtConsoleCommandOwner > myCommandOwner
Definition: unusedFeatureTileTracker.h:141
Mutex myMutex
Definition: unusedFeatureTileTracker.h:215
const boost::shared_ptr< Trackable > myTrackable
Definition: unusedFeatureTileTracker.h:244
tbb::atomic< double > myMinUnusedTime
Definition: unusedFeatureTileTracker.h:131
virtual void load()=0
Called when the sentinel is created.
static bool UnloadTryCatch(Trackable &)
Call unload, catch exceptions and print errors.
Mutex myMutex
Definition: unusedFeatureTileTracker.h:124
virtual unsigned size() const =0
Size of data stored in this object. This value is in no particular units, it is only compared to to t...
tbb::tick_count myUnusedTime
time at which object became unused
Definition: unusedFeatureTileTracker.h:225
TrackableList myUnused
Definition: unusedFeatureTileTracker.h:125
void print(double **a, int r, int c, char *str)