SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
extension_setter.h
Go to the documentation of this file.
1/*
2 © 2017 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14#ifndef SIMICS_SYSTEMC_INJECTION_EXTENSION_EXTENSION_SETTER_H
15#define SIMICS_SYSTEMC_INJECTION_EXTENSION_EXTENSION_SETTER_H
16
18
19#include <tlm>
20
21namespace simics {
22namespace systemc {
23namespace injection {
24namespace extension {
25
31template <typename TPAYLOAD, typename TExtension>
33 public:
34 explicit ExtensionSetter(TPAYLOAD *gp)
35 : gp_at_call_(gp), extension_at_call_(NULL) {
36 extension_.init(this);
37 }
38 virtual ~ExtensionSetter() {
39 if (extension_at_call_) {
40 gp_at_call_->resize_extensions();
41 delete gp_at_call_->set_extension(extension_at_call_);
42 }
43 }
44 ExtensionSetter(const ExtensionSetter &other) = delete;
45 ExtensionSetter& operator=(const ExtensionSetter &other) = delete;
46
47 TExtension *operator->() {
48 return &extension_;
49 }
51 return iface::Transaction(&gp_);
52 }
54 TExtension *e = (*transaction)->get_extension<TExtension>();
55 assert(e);
56 if (extension_at_call_)
57 delete extension_at_call_;
58
59 extension_at_call_ = static_cast<TExtension *>(e->clone());
60 }
62
63 private:
64 TPAYLOAD gp_;
65 TPAYLOAD *gp_at_call_;
66 TExtension extension_;
67 TExtension *extension_at_call_;
68};
69
70} // namespace extension
71} // namespace injection
72} // namespace systemc
73} // namespace simics
74
75#endif
Interface used by Extension class to send the extension.
Definition: extension_sender_interface.h:24
Class that encapsulates a generic_payload and returns it to the TransactionPool when the Transaction ...
Definition: transaction.h:29
iface::Transaction transaction() override
Called by extension to get a new Transaction.
Definition: extension_setter.h:50
virtual ~ExtensionSetter()
Definition: extension_setter.h:38
ExtensionSetter & operator=(const ExtensionSetter &other)=delete
ExtensionSetter(const ExtensionSetter &other)=delete
ExtensionSetter(TPAYLOAD *gp)
Definition: extension_setter.h:34
void send_failed(iface::Transaction *transaction) override
Called by extension if method_call invocation was missing.
Definition: extension_setter.h:61
TExtension * operator->()
Definition: extension_setter.h:47
void send_extension(iface::Transaction *transaction) override
Called by extension after the extension is set on the payload.
Definition: extension_setter.h:53
Definition: adapter.h:79