<commit_before>#ifndef __ENTITY_TEMPLATES_HPP_INCLUDED
#define __ENTITY_TEMPLATES_HPP_INCLUDED

#include "info_struct.hpp"
#include "universe.hpp"

// Include standard headers
#include <stdint.h> // uint32_t etc.
#include <typeinfo> // typeid
#include <vector>   // std::vector

namespace ontology
{
    class Universe;
    class Scene;
    class Shader;
    class Material;
    class Species;
    class Object;
    class VectorFont;
    class Glyph;
    class Text3D;

    template<class T1>
        void set_name(const std::string name, T1 entity)
        {
            ontology::Universe* universe = entity->universe_pointer;

            if (universe == nullptr)
            {
                return;
            }

            datatypes::AnyValue* entity_any_value = new datatypes::AnyValue(entity);

            if (entity_any_value == nullptr)
            {
                return;
            }

            if (universe->entity_anyvalue_map[name] != nullptr)
            {
                return;
            }

            entity->name = name;
            universe->entity_anyvalue_map[name] = entity_any_value;
        }

    template<class T1>
        int32_t get_number_of_child_types(const T1 entity)
        {
            return entity->child_vector_pointers_vector.size();
        }

    template<class T1>
        uint32_t get_number_of_descendants(const std::vector<T1> child_pointer_vector)
        {
            uint32_t number_of_descendants = 0;

            for (uint32_t i = 0; i < child_pointer_vector.size(); i++)
            {
                T1 child = child_pointer_vector.get(i);
                number_of_descendants += get_number_of_descendants_of_entity(child);
            }

            return number_of_descendants;
        }

    template<class T1>
        uint32_t get_number_of_descendants_of_entity(const T1 entity)<commit_msg>Replaced a check for `nullptr` with a `count` check.<commit_after>#ifndef __ENTITY_TEMPLATES_HPP_INCLUDED
#define __ENTITY_TEMPLATES_HPP_INCLUDED

#include "info_struct.hpp"
#include "universe.hpp"

// Include standard headers
#include <stdint.h> // uint32_t etc.
#include <typeinfo> // typeid
#include <vector>   // std::vector

namespace ontology
{
    class Universe;
    class Scene;
    class Shader;
    class Material;
    class Species;
    class Object;
    class VectorFont;
    class Glyph;
    class Text3D;

    template<class T1>
        void set_name(const std::string name, T1 entity)
        {
            ontology::Universe* universe = entity->universe_pointer;

            if (universe == nullptr)
            {
                return;
            }

            datatypes::AnyValue* entity_any_value = new datatypes::AnyValue(entity);

            if (entity_any_value == nullptr)
            {
                return;
            }

            if (universe->entity_anyvalue_map.count(name) != 0)
            {
                return;
            }

            entity->name = name;
            universe->entity_anyvalue_map[name] = entity_any_value;
        }

    template<class T1>
        int32_t get_number_of_child_types(const T1 entity)
        {
            return entity->child_vector_pointers_vector.size();
        }

    template<class T1>
        uint32_t get_number_of_descendants(const std::vector<T1> child_pointer_vector)
        {
            uint32_t number_of_descendants = 0;

            for (uint32_t i = 0; i < child_pointer_vector.size(); i++)
            {
                T1 child = child_pointer_vector.get(i);
                number_of_descendants += get_number_of_descendants_of_entity(child);
            }

            return number_of_descendants;
        }

    template<class T1>
        uint32_t get_number_of_descendants_of_entity(const T1 entity)
{'fraction_non_alphanumeric': 0.08428306387490062, 'fraction_numerical': 0.012987012987012988, 'mean_word_length': 2.041095890410959, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 29, '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': '2484114', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1121, 'n_words': 225}