Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers OperationList.h Source File

OperationList.h

00001 /*
00002  * Copyright (c) 2018-2019, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef MBED_OPERATION_LIST_H
00019 #define MBED_OPERATION_LIST_H
00020 
00021 #include "OperationListBase.h"
00022 #include "AsyncOp.h"
00023 
00024 /**
00025  * \defgroup drivers_OperationList OperationList class
00026  * \ingroup drivers-internal-api-usb
00027  * @{
00028  */
00029 template<class T>
00030 class OperationList: public OperationListBase {
00031 public:
00032 
00033     /**
00034      * Create a new empty operation list
00035      */
00036     OperationList()
00037     {
00038 
00039     }
00040 
00041     /**
00042      * Destroy this object and abort all operations
00043      */
00044     ~OperationList()
00045     {
00046 
00047     }
00048     /**
00049      * Add an operation to the list
00050      *
00051      * If the list was empty then call process on this
00052      * operation
00053      *
00054      * @param op Operation to add
00055      */
00056     void add(T *op)
00057     {
00058         OperationListBase::add(op);
00059     }
00060 
00061     /**
00062      * Remove an operation from the list
00063      *
00064      * If this was the head of the list then process the
00065      * next element in the list.
00066      *
00067      * @param op Operation to remove
00068      */
00069     void remove(T *op)
00070     {
00071         OperationListBase::remove(op);
00072     }
00073 
00074     /**
00075      * Dequeue the head of the list
00076      *
00077      * Remove the head of the operation list without completing it
00078      * or processing the next element. The caller must call the
00079      * AsnycOp::complete() function of the returned object.
00080      * Additionally process() must be called on this object
00081      * if there are still elements in the list.
00082      *
00083      * @return The asynchronous op at the head of the list
00084      */
00085     T *dequeue_raw()
00086     {
00087         return static_cast<AsyncOp *>(OperationListBase::dequeue_raw());
00088     }
00089 
00090 };
00091 
00092 /** @}*/
00093 
00094 #endif