# DBus-C++

## Desktop Communication Bus System

libdbus-c-- Documentation 0.9.0

- Files
- Data Structures
- Globals
- Main Page

Classes | Public Member Functions | Private Attributes | Friends | List of all members
DBus::PendingCall Class Reference

`#include <pendingcall.h>`

## Classes

struct | Private

## Public Member Functions

| PendingCall (Private *)
| PendingCall (const PendingCall &)
virtual | ~PendingCall ()
PendingCall & | operator= (const PendingCall &)
bool | completed ()
| Checks whether the pending call has received a reply yet, or not.
void | cancel ()
| Cancels the pending call, such that any reply or error received will just be ignored.
void | block ()
| Block until the pending call is completed.
void | data (void *data)
| Stores a pointer on a PendingCall, along with an optional function to be used for freeing the data when the data is set again, or when the pending call is finalized.
void * | data ()
| Retrieves data previously set with dbus_pending_call_set_data().
Slot< void, PendingCall & > & | slot ()
Message | steal_reply ()
| Gets the reply.

## Private Attributes

RefPtrI< Private > | _pvt

## Friends

struct | Private
class | Connection

## Detailed Description

Definition at line 37 of file pendingcall.h.

## Constructor & Destructor Documentation

## ◆ PendingCall() [1/2]

PendingCall::PendingCall | ( | PendingCall::Private * | p | ) |

Definition at line 63 of file pendingcall.cpp.

References _pvt, and DBus::PendingCall::Private::notify_stub().

Referenced by DBus::PendingCall::Private::notify_stub(), operator=(), and PendingCall().

## ◆ PendingCall() [2/2]

PendingCall::PendingCall | ( | const PendingCall & | c | ) |

Definition at line 72 of file pendingcall.cpp.

References _pvt, and PendingCall().

## ◆ ~PendingCall()

PendingCall::~PendingCall | ( |  | ) |

virtual

Definition at line 78 of file pendingcall.cpp.

References _pvt.

## Member Function Documentation

## ◆ block()

void PendingCall::block | ( |  | ) |

Block until the pending call is completed.

The blocking is as with Connection::send_blocking(); it does not enter the main loop or process other messages, it simply waits for the reply in question.

If the pending call is already completed, this function returns immediately.

Definition at line 104 of file pendingcall.cpp.

References _pvt.

## ◆ cancel()

void PendingCall::cancel | ( |  | ) |

Cancels the pending call, such that any reply or error received will just be ignored.

Drops the dbus library's internal reference to the DBusPendingCall so will free the call if nobody else is holding a reference. However you usually get a reference from Connection::send_async() so probably your app owns a ref also.

Note that canceling a pending call will not simulate a timed-out call; if a call times out, then a timeout error reply is received. If you cancel the call, no reply is received unless the the reply was already received before you canceled.

Definition at line 99 of file pendingcall.cpp.

References _pvt.

## ◆ completed()

bool PendingCall::completed | ( |  | ) |

Checks whether the pending call has received a reply yet, or not.

Returns
  true If a reply has been received.

Definition at line 94 of file pendingcall.cpp.

References _pvt.

## ◆ data() [1/2]

void * PendingCall::data | ( |  | ) |

Retrieves data previously set with dbus_pending_call_set_data().

The slot must still be allocated (must not have been freed).

Returns
  The data, or NULL if not found.

Definition at line 117 of file pendingcall.cpp.

References _pvt.

## ◆ data() [2/2]

void PendingCall::data | ( | void * | data | ) |

Stores a pointer on a PendingCall, along with an optional function to be used for freeing the data when the data is set again, or when the pending call is finalized.

The slot is allocated automatic.

Parameters

  data | The data to store.

Exceptions

  ErrorNoMemory |

Definition at line 109 of file pendingcall.cpp.

References _pvt.

Referenced by DBus::PendingCall::Private::notify_stub().

## ◆ operator=()

PendingCall & PendingCall::operator= | ( | const PendingCall & | c | ) |

Definition at line 83 of file pendingcall.cpp.

References _pvt, and PendingCall().

## ◆ slot()

Slot< void, PendingCall & > & PendingCall::slot | ( |  | ) |

Returns
  The data slot.

Definition at line 122 of file pendingcall.cpp.

References _pvt.

## ◆ steal_reply()

Message PendingCall::steal_reply | ( |  | ) |

Gets the reply.

Ownership of the reply message passes to the caller. This function can only be called once per pending call, since the reply message is tranferred to the caller.

Returns
  The reply Message.

Exceptions

  ErrorNoReply |

Definition at line 127 of file pendingcall.cpp.

References _pvt.

## Friends And Related Symbol Documentation

## ◆ Connection

friend class Connection

friend

Definition at line 128 of file pendingcall.h.

References Connection.

Referenced by Connection.

## ◆ Private

friend struct Private

friend

Definition at line 127 of file pendingcall.h.

## Member Data Documentation

## ◆ _pvt

RefPtrI<Private> DBus::PendingCall::_pvt

private

Definition at line 125 of file pendingcall.h.

Referenced by block(), cancel(), completed(), data(), data(), operator=(), PendingCall(), PendingCall(), slot(), steal_reply(), and ~PendingCall().

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

- pendingcall.h
- pendingcall.cpp