Apama  10.15.1.2
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

◆ derived_t

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

The type of the derived class.

◆ result_type

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

◆ error()

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.

◆ operator()() [1/10]

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)

◆ operator()() [2/10]

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)

◆ operator()() [3/10]

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)

◆ operator()() [4/10]

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)

◆ operator()() [5/10]

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)

◆ operator()() [6/10]

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)

◆ operator()() [7/10]

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)

◆ operator()() [8/10]

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)

◆ operator()() [9/10]

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)

◆ operator()() [10/10]

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)

◆ visitBoolean()

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

Visit a boolean.

◆ visitBuffer()

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

Visit a byte buffer.

◆ visitCustom()

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.

◆ visitDecimal()

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

Visit a decimal.

◆ visitDouble()

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

Visit a double.

◆ visitEmpty()

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

Visit an empty variant.

◆ visitInteger()

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

Visit an integer.

◆ visitList()

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

Visit a list.

◆ visitMap()

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

Visit a map.

◆ visitString()

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: