SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
transaction.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2018 Intel Corporation
5
6 This software and the related documents are Intel copyrighted materials, and
7 your use of them is governed by the express license under which they were
8 provided to you ("License"). Unless the License provides otherwise, you may
9 not use, modify, copy, publish, distribute, disclose or transmit this software
10 or the related documents without Intel's prior written permission.
11
12 This software and the related documents are provided as is, with no express or
13 implied warranties, other than those that are expressly stated in the License.
14*/
15
16#ifndef SIMICS_SYSTEMC_IFACE_TRANSACTION_H
17#define SIMICS_SYSTEMC_IFACE_TRANSACTION_H
18
20
21#include <tlm>
22
23namespace simics {
24namespace systemc {
25namespace iface {
26
32 public:
33 explicit Transaction(tlm::tlm_generic_payload *payload)
34 : payload_(payload) {
35 acquire();
36 }
37 Transaction() : payload_(NULL) {}
40 payload_ = t.payload_;
41 acquire();
42 }
45 if (this == &t)
46 return *this;
47
48 release();
49 payload_ = t.payload_;
50 acquire();
51 return *this;
52 }
55 release();
56 }
58 tlm::tlm_generic_payload *operator->() {
59 return payload_;
60 }
62 const tlm::tlm_generic_payload *operator->() const {
63 return payload_;
64 }
66 operator tlm::tlm_generic_payload &() {
67 return *payload_;
68 }
70 operator tlm::tlm_generic_payload *() {
71 return payload_;
72 }
74 tlm::tlm_generic_payload *payload() {
75 return payload_;
76 }
78 if (!payload_)
79 return NULL;
80
81 TransactionExtension *e = NULL;
82 payload_->get_extension(e);
83 return e;
84 }
85
86 private:
87 void acquire() {
88 if (payload_ && payload_->has_mm())
89 payload_->acquire();
90 }
91 void release() {
92 if (payload_ && payload_->has_mm())
93 payload_->release();
94 }
95
96 tlm::tlm_generic_payload *payload_;
97};
98
99} // namespace iface
100} // namespace systemc
101} // namespace simics
102
103#endif
Definition: transaction_extension.h:54
Class that encapsulates a generic_payload and returns it to the TransactionPool when the Transaction ...
Definition: transaction.h:31
Transaction(const Transaction &t)
Increases usage count for payload.
Definition: transaction.h:39
Transaction(tlm::tlm_generic_payload *payload)
Definition: transaction.h:33
const tlm::tlm_generic_payload * operator->() const
Access payload with ->
Definition: transaction.h:62
Transaction()
Definition: transaction.h:37
TransactionExtension * extension()
Definition: transaction.h:77
~Transaction()
Returns payload to pool.
Definition: transaction.h:54
tlm::tlm_generic_payload * operator->()
Access payload with ->
Definition: transaction.h:58
Transaction & operator=(const Transaction &t)
Increases usage count for new payload and returns former to pool.
Definition: transaction.h:44
tlm::tlm_generic_payload * payload()
Access payload by payload()
Definition: transaction.h:74
Definition: pci_bus_interface.h:24