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 namespace std;
00012 using boost::weak_ptr;
00013 using boost::shared_ptr;
00014
00015 namespace SctCalibrationController {
00016
00017 class Sequence;
00018
00019 class SequenceMap : boost::noncopyable {
00020 public:
00021 static SequenceMap& instance() throw();
00022
00023 weak_ptr<Sequence> getSequence(const string& name) throw();
00024 void addSequence(shared_ptr<Sequence> sequence) throw();
00025
00026 private:
00027 SequenceMap() throw();
00028
00029 struct SequenceMapData {
00030 SequenceMapData() throw();
00031 shared_ptr<Sequence> sequence;
00032 time_t created;
00033 time_t lastRequested;
00034 };
00035 typedef map<string, SequenceMapData> DataMap;
00036
00037 DataMap map;
00038
00039 void purge() throw();
00040 void remove(DataMap::iterator& i) throw();
00041 };
00042
00043 }
00044
00045 #endif //SEQUENCEMAP_H