Timeline.h
Go to the documentation of this file.
1 // Copyright (c) 2016 Digital Barriers
4 
5 #pragma once
6 
7 #include <string>
8 #include <vector>
9 #include "EdgeVisSDK.h"
10 #include "OpResult.h"
11 #include "TimelineEntryFlags.h"
12 
20 namespace EdgeVisDecoderSDK
21 {
22  class ITimelineWatcher
23  {
24  public:
30  virtual void TimelineUpdated(
31  TimelineEntryFlags resolution,
32  OpResult result
33  ) = 0;
34  };
35 
49  class Timeline
50  {
51  public:
52  typedef std::vector< int64_t > TimesList;
53  typedef TimesList::const_iterator TimesListIterator;
54  typedef std::pair< TimesListIterator, TimesListIterator > TimesIteratorPair;
55 
56  public:
57  DB_EDGEVIS_SDK Timeline();
58  DB_EDGEVIS_SDK virtual ~Timeline();
59 
60  void Reset();
61 
69  void RegisterWatcher(ITimelineWatcher* watcher);
70 
77  void UnRegisterWatcher(ITimelineWatcher* watcher);
78 
85  std::wstring Timezone() const;
86 
91  void Timezone(const std::wstring& tz);
92 
93 
101  void Insert(const TimesList& times, TimelineEntryFlags resolution);
102 
110  DB_EDGEVIS_SDK size_t CountDays() const;
111 
117  DB_EDGEVIS_SDK size_t CountHours() const;
118 
124  DB_EDGEVIS_SDK size_t CountMins() const;
125 
133  DB_EDGEVIS_SDK TimesIteratorPair Days() const;
134 
142  DB_EDGEVIS_SDK TimesIteratorPair Hours() const;
143 
151  DB_EDGEVIS_SDK TimesIteratorPair Mins() const;
152 
159  DB_EDGEVIS_SDK TimesList DaysList() const;
160 
167  DB_EDGEVIS_SDK TimesList HoursList() const;
168 
175  DB_EDGEVIS_SDK TimesList MinsList() const;
176 
183  DB_EDGEVIS_SDK int64_t FirstDay() const;
184 
191  DB_EDGEVIS_SDK int64_t LastDay() const;
192 
200  DB_EDGEVIS_SDK int64_t FirstHour() const;
201 
208  DB_EDGEVIS_SDK int64_t LastHour() const;
209 
216  DB_EDGEVIS_SDK int64_t FirstMin() const;
217 
224  DB_EDGEVIS_SDK int64_t LastMin() const;
225 
226 
232  DB_EDGEVIS_SDK static int64_t CurrentTimeUTC();
233 
234  private:
235  TimesList* GetListPtr(TimelineEntryFlags resolution);
236 
237  inline void DoInsertTimes(const TimesList& times, TimelineEntryFlags resolution);
238  inline void OnTimelineUpdated(TimelineEntryFlags resolution, OpResult result);
239 
240  private:
241  TimesList m_daysTimeline;
242  TimesList m_hoursTimeline;
243  TimesList m_minsTimeline;
244 
245  std::wstring m_timezone;
246  bool m_requiresConversion;
247 
248  typedef std::vector< ITimelineWatcher* > WatchersList;
249  WatchersList m_listeners;
250  };
251 }
TimelineEntryFlags
This contains values representing the type of timeline entry.
Definition: TimelineEntryFlags.h:21
This contains lists of days, hours and minutes that the archive holds footage for.
Definition: Timeline.h:49
The EdgeVis Decoder SDK namespace.
OpResult
Result of an operation.
Definition: OpResult.h:25