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
22#include <systemc-interfaces.h>
23
24#include <string>
25#include <vector>
26
27namespace simics {
28namespace systemc {
29namespace iface {
30
32template<typename TBase, typename TInterface = ScVectorInterface>
33class ScVectorSimicsAdapter : public SimicsAdapter<sc_vector_interface_t> {
34 public:
35 ScVectorSimicsAdapter() : SimicsAdapter<sc_vector_interface_t>(
36 SC_VECTOR_INTERFACE, init_iface()) {
37 }
38
39 protected:
40 static attr_value_t get_elements(conf_object_t *obj) {
41 return stl2simics(
42 adapter<TBase, TInterface>(obj)->get_elements());
43 }
44
45 private:
46 static attr_value_t stl2simics(std::vector<conf_object_t *> proxies) {
47 attr_value_t list = SIM_alloc_attr_list(proxies.size());
48 for (unsigned i = 0; i < proxies.size(); ++i)
49 SIM_attr_list_set_item(&list, i, SIM_make_attr_object(proxies[i]));
50
51 return list;
52 }
53 std::vector<std::string> description(conf_object_t *obj,
54 DescriptionType type) {
55 return descriptionBase<TBase, TInterface>(obj, type);
56 }
57 sc_vector_interface_t init_iface() {
58 sc_vector_interface_t iface = {};
59 iface.get_elements = get_elements;
60 return iface;
61 }
62};
63
64} // namespace iface
65} // namespace systemc
66} // namespace simics
67
68#endif
Definition: sc_vector_simics_adapter.h:33
ScVectorSimicsAdapter()
Definition: sc_vector_simics_adapter.h:35
static attr_value_t get_elements(conf_object_t *obj)
Definition: sc_vector_simics_adapter.h:40
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:47
DescriptionType
Definition: description_interface.h:25
Definition: pci_bus_interface.h:24