X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fio%2Fsg_netChannel.hxx;h=538618c3f0187ef930d5d717dfd9d8a434dcdf72;hb=70c5d605641b628039f75cb8761ce783a17a5bdf;hp=0ccc8607a7ba259ca03f968b2eeccc1eef2a107b;hpb=9ef56cbc4882b64c5de5ed157429235d30542b36;p=simgear.git diff --git a/simgear/io/sg_netChannel.hxx b/simgear/io/sg_netChannel.hxx index 0ccc8607..538618c3 100644 --- a/simgear/io/sg_netChannel.hxx +++ b/simgear/io/sg_netChannel.hxx @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA For further information visit http://plib.sourceforge.net @@ -54,20 +54,23 @@ #define SG_NET_CHANNEL_H #include + #include +#include namespace simgear { +class NetChannelPoller; + class NetChannel : public Socket { bool closed, connected, accepting, write_blocked, should_delete, resolving_host ; - NetChannel* next_channel ; std::string host; int port; - friend bool netPoll (unsigned int timeout); - + friend class NetChannelPoller; + NetChannelPoller* poller; public: NetChannel () ; @@ -109,9 +112,21 @@ public: virtual void handleWrite (void); virtual void handleAccept (void); virtual void handleError (int error); - - static bool poll (unsigned int timeout = 0 ) ; - static void loop (unsigned int timeout = 0 ) ; + +}; + +class NetChannelPoller +{ + typedef std::vector ChannelList; + ChannelList channels; +public: + void addChannel(NetChannel* channel); + void removeChannel(NetChannel* channel); + + bool hasChannels() const { return !channels.empty(); } + + bool poll(unsigned int timeout = 0); + void loop(unsigned int timeout = 0); }; } // of namespace simgear