Apama  10.2.0.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com::softwareag::connectivity::visitor< DERIVED, RV > Class Template Reference

Helper class for writing visitors to apply to data_t. More...

#include <sag_connectivity_cpp.hpp>

Public Types

typedef RV result_type
 The return type from applying this visitor. More...
 
typedef DERIVED derived_t
 The type of the derived class. More...
 

Public Member Functions

result_type operator() () const
 Visit an empty variant (don't override this, instead override visitEmpty) More...
 
result_type visitEmpty () const
 Visit an empty variant. More...
 
result_type operator() (int64_t &i) const
 Visit an integer (don't override this, instead override visitInteger) More...
 
result_type visitInteger (int64_t &i) const
 Visit an integer. More...
 
result_type operator() (double &i) const
 Visit a double (don't override this, instead override visitDouble) More...
 
result_type visitDouble (double &i) const
 Visit a double. More...
 
result_type operator() (bool &i) const
 Visit a boolean (don't override this, instead override visitBoolean) More...
 
result_type visitBoolean (bool &i) const
 Visit a boolean. More...
 
result_type operator() (const char *&i) const
 Visit a string (don't override this, instead override visitString) More...
 
result_type visitString (const char *&i) const
 Visit a string. More...
 
result_type operator() (decimal_t &i) const
 Visit a decimal (don't override this, instead override visitDecimal) More...
 
result_type visitDecimal (decimal_t &i) const
 Visit a decimal. More...
 
result_type operator() (buffer_t &i) const
 Visit a byte buffer (don't override this, instead override visitBuffer) More...
 
result_type visitBuffer (buffer_t &i) const
 Visit a byte buffer. More...
 
result_type operator() (list_t &i) const
 Visit a list (don't override this, instead override visitList) More...
 
result_type visitList (list_t &i) const
 Visit a list. More...
 
result_type operator() (map_t &i) const
 Visit a map (don't override this, instead override visitMap) More...
 
result_type visitMap (map_t &i) const
 Visit a map. More...
 
result_type operator() (sag_underlying_custom_t &i) const
 Visit a custom object (don't override this, instead override visitCustom) More...
 
result_type visitCustom (sag_underlying_custom_t &i) const
 Visit a custom object. More...
 

Protected Member Functions

result_type error (const std::string &reason) const
 Handles visiting unhandled types. More...
 

Detailed Description

template<typename DERIVED, typename RV>
class com::softwareag::connectivity::visitor< DERIVED, RV >

Helper class for writing visitors to apply to data_t.

This class provides the result_type typedef and all the operator()() methods and should be used for visiting non-const data_ts. For visiting const data_ts then you need to use const_visitor

These then call to visitTYPE methods which default to an error condition.

Users should override the visitTYPE(TYPE&) const methods for the types which their visitor needs to handle. Unhandled types will still default to error.

The default error condition is to throw std::runtime_error. If you wish to have a different error condition then override the error() method.

This class is templated over both the derived class (to avoid the need for virtual calls) and the return type. It should be used as:

class my_visitor: public visitor<my_visitor, void> { ... };

Member Typedef Documentation

template<typename DERIVED , typename RV >
typedef DERIVED com::softwareag::connectivity::visitor< DERIVED, RV >::derived_t

The type of the derived class.

template<typename DERIVED , typename RV >
typedef RV com::softwareag::connectivity::visitor< DERIVED, RV >::result_type

The return type from applying this visitor.

Member Function Documentation

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::error ( const std::string &  reason) const
inlineprotected

Handles visiting unhandled types.

Defaults to throwing std::runtime_error. Override it to provide different defaults.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( ) const
inline

Visit an empty variant (don't override this, instead override visitEmpty)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( int64_t &  i) const
inline

Visit an integer (don't override this, instead override visitInteger)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( double &  i) const
inline

Visit a double (don't override this, instead override visitDouble)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( bool &  i) const
inline

Visit a boolean (don't override this, instead override visitBoolean)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( const char *&  i) const
inline

Visit a string (don't override this, instead override visitString)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( decimal_t i) const
inline

Visit a decimal (don't override this, instead override visitDecimal)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( buffer_t i) const
inline

Visit a byte buffer (don't override this, instead override visitBuffer)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( list_t i) const
inline

Visit a list (don't override this, instead override visitList)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( map_t i) const
inline

Visit a map (don't override this, instead override visitMap)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::operator() ( sag_underlying_custom_t &  i) const
inline

Visit a custom object (don't override this, instead override visitCustom)

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitBoolean ( bool &  i) const
inline

Visit a boolean.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitBuffer ( buffer_t i) const
inline

Visit a byte buffer.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitCustom ( sag_underlying_custom_t &  i) const
inline

Visit a custom object.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitDecimal ( decimal_t i) const
inline

Visit a decimal.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitDouble ( double &  i) const
inline

Visit a double.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitEmpty ( ) const
inline

Visit an empty variant.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitInteger ( int64_t &  i) const
inline

Visit an integer.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitList ( list_t i) const
inline

Visit a list.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitMap ( map_t i) const
inline

Visit a map.

template<typename DERIVED , typename RV >
result_type com::softwareag::connectivity::visitor< DERIVED, RV >::visitString ( const char *&  i) const
inline

Visit a string.


The documentation for this class was generated from the following file: