SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
proxy_class_registry.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2014 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_AWARENESS_PROXY_CLASS_REGISTRY_H
17#define SIMICS_SYSTEMC_AWARENESS_PROXY_CLASS_REGISTRY_H
18
19#include <simics/base/types.h>
20#include <simics/base/sim-exception.h>
21#include <simics/simulator/sim-get-class.h>
22
26
27#include <systemc>
28#include <string>
29#include <utility>
30
31namespace simics {
32namespace systemc {
33namespace awareness {
34
36 public:
38 : factory_(factory) {
39 }
40 conf_class_t *confClass(sc_core::sc_object *object) {
41 if (!factory_.canManufacture(object))
42 return NULL;
43
45 object);
46
47 ProxyClassName name(
49 attributes->uniqueName(object) : attributes->name(object));
50 conf_class_t *cls = SIM_get_class(name.c_str());
51 if (SIM_clear_exception() != SimExc_No_Exception) {
52 cls = factory_.createConfClass(object, std::move(name),
53 attributes->description(object),
54 attributes->documentation(object));
55 if (cls == NULL) {
56 // Use (void) to avoid coverity warning "unchecked_return_value"
57 (void)SIM_clear_exception();
58 return NULL;
59 }
60
61 factory_.registerAttributes(object, cls);
62 factory_.registerInterfaces(object, cls);
63 factory_.registerLogGroups(object, cls);
64 }
65
66 return cls;
67 }
68
69 protected:
71};
72
73} // namespace awareness
74} // namespace systemc
75} // namespace simics
76
77#endif
Definition: class_attributes_interface.h:26
virtual std::string uniqueName(sc_core::sc_object *object) const =0
virtual std::string description(sc_core::sc_object *object) const =0
virtual std::string documentation(sc_core::sc_object *object) const =0
virtual std::string name(std::string class_name) const =0
Definition: proxy_class_name.h:33
Definition: proxy_class_registry.h:35
const ProxyFactoryInterface & factory_
Definition: proxy_class_registry.h:70
conf_class_t * confClass(sc_core::sc_object *object)
Definition: proxy_class_registry.h:40
ProxyClassRegistry(const ProxyFactoryInterface &factory)
Definition: proxy_class_registry.h:37
Definition: proxy_factory_interface.h:31
virtual void registerLogGroups(sc_core::sc_object *object, conf_class_t *cls) const =0
virtual conf_class_t * createConfClass(sc_core::sc_object *object, std::string name, std::string description, std::string documentation) const =0
virtual bool needUniqueConfClassName(sc_core::sc_object *object) const =0
virtual void registerAttributes(sc_core::sc_object *object, conf_class_t *cls) const =0
virtual const ClassAttributesInterface * classAttributes(sc_core::sc_object *object) const =0
virtual bool canManufacture(sc_core::sc_object *object) const =0
virtual void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const =0
conf_class_t * SIM_get_class(const char *NOTNULL name)
Definition: adapter.h:80