diff --git a/reflex/inc/Reflex/Scope.h b/reflex/inc/Reflex/Scope.h index 66559362417bf66c568e353cb218a710b6bac984..2d7ffcdfaeb03aa9d2ddfd497a9801b676a361bc 100644 --- a/reflex/inc/Reflex/Scope.h +++ b/reflex/inc/Reflex/Scope.h @@ -1,4 +1,4 @@ -// @(#)root/reflex:$Name: $:$Id: Scope.h,v 1.6 2006/03/13 15:49:50 roiser Exp $ +// @(#)root/reflex:$Name: $:$Id: Scope.h,v 1.7 2006/06/08 16:05:14 roiser Exp $ // Author: Stefan Roiser 2004 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved. @@ -250,6 +250,14 @@ namespace ROOT { Reverse_Member_Iterator FunctionMember_REnd() const; + + /** + * GlobalScope will return the global scope representation\ + * @return global scope + */ + static Scope GlobalScope(); + + /** * Id returns a unique identifier of the type in the system * @return unique identifier @@ -867,6 +875,13 @@ namespace ROOT { */ static Scope fg__NIRVANA__; + + /** + * @label __GLOBALSCOPE__ + * @link association + */ + static Scope fg__GLOBALSCOPE__; + private: /** diff --git a/reflex/src/Kernel.cxx b/reflex/src/Kernel.cxx index e694cce06bf222a45f9747203d2739e6d8d99123..d8d216167bddb91dbfd26243490c6700322d9019 100644 --- a/reflex/src/Kernel.cxx +++ b/reflex/src/Kernel.cxx @@ -1,4 +1,4 @@ -// @(#)root/reflex:$Name: $:$Id: Kernel.cxx,v 1.6 2006/03/13 15:49:50 roiser Exp $ +// @(#)root/reflex:$Name: $:$Id: Kernel.cxx,v 1.7 2006/03/20 09:46:18 roiser Exp $ // Author: Stefan Roiser 2004 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved. @@ -34,6 +34,8 @@ ROOT::Reflex::Scope ROOT::Reflex::Scope::fg__NIRVANA__ = ROOT::Reflex::Scope( new ScopeName( "@N@I@R@V@A@N@A@", 0 )); +ROOT::Reflex::Scope ROOT::Reflex::Scope::fg__GLOBALSCOPE__ = +ROOT::Reflex::Scope(); //------------------------------------------------------------------------------- ROOT::Reflex::Reflex::Reflex() { diff --git a/reflex/src/Scope.cxx b/reflex/src/Scope.cxx index 0adef6b8d01d334ae275f4eb3ce3491397dfffe0..f655fd2de81b33e6dc8c760ede61712153253799 100644 --- a/reflex/src/Scope.cxx +++ b/reflex/src/Scope.cxx @@ -1,4 +1,4 @@ -// @(#)root/reflex:$Name: $:$Id: Scope.cxx,v 1.7 2006/03/20 09:46:18 roiser Exp $ +// @(#)root/reflex:$Name: $:$Id: Scope.cxx,v 1.8 2006/06/08 16:05:14 roiser Exp $ // Author: Stefan Roiser 2004 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved. @@ -115,6 +115,14 @@ size_t ROOT::Reflex::Scope::FunctionMemberSize() const { } + +//------------------------------------------------------------------------------- +ROOT::Reflex::Scope ROOT::Reflex::Scope::GlobalScope() { +//------------------------------------------------------------------------------- + return fg__GLOBALSCOPE__; +} + + //------------------------------------------------------------------------------- ROOT::Reflex::Member ROOT::Reflex::Scope::LookupMember( const std::string & nam ) const { diff --git a/reflex/src/ScopeBase.cxx b/reflex/src/ScopeBase.cxx index 94b357508d9090dea5001cd5b80423b659f32d84..78944a56a665e07ead44ea9f5896d1aaeaa351e5 100644 --- a/reflex/src/ScopeBase.cxx +++ b/reflex/src/ScopeBase.cxx @@ -1,4 +1,4 @@ -// @(#)root/reflex:$Name: $:$Id: ScopeBase.cxx,v 1.10 2006/06/08 16:05:14 roiser Exp $ +// @(#)root/reflex:$Name: $:$Id: ScopeBase.cxx,v 1.11 2006/06/27 07:44:37 roiser Exp $ // Author: Stefan Roiser 2004 // Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved. @@ -98,6 +98,7 @@ ROOT::Reflex::ScopeBase::ScopeBase() //------------------------------------------------------------------------------- fScopeName = new ScopeName("", this); fPropertyList.AddProperty("Description", "global namespace"); + Scope::fg__GLOBALSCOPE__ = ThisScope(); } diff --git a/reflex/test/test_Reflex_unit.cxx b/reflex/test/test_Reflex_unit.cxx index cdceb4b275c72e9470624eeb7cf00b5c22f547d8..3680658ea78d6f90c21101001cebfc4a09497044 100644 --- a/reflex/test/test_Reflex_unit.cxx +++ b/reflex/test/test_Reflex_unit.cxx @@ -1,4 +1,4 @@ -// @(#)root/reflex:$Name: $:$Id: test_Reflex_unit.cxx,v 1.6 2006/06/26 17:21:38 roiser Exp $ +// @(#)root/reflex:$Name: $:$Id: test_Reflex_unit.cxx,v 1.7 2006/06/28 10:43:29 roiser Exp $ // Author: Stefan Roiser 2004 // CppUnit include file @@ -55,6 +55,7 @@ class ReflexUnitTest : public CppUnit::TestFixture { CPPUNIT_TEST( type_template ); CPPUNIT_TEST( member ); CPPUNIT_TEST( tools ); + CPPUNIT_TEST( global_scope ); CPPUNIT_TEST_SUITE_END(); public: void setUp () {} @@ -79,6 +80,7 @@ public: void type_template(); void member(); void tools(); + void global_scope(); void tearDown() {} }; @@ -592,6 +594,20 @@ void ReflexUnitTest::tools() { } + +void ReflexUnitTest::global_scope() { + + Scope g = Scope::ByName(""); + CPPUNIT_ASSERT(g); + + Scope g2 = Scope::GlobalScope(); + CPPUNIT_ASSERT(g2); + + CPPUNIT_ASSERT_EQUAL(g.Id(), g2.Id()); + CPPUNIT_ASSERT_EQUAL(g.Name(), g2.Name()); + +} + // Class registration on cppunit framework CPPUNIT_TEST_SUITE_REGISTRATION(ReflexUnitTest);