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/*
2 © 2014 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_AWARENESS_PROXY_CLASS_REGISTRY_H
15#define SIMICS_SYSTEMC_AWARENESS_PROXY_CLASS_REGISTRY_H
16
17#include <simics/base/types.h>
18#include <simics/base/sim-exception.h>
19#include <simics/simulator/sim-get-class.h>
20
24
25#include <systemc>
26#include <string>
27#include <utility> // std::ignore
28
29namespace simics {
30namespace systemc {
31namespace awareness {
32
34 public:
36 : factory_(factory) {
37 }
38 conf_class_t *confClass(sc_core::sc_object *object) {
39 if (!factory_.canManufacture(object))
40 return NULL;
41
43 object);
44
45 ProxyClassName name(
47 attributes->uniqueName(object) : attributes->name(object));
48 conf_class_t *cls = SIM_get_class(name.c_str());
49 if (SIM_clear_exception() != SimExc_No_Exception) {
50 cls = factory_.createConfClass(object, std::move(name),
51 attributes->description(object),
52 attributes->documentation(object));
53 if (cls == NULL) {
54 std::ignore = SIM_clear_exception();
55 return NULL;
56 }
57
58 factory_.registerAttributes(object, cls);
59 factory_.registerInterfaces(object, cls);
60 factory_.registerLogGroups(object, cls);
61 }
62
63 return cls;
64 }
65
66 protected:
68};
69
70} // namespace awareness
71} // namespace systemc
72} // namespace simics
73
74#endif
Definition: class_attributes_interface.h:24
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:31
Definition: proxy_class_registry.h:33
const ProxyFactoryInterface & factory_
Definition: proxy_class_registry.h:67
conf_class_t * confClass(sc_core::sc_object *object)
Definition: proxy_class_registry.h:38
ProxyClassRegistry(const ProxyFactoryInterface &factory)
Definition: proxy_class_registry.h:35
Definition: proxy_factory_interface.h:29
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:79