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