00001 /* 00002 Copyright (C) 2010 - 2014 Christoph Haenisch 00003 00004 Chair of Medical Engineering (mediTEC) 00005 RWTH Aachen University 00006 Pauwelsstr. 20 00007 52074 Aachen 00008 Germany 00009 00010 See license.txt for more information. 00011 00012 Version 0.3.0 (2014-07-01) 00013 */ 00014 00020 #ifndef TIMESTAMP_HPP_4765312314 00021 #define TIMESTAMP_HPP_4765312314 00022 00023 #include <ctime> 00024 #include <map> 00025 #include <set> 00026 #include <string> 00027 00028 00029 namespace TRTK 00030 { 00031 00032 00194 class Timestamp 00195 { 00196 public: 00197 Timestamp(); 00198 virtual ~Timestamp(); 00199 00200 class ObjectInfo; 00201 ObjectInfo & operator[](const std::string & object); 00202 00203 private: 00204 std::map<std::string, ObjectInfo> objects; 00205 }; 00206 00207 00215 class Timestamp::ObjectInfo 00216 { 00217 public: 00218 ObjectInfo(); 00219 ObjectInfo(Timestamp & parent_collection); 00220 virtual ~ObjectInfo(); 00221 00222 void addDependency(const std::string & object_name); 00223 void removeDependency(const std::string & object_name); 00224 00225 bool dependenciesHaveChanged() const; 00226 bool dependencyHasChanged(const std::string & other_object) const; 00227 bool isMoreRecentThan(const std::string & object, bool dependencies = true) const; 00228 void update(); 00229 00230 private: 00231 bool dependenciesUpToDate(const clock_t &) const; 00232 00233 Timestamp & parent_collection; // contains all InfoObjects (that is the other dependencies) 00234 clock_t timestamp; 00235 std::set<std::string> dependencies; 00236 }; 00237 00238 00239 } // namespace TRTK 00240 00241 00242 #endif // TIMESTAMP_HPP_4765312314
Documentation generated by Doxygen