libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | List of all members
qi::Property< T > Class Template Reference

#include <property.hpp>

Public Types

using ImplType = PropertyImpl< T >
 
using Getter = typename ImplType::Getter
 
using Setter = typename ImplType::Setter
 
- Public Types inherited from qi::PropertyImpl< T >
using Setter = boost::function< bool(boost::reference_wrapper< T >, const T &)>
 
using Getter = boost::function< T(boost::reference_wrapper< const T >)>
 
using SignalType = SignalF< void(const T &)>
 
using PropertyType = T
 
- Public Types inherited from qi::SignalF< void(const T &)>
using FunctionType = void(const T &)
 
- Public Types inherited from qi::SignalBase
using OnSubscribers = boost::function< Future< void >(bool)>
 

Public Member Functions

 Property (Getter getter=Getter(), Setter setter=Setter(), SignalBase::OnSubscribers onsubscribe=SignalBase::OnSubscribers())
 
 Property (Strand &strand, Getter getter=Getter(), Setter setter=Setter(), SignalBase::OnSubscribers onsubscribe=SignalBase::OnSubscribers())
 
 Property (AutoAnyReference defaultValue, Getter getter=Getter(), Setter setter=Setter(), SignalBase::OnSubscribers onsubscribe=SignalBase::OnSubscribers())
 
 Property (AutoAnyReference defaultValue, Strand &strand, Getter getter=Getter(), Setter setter=Setter(), SignalBase::OnSubscribers onsubscribe=SignalBase::OnSubscribers())
 
 ~Property () override
 
Property< T > & operator= (const T &v)
 
FutureSync< T > get () const override
 
FutureSync< void > set (const T &v) override
 
SignalBasesignal () override
 
FutureSync< void > setValue (AutoAnyReference value) override
 
FutureSync< AnyValuevalue () const override
 
- Public Member Functions inherited from qi::PropertyImpl< T >
 PropertyImpl (Getter getter=Getter(), Setter setter=Setter(), SignalBase::OnSubscribers onsubscribe=SignalBase::OnSubscribers())
 
 PropertyImpl (ExecutionContext *execContext, Getter getter=Getter(), Setter setter=Setter(), SignalBase::OnSubscribers onsubscribe=SignalBase::OnSubscribers())
 
 PropertyImpl (AutoAnyReference defaultValue, Getter getter=Getter(), Setter setter=Setter(), SignalBase::OnSubscribers onsubscribe=SignalBase::OnSubscribers())
 
 PropertyImpl (AutoAnyReference defaultValue, ExecutionContext *execContext=nullptr, Getter getter=Getter(), Setter setter=Setter(), SignalBase::OnSubscribers onsubscribe=SignalBase::OnSubscribers())
 
PropertyImpl< T > & operator= (const T &v)
 
- Public Member Functions inherited from qi::SignalF< void(const T &)>
 SignalF (OnSubscribers onSubscribers=OnSubscribers())
 
 SignalF (ExecutionContext *execContext, OnSubscribers onSubscribers)
 
virtual qi::Signature signature () const
 
SignalSubscriber connect (...)
 
- Public Member Functions inherited from qi::SignalBase
 SignalBase (const Signature &signature, OnSubscribers onSubscribers=OnSubscribers())
 
 SignalBase (const Signature &signature, ExecutionContext *execContext, OnSubscribers onSubscribers=OnSubscribers())
 
 SignalBase (OnSubscribers onSubscribers=OnSubscribers())
 
 SignalBase (ExecutionContext *execContext, OnSubscribers onSubscribers=OnSubscribers())
 
 SignalBase (const SignalBase &)=delete
 SignalBase is not copyable, since subscriptions should not be duplicated. More...
 
SignalBaseoperator= (const SignalBase &)=delete
 
virtual ~SignalBase ()
 
template<typename F >
SignalSubscriber connect (boost::function< F > func)
 
SignalSubscriber connect (AnyObject object, const unsigned int slot)
 
SignalSubscriber connect (AnyObject object, const std::string &slot)
 
SignalSubscriber connect (const SignalSubscriber &s)
 The following overloads are the lowest-level. More...
 
Future< SignalSubscriber > connectAsync (const SignalSubscriber &)
 
bool disconnectAll ()
 
Future< bool > disconnectAllAsync ()
 
bool asyncDisconnectAll ()
 
bool disconnect (const SignalLink &link)
 
Future< bool > disconnectAsync (const SignalLink &link)
 
bool asyncDisconnect (const SignalLink &link)
 
virtual void trigger (const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto)
 
void setCallType (MetaCallType callType)
 Set the MetaCallType used by operator()(). More...
 
void operator() (qi::AutoAnyReference p1=qi::AutoAnyReference(), qi::AutoAnyReference p2=qi::AutoAnyReference(), qi::AutoAnyReference p3=qi::AutoAnyReference(), qi::AutoAnyReference p4=qi::AutoAnyReference(), qi::AutoAnyReference p5=qi::AutoAnyReference(), qi::AutoAnyReference p6=qi::AutoAnyReference(), qi::AutoAnyReference p7=qi::AutoAnyReference(), qi::AutoAnyReference p8=qi::AutoAnyReference())
 Trigger the signal with given arguments, and call type set by setCallType() More...
 
std::vector< SignalSubscriber > subscribers ()
 
bool hasSubscribers ()
 
void setOnSubscribers (OnSubscribers onSubscribers)
 
void _setSignature (const Signature &s)
 
- Public Member Functions inherited from qi::PropertyBase
 PropertyBase ()=default
 
 PropertyBase (const PropertyBase &)=delete
 
PropertyBaseoperator= (const PropertyBase &)=delete
 
virtual ~PropertyBase ()=default
 

Additional Inherited Members

- Static Public Attributes inherited from qi::SignalBase
static const SignalLink invalidSignalLink
 
- Protected Types inherited from qi::SignalBase
using Trigger = boost::function< void(const GenericFunctionParameters &params, MetaCallType callType)>
 
- Protected Member Functions inherited from qi::PropertyImpl< T >
getImpl () const
 
void setImpl (const T &v)
 
- Protected Member Functions inherited from qi::SignalBase
void callSubscribers (const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto)
 
void setTriggerOverride (Trigger trigger)
 
void callOnSubscribe (bool v)
 
void createNewTrackLink (int &id, SignalLink *&trackLink)
 
void disconnectTrackLink (int id)
 
ExecutionContextexecutionContext () const
 
void clearExecutionContext ()
 
- Protected Attributes inherited from qi::PropertyImpl< T >
Getter _getter
 
Setter _setter
 
_value
 
- Protected Attributes inherited from qi::SignalBase
boost::shared_ptr
< SignalBasePrivate
_p
 

Detailed Description

template<typename T>
class qi::Property< T >

Povide thread-safe access to a stored value and signal to connected callbacks when the value changed.

See Also
qi::Signal which implement a similar pattern but without storing the value.
Remarks
For more performance in a single-threaded context, consider using UnsafeProperty instead.

Definition at line 157 of file property.hpp.

Member Typedef Documentation

template<typename T>
using qi::Property< T >::Getter = typename ImplType::Getter

Definition at line 161 of file property.hpp.

template<typename T>
using qi::Property< T >::ImplType = PropertyImpl<T>

Definition at line 160 of file property.hpp.

template<typename T>
using qi::Property< T >::Setter = typename ImplType::Setter

Definition at line 162 of file property.hpp.

Constructor & Destructor Documentation

template<typename T>
qi::Property< T >::Property ( Getter  getter = Getter(),
Setter  setter = Setter(),
SignalBase::OnSubscribers  onsubscribe = SignalBase::OnSubscribers() 
)
inline

Instantiates a strand by default and owns it. That strand will be used to wrap the getters and setters and synchronize them.

Definition at line 166 of file property.hpp.

template<typename T>
qi::Property< T >::Property ( Strand strand,
Getter  getter = Getter(),
Setter  setter = Setter(),
SignalBase::OnSubscribers  onsubscribe = SignalBase::OnSubscribers() 
)
inline

Uses the strand that is passed but does not own it. That strand will be used to wrap the getters and setters and synchronize them.

Definition at line 173 of file property.hpp.

template<typename T>
qi::Property< T >::Property ( AutoAnyReference  defaultValue,
Getter  getter = Getter(),
Setter  setter = Setter(),
SignalBase::OnSubscribers  onsubscribe = SignalBase::OnSubscribers() 
)
inline

Instantiates a strand by default and owns it. That strand will be used to wrap the getters and setters and synchronize them.

Definition at line 184 of file property.hpp.

template<typename T>
qi::Property< T >::Property ( AutoAnyReference  defaultValue,
Strand strand,
Getter  getter = Getter(),
Setter  setter = Setter(),
SignalBase::OnSubscribers  onsubscribe = SignalBase::OnSubscribers() 
)
inline

Uses the strand that is passed but does not own it. That strand will be used to wrap the getters and setters and synchronize them.

Definition at line 191 of file property.hpp.

template<typename T >
qi::Property< T >::~Property ( )
override

Definition at line 125 of file property.hxx.

Member Function Documentation

template<typename T >
FutureSync< T > qi::Property< T >::get ( ) const
overridevirtual

Implements qi::PropertyImpl< T >.

Definition at line 133 of file property.hxx.

template<typename T>
Property<T>& qi::Property< T >::operator= ( const T &  v)
inline

Definition at line 207 of file property.hpp.

template<typename T>
FutureSync< void > qi::Property< T >::set ( const T &  v)
overridevirtual

Implements qi::PropertyImpl< T >.

Definition at line 139 of file property.hxx.

template<typename T >
FutureSync< void > qi::Property< T >::setValue ( AutoAnyReference  value)
overridevirtual

Implements qi::PropertyBase.

Definition at line 151 of file property.hxx.

template<typename T>
SignalBase* qi::Property< T >::signal ( )
inlineoverridevirtual

Reimplemented from qi::PropertyImpl< T >.

Definition at line 212 of file property.hpp.

template<typename T >
FutureSync< AnyValue > qi::Property< T >::value ( ) const
overridevirtual

Implements qi::PropertyBase.

Definition at line 145 of file property.hxx.


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