C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
attribute.h File Reference
#include <simics/base/conf-object.h>
#include <string>
#include <type_traits>
#include "simics/attribute-type-string.h"
#include "simics/detail/attribute-getter.h"
#include "simics/detail/attribute-setter.h"

Go to the source code of this file.

Classes

struct  simics::AttributeAccessor< CLASS, MEMBER, m >
 A container of get and set callbacks for a class member variable. More...
 
class  simics::Attribute
 Represents a Simics attribute. More...
 
class  simics::ClassAttribute
 Represents a Simics class attribute. More...
 

Namespaces

namespace  simics
 

Macros

#define GET_MACRO(_1, _2, NAME, ...)   NAME
 MACRO take either 1 or 2 arguments.
 
#define IMPL(str)   str
 VA_ARGS is treated as single parameter in MSVC, use this as a workaround
 
#define ATTR_GETTER(...)    IMPL(GET_MACRO(__VA_ARGS__, _G_DUAL, _G_SINGLE)(__VA_ARGS__))
 MACROs convert the get/set function or variable access to function attr_getter and attr_setter.
 
#define ATTR_SETTER(...)    IMPL(GET_MACRO(__VA_ARGS__, _S_DUAL, _S_SINGLE)(__VA_ARGS__))
 
#define ATTR_CLS_VAR(CLASS, VAR)    simics::AttributeAccessor<CLASS, decltype(&CLASS::VAR), &CLASS::VAR>()
 
#define ATTR_TYPE_STR(VAR)   simics::attr_type_str<decltype(VAR)>()
 Get the Simics attribute string from a variable's C++ type.
 

Typedefs

using simics::attr_getter = std::add_pointer_t< attr_value_t(conf_object_t *)>
 
using simics::attr_setter = std::add_pointer_t< set_error_t(conf_object_t *, attr_value_t *)>
 

Macro Definition Documentation

◆ ATTR_CLS_VAR

#define ATTR_CLS_VAR (   CLASS,
  VAR 
)     simics::AttributeAccessor<CLASS, decltype(&CLASS::VAR), &CLASS::VAR>()

◆ ATTR_GETTER

#define ATTR_GETTER (   ...)     IMPL(GET_MACRO(__VA_ARGS__, _G_DUAL, _G_SINGLE)(__VA_ARGS__))

MACROs convert the get/set function or variable access to function attr_getter and attr_setter.

◆ ATTR_SETTER

#define ATTR_SETTER (   ...)     IMPL(GET_MACRO(__VA_ARGS__, _S_DUAL, _S_SINGLE)(__VA_ARGS__))

◆ ATTR_TYPE_STR

#define ATTR_TYPE_STR (   VAR)    simics::attr_type_str<decltype(VAR)>()

Get the Simics attribute string from a variable's C++ type.

◆ GET_MACRO

#define GET_MACRO (   _1,
  _2,
  NAME,
  ... 
)    NAME

MACRO take either 1 or 2 arguments.

◆ IMPL

#define IMPL (   str)    str

VA_ARGS is treated as single parameter in MSVC, use this as a workaround