CFileAcquisitionComp.h
Go to the documentation of this file.
1 #ifndef iqtcam_CFileAcquisitionComp_included
2 #define iqtcam_CFileAcquisitionComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QDir>
7 #include <QtCore/QStringList>
8 #include <QtCore/QMutex>
9 
10 // ACF includes
11 #include <ifile/IFilePersistence.h>
12 #include <ifile/IFileNameParam.h>
13 #include <ilog/TLoggerCompWrap.h>
15 
16 // ACF-Solutions includes
18 
19 #include <iqtcam/iqtcam.h>
20 
21 
22 namespace iqtcam
23 {
24 
25 
31  virtual public iproc::TSyncProcessorWrap<icam::IBitmapAcquisition>
32 {
33 public:
35 
36  I_BEGIN_COMPONENT(CFileAcquisitionComp);
37  I_REGISTER_INTERFACE(iproc::IProcessor);
38  I_REGISTER_INTERFACE(icam::IBitmapAcquisition);
39  I_ASSIGN(m_bitmapLoaderCompPtr, "BitmapLoader", "Load bitmap from file", true, "BitmapLoader");
40  I_ASSIGN(m_defaultDirAttrPtr, "DefaultDir", "Default directory or image file path, that will be used if no parameters are specified", true, ".");
41  I_ASSIGN(m_defaultPathParamCompPtr, "DefaultPathParam", "Path of file or directory will be used if no parameters are specified in paramter set", false, "DefaultDirParam");
42  I_ASSIGN(m_pathParamIdAttrPtr, "DirParamId", "Id used to get directory parameter (ifile::IFileNameParam)", true, "FileBitmapAcquisition");
43  I_ASSIGN(m_maxCachedDirectoriesAttrPtr, "MaxCachedDirs", "Maximum number of cached directories", true, 10);
44  I_ASSIGN(m_lastFileNameCompPtr, "LastFileName", "Stores last processed file name here if set", false, "LastFileName");
45  I_ASSIGN(m_acceptedFileNamePatternAttrPtr, "AcceptedFileNamePattern", "Text pattern to be matched for file acceptance", false, "");
46  I_END_COMPONENT;
47 
49 
50  // reimplemented (iproc::IProcessor)
51  virtual int DoProcessing(
52  const iprm::IParamsSet* paramsPtr,
53  const istd::IPolymorphic* inputPtr,
54  istd::IChangeable* outputPtr,
55  ibase::IProgressManager* progressManagerPtr = NULL);
56 
57  // reimplemented (icam::IBitmapAcquisition)
58  virtual istd::CIndex2d GetBitmapSize(const iprm::IParamsSet* paramsPtr) const;
59 
60  // reimplemented (ilog::CLoggerComponentBase)
61  virtual void OnComponentCreated();
62 
63 protected:
64  struct ParamsInfo
65  {
66  ParamsInfo();
67 
68  QStringList files;
69  QStringList::Iterator filesIter;
70  quint32 idStamp;
71  };
72 
73  typedef QMap<QString, ParamsInfo> DirInfos;
75 
76  quint32 m_lastIdStamp;
77 
79 
80  mutable QMutex m_lock;
81 
82 private:
83  I_REF(ifile::IFilePersistence, m_bitmapLoaderCompPtr);
84  I_REF(ifile::IFileNameParam, m_defaultPathParamCompPtr);
85  I_REF(ifile::IFileNameParam, m_lastFileNameCompPtr);
86  I_ATTR(QString, m_defaultDirAttrPtr);
87  I_ATTR(QByteArray, m_pathParamIdAttrPtr);
88  I_ATTR(int, m_maxCachedDirectoriesAttrPtr);
89  I_ATTR(QString, m_acceptedFileNamePatternAttrPtr);
90 };
91 
92 
93 } // namespace iqtcam
94 
95 
96 #endif // !iqtcam_CFileAcquisitionComp_included
97 
98 
Bitmap loader component implementing interface icam::IBitmapAcquisition over ifile::IFilePersistence...
Bitmap acquisition processor.
Wrapper of iproc::IProcessor for simple synchrone processor implementations.
virtual void OnComponentCreated()
ilog::CLoggerComponentBase BaseClass
QMap< QString, ParamsInfo > DirInfos
virtual istd::CIndex2d GetBitmapSize(const iprm::IParamsSet *paramsPtr) const
Get size of acquired bitmap for specified parameters.
virtual int DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)
Do synchronized processing.
Interface for all synchrone and asynchrone processors with "push data" model.
Definition: IProcessor.h:24

© 2007-2017 Witold Gantzke and Kirill Lepskiy