mbed-drivers
Transaction.h
1 /*
2  * Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may
6  * 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, WITHOUT
13  * 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 #ifndef MBED_TRANSACTION_H
18 #define MBED_TRANSACTION_H
19 
20 #include "platform.h"
21 #include "core-util/FunctionPointer.h"
22 #include "mbed-drivers/Buffer.h"
23 
24 namespace mbed {
25 
28 template <typename Callback>
31  uint32_t event;
32  Callback callback;
33 };
34 
37 template <typename Callback>
41  uint32_t event;
42  Callback callback;
43 };
44 
47 template<typename Class, typename TransactionData>
48 class Transaction {
49 public:
50  Transaction(Class *tpointer, const TransactionData& transaction) : _obj(tpointer), _data(transaction) {
51  }
52 
53  Transaction() : _obj(), _data() {
54  }
55 
56  ~Transaction() {
57  }
58 
63  Class* get_object() {
64  return _obj;
65  }
66 
71  TransactionData* get_transaction() {
72  return &_data;
73  }
74 
75 private:
76  Class* _obj;
77  TransactionData _data;
78 };
79 
80 } // namespace mbed
81 
82 #endif // #ifndef MBED_TRANSACTION_H
83 
Definition: Transaction.h:48
TransactionData * get_transaction()
Definition: Transaction.h:71
Buffer tx_buffer
Definition: Transaction.h:39
Callback callback
Definition: Transaction.h:42
Class * get_object()
Definition: Transaction.h:63
Definition: Transaction.h:38
uint32_t event
Definition: Transaction.h:41
Buffer rx_buffer
Definition: Transaction.h:40
Buffer buffer
Definition: Transaction.h:30
uint32_t event
Definition: Transaction.h:31
Definition: Buffer.h:30
Definition: BusIn.cpp:19
Callback callback
Definition: Transaction.h:32
Definition: Transaction.h:29