scc  2022.4.0
SystemC components library
value_registry.h
1 /*******************************************************************************
2  * Copyright 2020-2022 MINRES Technologies GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *******************************************************************************/
16 
17 #ifndef _SCC_VALUE_REGISTRY_H_
18 #define _SCC_VALUE_REGISTRY_H_
19 
20 #include "sc_variable.h"
21 #include "tracer_base.h"
22 #include <sstream>
23 #include <sysc/kernel/sc_simcontext.h>
24 #include <sysc/tracing/sc_trace.h>
25 
26 #ifndef SC_API
27 #define SC_API
28 #endif
29 
35 namespace scc {
37  struct value_holder { // @suppress("Class has a virtual method and non-virtual destructor")
38  const std::string name;
39  virtual std::string to_string() = 0;
40  value_holder(const std::string& name)
41  : name(name) {}
42  };
43 
44  virtual std::vector<std::string> get_names() const = 0;
45 
46  virtual value_holder& get_value(std::string& name) const = 0;
47 
48  virtual ~value_registry_if() {}
49 };
50 
51 class SC_API value_registry : protected tracer_base {
52 public:
54 
55  ~value_registry();
56 
57  std::vector<std::string> get_names() const;
58 
59  const sc_variable_b* get_value(std::string name) const;
60 
61 protected:
62  void end_of_elaboration() override;
63 };
64 
65 } // namespace scc // end of scc-sysc
67 #endif /* _SCC_VALUE_REGISTRY_H_ */
base class for automatic tracer
Definition: tracer_base.h:78
SCC SystemC utilities.