SFML - Simple and Fast Multimedia Library
Main Page
Namespaces
Classes
Files
File List
Selector.inl00001
00002 //
00003 // SFML - Simple and Fast Multimedia Library
00004 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
00005 //
00006 // This software is provided 'as-is', without any express or implied warranty.
00007 // In no event will the authors be held liable for any damages arising from the use of this software.
00008 //
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it freely,
00011 // subject to the following restrictions:
00012 //
00013 // 1. The origin of this software must not be misrepresented;
00014 // you must not claim that you wrote the original software.
00015 // If you use this software in a product, an acknowledgment
00016 // in the product documentation would be appreciated but is not required.
00017 //
00018 // 2. Altered source versions must be plainly marked as such,
00019 // and must not be misrepresented as being the original software.
00020 //
00021 // 3. This notice may not be removed or altered from any source distribution.
00022 //
00024
00025
00029 template <typename Type>
00030 void Selector<Type>::Add(Type Socket)
00031 {
00032 if (Socket.IsValid())
00033 {
00034 SelectorBase::Add(Socket.mySocket);
00035 mySockets[Socket.mySocket] = Socket;
00036 }
00037 }
00038
00039
00043 template <typename Type>
00044 void Selector<Type>::Remove(Type Socket)
00045 {
00046 typename SocketTable::iterator It = mySockets.find(Socket.mySocket);
00047 if (It != mySockets.end())
00048 {
00049 SelectorBase::Remove(Socket.mySocket);
00050 mySockets.erase(It);
00051 }
00052 }
00053
00054
00058 template <typename Type>
00059 void Selector<Type>::Clear()
00060 {
00061 SelectorBase::Clear();
00062 mySockets.clear();
00063 }
00064
00065
00071 template <typename Type>
00072 unsigned int Selector<Type>::Wait(float Timeout)
00073 {
00074 // No socket in the selector : return 0
00075 if (mySockets.empty())
00076 return 0;
00077
00078 return SelectorBase::Wait(Timeout);
00079 }
00080
00081
00087 template <typename Type>
00088 Type Selector<Type>::GetSocketReady(unsigned int Index)
00089 {
00090 SocketHelper::SocketType Socket = SelectorBase::GetSocketReady(Index);
00091
00092 typename SocketTable::const_iterator It = mySockets.find(Socket);
00093 if (It != mySockets.end())
00094 return It->second;
00095 else
00096 return Type(Socket);
00097 }
:: Copyright © 2007-2008 Laurent Gomila, all rights reserved ::
Documentation generated by doxygen 1.5.2 ::
Wyszukiwarka
Podobne podstrony:
Resource 8inl sourceUnicode 8inl sourceResourcePtr 8inl sourceRect 8inl sourceSelector 8hpp sourceVector3 8inl sourceVector2 8inl sourceSelectorBase 8hpp sourceMatrix3 8inl sourceSelectorBase?pp sourcesource30Functional Origins of Religious Concepts Ontological and Strategic Selection in Evolved MindsMatrix3?pp sourceThread?pp sourcearm biquad ?scade ?1 ?st q31? sourcearm conv ?2? sourcearm mat mult q15? sourcefunction socket selectwięcej podobnych podstron