<commit_before>//=======================================================================
// Copyright <NAME> 2011-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================

#ifndef STRUCT_H
#define STRUCT_H

#include <memory>
#include <string>
#include <vector>

namespace eddic {

class Type;

/*!
 * \class Member
 * \brief A member of a struct.  
 */
struct Member {
    std::string name;
    std::shared_ptr<const Type> type;

    Member(const std::string& n, std::shared_ptr<const Type> t);

    /*!
     * Increment the reference counter of the member. 
     */
    void add_reference();
    
    /*!
     * Return the reference counter of the member. 
     * \return The reference counter of the member. 
     */
    unsigned int get_references();

    private:
        unsigned int references = 0;
};

/*!
 * \class Struct
 * \brief A structure entry in the function table. 
 */
struct Struct {
    std::string name;
    std::vector<std::shared_ptr<Member>> members;
    
    Struct(const std::string& n);

    /*!
     * Indicates if the specified member exists in this structure. 
     * \param name The name of the member to search for. 
     * \return true if the member exists, otherwise false. 
     */
    bool member_exists(const std::string& name);
    
    /*!
     * Return the member with the specified name. 
     * \param name The name of the member to search for. 
     * \return A pointer to the member with the given name. 
     */
    std::shared_ptr<Member> operator[](const std::string& name);

    /*!
     * Increment the reference counter of the structure. 
     */<commit_msg>Store the parent type of a structure<commit_after>//=======================================================================
// Copyright <NAME> 2011-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================

#ifndef STRUCT_H
#define STRUCT_H

#include <memory>
#include <string>
#include <vector>

namespace eddic {

class Type;

/*!
 * \class Member
 * \brief A member of a struct.  
 */
struct Member {
    std::string name;
    std::shared_ptr<const Type> type;

    Member(const std::string& n, std::shared_ptr<const Type> t);

    /*!
     * Increment the reference counter of the member. 
     */
    void add_reference();
    
    /*!
     * Return the reference counter of the member. 
     * \return The reference counter of the member. 
     */
    unsigned int get_references();

    private:
        unsigned int references = 0;
};

/*!
 * \class Struct
 * \brief A structure entry in the function table. 
 */
struct Struct {
    std::string name;
    std::vector<std::shared_ptr<Member>> members;
    std::shared_ptr<Struct> parent_type;
   
    Struct(const std::string& n);

    /*!
     * Indicates if the specified member exists in this structure. 
     * \param name The name of the member to search for. 
     * \return true if the member exists, otherwise false. 
     */
    bool member_exists(const std::string& name);
    
    /*!
     * Return the member with the specified name. 
     * \param name The name of the member to search for. 
     * \return A pointer to the member with the given name. 
     */
    std::shared_ptr<Member> operator[](const std::string& name);

    /*!
     * Increment the reference counter of the structure. 
     */
{'fraction_non_alphanumeric': 0.18064338740720373, 'fraction_numerical': 0.008248556502612043, 'mean_word_length': 2.8867521367521367, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5902425', 'n_tokens_mistral': 1051, 'n_tokens_neox': 980, 'n_words': 356}