<commit_before>// vim : set fileencoding=utf-8 expandtab noai ts=4 sw=4 :
/// @addtogroup common
/// @{
/// @file sc_find.h
///
///
/// @date 2013-2014
/// @copyright All rights reserved.
///            Any reproduction, use, distribution or disclosure of this
///            program, without the express, prior written consent of the
///            authors is strictly prohibited.
/// @author
///
#ifndef COMMON_SC_FIND_H_
#define COMMON_SC_FIND_H_

#include <vector>
#include "common/sc_api.h"

// Function: Find a SystemC object in the hierarchy by it's name

inline sc_core::sc_object*findInSimContextByName(const char *name, sc_core::sc_object *node = 0) {
  // Base of the recursion
  if (node && (strcmp(node->name(), name) == 0)) {
    return node;
  }

  // Get the childs of the given node
  const std::vector<sc_core::sc_object *> *childs_stack;
  if (node) {
    // get child vector
#if SYSTEMC_API == 210
    sc_core::sc_module *node_as_module = dynamic_cast<sc_core::sc_module *>(node);
    if (node_as_module) {
      childs_stack = &(node_as_module->get_child_objects());
    } else {return 0;
    }
#else
    childs_stack = &node->get_child_objects();
#endif
  } else {
    // get child vector of sim context
#if SYSTEMC_API == 210<commit_msg>Common: Fixing Spacing<commit_after>// vim : set fileencoding=utf-8 expandtab noai ts=4 sw=4 :
/// @addtogroup common
/// @{
/// @file sc_find.h
///
///
/// @date 2013-2014
/// @copyright All rights reserved.
///            Any reproduction, use, distribution or disclosure of this
///            program, without the express, prior written consent of the
///            authors is strictly prohibited.
/// @author
///
#ifndef COMMON_SC_FIND_H_
#define COMMON_SC_FIND_H_

#include <vector>
#include "common/sc_api.h"

// Function: Find a SystemC object in the hierarchy by it's name

inline sc_core::sc_object *findInSimContextByName(const char *name, sc_core::sc_object *node = 0) {
  // Base of the recursion
  if (node && (strcmp(node->name(), name) == 0)) {
    return node;
  }

  // Get the childs of the given node
  const std::vector<sc_core::sc_object *> *childs_stack;
  if (node) {
    // get child vector
#if SYSTEMC_API == 210
    sc_core::sc_module *node_as_module = dynamic_cast<sc_core::sc_module *>(node);
    if (node_as_module) {
      childs_stack = &(node_as_module->get_child_objects());
    } else {return 0;
    }
#else
    childs_stack = &node->get_child_objects();
#endif
  } else {
    // get child vector of sim context
#if SYSTEMC_API == 210
{'fraction_non_alphanumeric': 0.13557312252964426, 'fraction_numerical': 0.015810276679841896, 'mean_word_length': 3.1356209150326797, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6295374', 'n_tokens_mistral': 888, 'n_tokens_neox': 841, 'n_words': 242}