Mbed OS Reference
Loading...
Searching...
No Matches
OperationListBase.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_BASE_H
19#define MBED_OPERATION_LIST_BASE_H
20
21#include "usb/internal/LinkedListBase.h"
22
23class AsyncOp;
24
25/**
26 * \defgroup drivers_OperationListBase OperationListBase class
27 * \ingroup drivers-internal-api-usb
28 * @{
29 */
31public:
32
33 /**
34 * Create a new empty operation list
35 */
37
38 /**
39 * Destroy this object and abort all operations
40 */
42
43 /**
44 * Check if the list is empty
45 *
46 * @return true if the list is empty false otherwise
47 */
48 bool empty();
49
50 /**
51 * Add an operation to the list
52 *
53 * If the list was empty then call process on this
54 * operation
55 *
56 * @param op Operation to add
57 */
58 void add(AsyncOp *op);
59
60 /**
61 * Remove an operation from the list
62 *
63 * If this was the head of the list then process the
64 * next element in the list.
65 *
66 * @param op Operation to remove
67 */
68 void remove(AsyncOp *op);
69
70 /**
71 * Dequeue the head of the list
72 *
73 * Remove the head of the operation list without completing it
74 * or processing the next element. The caller must call the
75 * AsnycOp::complete() function of the returned object.
76 * Additionally process() must be called on this object
77 * if there are still elements in the list.
78 *
79 * @return The asynchronous op at the head of the list
80 */
82
83 /**
84 * Abort all operations
85 */
86 void remove_all();
87
88 /**
89 * Process the operation list
90 *
91 * This allow the operation at the head of the list to perform processing
92 */
93 void process();
94
95private:
96 friend class AsyncOp;
97
98 LinkedListBase _list;
99};
100
101/** @}*/
102
103#endif
Base class for asynchronous operations in the USB stack.
Definition: AsyncOp.h:48
void process()
Process the operation list.
bool empty()
Check if the list is empty.
void remove(AsyncOp *op)
Remove an operation from the list.
void remove_all()
Abort all operations.
OperationListBase()
Create a new empty operation list.
void add(AsyncOp *op)
Add an operation to the list.
AsyncOp * dequeue_raw()
Dequeue the head of the list.
~OperationListBase()
Destroy this object and abort all operations.