From: Leandro Lucarella Date: Tue, 2 Jan 2007 15:09:18 +0000 (+0000) Subject: Rename event namespace to eventxx. X-Git-Tag: 0.1~17 X-Git-Url: https://git.llucax.com/software/eventxx.git/commitdiff_plain/ce13dd6e8fa9f96fc4535c942ac091333c562e64?hp=ea9a8685dc19d37823f02db60a96cf1dec354be1 Rename event namespace to eventxx. 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.). --- diff --git a/Doxyfile b/Doxyfile index c22e4e2..2826e0b 100644 --- a/Doxyfile +++ b/Doxyfile @@ -17,7 +17,7 @@ # 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 @@ -459,7 +459,7 @@ WARN_LOGFILE = # 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 diff --git a/event b/eventxx similarity index 96% rename from event rename to eventxx index 0db8728..080f40c 100644 --- a/event +++ b/eventxx @@ -1,5 +1,5 @@ -#ifndef _EVENT_HPP_ -#define _EVENT_HPP_ +#ifndef _EVENTXX_HPP_ +#define _EVENTXX_HPP_ #include // timeval (hack -> event.h don't include it) #include // std::exception, std::invalid_argument, @@ -49,7 +49,7 @@ /** * Namespace for all symbols libevent C++ wrapper defines. */ -namespace event +namespace eventxx { @@ -195,7 +195,7 @@ struct time: ::timeval * 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 @@ -275,7 +275,7 @@ 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 @@ -310,9 +310,9 @@ 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 @@ -376,13 +376,13 @@ struct timer: event< F > /** - * 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 > { /** @@ -449,7 +449,7 @@ struct signal: event< F > /** - * 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 @@ -489,6 +489,16 @@ struct signal< ccallback_type >: event< 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; + + //@} @@ -710,18 +720,8 @@ struct dispatcher }; // 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 : diff --git a/test/bench.cpp b/test/bench.cpp index a098012..e621ed0 100644 --- a/test/bench.cpp +++ b/test/bench.cpp @@ -55,14 +55,14 @@ #include #include -#include +#include 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 @@ -81,14 +81,14 @@ read_cb(int fd, short which, void *arg) } } -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]); } @@ -131,7 +131,7 @@ main (int argc, char **argv) { struct rlimit rl; int i, c; - event::time* tv; + eventxx::time* tv; int *cp; extern char *optarg; diff --git a/test/test-eof.cpp b/test/test-eof.cpp index a76b6b4..41fdaae 100644 --- a/test/test-eof.cpp +++ b/test/test-eof.cpp @@ -20,12 +20,12 @@ #include #include -#include +#include 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) @@ -60,7 +60,7 @@ main (int argc, char **argv) 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); diff --git a/test/test-time.cpp b/test/test-time.cpp index c1326b4..c3dba8d 100644 --- a/test/test-time.cpp +++ b/test/test-time.cpp @@ -18,14 +18,14 @@ #include #include -#include +#include 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) @@ -34,7 +34,7 @@ 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); @@ -49,8 +49,8 @@ main (int argc, char **argv) { 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(); diff --git a/test/test-weof.cpp b/test/test-weof.cpp index 90f2c08..8bcf684 100644 --- a/test/test-weof.cpp +++ b/test/test-weof.cpp @@ -20,15 +20,15 @@ #include #include -#include +#include 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) @@ -61,7 +61,7 @@ main (int argc, char **argv) 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);