CARMA C++
carma::control::AgingPolicy Class Reference

Class to describe an aging policy and associated methods for adding and removing files from it. More...

#include <carma/control/AgingPolicy.h>

Public Member Functions

 AgingPolicy (const std::string &directory,::boost::posix_time::time_duration interval, int intervalDays, int intervalWeeks, int intervalMonths, int durationDays, int durationMonths, int durationYears)
 
bool frameIsInPolicy (carma::util::frameType frame) const
 
std::string getDirectory () const
 
std::string getFilenameForFrame (const carma::util::frameType frame) const
 
void handleCandidate (const FileTimeMap::value_type candidate, AgingPolicy &previousPolicy, StateManager &manager)
 
FileTimeMap reapAgedCandidates ()
 
boost::posix_time::ptime subtractTotalDuration (const boost::posix_time::ptime &to) const
 
boost::posix_time::ptime subtractTotalInterval (const boost::posix_time::ptime &to) const
 
void syncToTime (const boost::posix_time::ptime &policyEndDate)
 

Detailed Description

Class to describe an aging policy and associated methods for adding and removing files from it.

A policy is defined by a time interval and duration. The interval defines the desired time resolution of files within the policy and the duration defines how long the policy should be applied. A policy is complete only when it is defined in relation to other policies via a policy chain. Files are aged out of policies and become candidates for inclusion into the next adjacent policy in the chain. An obvious side effect of this is that the interval of the first policy and the duration of the last policy don't apply and aren't used. There are holes in the way this all works - notably I don't exhaustively attempt to pair a candidate with every possible open slot in subsequent policies. Rather a file aged from a policy is a candidate for inclusion into the first open slots of the next policy only. This is fair since this program both produces the state files and ages them (e.g they are always both running together). Another weakness is that I don't attempt to validate policies relative to one another, thus one could easily define policies in a way that would starve subsequent policies - this case is left to the user's good common sense. Finally I could automatically name the associated directories but have put this on the backburner for now.

Definition at line 44 of file AgingPolicy.h.


The documentation for this class was generated from the following file: