SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_object_simics_adapter.h
Go to the documentation of this file.
1/*
2 © 2015 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_IFACE_SC_OBJECT_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_SC_OBJECT_SIMICS_ADAPTER_H
16
19#include <simics/attribute-traits.h>
20
21#include <systemc-interfaces.h>
22
23#include <string>
24#include <vector>
25
26namespace simics {
27namespace systemc {
28namespace iface {
29
31template<typename TBase, typename TInterface = ScObjectInterface>
32class ScObjectSimicsAdapter : public SimicsAdapter<sc_object_interface_t> {
33 public:
35 : SimicsAdapter<sc_object_interface_t>(
36 SC_OBJECT_INTERFACE, init_iface()) {
37 }
38
39 protected:
40 static attr_value_t sc_print(conf_object_t *obj) {
41 std::vector<std::string> lines =
42 adapter<TBase, TInterface>(obj)->sc_print();
43
44 return vectorToAttr(lines);
45 }
46 static attr_value_t sc_dump(conf_object_t *obj) {
47 std::vector<std::string> lines
48 = adapter<TBase, TInterface>(obj)->sc_dump();
49
50 return vectorToAttr(lines);
51 }
52 static attr_value_t sc_kind(conf_object_t *obj) {
53 return adapter<TBase, TInterface>(obj)->sc_kind();
54 }
55 static const char *sc_name(conf_object_t *obj) {
56 return adapter<TBase, TInterface>(obj)->sc_name();
57 }
58
59 private:
60 static attr_value_t vectorToAttr(const std::vector<std::string> &lines) {
61 return simics::std_to_attr(lines);
62 }
63 std::vector<std::string> description(conf_object_t *obj,
64 DescriptionType type) override {
65 return descriptionBase<TBase, TInterface>(obj, type);
66 }
67 sc_object_interface_t init_iface() {
68 sc_object_interface_t iface = {};
69 iface.sc_print = sc_print;
70 iface.sc_dump = sc_dump;
71 iface.sc_kind = sc_kind;
72 iface.sc_name = sc_name;
73 return iface;
74 }
75};
76
77} // namespace iface
78} // namespace systemc
79} // namespace simics
80
81#endif
Definition: sc_object_simics_adapter.h:32
static const char * sc_name(conf_object_t *obj)
Definition: sc_object_simics_adapter.h:55
ScObjectSimicsAdapter()
Definition: sc_object_simics_adapter.h:34
static attr_value_t sc_print(conf_object_t *obj)
Definition: sc_object_simics_adapter.h:40
static attr_value_t sc_kind(conf_object_t *obj)
Definition: sc_object_simics_adapter.h:52
static attr_value_t sc_dump(conf_object_t *obj)
Definition: sc_object_simics_adapter.h:46
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:45
DescriptionType
Definition: description_interface.h:23
Definition: adapter.h:79