TImageParamProcessorCompBase.h
Go to the documentation of this file.
1 #ifndef iipr_TImageParamProcessorCompBase_included
2 #define iipr_TImageParamProcessorCompBase_included
3 
4 
5 // ACF includes
6 #include "iprm/TParamsPtr.h"
7 
8 // ACF-Solutions includes
10 
11 
12 namespace iipr
13 {
14 
15 
19 template <class ParameterType>
21 {
22 public:
24 
25  I_BEGIN_BASE_COMPONENT(TImageParamProcessorCompBase);
26  I_ASSIGN(m_paramsIdAttrPtr, "ParamsId", "ID of processor parameters in the parameter set", false, "ParamsId");
27  I_END_COMPONENT;
28 
29 protected:
30  // reimplemented (iipr::CImageProcessorCompBase)
31  virtual bool ProcessImage(
32  const iprm::IParamsSet* paramsPtr,
33  const iimg::IBitmap& inputImage,
34  iimg::IBitmap& outputImage);
35 
36  // abstract methods
43  virtual bool ParamProcessImage(
44  const ParameterType* parameterPtr,
45  const iimg::IBitmap& inputImage,
46  iimg::IBitmap& outputImage) = 0;
47 
48 private:
49  I_ATTR(QByteArray, m_paramsIdAttrPtr);
50 };
51 
52 
53 // public methods
54 
55 // reimplemented (iipr::CImageProcessorCompBase)
56 
57 template <class ParameterType>
59  const iprm::IParamsSet* paramsPtr,
60  const iimg::IBitmap& inputImage,
61  iimg::IBitmap& outputImage)
62 {
63  iprm::TParamsPtr<ParameterType> processorParamsPtr;
64  if ((paramsPtr != NULL) && m_paramsIdAttrPtr.IsValid()){
65  processorParamsPtr.Init(paramsPtr, *m_paramsIdAttrPtr);
66  }
67 
68  // do image processing:
69  return ParamProcessImage(processorParamsPtr.GetPtr(), inputImage, outputImage);
70 }
71 
72 
73 } // namespace iipr
74 
75 
76 #endif // !iipr_TImageParamProcessorCompBase_included
77 
virtual bool ParamProcessImage(const ParameterType *parameterPtr, const iimg::IBitmap &inputImage, iimg::IBitmap &outputImage)=0
Do image processing with some (optional) parameter set.
Basic implementation for a simple bitmap processor.
const ParameterInterace * GetPtr() const
#define NULL
virtual bool ProcessImage(const iprm::IParamsSet *paramsPtr, const iimg::IBitmap &inputImage, iimg::IBitmap &outputImage)
Basic implementation for a simple bitmap processor.
void Init(const IParamsSet *parameterSetPtr, const QByteArray &parameterId, bool isObligatory=true)

© 2007-2011 Witold Gantzke and Kirill Lepskiy