16#ifndef SIMICS_CONF_CLASS_H
17#define SIMICS_CONF_CLASS_H
19#include <simics/base/conf-object.h>
20#include <simics/base/sim-exception.h>
51 const char delimiter =
'.');
82 const std::string &
name,
83 const std::string &short_desc,
85 const class_kind_t kind,
91 operator conf_class_t*()
const {
return cls_; }
96 const std::string &
name()
const {
return name_; }
106 const std::vector<std::string> &
log_groups()
const {
return log_groups_; }
174 void register_log_groups() const noexcept;
178 std::
string description_;
179 std::vector<
std::
string> log_groups_;
202 const class_kind_t kind = Sim_Class_Kind_Vanilla) {
205 detail::init_class<T>(cls.get());
206 decorate_class<T>(
nullptr, cls.get());
225 const std::string &
description, A *constructor_arg,
226 const class_kind_t kind = Sim_Class_Kind_Vanilla) {
230 detail::init_class<T>(cls.get());
231 decorate_class<T>(
nullptr, cls.get());
Represents a Simics attribute.
Definition: attribute.h:88
Represents Simics C type conf_class_t.
Definition: conf-class.h:63
ConfClass * add(ConfClass *port, const std::string &name)
A function to add a port object to the set of ports defined by the class.
ConfClass * add(const Attribute &attr)
A function to add an attribute to the set of attributes of ConfClass.
const std::string & name() const
Return the class name.
Definition: conf-class.h:96
const std::string & description() const
Return the class description.
Definition: conf-class.h:101
ConfClass(const ConfClass &)=delete
Avoid implicit copy.
ConfClass * add(EventInfo &&event)
A function to add an event to the set of events of ConfClass.
ConfClass * add(const iface::InterfaceInfo &iface)
A function to register that ConfClass implements the iface interface.
ConfClass(conf_class_t *cls, const std::string &name, const std::string &description)
Must use factory method to create instance.
Definition: conf-class.h:168
ConfClass * add(const ConfClassPtr &port, const std::string &name)
ConfClass * add(const LogGroups &names)
ConfClass * add(const char *const *names)
Functions to add log groups that an object can use to separate messages.
const std::vector< std::string > & log_groups() const
Return the class log groups.
Definition: conf-class.h:106
static ConfClassPtr createInstance(const std::string &name, const std::string &short_desc, const std::string &description, const class_kind_t kind, const iface::ObjectFactoryInterface &factory)
A function to create a ConfClass instance All parameters except the last one is used to call the Simi...
ConfClass & operator=(const ConfClass &)=delete
An object factory creates class T object with argument.
Definition: object-factory.h:49
An object factory creates class T object.
Definition: object-factory.h:29
Definition: interface-info.h:27
Definition: object-factory-interface.h:33
Definition: attr-value.h:23
std::initializer_list< std::string > LogGroups
Type used for log group names.
Definition: log.h:26
std::unique_ptr< ConfClass > ConfClassPtr
Definition: conf-class.h:35
std::vector< std::string > expand_names(const std::string &name, const char delimiter='.')
If name contains an array indicator, i.e.
void decorate_class(...)
Overload it with specific implementation by including the other header before this file.
Definition: conf-class.h:185
ConfClassPtr make_class(const std::string &name, const std::string &short_desc, const std::string &description, const class_kind_t kind=Sim_Class_Kind_Vanilla)
A factory method to create a ConfClassPtr which associate with the C++ class T.
Definition: conf-class.h:200
int array_index(const std::string &name)
Return the array index if name is using an array format like array[N].
Definition: common-types.h:63