CProcessedBitmapSupplierComp.h
Go to the documentation of this file.
1 #ifndef iipr_CProcessedBitmapSupplierComp_included
2 #define iipr_CProcessedBitmapSupplierComp_included
3 
4 
5 // ACF includes
7 #include <iimg/IBitmapProvider.h>
8 
9 // ACF-Solutions includes
10 #include <iproc/IProcessor.h>
11 #include <iinsp/ISupplier.h>
13 
14 
15 namespace iipr
16 {
17 
18 
25  public iinsp::TSupplierCompWrap<istd::TDelPtr<iimg::IBitmap> >,
26  virtual public iimg::IBitmapProvider,
27  virtual public i2d::ICalibrationProvider
28 {
29 public:
31 
32  I_BEGIN_BASE_COMPONENT(CProcessedBitmapSupplierBase);
33  I_REGISTER_INTERFACE(iimg::IBitmapProvider);
34  I_REGISTER_INTERFACE(i2d::ICalibrationProvider);
35  I_ASSIGN(m_bitmapProviderCompPtr, "BitmapProvider", "Provide input image", true, "BitmapProvider");
36  I_ASSIGN_TO(m_bitmapSupplierCompPtr, m_bitmapProviderCompPtr, false);
37  I_ASSIGN_TO(m_bitmapProviderModelCompPtr, m_bitmapProviderCompPtr, false);
38  I_ASSIGN(m_inputBitmapCalibrationProviderCompPtr, "InputBitmapCalibrationProvider", "Provide the the calibration of the input image", false, "InputBitmapCalibrationProvider");
39  I_ASSIGN_TO(m_inputBitmapCalibrationSupplierCompPtr, m_inputBitmapCalibrationProviderCompPtr, false);
40  I_ASSIGN_TO(m_inputBitmapCalibrationProviderModelCompPtr, m_inputBitmapCalibrationProviderCompPtr, false);
41  I_ASSIGN(m_imageProcessorCompPtr, "BitmapProcessor", "Bitmap conversion processor (takes bitmap as input and output)", true, "BitmapProcessor");
42  I_ASSIGN(m_outputBitmapCalibrationCompPtr, "OutputBitmapCalibration", "Resulting calibration of the processor output", false, "OutputBitmapCalibration");
43  I_END_COMPONENT;
44 
45  // reimplemented (i2d::ICalibrationProvider)
46  virtual const i2d::ICalibration2d* GetCalibration() const;
47 
48  // reimplemented (iimg::IBitmapProvider)
49  virtual const iimg::IBitmap* GetBitmap() const;
50 
51 protected:
52  bool EnsureBitmapCreated(ProductType& result) const;
53 
57  virtual iproc::IProcessor* GetImageProcessor() const;
58 
59  // reimplemented (iinsp::TSupplierCompWrap)
60  virtual int ProduceObject(ProductType& result) const;
61 
62  // reimplemented (icomp::CComponentBase)
63  virtual void OnComponentCreated();
64  virtual void OnComponentDestroyed();
65 
66  // abstract methods
67  virtual iimg::IBitmap* CreateBitmap() const = 0;
68 
69 private:
70  I_REF(iimg::IBitmapProvider, m_bitmapProviderCompPtr);
71  I_REF(iinsp::ISupplier, m_bitmapSupplierCompPtr);
72  I_REF(imod::IModel, m_bitmapProviderModelCompPtr);
73 
74  I_REF(i2d::ICalibrationProvider, m_inputBitmapCalibrationProviderCompPtr);
75  I_REF(iinsp::ISupplier, m_inputBitmapCalibrationSupplierCompPtr);
76  I_REF(imod::IModel, m_inputBitmapCalibrationProviderModelCompPtr);
77 
78  I_REF(i2d::ICalibration2d, m_outputBitmapCalibrationCompPtr);
79 
80  I_REF(iproc::IProcessor, m_imageProcessorCompPtr);
81 };
82 
83 
85 {
86 public:
88 
89  I_BEGIN_COMPONENT(CProcessedBitmapSupplierComp);
90  I_ASSIGN(m_bitmapCompFact, "BitmapFactory", "Use to create bitmap object", true, "BitmapFactory");
91  I_END_COMPONENT;
92 
93 protected:
94  // reimplemented (CProcessedBitmapSupplierBase)
95  virtual iimg::IBitmap* CreateBitmap() const
96  {
97  if (!m_bitmapCompFact.IsValid()){
98  return NULL;
99  }
100 
101  return m_bitmapCompFact.CreateInstance();
102  }
103 
104 private:
105  I_FACT(iimg::IBitmap, m_bitmapCompFact);
106 };
107 
108 
109 } // namespace iipr
110 
111 
112 #endif // !iipr_CProcessedBitmapSupplierComp_included
113 
114 
Image supplier providing processed image from some other input image supplier.
iinsp::TSupplierCompWrap< istd::TDelPtr< iimg::IBitmap > > BaseClass
virtual const i2d::ICalibration2d * GetCalibration() const
Standard implementation of interface iinsp::ISupplier with preparation for component implementation...
bool EnsureBitmapCreated(ProductType &result) const
virtual iimg::IBitmap * CreateBitmap() const =0
virtual const iimg::IBitmap * GetBitmap() const
virtual iimg::IBitmap * CreateBitmap() const
#define NULL
Base interface for suppliers providing calculating of objects on demand ("pull data" model)...
Definition: ISupplier.h:22
Interface for all synchrone and asynchrone processors with "push data" model.
Definition: IProcessor.h:24
virtual iproc::IProcessor * GetImageProcessor() const
Get access to the image processor used for process the input bitmap.
virtual int ProduceObject(ProductType &result) const
Produce single object.

© 2007-2017 Witold Gantzke and Kirill Lepskiy