[asycxx-devel] SF.net SVN: asycxx:[47] trunk/examples/echoserver
Status: Alpha
Brought to you by:
joe_steeve
From: <joe...@us...> - 2009-04-08 07:46:48
|
Revision: 47 http://asycxx.svn.sourceforge.net/asycxx/?rev=47&view=rev Author: joe_steeve Date: 2009-04-08 07:46:47 +0000 (Wed, 08 Apr 2009) Log Message: ----------- updated EchoServer to accomodate asycxx refactor * EchoServer now uses the StreamProtocol and StreamProtocolFactory. * Added a debug build in EchoServer's build. From: Joe Steeve <js...@hi...> Modified Paths: -------------- trunk/examples/echoserver/EchoServer.cxx trunk/examples/echoserver/Makefile.am Modified: trunk/examples/echoserver/EchoServer.cxx =================================================================== --- trunk/examples/echoserver/EchoServer.cxx 2009-04-08 07:46:06 UTC (rev 46) +++ trunk/examples/echoserver/EchoServer.cxx 2009-04-08 07:46:47 UTC (rev 47) @@ -15,37 +15,41 @@ #include <asycxx/Logger.h> #include <asycxx/Error.h> -#include <asycxx/Timer.h> +// #include <asycxx/Timer.h> #include <asycxx/SelectReactor.h> -#include <asycxx/Protocol.h> -#include <asycxx/Factory.h> +#include <asycxx/StreamProtocol.h> +#include <asycxx/StreamProtocolFactory.h> #include <asycxx/TCPListener.h> +using namespace asycxx; + Logger *Log; -class EchoServerProtocol : public Protocol +class EchoServerProtocol : public StreamProtocol { public: - EchoServerProtocol (Reactor *reactor, Factory *factory, Transport *transport) - : Protocol (reactor, factory, transport) + EchoServerProtocol (Reactor *reactor, StreamProtocolFactory *factory, + StreamTransport *transport) + : StreamProtocol (reactor, factory, transport) {} ~EchoServerProtocol () {} void DataAvailable (DataBuffer *data) { - m_Transport->Write (data); + getTransport()->Write (data); } }; -class EchoServerProtocolFactory : public Factory +class EchoServerProtocolFactory : public StreamProtocolFactory { public: - EchoServerProtocolFactory (Reactor *reactor) : Factory (reactor) + EchoServerProtocolFactory (Reactor *reactor) + : StreamProtocolFactory (reactor) {} ~EchoServerProtocolFactory () {} - EchoServerProtocol * GetProtocol (Transport *trans) + EchoServerProtocol * GetProtocol (StreamTransport *trans) { return new EchoServerProtocol (m_Reactor, this, trans); } @@ -61,7 +65,7 @@ Log->EnableConsole(); reactor = new SelectReactor (); - Timer::Init (reactor); +// Timer::Init (reactor); EchoServerProtocolFactory echofactory (reactor); TCPListener echolistener (reactor, &echofactory, (char *)"0.0.0.0", Modified: trunk/examples/echoserver/Makefile.am =================================================================== --- trunk/examples/echoserver/Makefile.am 2009-04-08 07:46:06 UTC (rev 46) +++ trunk/examples/echoserver/Makefile.am 2009-04-08 07:46:47 UTC (rev 47) @@ -1,11 +1,16 @@ -noinst_PROGRAMS = EchoServer +noinst_PROGRAMS = EchoServer EchoServer.debug EchoServer_SOURCES = EchoServer.cxx EchoServer_LDADD = $(top_srcdir)/src/libasycxx-0.1.la EchoServer_CPPFLAGS = -I$(top_srcdir)/include EchoServer_LDFLAGS = -L$(top_srcdir)/src +EchoServer_debug_SOURCES = $(EchoServer_SOURCES) +EchoServer_debug_CXXFLAGS = -g $(AM_CXXFLAGS) +EchoServer_debug_LDADD = $(top_srcdir)/src/.libs/libasycxx-dbg-0.1.a +EchoServer_debug_CPPFLAGS = -I$(top_srcdir)/include +#EchoServer_debug_LDFLAGS = -L$(top_srcdir)/src # Local Variables: # mode: makefile This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |