16#ifndef SIMICS_CONF_OBJECT_H
17#define SIMICS_CONF_OBJECT_H
19#include <simics/base/conf-object.h>
20#include <simics/simulator/conf-object.h>
23#include <unordered_map>
63 const std::string &
port_name()
const {
return port_name_; }
71 const std::string &
name()
const;
105 std::string port_name_;
108 mutable std::string name_;
116 template <
typename IFACE>
138 return SIM_object_is_configured(obj_);
142 void init_log_groups();
145 std::unordered_map<std::string, uint64> groups_;
150template <
typename T>
inline
152 static_assert(std::is_base_of<ConfObject, T>::value,
153 "type T is not derived from type ConfObject");
154 void *d = SIM_object_data(obj);
158 return static_cast<T*
>(d);
struct conf_object conf_object_t
Definition: bank-issue-callbacks-interface.h:23
Represents Simics C type conf_object_t.
Definition: conf-object.h:37
conf_object_t * port_obj_parent() const
Return the parent object if the object is a port object, nullptr otherwise.
conf_object_t * object() const
Get a pointer to the configuration object represented by this ConfObjectRef.
Definition: conf-object.h:57
bool configured() const
Return true if the configuration object is configured, false otherwise.
void require() const
Ensure that the configuration object is instantiated (this is the same as calling SIM_require_object(...
const interface_t * get_interface(const std::string &name) const
Return an interface implemented by the underlying configuration object.
virtual ~ConfObjectRef()=default
const std::string & name() const
Get the name of the underlying configuration object.
ConfObjectRef(conf_object_t *obj=nullptr)
Not explicit constructor, allow conversion of conf_object_t to ConfObjectRef.
Definition: conf-object.h:46
const std::string & port_name() const
Get & set name for the port implements the interface.
Definition: conf-object.h:63
uint64 group_id(const std::string &name) const
void * data() const
Get the data of the underlying configuration object.
ConfObject & as_conf_object() const
Get a reference to the associated ConfObject.
void set_port_name(const std::string &name)
Definition: conf-object.h:64
bool operator==(const ConfObjectRef &other) const
Definition: conf-object.h:50
A class inherited by a model class to support Simics configuration.
Definition: conf-object.h:114
ConfObject(const ConfObjectRef &obj)
Create a ConfObject from ConfObjectRef.
Definition: conf-object.h:122
virtual ~ConfObject()=default
void objects_finalized() override
Definition: conf-object.h:131
virtual bool finalized()
Return if the finalize method has been called.
Definition: conf-object.h:137
void finalize() override
Definition: conf-object.h:130
ConfObjectRef obj() const
Return a ConfObjectRef represents this object.
Definition: conf-object.h:134
Abstract C++ interface contains methods for register model defined behavior after the construction an...
Definition: conf-object-interface.h:26
void interface_t
Definition: interface-info.h:22
Definition: attr-value.h:23
T * from_obj(conf_object_t *obj)
Utility function to convert a conf_object_t* to a pointer to C++ class derived from simics::ConfObjec...
Definition: conf-object.h:151
IFACE * get_interface(conf_object_t *obj)
Return the Simics C++ interface class from a configuration object.
Definition: utility.h:27