7#ifndef __GS_FSS_UTILS_H__ 
    8#define __GS_FSS_UTILS_H__ 
   17#include "fss_interfaces.h" 
   29template <
class PARENT_TYPE, 
class MEMBER_TYPE>
 
   34                                                     reinterpret_cast<const uint8_t*
>(parent));
 
 
   39void die_null_ptr(
const std::string& 
fn_name, 
const std::string& 
ptr_name)
 
   41    std::cerr << 
"Error: fss_utils.h -> Function: " << 
fn_name << 
" => pointer: " << 
ptr_name << 
"is null!" 
   46template <
typename INTERFACE>
 
   50    virtual INTERFACE* get_if_handle() 
const = 0;
 
   52    virtual fssString get_if_name() 
const = 0;
 
   56        bind_if(
other.get_if_name(), 
other.get_if_handle());
 
   57        other.bind_if(get_if_name(), get_if_handle());
 
 
   80            die_null_ptr(
"fss_binder_base", 
"bind_handle");
 
   83            die_null_ptr(
"fss_binder_base", 
"if_name");
 
   86        if constexpr (std::is_same_v<IF, fssEventsIf>) {
 
   88        } 
else if constexpr (std::is_same_v<IF, fssTimeSyncIf>) {
 
   90        } 
else if constexpr (std::is_same_v<IF, fssControlIf>) {
 
   96            die_null_ptr(
"fss_binder_base", 
"get_if");
 
  100            die_null_ptr(
"fss_binder_base", 
"m_if_handle");
 
  108            die_null_ptr(
"fss_binder_base", 
"if_handle");
 
  111            die_null_ptr(
"fss_binder_base", 
"_if_name");
 
  113        m_bind_handle = 
nullptr;
 
  116    IF* get_if_handle()
 const override { 
return m_if_handle; }
 
  118    fssString get_if_name()
 const override { 
return m_if_name; }
 
  126            die_null_ptr(
"bind_if", 
"if_name");
 
  129            die_null_ptr(
"bind_if", 
"if_handle");
 
  135            if constexpr (std::is_same_v<IF, fssEventsIf>) {
 
  137            } 
else if constexpr (std::is_same_v<IF, fssTimeSyncIf>) {
 
  139            } 
else if constexpr (std::is_same_v<IF, fssControlIf>) {
 
  145                die_null_ptr(
"bind_if", 
"bind_if_if");
 
  156    fssString other_if_name;
 
 
  174        if (!other_if_handle) {
 
  175            die_null_ptr(
"bind_if", 
"other_if_handle");
 
  177        if (!other_if_handle->handleEvents) {
 
  178            die_null_ptr(
"bind_if", 
"other_if_handle->handleEvents");
 
  180        other_if_handle->handleEvents(other_if_handle, event);
 
 
  201        if (!other_if_handle) {
 
  202            die_null_ptr(
"update_time", 
"other_if_handle");
 
  204        if (!other_if_handle->updateTimeWindow) {
 
  205            die_null_ptr(
"update_time", 
"other_if_handle->updateTimeWindow");
 
  207        other_if_handle->updateTimeWindow(other_if_handle, window);
 
 
  228        if (!other_if_handle) {
 
  229            die_null_ptr(
"get_number", 
"other_if_handle");
 
  231        if (!other_if_handle->getNumber) {
 
  232            die_null_ptr(
"get_number", 
"other_if_handle->getNumber");
 
  234        return other_if_handle->getNumber(other_if_handle);
 
  238        if (!other_if_handle) {
 
  239            die_null_ptr(
"get_name", 
"other_if_handle");
 
  241        if (!other_if_handle->getName) {
 
  242            die_null_ptr(
"get_name", 
"other_if_handle->getName");
 
  244        return other_if_handle->getName(other_if_handle, 
_index);
 
  248        if (!other_if_handle) {
 
  249            die_null_ptr(
"get_size", 
"other_if_handle");
 
  251        if (!other_if_handle->getSize) {
 
  252            die_null_ptr(
"get_size", 
"other_if_handle->getSize");
 
  254        return other_if_handle->getSize(other_if_handle, 
_index);
 
  258        if (!other_if_handle) {
 
  259            die_null_ptr(
"get_index", 
"other_if_handle");
 
  261        if (!other_if_handle->getIndex) {
 
  262            die_null_ptr(
"get_index", 
"other_if_handle->getIndex");
 
  264        return other_if_handle->getIndex(other_if_handle, 
_name);
 
  268        if (!other_if_handle) {
 
  269            die_null_ptr(
"add_item", 
"other_if_handle");
 
  271        if (!other_if_handle->addItem) {
 
  272            die_null_ptr(
"add_item", 
"other_if_handle->addItem");
 
  274        return other_if_handle->addItem(other_if_handle, 
_name, 
_size);
 
  278        if (!other_if_handle) {
 
  279            die_null_ptr(
"get_item", 
"other_if_handle");
 
  281        if (!other_if_handle->getItem) {
 
  282            die_null_ptr(
"get_item", 
"other_if_handle->getItem");
 
  284        return other_if_handle->getItem(other_if_handle, 
_index);
 
  288        if (!other_if_handle) {
 
  289            die_null_ptr(
"set_item", 
"other_if_handle");
 
  291        if (!other_if_handle->setItem) {
 
  292            die_null_ptr(
"set_item", 
"other_if_handle->setItem");
 
  294        other_if_handle->setItem(other_if_handle, 
_index, 
_data);
 
  299        if (!other_if_handle) {
 
  300            die_null_ptr(
"transmit", 
"other_if_handle");
 
  302        if (!other_if_handle->transmit) {
 
  303            die_null_ptr(
"transmit", 
"other_if_handle->transmit");
 
  305        other_if_handle->transmit(other_if_handle);
 
 
  326        if (!other_if_handle) {
 
  327            die_null_ptr(
"do_command", 
"other_if_handle");
 
  329        if (!other_if_handle->doCommand) {
 
  330            die_null_ptr(
"do_command", 
"other_if_handle->doCommand");
 
  332        return other_if_handle->doCommand(other_if_handle, cmd);
 
 
Definition fss_utils.h:74
 
Definition fss_utils.h:48
 
Definition fss_utils.h:312
 
Definition fss_utils.h:214
 
Definition fss_utils.h:160
 
Definition fss_utils.h:187
 
Tool which reads a Lua configuration file and sets parameters.
Definition biflow.cc:10
 
PARENT_TYPE * container_of(const MEMBER_TYPE *member, const MEMBER_TYPE PARENT_TYPE::*member_ptr)
Definition fss_utils.h:30
 
Time window struct declaration 'from' and 'to' members are 64 floating point types to represent time ...
Definition fss_interfaces.h:63
 
Bind interface encapsulates the functions to bind different interfaces.
Definition fss_interfaces.h:368
 
Bus Interface encapsulates the data which can be transmitted on a bus.
Definition fss_interfaces.h:321
 
Control interface encapsulates the function to inject and query parameters.
Definition fss_interfaces.h:360
 
Events interface encapsulates the function to handle simulation events.
Definition fss_interfaces.h:344
 
Time synchronization interface encapsulates the function to handle time window update.
Definition fss_interfaces.h:352