Mbed OS Reference
Loading...
Searching...
No Matches
OperationList.h
1/*
2 * Copyright (c) 2018-2019, Arm Limited and affiliates.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef MBED_OPERATION_LIST_H
19#define MBED_OPERATION_LIST_H
20
21#include "OperationListBase.h"
22#include "AsyncOp.h"
23
24/**
25 * \defgroup drivers_OperationList OperationList class
26 * \ingroup drivers-internal-api-usb
27 * @{
28 */
29template<class T>
31public:
32
33 /**
34 * Create a new empty operation list
35 */
37 {
38
39 }
40
41 /**
42 * Destroy this object and abort all operations
43 */
45 {
46
47 }
48 /**
49 * Add an operation to the list
50 *
51 * If the list was empty then call process on this
52 * operation
53 *
54 * @param op Operation to add
55 */
56 void add(T *op)
57 {
59 }
60
61 /**
62 * Remove an operation from the list
63 *
64 * If this was the head of the list then process the
65 * next element in the list.
66 *
67 * @param op Operation to remove
68 */
69 void remove(T *op)
70 {
72 }
73
74 /**
75 * Dequeue the head of the list
76 *
77 * Remove the head of the operation list without completing it
78 * or processing the next element. The caller must call the
79 * AsnycOp::complete() function of the returned object.
80 * Additionally process() must be called on this object
81 * if there are still elements in the list.
82 *
83 * @return The asynchronous op at the head of the list
84 */
86 {
87 return static_cast<AsyncOp *>(OperationListBase::dequeue_raw());
88 }
89
90};
91
92/** @}*/
93
94#endif
Base class for asynchronous operations in the USB stack.
Definition: AsyncOp.h:48
void remove(AsyncOp *op)
Remove an operation from the list.
void add(AsyncOp *op)
Add an operation to the list.
AsyncOp * dequeue_raw()
Dequeue the head of the list.
void add(T *op)
Add an operation to the list.
Definition: OperationList.h:56
T * dequeue_raw()
Dequeue the head of the list.
Definition: OperationList.h:85
~OperationList()
Destroy this object and abort all operations.
Definition: OperationList.h:44
OperationList()
Create a new empty operation list.
Definition: OperationList.h:36
void remove(T *op)
Remove an operation from the list.
Definition: OperationList.h:69