00001
00002 #ifndef SENDS_FRAME_LOC_HH
00003 #define SENDS_FRAME_LOC_HH
00004
00005 #include <string>
00006 #include <iosfwd>
00007
00008 namespace sends {
00009
00024 class frame_loc {
00025 public:
00026
00029 typedef unsigned long gps_type;
00030
00033 enum arch_type {
00034 kOnline,
00035 kCache,
00036 kArchive,
00037 kOffline
00038 };
00039
00042 enum driver_type {
00043 kLocal,
00044 kSamQfs,
00045 kSends,
00046 kShared,
00047 kUnknown
00048 };
00049 public:
00060 frame_loc(const std::string& location, const std::string& prefix,
00061 gps_type start, gps_type stop, gps_type dT,
00062 arch_type type, driver_type driv=kUnknown);
00063
00067 ~frame_loc(void);
00068
00073 arch_type archive(void) const;
00074
00079 driver_type driver(void) const;
00080
00086 std::ostream& dump(std::ostream& out) const;
00087
00093 gps_type frame_end(gps_type t) const;
00094
00104 std::string frame_path(gps_type gps) const;
00105
00111 gps_type frame_start(gps_type t) const;
00112
00117 gps_type gps_end(void) const;
00118
00123 gps_type gps_start(void) const;
00124
00131 bool in_range(gps_type gps) const;
00132
00136 const std::string& prefix(void) const;
00137
00140 gps_type start(void) const;
00141
00144 gps_type stop(void) const;
00145
00146 private:
00147 std::string mLocation;
00148 std::string mPrefix;
00149 gps_type mStart;
00150 gps_type mStop;
00151 gps_type mDuration;
00152 arch_type mType;
00153 driver_type mDriver;
00154 };
00155
00156
00157 inline frame_loc::arch_type
00158 frame_loc::archive(void) const {
00159 return mType;
00160 }
00161
00162 inline frame_loc::driver_type
00163 frame_loc::driver(void) const {
00164 return mDriver;
00165 }
00166
00167 inline frame_loc::gps_type
00168 frame_loc::frame_end(gps_type t) const {
00169 gps_type end = frame_start(t) + mDuration;
00170 if (end > mStop) end = mStop;
00171 return end;
00172 }
00173
00174 inline frame_loc::gps_type
00175 frame_loc::frame_start(gps_type t) const {
00176 return t - (t - mStart)%mDuration;
00177 }
00178
00179 inline frame_loc::gps_type
00180 frame_loc::gps_end(void) const {
00181 return mStop;
00182 }
00183
00184 inline frame_loc::gps_type
00185 frame_loc::gps_start(void) const {
00186 return mStart;
00187 }
00188
00189 inline bool
00190 frame_loc::in_range(gps_type gps) const {
00191 return gps >= mStart && gps < mStop;
00192 }
00193
00194 inline const std::string&
00195 frame_loc::prefix(void) const {
00196 return mPrefix;
00197 }
00198
00199 inline frame_loc::gps_type
00200 frame_loc::start(void) const {
00201 return mStart;
00202 }
00203
00204 inline frame_loc::gps_type
00205 frame_loc::stop(void) const {
00206 return mStop;
00207 }
00208
00209 }
00210
00211 #endif // !defined(SENDS_FRAME_LOC_HH)