SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_vector_simics_adapter.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_IFACE_SC_VECTOR_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_SC_VECTOR_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 = ScVectorInterface>
34class ScVectorSimicsAdapter : public SimicsAdapter<sc_vector_interface_t> {
35 public:
36 ScVectorSimicsAdapter() : SimicsAdapter<sc_vector_interface_t>(
37 SC_VECTOR_INTERFACE, init_iface()) {
38 }
39
40 protected:
41 static attr_value_t get_elements(conf_object_t *obj) {
42 auto elements = adapter<TBase, TInterface>(obj)->get_elements();
43 return simics::std_to_attr(
44 std::vector<simics::ConfObjectRef>(elements.begin(),
45 elements.end()));
46 }
47
48 private:
49 std::vector<std::string> description(conf_object_t *obj,
50 DescriptionType type) override {
51 return descriptionBase<TBase, TInterface>(obj, type);
52 }
53 sc_vector_interface_t init_iface() {
54 sc_vector_interface_t iface = {};
55 iface.get_elements = get_elements;
56 return iface;
57 }
58};
59
60} // namespace iface
61} // namespace systemc
62} // namespace simics
63
64#endif
Definition: sc_vector_simics_adapter.h:34
ScVectorSimicsAdapter()
Definition: sc_vector_simics_adapter.h:36
static attr_value_t get_elements(conf_object_t *obj)
Definition: sc_vector_simics_adapter.h:41
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