cxWidgets 1.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
cx::cxFunction1RefTemplated< T1 > Class Template Reference

This class is a cxFunction that is templated to take a reference of a specific type. More...

#include <cxFunction.h>

Inheritance diagram for cx::cxFunction1RefTemplated< T1 >:
Inheritance graph
Collaboration diagram for cx::cxFunction1RefTemplated< T1 >:
Collaboration graph

Public Types

using FuncPtr = std::string(*)(T1 &)
 

Public Member Functions

 cxFunction1RefTemplated (FuncPtr pFuncPtr, T1 &pParam, bool pUseReturnVal=false, bool pExitAfterRun=false, bool pRunOnLeaveFunction=true)
 Default constructor. All parameters have default values.
 
virtual ~cxFunction1RefTemplated ()
 
virtual bool functionIsSet () const override
 
void setFunction (FuncPtr pFuncPtr)
 
FuncPtr getFunction () const
 Accessor for the internal function pointer.
 
void setParam (T1 &pParam)
 
const T1 & getParam () const
 
virtual std::string runFunction () const override
 
virtual void * getFuncPtr () const override
 
virtual std::string cxTypeStr () const override
 Returns the name of the cxWidgets class, "cxFunction1RefTemplated". This can be.
 
- Public Member Functions inherited from cx::cxFunction
 cxFunction (bool pUseReturnVal, bool pExitAfterRun, bool pRunOnLeaveFunction)
 Constructor.
 
virtual ~cxFunction ()
 
virtual bool getUseReturnVal () const
 Accessor for whether the caller should use the return value.
 
virtual void setUseReturnVal (bool pUseReturnVal)
 Setter for whether or not the caller should make use of the return value.
 
virtual bool getExitAfterRun () const
 Accessor for whether the caller should exit after the function.
 
virtual void setExitAfterRun (bool pExitAfterRun)
 Setter for whether or not the caller should quit what.
 
virtual bool getRunOnLeaveFunction () const
 Accessor for whether the caller should run its onLeave function.
 
virtual void setRunOnLeaveFunction (bool pRunOnLeaveFunction)
 Setter for whether or not the caller should run its.
 

Static Public Member Functions

static std::shared_ptr< cxFunction1RefTemplated< T1 > > create (FuncPtr pFuncPtr, T1 &pParam1, bool pUseReturnVal=false, bool pExitAfterRun=false, bool pRunOnLeaveFunction=true)
 

Detailed Description

template<typename T1>
class cx::cxFunction1RefTemplated< T1 >

This class is a cxFunction that is templated to take a reference of a specific type.

Member Typedef Documentation

◆ FuncPtr

template<typename T1 >
using cx::cxFunction1RefTemplated< T1 >::FuncPtr = std::string (*)(T1&)

Constructor & Destructor Documentation

◆ cxFunction1RefTemplated()

template<typename T1 >
cx::cxFunction1RefTemplated< T1 >::cxFunction1RefTemplated ( FuncPtr  pFuncPtr,
T1 &  pParam,
bool  pUseReturnVal = false,
bool  pExitAfterRun = false,
bool  pRunOnLeaveFunction = true 
)
inlineexplicit

Default constructor. All parameters have default values.

available. Note that function must have this signature:

string func(void*, void*)

Parameters
pFuncPtrPointer to the function to be run. Defaults to nullptr.
pParam1The first parameter to pass to the function when it's run
pUseReturnValIndicates whether caller will make use of return value. Defaults to false
pExitAfterRunWhether or not the caller should exit from its input loop once the function is done. Defaults to false.
pRunOnLeaveFunctionWhether or not the caller should run its onLeave function when it exits (useful if pExitAfterRun is true). This defaults to true.

◆ ~cxFunction1RefTemplated()

template<typename T1 >
virtual cx::cxFunction1RefTemplated< T1 >::~cxFunction1RefTemplated ( )
inlinevirtual

Destructor

Member Function Documentation

◆ create()

template<typename T1 >
static std::shared_ptr< cxFunction1RefTemplated< T1 > > cx::cxFunction1RefTemplated< T1 >::create ( FuncPtr  pFuncPtr,
T1 &  pParam1,
bool  pUseReturnVal = false,
bool  pExitAfterRun = false,
bool  pRunOnLeaveFunction = true 
)
inlinestatic

◆ cxTypeStr()

template<typename T1 >
virtual std::string cx::cxFunction1RefTemplated< T1 >::cxTypeStr ( ) const
inlineoverridevirtual

Returns the name of the cxWidgets class, "cxFunction1RefTemplated". This can be.

used to determine the type of cxWidgets object that deriving

classes derive from in applications.

Returns
The name of the cxWidgets class ("cxFunction1RefTemplated").

Implements cx::cxFunction.

◆ functionIsSet()

template<typename T1 >
virtual bool cx::cxFunction1RefTemplated< T1 >::functionIsSet ( ) const
inlineoverridevirtual

Returns whether the internal funtion pointer is set.

Returns
Returns true if the internal function pointer is set (not null), or false otherwise.

Implements cx::cxFunction.

◆ getFuncPtr()

template<typename T1 >
virtual void * cx::cxFunction1RefTemplated< T1 >::getFuncPtr ( ) const
inlineoverridevirtual

Implements cx::cxFunction.

◆ getFunction()

template<typename T1 >
FuncPtr cx::cxFunction1RefTemplated< T1 >::getFunction ( ) const
inline

Accessor for the internal function pointer.

Returns
The internal function pointer

◆ getParam()

template<typename T1 >
const T1 & cx::cxFunction1RefTemplated< T1 >::getParam ( ) const
inline

Accessor for the function parameter

Returns
Returns the first parameter

◆ runFunction()

template<typename T1 >
virtual std::string cx::cxFunction1RefTemplated< T1 >::runFunction ( ) const
inlineoverridevirtual

If function pointer is not null, runs the function and returns its return value; If function pointer is nullptr, returns empty string

Returns
Returns return value of function pointed to if pointer is not null, otherwise returns empty string

Implements cx::cxFunction.

◆ setFunction()

template<typename T1 >
void cx::cxFunction1RefTemplated< T1 >::setFunction ( FuncPtr  pFuncPtr)
inline

Sets the internal function pointer

Parameters
pFuncPtrThe function to which to point

◆ setParam()

template<typename T1 >
void cx::cxFunction1RefTemplated< T1 >::setParam ( T1 &  pParam)
inline

Sets the parameter to pass to the function.

Parameters
pParamThe parameter to pass to function

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