summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ea9a868)
This renaming is for the sake of clarity, so libevent and eventxx don't get
confused (by the compiler, by the documentation tools, by the man page reader,
etc.).
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
-PROJECT_NAME = libeventxx
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-#ifndef _EVENT_HPP_
-#define _EVENT_HPP_
+#ifndef _EVENTXX_HPP_
+#define _EVENTXX_HPP_
#include <sys/types.h> // timeval (hack -> event.h don't include it)
#include <stdexcept> // std::exception, std::invalid_argument,
#include <sys/types.h> // timeval (hack -> event.h don't include it)
#include <stdexcept> // std::exception, std::invalid_argument,
/**
* Namespace for all symbols libevent C++ wrapper defines.
*/
/**
* Namespace for all symbols libevent C++ wrapper defines.
*/
* All events derive from this class, so it's useful for use in containers,
* like:
* @code
* All events derive from this class, so it's useful for use in containers,
* like:
* @code
- * std::list< event::basic_event* > events;
+ * std::list< eventxx::basic_event* > events;
* @endcode
*/
struct basic_event: internal::event
* @endcode
*/
struct basic_event: internal::event
* version of this class which takes as the template parameter a C function
* with the ccallback_type signature, just like C libevent API does.
*
* version of this class which takes as the template parameter a C function
* with the ccallback_type signature, just like C libevent API does.
*
- * @see event::event< ccallback_type >
+ * @see eventxx::event< ccallback_type >
*/
template < typename F >
struct event: basic_event
*/
template < typename F >
struct event: basic_event
- * This is the specialization of event::event for C-style callbacks.
+ * This is the specialization of eventxx::event for C-style callbacks.
*/
template <>
struct event< ccallback_type >: basic_event
*/
template <>
struct event< ccallback_type >: basic_event
- * This is the specialization of event::timer for C-style callbacks.
+ * This is the specialization of eventxx::timer for C-style callbacks.
*
* @note This event can't EV_PERSIST.
* @see timer
*/
template <>
*
* @note This event can't EV_PERSIST.
* @see timer
*/
template <>
-struct timer< ccallback_type >: event::event< ccallback_type >
+struct timer< ccallback_type >: event< ccallback_type >
- * This is the specialization of event::signal for C-style callbacks.
+ * This is the specialization of eventxx::signal for C-style callbacks.
*
* @note This event allways EV_PERSIST.
* @see signal
*
* @note This event allways EV_PERSIST.
* @see signal
}; // struct signal< ccallback_type >
}; // struct signal< ccallback_type >
+/// Shortcut to C-style event.
+typedef eventxx::event< ccallback_type > cevent;
+
+/// Shortcut to C-style timer.
+typedef eventxx::timer< ccallback_type > ctimer;
+
+/// Shortcut to C-style signal handler.
+typedef eventxx::signal< ccallback_type > csignal;
+
+
-/// Shortcut to C-style event.
-typedef event::event< ccallback_type > cevent;
-
-/// Shortcut to C-style timer.
-typedef event::timer< ccallback_type > ctimer;
-
-/// Shortcut to C-style signal handler.
-typedef event::signal< ccallback_type > csignal;
-
-
// vim: set filetype=cpp :
// vim: set filetype=cpp :
#include <cerrno>
#include <vector>
#include <cerrno>
#include <vector>
static int count, writes, fired;
static int *pipes;
static int num_pipes, num_active, num_writes;
static int count, writes, fired;
static int *pipes;
static int num_pipes, num_active, num_writes;
-static std::vector< event::cevent* > events;
-static event::dispatcher d;
+static std::vector< eventxx::cevent* > events;
+static eventxx::dispatcher d;
run_once(void)
{
int *cp, i, space;
run_once(void)
{
int *cp, i, space;
- static event::time ts, te;
+ static eventxx::time ts, te;
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
- events.push_back(new event::cevent(cp[0], EV_READ | EV_PERSIST,
+ events.push_back(new eventxx::cevent(cp[0], EV_READ | EV_PERSIST,
read_cb, (void *) i));
d.add(*events[i]);
}
read_cb, (void *) i));
d.add(*events[i]);
}
{
struct rlimit rl;
int i, c;
{
struct rlimit rl;
int i, c;
int *cp;
extern char *optarg;
int *cp;
extern char *optarg;
#include <cstring>
#include <cerrno>
#include <cstring>
#include <cerrno>
int test_okay = 1;
int called = 0;
int test_okay = 1;
int called = 0;
-event::dispatcher d;
-event::cevent* ev;
+eventxx::dispatcher d;
+eventxx::cevent* ev;
void
read_cb(int fd, short event, void *arg)
void
read_cb(int fd, short event, void *arg)
shutdown(pair[0], SHUT_WR);
/* Initalize one event */
shutdown(pair[0], SHUT_WR);
/* Initalize one event */
- ev = new event::cevent(pair[1], EV_READ, read_cb, NULL);
+ ev = new eventxx::cevent(pair[1], EV_READ, read_cb, NULL);
#include <cstring>
#include <cerrno>
#include <cstring>
#include <cerrno>
int called = 0;
#define NEVENT 20000
int called = 0;
#define NEVENT 20000
-event::ctimer* ev[NEVENT];
-event::dispatcher d;
+eventxx::ctimer* ev[NEVENT];
+eventxx::dispatcher d;
void
time_cb(int fd, short event, void *arg)
void
time_cb(int fd, short event, void *arg)
if (called < 10*NEVENT) {
for (int i = 0; i < 10; i++) {
if (called < 10*NEVENT) {
for (int i = 0; i < 10; i++) {
- event::time tv(0, random() % 50000L);
+ eventxx::time tv(0, random() % 50000L);
int j = random() % NEVENT;
if (tv.usec() % 2)
d.add(*ev[j], tv);
int j = random() % NEVENT;
if (tv.usec() % 2)
d.add(*ev[j], tv);
{
for (int i = 0; i < NEVENT; i++) {
/* Initalize one event */
{
for (int i = 0; i < NEVENT; i++) {
/* Initalize one event */
- ev[i] = new event::ctimer(time_cb, NULL);
- d.add(*ev[i], event::time(0, random() % 50000L));
+ ev[i] = new eventxx::ctimer(time_cb, NULL);
+ d.add(*ev[i], eventxx::time(0, random() % 50000L));
#include <csignal>
#include <cerrno>
#include <csignal>
#include <cerrno>
typedef void (cb_t)(int, short);
int pair[2];
int test_okay = 1;
int called = 0;
typedef void (cb_t)(int, short);
int pair[2];
int test_okay = 1;
int called = 0;
-event::dispatcher d;
-event::event< cb_t >* ev;
+eventxx::dispatcher d;
+eventxx::event< cb_t >* ev;
void
write_cb(int fd, short event)
void
write_cb(int fd, short event)
return (1);
/* Initalize one event */
return (1);
/* Initalize one event */
- ev = new event::event< cb_t >(pair[1], EV_WRITE, write_cb);
+ ev = new eventxx::event< cb_t >(pair[1], EV_WRITE, write_cb);