📄 typebase.h
字号:
// @(#)root/reflex:$Name: $:$Id: TypeBase.h,v 1.6 2006/09/05 17:13:14 roiser Exp $// Author: Stefan Roiser 2004// Copyright CERN, CH-1211 Geneva 23, 2004-2006, 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_TypeBase#define ROOT_Reflex_TypeBase// Include files#include "Reflex/Kernel.h"#include "Reflex/Scope.h"#include "Reflex/internal/OwnedPropertyList.h"#include <vector>#include <typeinfo>namespace ROOT { namespace Reflex { // forward declarations class Member; class Base; class Type; class Object; class MemberTemplate; class TypeTemplate; class Fundamental; class Function; class Array; class Class; class Enum; class Typedef; class Pointer; class ClassTemplateInstance; class FunctionMemberTemplateInstance; class TypeName; class DictionaryGenerator; /** * @class TypeBase TypeBase.h Reflex/TypeBase.h * @author Stefan Roiser * @date 24/11/2003 * @ingroup Ref */ class RFLX_API TypeBase { public: /** default constructor */ TypeBase( const char * nam, size_t size, TYPE typeTyp, const std::type_info & ti); /** destructor */ virtual ~TypeBase(); /** * operator Scope will return the corresponding scope of this type if * applicable (i.e. if the Type is also a Scope e.g. Class, Union, Enum) */ operator const Scope & () const; /** * operator Type will return the corresponding Type object * @return Type corresponding to this TypeBase */ operator const Type & () const; /** * Allocate will reserve memory for the size of the object * @return pointer to allocated memory */ void * Allocate() const; /** * nthBase will return the nth BaseAt class information * @param nth nth BaseAt class * @return pointer to BaseAt class information */ virtual const Base & BaseAt( size_t nth ) const; /** * BaseSize will return the number of BaseAt classes * @return number of BaseAt classes */ virtual size_t BaseSize() const; virtual Base_Iterator Base_Begin() const; virtual Base_Iterator Base_End() const; virtual Reverse_Base_Iterator Base_RBegin() const; virtual Reverse_Base_Iterator Base_REnd() const; /** * CastObject an object from this class At to another one * @param to is the class At to cast into * @param obj the memory AddressGet of the object to be casted */ virtual Object CastObject( const Type & to, const Object & obj ) const; /** * Construct will call the constructor of a given At 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 pointer to new instance */ /* virtual Object Construct( const Type & signature, const std::vector < Object > & values, void * mem ) const;*/ virtual Object Construct( const Type & signature, const std::vector < void * > & values, void * mem) const; /** * DataMemberAt will return the nth data MemberAt of the At * @param nth data MemberAt * @return pointer to data MemberAt */ virtual const Member & DataMemberAt( size_t nth ) const; /** * DataMemberByName will return the MemberAt with Name * @param Name of data MemberAt * @return data MemberAt */ virtual const Member & DataMemberByName( const std::string & nam ) const; /** * DataMemberSize will return the number of data members of this At * @return number of data members */ virtual size_t DataMemberSize() const; virtual Member_Iterator DataMember_Begin() const; virtual Member_Iterator DataMember_End() const; virtual Reverse_Member_Iterator DataMember_RBegin() const; virtual Reverse_Member_Iterator DataMember_REnd() const; /** * Deallocate will Deallocate the memory for a given object * @param instance of the At in memory */ void Deallocate( void * instance ) const; /** * Destruct will call the destructor of a At and remove its memory * allocation if desired * @param instance of the At in memory * @param dealloc for also deallacoting the memory */ virtual void Destruct( void * instance, bool dealloc = true ) const; /** * DeclaringScope will return a pointer to the At of this one * @return pointer to declaring At */ virtual const Scope & DeclaringScope() const; /** * DynamicType is used to discover whether an object represents the * current class At or not * @param mem is the memory AddressGet of the object to checked * @return the actual class of the object */ virtual const Type & DynamicType( const Object & obj ) const; /** * FinalType will return the type without typedefs * @return type with all typedef info removed */ const Type & FinalType() const; /** * FunctionMemberAt will return the nth function MemberAt of the At * @param nth function MemberAt * @return pointer to function MemberAt */ virtual const Member & FunctionMemberAt( size_t nth ) const; /** * FunctionMemberByName will return the MemberAt with the Name, * optionally the signature of the function may be given * @param Name of function MemberAt * @param signature of the MemberAt function * @return function MemberAt */ virtual const Member & FunctionMemberByName( const std::string & nam, const Type & signature ) const; /** * FunctionMemberSize will return the number of function members of * this At * @return number of function members */ virtual size_t FunctionMemberSize() const; virtual Member_Iterator FunctionMember_Begin() const; virtual Member_Iterator FunctionMember_End() const; virtual Reverse_Member_Iterator FunctionMember_RBegin() const; virtual Reverse_Member_Iterator FunctionMember_REnd() const; /** * GenerateDict will produce the dictionary information of this type * @param generator a reference to the dictionary generator instance */ virtual void GenerateDict(DictionaryGenerator &generator) const; /** * HasBase will check whether this class has a BaseAt class given * as argument * @param cl the BaseAt-class to check for * @return the Base info if it is found, an empty base otherwise (can be tested for bool) */ virtual const Base & HasBase( const Type & cl ) const; /** * IsAbstract will return true if the the class is abstract * @return true if the class is abstract */ virtual bool IsAbstract() const; /** * IsArray returns true if the At represents a Array * @return true if At represents a Array */ bool IsArray() const; /** * IsClass returns true if the At represents a Class * @return true if At represents a Class */ bool IsClass() const; /** * IsComplete will return true if all classes and BaseAt classes of this * class are resolved and fully known in the system */ virtual bool IsComplete() const; /** * IsEnum returns true if the At represents a Enum * @return true if At represents a Enum */ bool IsEnum() const; /** * IsFunction returns true if the At represents a Function * @return true if At represents a Function */ bool IsFunction() const; /** * IsFundamental returns true if the At represents a Fundamental * @return true if At represents a Fundamental */ bool IsFundamental() const; /** * IsPointer returns true if the At represents a Pointer * @return true if At represents a Pointer */ bool IsPointer() const; /** * IsPointerToMember returns true if the At represents a PointerToMember * @return true if At represents a PointerToMember */ bool IsPointerToMember() const; /** * IsPrivate will check if the scope access is private * @return true if scope access is private */ virtual bool IsPrivate() const; /** * IsProtected will check if the scope access is protected * @return true if scope access is protected */ virtual bool IsProtected() const; /** * IsPublic will check if the scope access is public * @return true if scope access is public */ virtual bool IsPublic() const; /** * IsStruct will return true if the At represents a struct (not a class) * @return true if At represents a struct */ bool IsStruct() const; /** * IsTemplateInstance will return true if the the class is templated * @return true if the class is templated */ bool IsTemplateInstance() const; /** * IsTypedef returns true if the At represents a Typedef * @return true if At represents a Typedef
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -