dbus-cpp-2.0.0+14.04.20140326/ 0000755 0000152 0177776 00000000000 12314613362 015625 5 ustar pbuser nogroup 0000000 0000000 dbus-cpp-2.0.0+14.04.20140326/include/ 0000755 0000152 0177776 00000000000 12314613362 017250 5 ustar pbuser nogroup 0000000 0000000 dbus-cpp-2.0.0+14.04.20140326/include/core/ 0000755 0000152 0177776 00000000000 12314613362 020200 5 ustar pbuser nogroup 0000000 0000000 dbus-cpp-2.0.0+14.04.20140326/include/core/dbus/ 0000755 0000152 0177776 00000000000 12314613362 021135 5 ustar pbuser nogroup 0000000 0000000 dbus-cpp-2.0.0+14.04.20140326/include/core/dbus/traits/ 0000755 0000152 0177776 00000000000 12314613362 022443 5 ustar pbuser nogroup 0000000 0000000 dbus-cpp-2.0.0+14.04.20140326/include/core/dbus/traits/timeout.h 0000644 0000152 0177776 00000002260 12314613163 024301 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright © 2012 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Authored by: Thomas Voß
*/
#ifndef CORE_DBUS_TRAITS_TIMEOUT_H_
#define CORE_DBUS_TRAITS_TIMEOUT_H_
#include
namespace core
{
namespace dbus
{
namespace traits
{
template
struct Timeout
{
typedef std::chrono::milliseconds DurationType;
static bool is_timeout_enabled(UnderlyingType* timeout);
static DurationType get_timeout_interval(UnderlyingType* timeout);
static void invoke_timeout_handler(UnderlyingType* timeout);
};
}
}
}
#endif // CORE_DBUS_TRAITS_WATCH_H_
dbus-cpp-2.0.0+14.04.20140326/include/core/dbus/traits/watch.h 0000644 0000152 0177776 00000002741 12314613163 023725 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright © 2012 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Authored by: Thomas Voß
*/
#ifndef CORE_DBUS_TRAITS_WATCH_H_
#define CORE_DBUS_TRAITS_WATCH_H_
#include
namespace core
{
namespace dbus
{
namespace traits
{
template
struct Watch
{
static inline int readable_event() { return -1; }
static inline int writeable_event() { return -1; }
static inline int error_event() { return -1; }
static inline int hangup_event() { return -1; }
static bool is_watch_enabled(UnderlyingType* watch);
static int get_watch_unix_fd(UnderlyingType* watch);
static bool is_watch_monitoring_fd_for_readable(UnderlyingType* watch);
static bool is_watch_monitoring_fd_for_writable(UnderlyingType* watch);
static bool invoke_watch_handler_for_event(UnderlyingType* watch, int event);
};
}
}
}
#endif // CORE_DBUS_TRAITS_WATCH_H_
dbus-cpp-2.0.0+14.04.20140326/include/core/dbus/traits/service.h 0000644 0000152 0177776 00000002021 12314613163 024246 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright © 2012 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Authored by: Thomas Voß
*/
#ifndef CORE_DBUS_TRAITS_SERVICE_H_
#define CORE_DBUS_TRAITS_SERVICE_H_
#include
namespace core
{
namespace dbus
{
namespace traits
{
template
struct Service
{
static const std::string& interface_name()
{
return Interface::name();
}
};
}
}
}
#endif // CORE_DBUS_TRAITS_SERVICE_H_
dbus-cpp-2.0.0+14.04.20140326/include/core/dbus/message_router.h 0000644 0000152 0177776 00000006171 12314613163 024336 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright © 2012 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Authored by: Thomas Voß
*/
#ifndef CORE_DBUS_MESSAGE_ROUTER_H_
#define CORE_DBUS_MESSAGE_ROUTER_H_
#include
#include
#include
#include
#include
#include
namespace core
{
namespace dbus
{
/**
* @brief Takes a raw DBus message and routes it to a handler.
*/
template
class MessageRouter
{
public:
/**
* @brief Mapper takes a raw DBus Message and maps it to the Key type of the router.
*/
typedef std::function Mapper;
/**
* @brief Handler is a function type that handles raw DBus messages.
*/
typedef std::function Handler;
/**
* @brief Constructs an empty router with the specified mapper instance.
* @param m An object of type Mapper.
*/
inline explicit MessageRouter(const Mapper& m) : mapper(m)
{
}
MessageRouter(const MessageRouter&) = delete;
MessageRouter& operator=(const MessageRouter&) = delete;
/**
* @brief Installs a route for a specific key in a thread-safe manner, replacing any previously installed route.
* @param key The key to install the route for.
* @param handler The handler to install, must not be empty.
*/
inline void install_route(const Key& key, Handler handler)
{
std::unique_lock ul(guard);
router[key] = handler;
}
/**
* @brief Uninstalls a route for a specific key in a thread-safe manner.
* @param key The key to uninstall the route for.
*/
inline void uninstall_route(const Key& key)
{
std::unique_lock ul(guard);
router.erase(key);
}
/**
* @brief Maps and routes a raw DBus message in a thread-safe manner.
* @param msg The message to map and route, must not be null.
* @return true if the message has been routes successfully, false otherwise.
*/
inline bool operator()(const Message::Ptr& msg)
{
std::unique_lock ul(guard);
auto it = router.find(mapper(msg));
if (it != router.end()) {
// release the lock so that Handler can modify the Router
Handler handler = it->second;
ul.unlock();
handler(msg);
return true;
}
return false;
}
private:
std::mutex guard;
Mapper mapper;
std::unordered_map router;
};
}
}
#endif // CORE_DBUS_MESSAGE_ROUTER_H_
dbus-cpp-2.0.0+14.04.20140326/include/core/dbus/argument_type.h 0000644 0000152 0177776 00000005617 12314613163 024201 0 ustar pbuser nogroup 0000000 0000000 /*
* Copyright © 2012 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Authored by: Thomas Voß
*/
#ifndef CORE_DBUS_ARGUMENT_TYPE_H_
#define CORE_DBUS_ARGUMENT_TYPE_H_
#include