14 #include <tbb/spin_rw_mutex.h>
15 #include <tbb/tick_count.h>
18 #include <boost/optional.hpp>
19 #include <boost/noncopyable.hpp>
28 namespace MAKVRinTerra
41 #ifdef DtObjectDebugger_Enable
49 typedef std::shared_ptr<DtUnusedFeatureTileTracker>
Ptr;
50 typedef std::weak_ptr<DtUnusedFeatureTileTracker>
WeakPtr;
59 const std::string& name =
"tracker");
72 unsigned size()
const;
75 unsigned totalLength()
const;
78 void setMaxSize(
unsigned max);
81 unsigned maxSize()
const;
84 void setMinUnusedTime(
double);
87 double minUnusedTime()
const;
90 unsigned long unloadUntilSize(
unsigned maxSize,
double minTime);
91 unsigned long unloadUntilSize(
unsigned maxSize);
94 void addSubtracker(
const Ptr& subtracker);
97 void info(std::ostream&)
const;
100 void print(std::ostream&)
const;
110 bool add(
const std::shared_ptr<Trackable>&);
143 :
private boost::noncopyable
144 #ifdef DtObjectDebugger_Enable
156 virtual std::string
label()
const = 0;
159 virtual void load() = 0;
162 virtual bool unload() = 0;
165 virtual bool loading()
const = 0;
168 virtual bool loaded()
const = 0;
173 virtual unsigned size()
const = 0;
180 virtual std::shared_ptr<Trackable>
getPtr()
const = 0;
184 std::shared_ptr<Sentinel>
getSentinel(
bool loadIfNotPresent=
true)
const;
226 :
private boost::noncopyable
227 #ifdef DtObjectDebugger_Enable
232 typedef std::shared_ptr<Sentinel>
Ptr;
239 explicit Sentinel(
const std::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:52
std::unique_ptr< std::thread > myPageOutThread
Definition: unusedFeatureTileTracker.h:125
tbb::spin_rw_mutex Mutex
Definition: unusedFeatureTileTracker.h:105
unsigned useCount() const
Number of references to the sentinel in existence.
const DtUnusedFeatureTileTracker::WeakPtr myTracker
Definition: unusedFeatureTileTracker.h:214
Definition: unusedFeatureTileTracker.h:225
Trackable(const DtUnusedFeatureTileTracker::Ptr &)
std::shared_ptr< DtUnusedFeatureTileTracker > Ptr
Definition: unusedFeatureTileTracker.h:49
Tracks objects so they can be deleted at a later time.
Definition: unusedFeatureTileTracker.h:40
TrackableList::iterator iterator() const
Definition: unusedFeatureTileTracker.h:210
voidpf void uLong size
Definition: ioapi.h:39
std::unique_ptr< DtConsoleCommandManager > myCommandManager
Definition: unusedFeatureTileTracker.h:137
std::shared_ptr< Trackable > TrackablePtr
Definition: unusedFeatureTileTracker.h:51
std::unique_ptr< DtConsoleCommandOwner > myCommandOwner
Definition: unusedFeatureTileTracker.h:138
#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
std::shared_ptr< Sentinel > Ptr
Definition: unusedFeatureTileTracker.h:232
boost::optional< TrackableList::iterator > myIterator
Definition: unusedFeatureTileTracker.h:218
This is a class which maintains a list of string command names and the callback functions that are to...
Definition: consoleCommandManager.h:56
std::weak_ptr< DtUnusedFeatureTileTracker > WeakPtr
Definition: unusedFeatureTileTracker.h:50
std::weak_ptr< Sentinel > mySentinel
weak ptr to sentinel otherwise it would never be destroyed
Definition: unusedFeatureTileTracker.h:217
virtual bool unload()=0
Called by the tracker when it's time to unload.
virtual std::shared_ptr< Trackable > getPtr() const =0
Trackable must be managed by a shared pointer, std::enable_shared_from_this is encouraged for use in ...
void print(double **a, int r, int c, const char *str)
std::vector< Ptr > SubTrackerList
clear on exit
Definition: unusedFeatureTileTracker.h:131
Mixin interface for classes which wish to be tracked.
Definition: unusedFeatureTileTracker.h:142
virtual bool loading() const =0
Has this set been requested to load.
Sentinel(const std::shared_ptr< Trackable > &)
const std::shared_ptr< Trackable > myTrackable
Definition: unusedFeatureTileTracker.h:241
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:124
A utility class for use with DtConsoleCommandManager. This class takes ownership of an arbitrary numb...
Definition: consoleCommandManager.h:168
Mutex myTotalListMutex
Definition: unusedFeatureTileTracker.h:134
virtual std::string label() const =0
Only used for output, won't change operation.
std::list< Trackable * > TrackableRawPtrList
Definition: unusedFeatureTileTracker.h:53
bool notInList() const
keeps an iterator to itself in the unused list so we can quickly remove
Definition: unusedFeatureTileTracker.h:209
tbb::spin_rw_mutex Mutex
Definition: unusedFeatureTileTracker.h:203
tbb::tick_count unusedTime() const
Time at which object became unused.
TrackableRawPtrList myTrackables
Definition: unusedFeatureTileTracker.h:135
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.
boost::optional< TrackableRawPtrList::iterator > myTrackableListIterator
Definition: unusedFeatureTileTracker.h:219
std::atomic< double > myMinUnusedTime
Definition: unusedFeatureTileTracker.h:128
SubTrackerList mySubtrackers
Definition: unusedFeatureTileTracker.h:132
Mutex myMutex
Definition: unusedFeatureTileTracker.h:212
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:121
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...
std::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...
std::atomic< unsigned > myMaxSize
Definition: unusedFeatureTileTracker.h:127
tbb::tick_count myUnusedTime
time at which object became unused
Definition: unusedFeatureTileTracker.h:222
TrackableList myUnused
Definition: unusedFeatureTileTracker.h:122