- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
qi::SignalBase Class Reference

`#include <signal.hpp>`

## Public Types
using | OnSubscribers = boost::function< Future< void >(bool)>

## Public Member Functions
| 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...
SignalBase & | operator= (const SignalBase &)=delete
virtual | ~SignalBase ()
virtual qi::Signature | signature () const
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)

## Static Public Attributes
static const SignalLink | invalidSignalLink

## Protected Types
using | Trigger = boost::function< void(const GenericFunctionParameters &params, MetaCallType callType)>

## Protected Member Functions
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)
ExecutionContext * | executionContext () const
void | clearExecutionContext ()

## Protected Attributes
boost::shared_ptr < SignalBasePrivate > | _p

## Friends
class | SignalBasePrivate

## Detailed Description

SignalBase provides a signal subscription mechanism called "connection". Derived classes can customize the subscription step by setting an "onSubscribers" callback.

See Also
  onSubscriber.

Definition at line 42 of file signal.hpp.

## Member Typedef Documentation

using qi::SignalBase::OnSubscribers = boost::function<Future<void>(bool)>

Definition at line 45 of file signal.hpp.

using qi::SignalBase::Trigger = boost::function<void(const GenericFunctionParameters& params, MetaCallType callType)>
| protected

Definition at line 154 of file signal.hpp.

## Constructor & Destructor Documentation

qi::SignalBase::SignalBase | ( | const Signature & | signature,
|  | OnSubscribers | onSubscribers = `OnSubscribers()`
| ) |  |
| explicit

qi::SignalBase::SignalBase | ( | const Signature & | signature,
|  | ExecutionContext * | execContext,
|  | OnSubscribers | onSubscribers = `OnSubscribers()`
| ) |  |

qi::SignalBase::SignalBase | ( | OnSubscribers | onSubscribers = `OnSubscribers()` | ) |

qi::SignalBase::SignalBase | ( | ExecutionContext * | execContext,
|  | OnSubscribers | onSubscribers = `OnSubscribers()`
| ) |  |

qi::SignalBase::SignalBase | ( | const SignalBase & |  | ) |
| delete

SignalBase is not copyable, since subscriptions should not be duplicated.

virtual qi::SignalBase::~SignalBase | ( |  | ) |
| virtual

## Member Function Documentation

void qi::SignalBase::_setSignature | ( | const Signature & | s | ) |

bool qi::SignalBase::asyncDisconnect | ( | const SignalLink & | link | ) |
| inline

Definition at line 116 of file signal.hpp.

bool qi::SignalBase::asyncDisconnectAll | ( |  | ) |
| inline

Definition at line 89 of file signal.hpp.

void qi::SignalBase::callOnSubscribe | ( | bool | v | ) |
| protected

void qi::SignalBase::callSubscribers | ( | const GenericFunctionParameters & | params,
|  | MetaCallType | callType = `MetaCallType_Auto`
| ) |  |
| protected

void qi::SignalBase::clearExecutionContext | ( |  | ) |
| protected

template<typename F >

SignalSubscriber qi::SignalBase::connect | ( | boost::function< F > | func | ) |

Definition at line 89 of file signal.hxx.

SignalSubscriber qi::SignalBase::connect | ( | AnyObject | object,
|  | const unsigned int | slot
| ) |  |

SignalSubscriber qi::SignalBase::connect | ( | AnyObject | object,
|  | const std::string & | slot
| ) |  |

SignalSubscriber qi::SignalBase::connect | ( | const SignalSubscriber & | s | ) |

The following overloads are the lowest-level.

Future<SignalSubscriber> qi::SignalBase::connectAsync | ( | const SignalSubscriber & |  | ) |

Connect asynchronously. This is recommended since derived classes may provide asynchronous customizations for dealing with subscribers. The callbacks are guaranteed to be called only after the returned future is set.

void qi::SignalBase::createNewTrackLink | ( | int & | id,
|  | SignalLink *& | trackLink
| ) |  |
| protected

bool qi::SignalBase::disconnect | ( | const SignalLink & | link | ) |

Disconnect a SignalHandler.

The associated callback will not be called anymore as soon as this function returns.

This method blocks until all the already running callbacks are finished.

Returns
  Returns true on success.

bool qi::SignalBase::disconnectAll | ( |  | ) |

Disconnect all callbacks from signal.

This function will block until all callbacks are finished.

Returns
  Returns true on success.

Future<bool> qi::SignalBase::disconnectAllAsync | ( |  | ) |

Disconnect all callbacks from signal without waiting for them.

This function does not block.

Returns
  A future set to true on success.

Future<bool> qi::SignalBase::disconnectAsync | ( | const SignalLink & | link | ) |

Disconnect a SignalHandler without waiting for it.

Same as disconnect, but this method does not block. Though this is async, you are guaranteed that once the function returns the future, your callback will not be called anymore.

Returns
  A future set to true on success.

void qi::SignalBase::disconnectTrackLink | ( | int | id | ) |
| protected

ExecutionContext* qi::SignalBase::executionContext | ( |  | ) | const
| protected

bool qi::SignalBase::hasSubscribers | ( |  | ) |

void qi::SignalBase::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()

SignalBase& qi::SignalBase::operator= | ( | const SignalBase & |  | ) |
| delete

void qi::SignalBase::setCallType | ( | MetaCallType | callType | ) |

Set the MetaCallType used by operator()().

void qi::SignalBase::setOnSubscribers | ( | OnSubscribers | onSubscribers | ) |

Set a function to call when the number of subscribers go between 1 and 0. You can use this to avoid computing if no one has subscribed to the signal.

void qi::SignalBase::setTriggerOverride | ( | Trigger | trigger | ) |
| protected

virtual qi::Signature qi::SignalBase::signature | ( |  | ) | const
| virtual

Reimplemented in qi::GenericProperty, qi::SignalF< T >, qi::SignalF< void(const qi::ServiceDirectoryProxy::Status &)>, qi::SignalF< void(const bool &)>, qi::SignalF< void(P...)>, qi::SignalF< void(const T &)>, and qi::SignalF< void(const AnyValue &)>.

std::vector<SignalSubscriber> qi::SignalBase::subscribers | ( |  | ) |

virtual void qi::SignalBase::trigger | ( | const GenericFunctionParameters & | params,
|  | MetaCallType | callType = `MetaCallType_Auto`
| ) |  |
| virtual

Trigger the signal with given type-erased parameters.

Parameters

  params | the signal arguments
  callType | specify how to invoke subscribers. Used in combination with each subscriber's MetaCallType to chose between synchronous and asynchronous call. The combination rule is to honor subscriber's override, then `callType`, then signal's callType and default to asynchronous

## Friends And Related Function Documentation

friend class SignalBasePrivate
| friend

Definition at line 165 of file signal.hpp.

## Member Data Documentation

boost::shared_ptr<SignalBasePrivate> qi::SignalBase::_p
| protected

Definition at line 164 of file signal.hpp.

const SignalLink qi::SignalBase::invalidSignalLink
| static

Definition at line 151 of file signal.hpp.

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

- /home/opennao/work/release-2.8/sdk/libqi/qi/signal.hpp
- /home/opennao/work/release-2.8/sdk/libqi/qi/type/detail/signal.hxx