| Kea 3.0.2-git

isc::hooks::ParkingLotHandle Class Reference

Provides a limited view to the `ParkingLot`. More...

`#include <parking_lots.h>`

## Public Member Functions
| ParkingLotHandle (const ParkingLotPtr &parking_lot)
| Constructor.
template<typename T>
int | dereference (T parked_object)
| Decreases the reference counter for the parked object.
template<typename T>
bool | drop (T parked_object)
| Removes parked object without calling a callback.
template<typename T>
int | reference (T parked_object)
| Increases reference counter for the parked object.
template<typename T>
bool | unpark (T parked_object)
| Signals that the object should be unparked.

## Detailed Description

Provides a limited view to the `ParkingLot`.

The handle is provided to the callouts which can reference and unpark parked objects. The callouts should not park objects, therefore this operation is not available.

The types of the parked objects provided as T parameter of respective functions are most often shared pointers. One should not use references to parked objects nor references to shared pointers to avoid premature destruction of the parked objects.

Definition at line 306 of file parking_lots.h.

## Constructor & Destructor Documentation

## ◆ ParkingLotHandle()

isc::hooks::ParkingLotHandle::ParkingLotHandle | ( | const ParkingLotPtr & | parking_lot | ) |
| inline

Constructor.

Parameters

  parking_lot | pointer to the parking lot for which the handle is created.

Definition at line 313 of file parking_lots.h.

## Member Function Documentation

## ◆ dereference()

template<typename T>

int isc::hooks::ParkingLotHandle::dereference | ( | T | parked_object | ) |
| inline

Decreases the reference counter for the parked object.

This method is called by the callouts to decrease the reference count of a parked object.

Template Parameters

  Type | of the parked object.

Parameters

  parked_object | object which will be parked.

Returns
  new reference count as an integer

Definition at line 340 of file parking_lots.h.

## ◆ drop()

template<typename T>

bool isc::hooks::ParkingLotHandle::drop | ( | T | parked_object | ) |
| inline

Removes parked object without calling a callback.

It ignores any reference counts on the parked object.

Template Parameters

  Type | of the parked object.

Parameters

  parked_object | parked object to be removed.

Returns
  false if the object couldn't be removed because there is no such object, true otherwise.

Definition at line 369 of file parking_lots.h.

## ◆ reference()

template<typename T>

int isc::hooks::ParkingLotHandle::reference | ( | T | parked_object | ) |
| inline

Increases reference counter for the parked object.

This method is called by the callouts to increase a reference count on the object to be parked. It must be called before the object is actually parked.

Template Parameters

  Type | of the parked object.

Parameters

  parked_object | object which will be parked.

Returns
  new reference count as an integer

Definition at line 327 of file parking_lots.h.

## ◆ unpark()

template<typename T>

bool isc::hooks::ParkingLotHandle::unpark | ( | T | parked_object | ) |
| inline

Signals that the object should be unparked.

If the specified object is parked in this parking lot, the reference count is decreased as a result of this method. If the reference count is 0, the object is unparked and the callback is invoked. Typically, the callback points to a function which resumes processing of a packet.

Template Parameters

  Type | of the parked object.

Parameters

  parked_object | parked object to be unparked.

Returns
  false if the object couldn't be unparked because there is no such object, true otherwise.

Definition at line 356 of file parking_lots.h.

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

- parking_lots.h