#ifndef MSP_IO_POLL_H_
#define MSP_IO_POLL_H_
-#include <list>
#include <map>
#include <vector>
+#include <msp/core/attributes.h>
+#include <msp/core/noncopyable.h>
#include <msp/time/timedelta.h>
namespace Msp {
{ return PollEvent(~static_cast<int>(e)); }
-class Poller
+class Poller: private NonCopyable
{
public:
struct Slot
Slot(EventObject *o, PollEvent e): object(o), events(e) { }
};
- typedef std::list<Slot> SlotList;
+ typedef std::vector<Slot> SlotList DEPRECATED;
private:
- typedef std::map<EventObject *, PollEvent> EventMap;
-
struct Private;
- EventMap objects;
+ std::vector<Slot> objects;
Private *priv;
+ bool events_changed;
bool objs_changed;
- SlotList poll_result;
+ std::vector<Slot> poll_result;
public:
Poller();
int do_poll(int);
void platform_poll(int);
public:
- const SlotList &get_result() const { return poll_result; }
+ const std::vector<Slot> &get_result() const { return poll_result; }
};
PollEvent poll(EventObject &, PollEvent);