00001 #ifndef SEQUENCEMAP_H
00002 #define SEQUENCEMAP_H
00003
00004 #include <boost/utility.hpp>
00005 #include <boost/weak_ptr.hpp>
00006 #include <boost/shared_ptr.hpp>
00007 #include <ctime>
00008 #include <map>
00009 #include <string>
00010
00011 using boost::weak_ptr;
00012 using boost::shared_ptr;
00013
00014 namespace SctCalibrationController {
00015
00016 class Sequence;
00017
00018 class SequenceMap : boost::noncopyable {
00019 public:
00020 static SequenceMap& instance() throw();
00021
00022 weak_ptr<Sequence> getSequence(const std::string& name) throw();
00023 void addSequence(shared_ptr<Sequence> sequence) throw();
00024
00025 private:
00026 SequenceMap() throw();
00027
00028 struct SequenceMapData {
00029 SequenceMapData() throw();
00030 shared_ptr<Sequence> sequence;
00031 time_t created;
00032 time_t lastRequested;
00033 };
00034 typedef std::map<std::string, SequenceMapData> DataMap;
00035
00036 DataMap map;
00037
00038 void purge() throw();
00039 void remove(DataMap::iterator& i) throw();
00040 };
00041
00042 }
00043
00044 #endif //SEQUENCEMAP_H