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// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2017 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_INJECTION_EXTENSION_EXTENSION_SETTER_H
17#define SIMICS_SYSTEMC_INJECTION_EXTENSION_EXTENSION_SETTER_H
18
20
21#include <tlm>
22
23namespace simics {
24namespace systemc {
25namespace injection {
26namespace extension {
27
33template <typename TPAYLOAD, typename TExtension>
35 public:
36 explicit ExtensionSetter(TPAYLOAD *gp)
37 : gp_at_call_(gp), extension_at_call_(NULL) {
38 extension_.init(this);
39 }
40 TExtension *operator->() {
41 return &extension_;
42 }
44 return iface::Transaction(&gp_);
45 }
47 TExtension *e = (*transaction)->get_extension<TExtension>();
48 assert(e);
49 if (extension_at_call_)
50 delete extension_at_call_;
51
52 extension_at_call_ = static_cast<TExtension *>(e->clone());
53 }
55 virtual ~ExtensionSetter() {
56 if (extension_at_call_) {
57 gp_at_call_->resize_extensions();
58 delete gp_at_call_->set_extension(extension_at_call_);
59 }
60 }
61
62 private:
63 TPAYLOAD gp_;
64 TPAYLOAD *gp_at_call_;
65 TExtension extension_;
66 TExtension *extension_at_call_;
67};
68
69} // namespace extension
70} // namespace injection
71} // namespace systemc
72} // namespace simics
73
74#endif
Interface used by Extension class to send the extension.
Definition: extension_sender_interface.h:26
Class that encapsulates a generic_payload and returns it to the TransactionPool when the Transaction ...
Definition: transaction.h:31
virtual ~ExtensionSetter()
Definition: extension_setter.h:55
virtual void send_failed(iface::Transaction *transaction)
Called by extension if method_call invocation was missing.
Definition: extension_setter.h:54
ExtensionSetter(TPAYLOAD *gp)
Definition: extension_setter.h:36
virtual void send_extension(iface::Transaction *transaction)
Called by extension after the extension is set on the payload.
Definition: extension_setter.h:46
TExtension * operator->()
Definition: extension_setter.h:40
virtual iface::Transaction transaction()
Called by extension to get a new Transaction.
Definition: extension_setter.h:43
Definition: pci_bus_interface.h:24