1 #ifndef CARMA_CONTROL_AGINGPOLICY_H
2 #define CARMA_CONTROL_AGINGPOLICY_H
6 #include <boost/date_time/gregorian/gregorian_types.hpp>
7 #include <boost/date_time/posix_time/posix_time.hpp>
19 typedef std::map< boost::posix_time::ptime, std::string > FileTimeMap;
20 typedef FileTimeMap::iterator FileTimeMapIter;
21 typedef FileTimeMap::const_iterator FileTimeMapConstIter;
48 ::boost::posix_time::time_duration interval,
49 int intervalDays,
int intervalWeeks,
int intervalMonths,
50 int durationDays,
int durationMonths,
int durationYears );
52 std::string getDirectory( )
const;
55 void syncToTime(
const boost::posix_time::ptime & policyEndDate );
60 FileTimeMap reapAgedCandidates( );
65 handleCandidate(
const FileTimeMap::value_type candidate,
67 StateManager & manager );
69 boost::posix_time::ptime
70 subtractTotalDuration(
const boost::posix_time::ptime & to )
const;
72 boost::posix_time::ptime
73 subtractTotalInterval(
const boost::posix_time::ptime & to )
const;
83 typedef std::vector<boost::posix_time::time_period> TimeSlots;
84 void updateFirstOpenTimeSlots( );
86 void traceDeletion(
const FileTimeMap::value_type & candidate,
88 const std::string & spiel );
90 void traceOpenTimeSlots( );
92 void removeFileFromPolicy( FileTimeMap::value_type entry,
93 StateManager & manager );
95 std::string directory_;
96 boost::posix_time::time_duration interval_;
97 boost::gregorian::days intervalDays_;
98 boost::gregorian::weeks intervalWeeks_;
99 boost::gregorian::months intervalMonths_;
100 boost::gregorian::days durationDays_;
101 boost::gregorian::months durationMonths_;
102 boost::gregorian::years durationYears_;
104 FileTimeMap fileTimeMap_;
105 TimeSlots openTimeSlots_;
106 boost::posix_time::ptime policyStartDate_;
107 boost::posix_time::ptime policyEndDate_;
108 boost::posix_time::time_period policyPeriod_;
112 typedef std::vector< AgingPolicy > PolicyChain;
114 PolicyChain createAgingPolicyChain(
const std::string & dirname );
116 std::string retrieveFilenameForFrame(
const PolicyChain & policies,
unsigned int frameType
Half second frames since Jan 1, 2000.
Class to describe an aging policy and associated methods for adding and removing files from it...
Various type definitions for util classes.