SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
proxy_factory_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_FACTORY_REGISTRY_H
15#define SIMICS_SYSTEMC_AWARENESS_PROXY_FACTORY_REGISTRY_H
16
18
19#include <string>
20#include <deque>
21#include <utility> // move
22
23namespace simics {
24namespace systemc {
25namespace awareness {
26
28 public:
29 ProxyFactoryRegistry() : factory_(factories_.end()) {}
31 factories_.push_front(factory);
32 factory_ = factories_.end();
33 }
34 bool mapToProxy(sc_core::sc_object *object) const override {
35 for (auto *factory : factories_) {
36 if (!factory->mapToProxy(object))
37 return false;
38 }
39 return true;
40 }
41 bool canManufacture(sc_core::sc_object *object) const override {
42 factory_ = factories_.end();
43 for (auto it = factories_.begin(); it != factories_.end(); ++it) {
44 if ((*it)->canManufacture(object)) {
45 factory_ = it;
46 return true;
47 }
48 }
49 return false;
50 }
51 bool needUniqueConfClassName(sc_core::sc_object *object) const override {
52 if (factory_ != factories_.end()) {
53 if ((*factory_)->needUniqueConfClassName(object))
54 return true;
55 }
56 return false;
57 }
59 sc_core::sc_object *object) const override {
60 if (factory_ != factories_.end()) {
61 return (*factory_)->classAttributes(object);
62 }
63 return NULL;
64 }
66 sc_core::sc_object *object) const override {
67 if (factory_ != factories_.end()) {
68 return (*factory_)->instanceAttributes(object);
69 }
70 return NULL;
71 }
72 conf_class_t *createConfClass(sc_core::sc_object *object,
73 std::string name,
74 std::string description,
75 std::string documentation) const override {
76 if (factory_ != factories_.end()) {
77 return (*factory_)->createConfClass(object, std::move(name),
78 std::move(description),
79 std::move(documentation));
80 }
81 return NULL;
82 }
83 void registerAttributes(sc_core::sc_object *object,
84 conf_class_t *cls) const override {
85 if (factory_ != factories_.end())
86 (*factory_)->registerAttributes(object, cls);
87 }
88 void registerInterfaces(sc_core::sc_object *object,
89 conf_class_t *cls) const override {
90 if (factory_ != factories_.end())
91 (*factory_)->registerInterfaces(object, cls);
92 }
93 void registerLogGroups(sc_core::sc_object *object,
94 conf_class_t *cls) const override {
95 if (factory_ != factories_.end())
96 (*factory_)->registerLogGroups(object, cls);
97 }
98 void registerFeatures(sc_core::sc_object *object,
99 ProxyInterface *proxy) const override {
100 if (factory_ != factories_.end())
101 (*factory_)->registerFeatures(object, proxy);
102 }
104 std::string sc_kind, const char *class_name) const override {
105 if (factory_ != factories_.end())
106 return (*factory_)->registerClass(std::move(sc_kind), class_name);
107 return false;
108 }
109 bool isClassRegistered(std::string sc_kind) const override {
110 if (factory_ != factories_.end())
111 return (*factory_)->isClassRegistered(std::move(sc_kind));
112 return false;
113 }
114
115 private:
116 std::deque<ProxyFactoryInterface*> factories_;
117 mutable std::deque<ProxyFactoryInterface*>::const_iterator factory_;
118};
119
120} // namespace awareness
121} // namespace systemc
122} // namespace simics
123
124#endif
Definition: class_attributes_interface.h:24
Definition: instance_attributes_interface.h:24
Definition: proxy_factory_interface.h:29
Definition: proxy_factory_registry.h:27
bool needUniqueConfClassName(sc_core::sc_object *object) const override
Definition: proxy_factory_registry.h:51
void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const override
Definition: proxy_factory_registry.h:88
conf_class_t * createConfClass(sc_core::sc_object *object, std::string name, std::string description, std::string documentation) const override
Definition: proxy_factory_registry.h:72
void registerAttributes(sc_core::sc_object *object, conf_class_t *cls) const override
Definition: proxy_factory_registry.h:83
ProxyFactoryRegistry()
Definition: proxy_factory_registry.h:29
void addFactory(ProxyFactoryInterface *factory)
Definition: proxy_factory_registry.h:30
void registerLogGroups(sc_core::sc_object *object, conf_class_t *cls) const override
Definition: proxy_factory_registry.h:93
const ClassAttributesInterface * classAttributes(sc_core::sc_object *object) const override
Definition: proxy_factory_registry.h:58
bool canManufacture(sc_core::sc_object *object) const override
Definition: proxy_factory_registry.h:41
void registerFeatures(sc_core::sc_object *object, ProxyInterface *proxy) const override
Definition: proxy_factory_registry.h:98
bool registerClass(std::string sc_kind, const char *class_name) const override
Definition: proxy_factory_registry.h:103
bool mapToProxy(sc_core::sc_object *object) const override
Definition: proxy_factory_registry.h:34
bool isClassRegistered(std::string sc_kind) const override
Definition: proxy_factory_registry.h:109
const InstanceAttributesInterface * instanceAttributes(sc_core::sc_object *object) const override
Definition: proxy_factory_registry.h:65
Definition: proxy_interface.h:27
Definition: adapter.h:79