C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
simics::MapNameToInterfaceObject< IFACE > Class Template Reference

Class that supports get/set a pointer to IFACE with a string name. More...

#include <mappable-conf-object.h>

Inheritance diagram for simics::MapNameToInterfaceObject< IFACE >:
simics::MapNameToInterface< IFACE >

Public Member Functions

void set_iface (const std::string &name, IFACE *iface) override
 Sets the IFACE associated with the given name.
 
IFACE * get_iface (const std::string &name) const override
 Gets the interface associated with the given name.
 
IFACE * get_iface (size_t name_hash) const
 Gets the interface associated with the given name hash.
 
void erase_iface (const std::string &name) override
 Erases the interface associated with the given name.
 
- Public Member Functions inherited from simics::MapNameToInterface< IFACE >
virtual ~MapNameToInterface ()=default
 
virtual void set_iface (const std::string &name, IFACE *iface)=0
 
virtual IFACE * get_iface (const std::string &name) const =0
 
virtual void erase_iface (const std::string &name)=0
 

Detailed Description

template<typename IFACE>
class simics::MapNameToInterfaceObject< IFACE >

Class that supports get/set a pointer to IFACE with a string name.

The MapNameToInterfaceObject class provides functionality to map names to interface objects. It allows setting, getting, and erasing interfaces by their names. This class is used to manage associations between names and interface objects in a structured manner.

Template Parameters
IFACEThe type of the interface.

Member Function Documentation

◆ erase_iface()

template<typename IFACE >
void simics::MapNameToInterfaceObject< IFACE >::erase_iface ( const std::string &  name)
inlineoverridevirtual

Erases the interface associated with the given name.

This function removes the association between the specified name and its interface. If no association exists for the given name, it does nothing.

Parameters
nameThe name associated with the interface to erase.

Implements simics::MapNameToInterface< IFACE >.

◆ get_iface() [1/2]

template<typename IFACE >
IFACE * simics::MapNameToInterfaceObject< IFACE >::get_iface ( const std::string &  name) const
inlineoverridevirtual

Gets the interface associated with the given name.

This function retrieves the interface associated with the specified name. If no interface is found for the given name, it returns nullptr.

Parameters
nameThe name associated with the interface.
Returns
The interface associated with the name, or nullptr if not found.

Implements simics::MapNameToInterface< IFACE >.

◆ get_iface() [2/2]

template<typename IFACE >
IFACE * simics::MapNameToInterfaceObject< IFACE >::get_iface ( size_t  name_hash) const
inline

Gets the interface associated with the given name hash.

This function retrieves the interface associated with the specified name hash. If no interface is found for the given hash, it returns nullptr.

Parameters
name_hashThe hash value of the name associated with the interface.
Returns
The interface associated with the name hash, or nullptr if not found.

◆ set_iface()

template<typename IFACE >
void simics::MapNameToInterfaceObject< IFACE >::set_iface ( const std::string &  name,
IFACE *  iface 
)
inlineoverridevirtual

Sets the IFACE associated with the given name.

This function associates the given IFACE with the specified name. If the interface is null or the name is empty, it throws an invalid_argument exception.

Parameters
nameThe name to associate with the IFACE.
ifaceThe IFACE to associate with the name.
Exceptions
std::invalid_argumentif the interface is null or the name is empty.

Implements simics::MapNameToInterface< IFACE >.


The documentation for this class was generated from the following file: