poco/Foundation/include/Poco/AsyncIOEvent.h
Guenter Obiltschnig 049c3b914b added AsyncIO
2007-06-18 07:00:47 +00:00

122 lines
3.2 KiB
C++

//
// AsyncIOEvent.h
//
// $Id: //poco/Main/Foundation/include/Poco/AsyncIOEvent.h#1 $
//
// Library: Foundation
// Package: AsyncIO
// Module: AsyncIOEvent
//
// Definition of the AsyncIOEvent class.
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Foundation_AsyncIOEvent_INCLUDED
#define Foundation_AsyncIOEvent_INCLUDED
#include "Poco/Foundation.h"
namespace Poco {
class AsyncIOCommand;
class AsyncIOChannel;
class Foundation_API AsyncIOEvent
/// The AsyncIOEvent class holds information about an event
/// caused by asynchronous input or output operation.
{
public:
enum EventKind
{
EV_COMMAND_COMPLETED,
EV_COMMAND_FAILED
};
AsyncIOEvent(AsyncIOCommand* pCommand, AsyncIOChannel* pChannel, EventKind what);
/// Creates the AsyncIOEvent.
AsyncIOEvent(const AsyncIOEvent& event);
/// Creates a AsyncIOEvent from another one.
~AsyncIOEvent();
/// Destroys the AsyncIOEvent.
AsyncIOEvent& operator = (const AsyncIOEvent& event);
/// Assigns a AsyncIOEvent.
void swap(AsyncIOEvent& event);
/// Swaps the event with another one.
AsyncIOCommand& command() const;
/// Returns the command that caused the event.
AsyncIOChannel& channel() const;
/// Returns the channel that caused the event.
EventKind what() const;
/// Returns the reason of the event.
private:
AsyncIOEvent();
AsyncIOCommand* _pCommand;
AsyncIOChannel* _pChannel;
EventKind _what;
};
//
// inlines
//
inline AsyncIOCommand& AsyncIOEvent::command() const
{
return *_pCommand;
}
inline AsyncIOChannel& AsyncIOEvent::channel() const
{
return *_pChannel;
}
inline AsyncIOEvent::EventKind AsyncIOEvent::what() const
{
return _what;
}
} // namespace Poco
#endif // Foundation_AsyncIOEvent_INCLUDED