2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file waitable_input_output_execution_context_support.h
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief This file is the header file for waitable input-output execution
23 #ifndef DPL_WAITABLE_INPUT_OUTPUT_EXECUTION_CONTEXT_SUPPORT_H
24 #define DPL_WAITABLE_INPUT_OUTPUT_EXECUTION_CONTEXT_SUPPORT_H
26 #include <dpl/abstract_waitable_input_output.h>
27 #include <dpl/waitable_handle_watch_support.h>
28 #include <dpl/binary_queue.h>
32 class WaitableInputOutputExecutionContextSupport :
33 private WaitableHandleWatchSupport::WaitableHandleListener
39 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
40 DECLARE_EXCEPTION_TYPE(Base, AlreadyOpened)
41 DECLARE_EXCEPTION_TYPE(Base, NotOpened)
42 DECLARE_EXCEPTION_TYPE(Base, OpenFailed)
43 DECLARE_EXCEPTION_TYPE(Base, CloseFailed)
48 AbstractWaitableInputOutput *m_waitableInputOutput;
55 void RemoveReadWatch();
57 void RemoveWriteWatch();
61 void CheckedRemoveReadWatch();
62 void CheckedRemoveWriteWatch();
64 void CheckedRemoveReadWriteWatch();
66 virtual void OnWaitableHandleEvent(WaitableHandle waitableHandle,
70 // Incoming/Outgoing streams
71 BinaryQueue m_inputStream;
72 BinaryQueue m_outputStream;
74 // Support calbback methods
75 virtual void OnInputStreamRead() = 0;
76 virtual void OnInputStreamClosed() = 0;
77 virtual void OnInputStreamBroken() = 0;
79 // Trigger feeding output - after updating output stream
82 // Open/Close destination waitable input-output
83 void Open(AbstractWaitableInputOutput *waitableInputOutput);
90 explicit WaitableInputOutputExecutionContextSupport();
95 virtual ~WaitableInputOutputExecutionContextSupport();
100 #endif // DPL_WAITABLE_INPUT_OUTPUT_EXECUTION_CONTEXT_SUPPORT_H