<commit_before>// @(#)root/reflex:$Name:  $:$Id: Type.h,v 1.2 2005/11/03 15:24:40 roiser Exp $
// Author: <NAME> 2004

// Copyright CERN, CH-1211 Geneva 23, 2004-2005, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.

#ifndef ROOT_Reflex_Type
#define ROOT_Reflex_Type

// Include files
#include "Reflex/Kernel.h"
#include <vector>
#include <string>
#include <typeinfo>
#include <utility>

namespace ROOT {
  namespace Reflex {

    // forward declarations
    class Array;
    class Base;
    class Class;
    class Fundamental;
    class Function;
    class Enum;
    class InstantiatedTemplateFunction;
    class InstantiatedTemplateClass;
    class Member;
    class Object;
    class Pointer;
    class PropertyList;
    class Scope;
    class TypeBase;
    class Typedef;
    class TypeName;
    class MemberTemplate;
    class TypeTemplate;

    /**
     * @class Type Type.h Reflex/Type.h
     * @author <NAME>
     * @date 05/11/2004
     * @ingroup Ref
     */
    class Type {

    public:

      /** default constructor */
      Type( const TypeName * typName = 0,
            unsigned int modifiers = 0 );

      
      /** copy constructor */
      Type( const Type & rh );


      /** copy constructor applying qualification */
      Type( const Type & rh,
            unsigned int modifiers );
      

      /** destructor */
      ~Type();

      
      /** 
       * assignment operator
      */
      Type & operator = ( const Type & rh );


      /** 
       * equal operator 
       */
      bool operator == ( const Type & rh ) const;


      /** 
       * inequal operator
       */
      bool operator != ( const Type & rh ) const;

      
      /**
       * lesser than operator
       */
      bool operator < ( const Type & rh) const; 


      /**
       * the bool operator returns true if the Type is resolved (implemented)
       * @return true if Type is implemented 
       */
      operator bool () const;


      /**
       * Allocate will reserve memory for the size of the object
       * @return pointer to allocated memory
       */
      void * Allocate() const;
      

      /**
       * nthBase will return the nth BaseNth class information
       * @param  nth nth BaseNth class
       * @return pointer to BaseNth class information
       */
      Base BaseNth( size_t nth ) const;


      /**
       * BaseCount will return the number of BaseNth classes
       * @return number of BaseNth classes
       */
      size_t BaseCount() const;


      Base_Iterator Base_Begin() const;
      Base_Iterator Base_End() const;
      Reverse_Base_Iterator Base_Rbegin() const;
      Reverse_Base_Iterator Base_Rend() const;


      /**
       * ByName will look for a TypeNth given as a string and return a pointer to
       * its reflexion TypeNth
       * @param  key fully qualified Name of the TypeNth as string
       * @return pointer to TypeNth or 0 if none is found
       */
      static Type ByName( const std::string & key );
      
      
      /**
       * byTypeId will look for a TypeNth given as a string representation of a
       * type_info and return a pointer to its reflexion TypeNth
       * @param  tid string representation of the type_info TypeNth
       * @return pointer to TypeNth or 0 if none is found
       */
      static Type ByTypeInfo( const std::type_info & tid );


      /**
       * CastObject an object from this class TypeNth to another one
       * @param  to is the class TypeNth to cast into
       * @param  obj the memory AddressGet of the object to be casted
       */
      Object CastObject( const Type & to, 
                         const Object & obj ) const;
      

      /**
       * Construct will call the constructor of a given TypeNth and Allocate
       * the memory for it
       * @param  signature of the constructor
       * @param  values for parameters of the constructor
       * @param  mem place in memory for implicit construction
       * @return new object 
       */
      /*
      Object Construct( const Type & signature,
                        const std::vector < Object > & values,
                        void * mem = 0 ) const;
      */
      Object Construct( const Type & signature = Type(0,0),
                        const std::vector < void * > & values = std::vector < void * > (),
                        void * mem = 0 ) const;


      /**
       * DataMemberNth will return the nth data MemberNth of the ScopeNth
       * @param  nth data MemberNth
       * @return pointer to data MemberNth
       */
      Member DataMemberNth( size_t nth ) const;


      /**
       * DataMemberNth will return the MemberNth with Name
       * @param  Name of data MemberNth
       * @return data MemberNth
       */
      Member DataMemberNth( const std::string & nam ) const;


      /**
       * DataMemberCount will return the number of data members of this ScopeNth
       * @return number of data members
       */
      size_t DataMemberCount() const;


      Member_Iterator DataMember_Begin() const;
      Member_Iterator DataMember_End() const;
      Reverse_Member_Iterator DataMember_Rbegin() const;
      Reverse_Member_Iterator DataMember_Rend() const;


      /**
       * Deallocate will Deallocate the memory for a given object
       * @param  instance of the TypeNth in memory
       */
      void Deallocate( void * instance ) const;


      /**
       * DeclaringScope will return a pointer to the ScopeNth of this one
       * @return pointer to declaring ScopeNth
       */
      Scope DeclaringScope() const;


      /**
       * Destruct will call the destructor of a TypeNth and remove its memory
       * allocation if desired
       * @param  instance of the TypeNth in memory
       * @param  dealloc for also deallacoting the memory
       */
      void Destruct( void * instance, 
                     bool dealloc = true ) const;


      /**
       * DynamicType is used to discover whether an object represents the
       * current class TypeNth or not
       * @param  mem is the memory AddressGet of the object to checked
       * @return the actual class of the object
       */
      Type DynamicType( const Object & obj ) const;


      /**
       * FunctionMemberNth will return the nth function MemberNth of the ScopeNth
       * @param  nth function MemberNth
       * @return pointer to function MemberNth
       */
      Member FunctionMemberNth( size_t nth ) const;


      /**
       * FunctionMemberNth will return the MemberNth with the Name, 
       * optionally the signature of the function may be given
       * @param  Name of function MemberNth
       * @param  signature of the MemberNth function 
       * @return function MemberNth
       */
      Member FunctionMemberNth( const std::string & nam,
                             const Type & signature = Type() ) const;


      /**
       * FunctionMemberCount will return the number of function members of
       * this ScopeNth
       * @return number of function members
       */
      size_t FunctionMemberCount() const;
<commit_msg>fix AIX/xlc compiler warning<commit_after>// @(#)root/reflex:$Name:  $:$Id: Type.h,v 1.3 2005/11/07 09:22:20 roiser Exp $
// Author: <NAME> 2004

// Copyright CERN, CH-1211 <NAME>, 2004-2005, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.

#ifndef ROOT_Reflex_Type
#define ROOT_Reflex_Type

// Include files
#include "Reflex/Kernel.h"
#include <vector>
#include <string>
#include <typeinfo>
#include <utility>

namespace ROOT {
  namespace Reflex {

    // forward declarations
    class Array;
    class Base;
    class Class;
    class Fundamental;
    class Function;
    class Enum;
    class InstantiatedTemplateFunction;
    class InstantiatedTemplateClass;
    class Member;
    class Object;
    class Pointer;
    class PropertyList;
    class Scope;
    class TypeBase;
    class Typedef;
    class TypeName;
    class MemberTemplate;
    class TypeTemplate;

    /**
     * @class Type Type.h Reflex/Type.h
     * @author <NAME>
     * @date 05/11/2004
     * @ingroup Ref
     */
    class Type {

    public:

      /** default constructor */
      Type( const TypeName * typName = 0,
            unsigned int modifiers = 0 );

      
      /** copy constructor */
      Type( const Type & rh );


      /** copy constructor applying qualification */
      Type( const Type & rh,
            unsigned int modifiers );
      

      /** destructor */
      ~Type();

      
      /** 
       * assignment operator
      */
      Type & operator = ( const Type & rh );


      /** 
       * equal operator 
       */
      bool operator == ( const Type & rh ) const;


      /** 
       * inequal operator
       */
      bool operator != ( const Type & rh ) const;

      
      /**
       * lesser than operator
       */
      bool operator < ( const Type & rh) const; 


      /**
       * the bool operator returns true if the Type is resolved (implemented)
       * @return true if Type is implemented 
       */
      operator bool () const;


      /**
       * Allocate will reserve memory for the size of the object
       * @return pointer to allocated memory
       */
      void * Allocate() const;
      

      /**
       * nthBase will return the nth BaseNth class information
       * @param  nth nth BaseNth class
       * @return pointer to BaseNth class information
       */
      Base BaseNth( size_t nth ) const;


      /**
       * BaseCount will return the number of BaseNth classes
       * @return number of BaseNth classes
       */
      size_t BaseCount() const;


      Base_Iterator Base_Begin() const;
      Base_Iterator Base_End() const;
      Reverse_Base_Iterator Base_Rbegin() const;
      Reverse_Base_Iterator Base_Rend() const;


      /**
       * ByName will look for a TypeNth given as a string and return a pointer to
       * its reflexion TypeNth
       * @param  key fully qualified Name of the TypeNth as string
       * @return pointer to TypeNth or 0 if none is found
       */
      static Type ByName( const std::string & key );
      
      
      /**
       * byTypeId will look for a TypeNth given as a string representation of a
       * type_info and return a pointer to its reflexion TypeNth
       * @param  tid string representation of the type_info TypeNth
       * @return pointer to TypeNth or 0 if none is found
       */
      static Type ByTypeInfo( const std::type_info & tid );


      /**
       * CastObject an object from this class TypeNth to another one
       * @param  to is the class TypeNth to cast into
       * @param  obj the memory AddressGet of the object to be casted
       */
      Object CastObject( const Type & to, 
                         const Object & obj ) const;
      

      /**
       * Construct will call the constructor of a given TypeNth and Allocate
       * the memory for it
       * @param  signature of the constructor
       * @param  values for parameters of the constructor
       * @param  mem place in memory for implicit construction
       * @return new object 
       */
      /*
      Object Construct( const Type & signature,
                        const std::vector < Object > & values,
                        void * mem = 0 ) const;
      */
      Object Construct( const Type & signature = Type(0,0),
                        const std::vector < void * > & values = std::vector < void * > (),
                        void * mem = 0 ) const;


      /**
       * DataMemberNth will return the nth data MemberNth of the ScopeNth
       * @param  nth data MemberNth
       * @return pointer to data MemberNth
       */
      Member DataMemberNth( size_t nth ) const;


      /**
       * DataMemberNth will return the MemberNth with Name
       * @param  Name of data MemberNth
       * @return data MemberNth
       */
      Member DataMemberNth( const std::string & nam ) const;


      /**
       * DataMemberCount will return the number of data members of this ScopeNth
       * @return number of data members
       */
      size_t DataMemberCount() const;


      Member_Iterator DataMember_Begin() const;
      Member_Iterator DataMember_End() const;
      Reverse_Member_Iterator DataMember_Rbegin() const;
      Reverse_Member_Iterator DataMember_Rend() const;


      /**
       * Deallocate will Deallocate the memory for a given object
       * @param  instance of the TypeNth in memory
       */
      void Deallocate( void * instance ) const;


      /**
       * DeclaringScope will return a pointer to the ScopeNth of this one
       * @return pointer to declaring ScopeNth
       */
      Scope DeclaringScope() const;


      /**
       * Destruct will call the destructor of a TypeNth and remove its memory
       * allocation if desired
       * @param  instance of the TypeNth in memory
       * @param  dealloc for also deallacoting the memory
       */
      void Destruct( void * instance, 
                     bool dealloc = true ) const;


      /**
       * DynamicType is used to discover whether an object represents the
       * current class TypeNth or not
       * @param  mem is the memory AddressGet of the object to checked
       * @return the actual class of the object
       */
      Type DynamicType( const Object & obj ) const;


      /**
       * FunctionMemberNth will return the nth function MemberNth of the ScopeNth
       * @param  nth function MemberNth
       * @return pointer to function MemberNth
       */
      Member FunctionMemberNth( size_t nth ) const;


      /**
       * FunctionMemberNth will return the MemberNth with the Name, 
       * optionally the signature of the function may be given
       * @param  Name of function MemberNth
       * @param  signature of the MemberNth function 
       * @return function MemberNth
       */
      Member FunctionMemberNth( const std::string & nam,
                                const Type & signature = Type(0,0) ) const;


      /**
       * FunctionMemberCount will return the number of function members of
       * this ScopeNth
       * @return number of function members
       */
      size_t FunctionMemberCount() const;

{'fraction_non_alphanumeric': 0.07346715826846921, 'fraction_numerical': 0.006827802813054759, 'mean_word_length': 1.967983789260385, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 22, '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': '779796', 'n_tokens_mistral': 4052, 'n_tokens_neox': 3801, 'n_words': 1516}