Optional

Description

This template is used to wrap inputs, which are optional. That means, one can pass atl::NIL as optional input, if there is no need to define its value by self. Most popular optional input is inRoi. If user wants to specify region of interest for image processing function, Region object should be passed. If atl::NIL is passed, function will process whole image.

template< typename T >
class Optional : public OptionalBase< T >
{
public:
	typedef Optional< T > MyType;
	typedef OptionalBase< T > MyBase;
	typedef typename MyBase::ValueType ValueType;
	typedef typename MyBase::RefType RefType;
	typedef typename MyBase::ConstValueType ConstValueType;
	typedef typename MyBase::ConstRefType ConstRefType;

	Optional() : MyBase() { }
	Optional( const Optional< ValueType >& other ) : MyBase(other) { }
	Optional( const Optional< RefType >& other ) : MyBase(other) { }
	Optional( const Optional< ConstValueType >& other ) : MyBase(other) { }
	Optional( const Optional< ConstRefType >& other ) : MyBase(other) { }
	Optional( const NilType& ) : MyBase(NIL) { }
	Optional( ConstRefType value ) : MyBase(value) { }

	const MyType& operator = ( const Optional< ValueType >& other );
	const MyType& operator = ( const Optional< RefType >& other );
	const MyType& operator = ( const Optional< ConstValueType >& other );
	const MyType& operator = ( const Optional< ConstRefType >& other );
	const MyType& operator = ( const NilType& );
	const MyType& operator = ( ConstRefType value );

#ifdef HAS_CPP0X

	Optional( Optional< ValueType >&& other ) : MyBase( std::move(other) ) { }
	Optional( ValueType&& value ) : MyBase( std::move(value) ) { }
	const MyType& operator = ( Optional< ValueType >&& other );
	const MyType& operator = ( ValueType&& value );
#endif

	bool operator == ( const Optional< ValueType >& other ) const;
	bool operator == ( const Optional< RefType >& other ) const;
	bool operator == ( const Optional< ConstValueType >& other ) const;
	bool operator == ( const Optional< ConstRefType >& other ) const;
	bool operator == ( const NilType& ) const;
	bool operator == ( ConstRefType value ) const;
		
	bool operator != ( const Optional< ValueType >& other ) const;
	bool operator != ( const Optional< RefType >& other ) const;
	bool operator != ( const Optional< ConstValueType >& other ) const;
	bool operator != ( const Optional< ConstRefType >& other ) const;
	bool operator != ( const NilType& ) const;
	bool operator != ( ConstRefType value ) const;
}