CHotfolderStatistics.h
Go to the documentation of this file.
1 #ifndef ihotf_CHotfolderStatistics_included
2 #define ihotf_CHotfolderStatistics_included
3 
4 
5 // Qt includes
6 #include <QtCore/QMap>
7 
8 // ACF includes
10 
11 // AcfSln includes
14 
15 
16 namespace ihotf
17 {
18 
19 
25  virtual public ihotf::IHotfolderStatistics,
26  public imod::TSingleModelObserverBase<ihotf::IHotfolderProcessingInfo>
27 {
28 public:
30 
32 
33  // reimplemented (ihotf::IHotfolderStatistics)
34  virtual int GetItemsCount(const QString& directoryPath = QString()) const;
35  virtual int GetSuccessCount(const QString& directoryPath = QString()) const;
36  virtual int GetErrorsCount(const QString& directoryPath = QString()) const;
37  virtual int GetAbortedCount(const QString& directoryPath = QString()) const;
38  virtual double GetProcessingTime(const QString& directoryPath = QString()) const;
39 
40  // reimplemented (imod::TSingleModelObserverBase)
41  virtual void OnUpdate(int updateFlags, istd::IPolymorphic* updateParamsPtr);
42 
43  // reimplemented (imod::IObserver)
44  virtual bool OnAttached(imod::IModel* modelPtr);
45 
46  // reimplemented (iser::ISerializable)
47  virtual bool Serialize(iser::IArchive& archive);
48 
49 protected:
50  void ResetStatistics();
51  void RebuildStatistics();
52  void UpdateStateMaps(int itemState, const QString& directoryPath);
53  static QString GetDirectoryPath(const ihotf::IHotfolderProcessingItem& item);
54 
55 private:
56  typedef QMap<QString, int> CounterMap;
57  CounterMap m_itemsCount;
58  CounterMap m_successCount;
59  CounterMap m_errorsCount;
60  CounterMap m_abortedCount;
61 
62  typedef QMap<QString, double> ProcessingTimeMap;
63  ProcessingTimeMap m_processingTimeMap;
64 };
65 
66 
67 } // namespace ihotf
68 
69 
70 #endif // !ihotf_CHotfolderStatistics_included
71 
72 
Interface for a single processing item in the hotfolder.
virtual void OnUpdate(int updateFlags, istd::IPolymorphic *updateParamsPtr)
virtual double GetProcessingTime(const QString &directoryPath=QString()) const
void UpdateStateMaps(int itemState, const QString &directoryPath)
virtual int GetAbortedCount(const QString &directoryPath=QString()) const
Interface for a simple static of the hotfolder processing.
Standard implementation if the IHotfolderStatistics interface.
virtual int GetSuccessCount(const QString &directoryPath=QString()) const
static QString GetDirectoryPath(const ihotf::IHotfolderProcessingItem &item)
imod::TSingleModelObserverBase< ihotf::IHotfolderProcessingInfo > BaseClass
virtual int GetErrorsCount(const QString &directoryPath=QString()) const
virtual bool Serialize(iser::IArchive &archive)
virtual bool OnAttached(imod::IModel *modelPtr)
virtual int GetItemsCount(const QString &directoryPath=QString()) const

© 2007-2011 Witold Gantzke and Kirill Lepskiy