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>
25#include <unordered_map>
54 conf_object_t *
object()
const {
return o_; }
55 operator conf_object_t *()
const {
return o_; }
60 const std::string &
port_name()
const {
return port_name_; }
97 [[deprecated(
"Use GROUP_ID or ConfClass::getGroupId instead")]]
101 conf_object_t *o_ {
nullptr};
103 std::string port_name_;
141 return SIM_object_is_configured(obj_);
146 [[deprecated(
"Dead function to maintain ABI compatibility with "
147 "Simics Base version 6.0.215")]]
148 void init_log_groups();
153 std::unordered_map<std::string, uint64> groups_;
168template <
typename T>
inline
170 static_assert(std::is_base_of<ConfObject, T>::value,
171 "type T is not derived from type ConfObject");
172 auto *d =
static_cast<ConfObject *
>(SIM_object_data(obj));
174 return static_cast<T*
>(d);
Abstract C++ interface contains methods for register model defined behavior after the construction an...
Definition: conf-object-interface.h:25
Represents Simics C type conf_object_t.
Definition: conf-object.h:38
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:54
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(...
std::string name() const
Get the name of the underlying configuration object.
const interface_t * get_interface(const std::string &name) const
Return an interface implemented by the underlying configuration object.
virtual ~ConfObjectRef()=default
ConfObjectRef(conf_object_t *obj=nullptr)
Not explicit constructor, allow conversion of conf_object_t to ConfObjectRef.
Definition: conf-object.h:47
const std::string & port_name() const
Get & set name for the port implements the interface.
Definition: conf-object.h:60
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:61
Base class for all Simics configuration objects.
Definition: conf-object.h:126
ConfObject(const ConfObjectRef &obj)
Create a ConfObject from ConfObjectRef.
Definition: conf-object.h:129
virtual ~ConfObject()=default
void objects_finalized() override
Definition: conf-object.h:134
virtual bool finalized()
Return if the finalize method has been called.
Definition: conf-object.h:140
void finalize() override
Definition: conf-object.h:133
ConfObjectRef obj() const
Return a ConfObjectRef represents this object.
Definition: conf-object.h:137
void interface_t
Definition: interface-info.h:22
Definition: after-bank.h:33
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:169
bool operator==(const ConfObjectRef &lhs, const ConfObjectRef &rhs)
Compares two ConfObjectRef objects for equality.
bool operator!=(const ConfObjectRef &lhs, const ConfObjectRef &rhs)