SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
temporal_state_simics_adapter.h
Go to the documentation of this file.
1/*
2 © 2016 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_TEMPORAL_STATE_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_TEMPORAL_STATE_SIMICS_ADAPTER_H
16
17/* Some parts of SystemC is built with SHOW_OBSOLETE_API set and some is not.
18 We always need the temporal_state interface. */
19#ifndef SHOW_OBSOLETE_API
20#define SHOW_OBSOLETE_API
21#define WE_DEFINED_SHOW_OBSOLETE_API
22#endif
23#include <simics/model-iface/temporal-state.h>
24#ifdef WE_DEFINED_SHOW_OBSOLETE_API
25#undef SHOW_OBSOLETE_API
26#undef WE_DEFINED_SHOW_OBSOLETE_API
27#endif
28
31
32#include <string>
33#include <vector>
34
35namespace simics {
36namespace systemc {
37namespace iface {
38
39template<typename TBase, typename TInterface = TemporalStateInterface>
41 : public SimicsAdapter<temporal_state_interface_t> {
42 public:
44 temporal_state_interface_t>(TEMPORAL_STATE_INTERFACE, init_iface()) {}
45
46 protected:
47 static lang_void *save(conf_object_t *obj) {
48 return adapter<TBase, TInterface>(obj)->save();
49 }
50 static void merge(conf_object_t *obj, lang_void *prev, lang_void *killed) {
51 return adapter<TBase, TInterface>(obj)->merge(prev, killed);
52 }
53 static void prepare_restore(conf_object_t *obj) {
54 return adapter<TBase, TInterface>(obj)->prepare_restore();
55 }
56 static void finish_restore(conf_object_t *obj, lang_void *state) {
57 return adapter<TBase, TInterface>(obj)->finish_restore(state);
58 }
59
60 private:
61 std::vector<std::string> description(conf_object_t *obj,
62 DescriptionType type) override {
63 return descriptionBase<TBase, TInterface>(obj, type);
64 }
65 temporal_state_interface_t init_iface() {
66 temporal_state_interface_t iface = {};
67 iface.save = save;
68 iface.merge = merge;
69 iface.prepare_restore = prepare_restore;
70 iface.finish_restore = finish_restore;
71
72 return iface;
73 }
74};
75
76} // namespace iface
77} // namespace systemc
78} // namespace simics
79
80#endif // SIMICS_SYSTEMC_IFACE_TEMPORAL_STATE_SIMICS_ADAPTER_H
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:45
Definition: temporal_state_simics_adapter.h:41
TemporalStateSimicsAdapter()
Definition: temporal_state_simics_adapter.h:43
static void merge(conf_object_t *obj, lang_void *prev, lang_void *killed)
Definition: temporal_state_simics_adapter.h:50
static void prepare_restore(conf_object_t *obj)
Definition: temporal_state_simics_adapter.h:53
static lang_void * save(conf_object_t *obj)
Definition: temporal_state_simics_adapter.h:47
static void finish_restore(conf_object_t *obj, lang_void *state)
Definition: temporal_state_simics_adapter.h:56
DescriptionType
Definition: description_interface.h:23
Definition: adapter.h:79