Dependents:   SimpleLCDClock readCard2Twitter_http AnalogClock_StepperMotor_NTP ServoCamV1

if/net/netservice.h

Committer:
donatien
Date:
2010-05-24
Revision:
0:3717b703f76d
Child:
1:e52ec2a24c6a

File content as of revision 0:3717b703f76d:

#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