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
30namespace simics {
31namespace systemc {
32namespace awareness {
33
35 public:
37 : factory_(factory) {
38 }
39 conf_class_t *confClass(sc_core::sc_object *object) {
40 if (!factory_.canManufacture(object))
41 return NULL;
42
44 object);
45
46 ProxyClassName name(
48 attributes->uniqueName(object) : attributes->name(object));
49 conf_class_t *cls = SIM_get_class(name.c_str());
50 if (SIM_clear_exception() != SimExc_No_Exception) {
51 cls = factory_.createConfClass(object, name,
52 attributes->description(object),
53 attributes->documentation(object));
54 if (cls == NULL) {
55 SIM_clear_exception();
56 return NULL;
57 }
58
59 factory_.registerAttributes(object, cls);
60 factory_.registerInterfaces(object, cls);
61 factory_.registerLogGroups(object, cls);
62 }
63
64 return cls;
65 }
66
67 protected:
69};
70
71} // namespace awareness
72} // namespace systemc
73} // namespace simics
74
75#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:34
const ProxyFactoryInterface & factory_
Definition: proxy_class_registry.h:68
conf_class_t * confClass(sc_core::sc_object *object)
Definition: proxy_class_registry.h:39
ProxyClassRegistry(const ProxyFactoryInterface &factory)
Definition: proxy_class_registry.h:36
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: pci_bus_interface.h:24