Dependents: SimpleLCDClock readCard2Twitter_http AnalogClock_StepperMotor_NTP ServoCamV1
Diff: if/net/netservice.h
- Revision:
- 0:3717b703f76d
- Child:
- 1:e52ec2a24c6a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/if/net/netservice.h Mon May 24 10:23:42 2010 +0000 @@ -0,0 +1,35 @@ +#ifndef NETSERVICE_H +#define NETSERVICE_H + +//class NetDnsRequest; +//#include "net.h" + +//Each connection-oriented object can register as service (by inheriting this class), so that it is polled regularly +//It notifies the pool when the connection is terminated so that it can be destroyed + +#include <list> +using std::list; + +class NetService +{ +public: + NetService(bool owned = true); //Is owned by the pool? + virtual ~NetService(); + + virtual void poll(); + + static void servicesPoll(); //Poll all registered services & destroy closed ones + +protected: + void close(); + +private: + bool m_closed; + bool m_removed; + bool m_owned; + + static list<NetService*>& lpServices(); //Helper to prevent static initialization fiasco + +}; + +#endif