]> git.tdb.fi Git - libs/core.git/blobdiff - source/poll.h
Move class members and comments around
[libs/core.git] / source / poll.h
index 6ac6149b155b1634b9835a87233342e51fdd25b1..6367d8f2b301544f26953220284868d7658b22fb 100644 (file)
@@ -1,9 +1,3 @@
-/* $Id$
-
-This file is part of libmspio
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
 #ifndef MSP_IO_POLL_H_
 #define MSP_IO_POLL_H_
 
@@ -23,21 +17,22 @@ class Base;
 
 enum PollEvent
 {
-       P_NONE=0,
-       P_INPUT=1,
-       P_PRIO=2,
-       P_OUTPUT=4,
-       P_ERROR=8
+       P_NONE = 0,
+       P_INPUT = 1,
+       P_PRIO = 2,
+       P_OUTPUT = 4,
+       P_ERROR = 8
 };
 
 inline PollEvent operator|(PollEvent e, PollEvent f)
-{ return PollEvent((int)e|(int)f); }
+{ return PollEvent(static_cast<int>(e)|static_cast<int>(f)); }
 
 inline PollEvent operator&(PollEvent e, PollEvent f)
-{ return PollEvent((int)e&(int)f); }
+{ return PollEvent(static_cast<int>(e)&static_cast<int>(f)); }
 
 inline PollEvent operator~(PollEvent e)
-{ return PollEvent(~(int)e); }
+{ return PollEvent(~static_cast<int>(e)); }
+
 
 class Poller
 {
@@ -49,13 +44,8 @@ public:
 
                Slot(Base *o, PollEvent e): object(o), events(e) { }
        };
-       typedef std::list<Slot> SlotSeq;
 
-       Poller();
-       void set_object(Base &, PollEvent);
-       int  poll();
-       int  poll(const Time::TimeDelta &);
-       const SlotSeq &get_result() const { return poll_result; }
+       typedef std::list<Slot> SlotSeq;
 private:
        typedef std::map<Base *, Slot> SlotMap;
 
@@ -73,6 +63,14 @@ private:
 
        void rebuild_pfd();
        int do_poll(int);
+
+public:
+       Poller();
+
+       void set_object(Base &, PollEvent);
+       int poll();
+       int poll(const Time::TimeDelta &);
+       const SlotSeq &get_result() const { return poll_result; }
 };
 
 PollEvent poll(Base &, PollEvent);