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