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