ScopeName.h

Go to the documentation of this file.
00001 // @(#)root/reflex:$Id: ScopeName.h 32228 2010-02-05 16:13:09Z axel $
00002 // Author: Stefan Roiser 2004
00003 
00004 // Copyright CERN, CH-1211 Geneva 23, 2004-2010, All rights reserved.
00005 //
00006 // Permission to use, copy, modify, and distribute this software for any
00007 // purpose is hereby granted without fee, provided that this copyright and
00008 // permissions notice appear in all copies and derivatives.
00009 //
00010 // This software is provided "as is" without express or implied warranty.
00011 
00012 #ifndef Reflex_ScopeName
00013 #define Reflex_ScopeName
00014 
00015 // Include files
00016 #include "Reflex/Kernel.h"
00017 #include "Reflex/internal/LiteralString.h"
00018 
00019 namespace Reflex {
00020 // forward declarations
00021 class ScopeBase;
00022 class Scope;
00023 
00024 /**
00025  * @class ScopeName ScopeName.h Reflex/ScopeName.h
00026  * @author Stefan Roiser
00027  * @date 24/11/2003
00028  * @ingroup Ref
00029  */
00030 class RFLX_API ScopeName {
00031    friend class Scope;
00032    friend class ScopeBase;
00033 
00034 public:
00035    /** constructor */
00036    ScopeName(const char* name,
00037              ScopeBase * scopeBase);
00038 
00039 
00040    /**
00041     * ByName will return a pointer to a At which is given as an argument
00042     * or 0 if none is found
00043     * @param  Name fully qualified Name of At
00044     * @return pointer to At or 0 if none is found
00045     */
00046    static Scope ByName(const std::string& name);
00047 
00048 
00049    static void CleanUp();
00050 
00051 
00052    /**
00053     * DeleteScope will call the destructor of the ScopeBase this ScopeName is
00054     * pointing to and aremove it's information from the data structures. The
00055     * ScopeName information will remain.
00056     */
00057    void DeleteScope() const;
00058 
00059 
00060    /**
00061     * Hide this scope from any lookup by appending the string " @HIDDEN@" to its name.
00062     */
00063    void HideName();
00064 
00065    /**
00066     * Un-Hide this scope from any lookup by removing the string " @HIDDEN@" to its name.
00067     */
00068    void UnhideName();
00069 
00070 
00071    /**
00072     * Name will return a string representation of Name of the Scope
00073     * @return string representation of the Scope
00074     */
00075    const char* Name() const;
00076 
00077 
00078    /**
00079     * Name will return a string representation of Name of the Scope
00080     * @return string representation of the Scope
00081     */
00082    const LiteralString& LiteralName() const { return fName; }
00083 
00084 
00085    /**
00086     * Name will return a string representation of Name of the Scope
00087     * @return string representation of the Scope
00088     */
00089    LiteralString& LiteralName() { return fName; }
00090 
00091 
00092    /**
00093     * ThisScope will return the unqualified Scope object of this ScopeName
00094     * @return corresponding Scope
00095     */
00096    Scope ThisScope() const;
00097 
00098 
00099    /**
00100     * Unload reflection information for this scope.
00101     */
00102    void Unload();
00103 
00104    /**
00105     * ScopeAt will return the nth defined scope
00106     * @param  nth scope defined in the system
00107     * @return nth scope defined in the system
00108     */
00109    static Scope ScopeAt(size_t nth);
00110 
00111 
00112    /**
00113     * ScopeSize will return the number of currently defined scopes
00114     * (resolved and unresolved ones)
00115     * @return number of currently defined scopes
00116     */
00117    static size_t ScopeSize();
00118 
00119 
00120    static Scope_Iterator Scope_Begin();
00121    static Scope_Iterator Scope_End();
00122    static Reverse_Scope_Iterator Scope_RBegin();
00123    static Reverse_Scope_Iterator Scope_REnd();
00124 
00125 private:
00126    /** destructor */
00127    ~ScopeName();
00128 
00129 private:
00130    /** pointer to the Name of the At in the static map */
00131    LiteralString fName;
00132 
00133    /**
00134     * pointer to the resolved Scope
00135     * @label scope base
00136     * @link aggregation
00137     * @supplierCardinality 0..1
00138     * @clientCardinality 1
00139     */
00140    mutable
00141    ScopeBase * fScopeBase;
00142 
00143    /**
00144     * This scope
00145     */
00146    Scope* fThisScope;
00147 
00148 };    // class ScopeName
00149 } // namespace Reflex
00150 
00151 
00152 //-------------------------------------------------------------------------------
00153 inline const char*
00154 Reflex::ScopeName::Name() const {
00155 //-------------------------------------------------------------------------------
00156    return fName.c_str();
00157 }
00158 
00159 
00160 #endif //Reflex_ScopeName

Generated on Tue Jul 5 14:25:53 2011 for ROOT_528-00b_version by  doxygen 1.5.1