/// until all hook libraries call @c ParkingLotHandle::unpark to mark
/// that respective asynchronous operations are completed.
///
+ /// @tparam Type of the parked object.
/// @param hook_name name of the hook point for which the packet is parked.
/// @param parked_object packet to be parked.
/// @param unpark_callback callback invoked when the packet is unparked.
- /// @tparam Type of the parked object.
template<typename T>
static void park(const std::string& hook_name, T parked_object,
std::function<void()> unpark_callback) {
/// value. This is used in the situations when the callouts fail to unpark
/// the packet for some reason.
///
+ /// @tparam T type of the parked object.
/// @param hook_name name of the hook point for which the packet is parked.
/// @param parked_object parked object to be unparked.
- /// @tparam T type of the parked object.
/// @return true if the specified object has been found, false otherwise.
template<typename T>
static bool unpark(const std::string& hook_name, T parked_object) {
/// @brief Removes parked object without calling a callback.
///
+ /// @tparam T type of the parked object.
/// @param hook_name name of the hook point for which the packet is parked.
/// @param parked_object parked object to be removed.
- /// @tparam T type of the parked object.
/// @return true if the specified object has been found false otherwise.
template<typename T>
static bool drop(const std::string& hook_name, T parked_object) {
/// Reference counter must be increased at least to 1 before the @c park()
/// method can be called.
///
+ /// @tparam Type of the parked object.
/// @param hook_name name of the hook point for which the packet is parked.
/// @param parked_object parked object for which reference counter should
/// be increased.
- /// @tparam Type of the parked object.
template<typename T>
static void reference(const std::string& hook_name, T parked_object) {
getHooksManager().referenceInternal(hook_name, parked_object);
/// @brief Park an object (packet).
///
+ /// @tparam Type of the parked object.
/// @param hook_name Name of the hook point for which the packet is parked.
/// @param parked_object packet to be parked.
/// @param unpark_callback callback invoked when the packet is unparked.
- /// @tparam Type of the parked object.
template<typename T>
void parkInternal(const std::string& hook_name, T parked_object,
std::function<void()> unpark_callback) {
/// @brief Signals that the object (packet) should be unparked.
///
+ /// @tparam Type of the parked object.
/// @param hook_name name of the hook point for which the packet is parked.
/// @param parked_object parked object to be unparked.
- /// @tparam Type of the parked object.
/// @return true if the specified object has been found, false otherwise.
template<typename T>
bool unparkInternal(const std::string& hook_name, T parked_object) {
/// @brief Removes parked object without calling a callback.
///
+ /// @tparam T type of the parked object.
/// @param hook_name name of the hook point for which the packet is parked.
/// @param parked_object parked object to be removed.
- /// @tparam T type of the parked object.
/// @return true if the specified object has been found false otherwise.
template<typename T>
static bool dropInternal(const std::string& hook_name, T parked_object) {
/// @brief Increases reference counter for the parked object.
///
+ /// @tparam Type of the parked object.
/// @param hook_name name of the hook point for which the packet is parked.
/// @param parked_object parked object for which reference counter should
/// be increased.
- /// @tparam Type of the parked object.
template<typename T>
void referenceInternal(const std::string& hook_name, T parked_object) {
ServerHooks::getServerHooks().
/// @brief Parks an object.
///
+ /// @tparam Type of the parked object.
/// @param parked_object object to be parked, e.g. pointer to a packet.
/// @param unpark_callback callback function to be invoked when the object
/// is unparked.
- /// @tparam Type of the parked object.
/// @throw InvalidOperation if the @c reference() wasn't called prior to
/// parking the object.
template<typename T>
/// on the object to be parked. It must be called before the object is
/// actually parked.
///
- /// @param parked_object object which will be parked.
/// @tparam Type of the parked object.
+ /// @param parked_object object which will be parked.
template<typename T>
void reference(T parked_object) {
auto it = find(parked_object);
/// is 0, the object is unparked and the callback is invoked. Typically, the
/// callback points to a function which resumes processing of a packet.
///
+ /// @tparam Type of the parked object.
/// @param parked_object parked object to be unparked.
/// @param force boolean value indicating if the reference counting should
/// be ignored and the object should be unparked immediately.
/// @brief Removes parked object without calling a callback.
///
+ /// @tparam Type of the parked object.
/// @param parked_object parked object to be removed.
+ /// @return false if the object couldn't be removed because there is
+ /// no such object, true otherwise.
template<typename T>
bool drop(T parked_object) {
auto it = find(parked_object);
/// @brief Search for the information about the parked object.
///
- /// @param parked_object object for which the information should be found.
/// @tparam T parked object type.
+ /// @param parked_object object for which the information should be found.
/// @return Iterator pointing to the parked object, or @c parking_.end() if
/// no such object found.
template<typename T>
/// on the object to be parked. It must be called before the object is
/// actually parked.
///
- /// @param parked_object object which will be parked.
/// @tparam Type of the parked object.
+ /// @param parked_object object which will be parked.
template<typename T>
void reference(T parked_object) {
parking_lot_->reference(parked_object);
/// is 0, the object is unparked and the callback is invoked. Typically, the
/// callback points to a function which resumes processing of a packet.
///
+ /// @tparam Type of the parked object.
/// @param parked_object parked object to be unparked.
/// @return false if the object couldn't be unparked because there is
/// no such object, true otherwise.
///
/// It ignores any reference counts on the parked object.
///
+ /// @tparam Type of the parked object.
/// @param parked_object parked object to be removed.
+ /// @return false if the object couldn't be removed because there is
+ /// no such object, true otherwise.
template<typename T>
bool drop(T parked_object) {
return (parking_lot_->drop(parked_object));