X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FValue.h.d;fp=lib%2FcpPlugins%2FValue.h.d;h=6f2472101b623b3677d7da7d314bcbe9a3b962a4;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=0000000000000000000000000000000000000000;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/cpPlugins/Value.h.d b/lib/cpPlugins/Value.h.d new file mode 100644 index 0000000..6f24721 --- /dev/null +++ b/lib/cpPlugins/Value.h.d @@ -0,0 +1,116 @@ +// ========================================================================= +// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) +// ========================================================================= +#ifndef __cpPlugins__Value__h__ +#define __cpPlugins__Value__h__ + +$include "Value.e" + +#include +#include + +namespace cpPlugins +{ + // Some forward declarations... + class ProcessObject; + + /*! \brief Class to represent simple scalar values, independently from + * atomic types. + */ + struct CPPLUGINS_EXPORT Value + { + //! Output streaming operator overload + friend std::ostream& operator<<( std::ostream& o, const Value& v ) + { + v.Print( o ); + return( o ); + } + + public: + //! Simple typedef to be used by lazy programmers :-) + typedef Value Self; + + /*! @defgroup ScalarTypes + * Types that describe all base scalar values + * @{ + */ + typedef bool TBool; + typedef long TInteger; + typedef unsigned long TNatural; + typedef long double TReal; + typedef std::complex< TReal > TComplex; + typedef std::string TString; + //! @} + + /*! @defgroup Constructors + * Types that describe all base scalar values + * @{ + */ + //! Default constructor + Value( ); + + //! Prepare a particular value + Value( const std::type_info& i ); + + //! Cast constructor(s) + Value( const Self& v ); + {{#s}} + Value( const {{s}}& v ); + {{/s}} + + //! @} + + //! Output cast operator + {{#s}} + explicit operator {{s}}( ) const; + {{/s}} + + //! Assignement operator + Self& operator=( const Self& v ); + {{#s}} + Self& operator=( const {{s}}& v ); + {{/s}} + + //! Comparison operator + bool operator<( const Self& v ) const; + + //! Return a string with contained type information. + const std::string& GetTypeName( ) const; + + /*! @defgroup Pipeline + * Methods to synchronize values in processing pipelines + * @{ + */ + ProcessObject* GetSource( ); + const ProcessObject* GetSource( ) const; + + template< class _TObject > + void SetSource( _TObject* source ); + //! @} + + //! Send information to a stream + void Print( std::ostream& o ) const; + + protected: + /*! @ingroup ScalarTypes + * Types that describe all base scalar values + * @{ + */ + TString m_TypeName; + TBool m_Bool; + TNatural m_Natural; + TInteger m_Integer; + TReal m_Real; + TComplex m_Complex; + TString m_String; + //! @} + + //! @ingroup Pipeline + std::weak_ptr< ProcessObject > m_Source; + + }; // end class +} // end namespace + +#endif // __cpPlugins__Value__h__ + +// eof - $RCSfile$