Smart

The following functions provide a convenient way for managing IDisposable instances lifecycle via the smart pointers of the C++ standard library. These functions should be called immediately after creating the instance to avoid both raw and smart pointers around at the same time. When the smart pointer is destroyed, the IDisposable::Dispose method of the IDisposable interface is automatically called.

{
  // here the system instance is created and passed to a smart pointer
  Itala::SystemPtr pSystem = Itala::SmartAssign(Itala::CreateSystem());
} // here the system instance is automatically disposed as the pointer goes out of scope

Note that this header is just a quick helper completely editable by the user. Feel free to introduce improvements or entirely swap the smart pointer implementation with a different one (e.g. Boost).

Warning

When a IDisposable instance is owned by a smart pointer, its IDisposable::Dispose method must NEVER be called manually!

namespace Itala

Typedefs

typedef std::shared_ptr<ISystem> SystemPtr
typedef std::shared_ptr<IDevice> DevicePtr
typedef std::shared_ptr<IImage> ImagePtr

Functions

inline SystemPtr SmartAssign(ISystem *pSystem)
inline DevicePtr SmartAssign(IDevice *pDevice)
inline ImagePtr SmartAssign(IImage *pImage)
inline SmartPolarComponents SmartAssign(PolarComponents polarComponents)
inline SmartPolarComponentsColor SmartAssign(PolarComponentsColor &polarComponentsColor)
inline SmartStokesVectors SmartAssign(StokesVectors stokesVector)
struct SmartPolarComponents

Public Functions

inline operator PolarComponents() const

Public Members

ImagePtr P0
ImagePtr P45
ImagePtr P90
ImagePtr P135
struct SmartPolarComponentsColor

Public Functions

inline operator PolarComponentsColor() const

Public Members

SmartPolarComponents RedComponents
SmartPolarComponents GreenComponents
SmartPolarComponents BlueComponents
struct SmartStokesVectors

Public Functions

inline operator StokesVectors() const

Public Members

ImagePtr S0
ImagePtr S1
ImagePtr S2