cxWidgets 1.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
cx::cxFunction4RefTemplated< T1, T2, T3, T4 > Class Template Reference

This class is a cxFunction that is templated to take 4 references of specific types. More...

#include <cxFunction.h>

Inheritance diagram for cx::cxFunction4RefTemplated< T1, T2, T3, T4 >:
Inheritance graph
Collaboration diagram for cx::cxFunction4RefTemplated< T1, T2, T3, T4 >:
Collaboration graph

Public Types

using FuncPtr = std::string(*)(T1 &, T2 &, T3 &, T4 &)
 

Public Member Functions

 cxFunction4RefTemplated (FuncPtr pFuncPtr, T1 &pParam1, T2 &pParam2, T3 &pParam3, T4 &pParam4, bool pUseReturnVal=false, bool pExitAfterRun=false, bool pRunOnLeaveFunction=true)
 Default constructor. All parameters have default values.
 
virtual ~cxFunction4RefTemplated ()
 
virtual bool functionIsSet () const override
 
void setFunction (FuncPtr pFuncPtr)
 
FuncPtr getFunction () const
 Accessor for the internal function pointer.
 
void setParams (T1 &pParam1, T2 &pParam2, T3 &pParam3, T4 &pParam4)
 
void setParam1 (T1 &pParam)
 
void setParam2 (T2 &pParam)
 
void setParam3 (T3 &pParam)
 
void setParam4 (T4 &pParam)
 
const T1 & getParam1 () const
 
const T2 & getParam2 () const
 
const T3 & getParam3 () const
 
const T4 & getParam4 () 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, "cxFunction4RefTemplated". 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< cxFunction4RefTemplated< T1, T2, T3, T4 > > create (FuncPtr pFuncPtr, T1 &pParam1, T2 &pParam2, T3 &pParam3, T4 &pParam4, bool pUseReturnVal=false, bool pExitAfterRun=false, bool pRunOnLeaveFunction=true)
 Static create method for cxFunction4RefTemplated. This is the recommended way to create a cxFunction4RefTemplated, as it returns a shared pointer to the created object.
 

Detailed Description

template<typename T1, typename T2, typename T3, typename T4>
class cx::cxFunction4RefTemplated< T1, T2, T3, T4 >

This class is a cxFunction that is templated to take 4 references of specific types.

Member Typedef Documentation

◆ FuncPtr

template<typename T1 , typename T2 , typename T3 , typename T4 >
using cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::FuncPtr = std::string (*)(T1&, T2&, T3&, T4&)

Constructor & Destructor Documentation

◆ cxFunction4RefTemplated()

template<typename T1 , typename T2 , typename T3 , typename T4 >
cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::cxFunction4RefTemplated ( FuncPtr  pFuncPtr,
T1 &  pParam1,
T2 &  pParam2,
T3 &  pParam3,
T4 &  pParam4,
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
pParam2The second parameter to pass to the function when it's run
pParam3The 3rd parameter to pass to the function when it's run
pParam4The 4th 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.

◆ ~cxFunction4RefTemplated()

template<typename T1 , typename T2 , typename T3 , typename T4 >
virtual cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::~cxFunction4RefTemplated ( )
inlinevirtual

Destructor

Member Function Documentation

◆ create()

template<typename T1 , typename T2 , typename T3 , typename T4 >
static std::shared_ptr< cxFunction4RefTemplated< T1, T2, T3, T4 > > cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::create ( FuncPtr  pFuncPtr,
T1 &  pParam1,
T2 &  pParam2,
T3 &  pParam3,
T4 &  pParam4,
bool  pUseReturnVal = false,
bool  pExitAfterRun = false,
bool  pRunOnLeaveFunction = true 
)
inlinestatic

Static create method for cxFunction4RefTemplated. This is the recommended way to create a cxFunction4RefTemplated, as it returns a shared pointer to the created object.

◆ cxTypeStr()

template<typename T1 , typename T2 , typename T3 , typename T4 >
virtual std::string cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::cxTypeStr ( ) const
inlineoverridevirtual

Returns the name of the cxWidgets class, "cxFunction4RefTemplated". 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 ("cxFunction4RefTemplated").

Implements cx::cxFunction.

◆ functionIsSet()

template<typename T1 , typename T2 , typename T3 , typename T4 >
virtual bool cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::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 , typename T2 , typename T3 , typename T4 >
virtual void * cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::getFuncPtr ( ) const
inlineoverridevirtual

Implements cx::cxFunction.

◆ getFunction()

template<typename T1 , typename T2 , typename T3 , typename T4 >
FuncPtr cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::getFunction ( ) const
inline

Accessor for the internal function pointer.

Returns
The internal function pointer

◆ getParam1()

template<typename T1 , typename T2 , typename T3 , typename T4 >
const T1 & cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::getParam1 ( ) const
inline

Accessor for the first function parameter

Returns
Returns the 1st parameter

◆ getParam2()

template<typename T1 , typename T2 , typename T3 , typename T4 >
const T2 & cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::getParam2 ( ) const
inline

Accessor for the second function parameter

Returns
Returns the 2nd parameter

◆ getParam3()

template<typename T1 , typename T2 , typename T3 , typename T4 >
const T3 & cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::getParam3 ( ) const
inline

Accessor for the 3rd function parameter

Returns
Returns the 3rd parameter

◆ getParam4()

template<typename T1 , typename T2 , typename T3 , typename T4 >
const T4 & cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::getParam4 ( ) const
inline

Accessor for the 4th function parameter

Returns
Returns the 4th parameter

◆ runFunction()

template<typename T1 , typename T2 , typename T3 , typename T4 >
virtual std::string cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::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 , typename T2 , typename T3 , typename T4 >
void cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::setFunction ( FuncPtr  pFuncPtr)
inline

Sets the internal function pointer

Parameters
pFuncPtrThe function to which to point

◆ setParam1()

template<typename T1 , typename T2 , typename T3 , typename T4 >
void cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::setParam1 ( T1 &  pParam)
inline

Sets the first parameter

Parameters
pParamFirst parameter to pass to function

◆ setParam2()

template<typename T1 , typename T2 , typename T3 , typename T4 >
void cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::setParam2 ( T2 &  pParam)
inline

Sets the second parameter

Parameters
pParamSecond parameter to pass to function

◆ setParam3()

template<typename T1 , typename T2 , typename T3 , typename T4 >
void cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::setParam3 ( T3 &  pParam)
inline

Sets the 3rd parameter

Parameters
pParamThird parameter to pass to function

◆ setParam4()

template<typename T1 , typename T2 , typename T3 , typename T4 >
void cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::setParam4 ( T4 &  pParam)
inline

Sets the 4th parameter

Parameters
pParamFourth parameter to pass to function

◆ setParams()

template<typename T1 , typename T2 , typename T3 , typename T4 >
void cx::cxFunction4RefTemplated< T1, T2, T3, T4 >::setParams ( T1 &  pParam1,
T2 &  pParam2,
T3 &  pParam3,
T4 &  pParam4 
)
inline

Sets the parameters to pass to the function.

Parameters
pParam1First parameter to pass to function
pParam2Second parameter to pass to function
pParam3Third parameter to pass to function
pParam4Fourth parameter to pass to function

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