# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
-PROJECT_NAME = libeventxx
+PROJECT_NAME = eventxx
# 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.
-INPUT = event
+INPUT = eventxx
# 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,
/**
* Namespace for all symbols libevent C++ wrapper defines.
*/
-namespace event
+namespace eventxx
{
* 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
* 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
/**
- * This is the specialization of event::event for C-style callbacks.
+ * This is the specialization of eventxx::event for C-style callbacks.
*
- * @see event::event
+ * @see eventxx::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 <>
-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
}; // 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;
+
+
//@}
}; // struct dispatcher
-/// 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;
-
-
} // namespace event
-#endif // _EVENT_HPP_
+#endif // _EVENTXX_HPP_
// vim: set filetype=cpp :
#include <cerrno>
#include <vector>
-#include <event>
+#include <eventxx>
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;
void
}
}
-event::time *
+eventxx::time *
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) {
- 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]);
}
{
struct rlimit rl;
int i, c;
- event::time* tv;
+ eventxx::time* tv;
int *cp;
extern char *optarg;
#include <cstring>
#include <cerrno>
-#include <event>
+#include <eventxx>
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)
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);
d.add(*ev);
#include <cstring>
#include <cerrno>
-#include <event>
+#include <eventxx>
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)
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);
{
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));
}
d.dispatch();
#include <csignal>
#include <cerrno>
-#include <event>
+#include <eventxx>
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)
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);
d.add(*ev);