From 30d8c84cc0f1a57c47915ad9b803f26570ee5c6e Mon Sep 17 00:00:00 2001 From: Stefan Roiser <Stefan.Roiser@cern.ch> Date: Tue, 18 Apr 2006 07:35:09 +0000 Subject: [PATCH] New feature for Cpp selection mechanism. If a class in the Cpp selection namespace contains a member of type "NO_SELF_AUTOSELECT", then this class will NOT be selected for dictionary generation (despite dictinaries for any member types etc. in this class will be generated) git-svn-id: http://root.cern.ch/svn/root/trunk@14727 27541ba8-7e3a-0410-8455-c3a389f83636 --- reflex/inc/Reflex/Builder/DictSelection.h | 12 ++++++++- reflex/python/genreflex/gendict.py | 31 +++++++++++++---------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/reflex/inc/Reflex/Builder/DictSelection.h b/reflex/inc/Reflex/Builder/DictSelection.h index acce9761232..3ac4ddfc400 100644 --- a/reflex/inc/Reflex/Builder/DictSelection.h +++ b/reflex/inc/Reflex/Builder/DictSelection.h @@ -1,4 +1,4 @@ -// @(#)root/reflex:$Name: $:$Id: DictSelection.h,v 1.3 2005/11/23 16:08:08 roiser Exp $ +// @(#)root/reflex:$Name: $:$Id: DictSelection.h,v 1.4 2006/03/13 15:49:50 roiser Exp $ // Author: Stefan Roiser 2004 #ifndef ROOT_Reflex_DictSelection @@ -236,6 +236,16 @@ namespace ROOT { namespace Reflex { namespace Selection { + + /* + * @brief turn of autoselection of the class + * + * By default classes which appear in the Selection namespace will be selected + * for dictionary generation. If a class has a member of type NO_SELF_AUTOSELECT + * no dictionary information for this class will be generated. + */ + class RFLX_API NO_SELF_AUTOSELECT {}; + /* * @brief Mark a MemberAt as being transient. diff --git a/reflex/python/genreflex/gendict.py b/reflex/python/genreflex/gendict.py index 18139126f3a..59dd23037c0 100644 --- a/reflex/python/genreflex/gendict.py +++ b/reflex/python/genreflex/gendict.py @@ -131,24 +131,27 @@ class genDictionary(object) : return #---------------------------------------------------------------------------------- def notice_autoselect (self, c, selection): - attrs = self.xref[c['id']]['attrs'] - if attrs.has_key('extra') : attrs['extra']['autoselect'] = 'true' - else : attrs['extra'] = {'autoselect':'true'} + self_autoselect = 1 for f in self.get_fields (selection): tid = f['type'] tname = self.genTypeName (tid) + if tname.startswith( self.selectionname+'::NO_SELF_AUTOSELECT'): self_autoselect = 0 if tname.startswith (self.selectionname+'::AUTOSELECT'): - if 'members' in c: - for mnum in c['members'].split(): - m = self.xref[mnum] - if 'name' in m['attrs'] and m['attrs']['name'] == f['name']: - if m['elem'] == 'Field': - fattrs = self.xref[m['attrs']['type']]['attrs'] - if fattrs.has_key('extra') : fattrs['extra']['autoselect'] = 'true' - else : fattrs['extra'] = {'autoselect':'true'} - else : - print '--->> genreflex: WARNING: AUTOSELECT selection functionality for %s not implemented yet' % m['elem'] - self.warnings += 1 + if 'members' in c: + for mnum in c['members'].split(): + m = self.xref[mnum] + if 'name' in m['attrs'] and m['attrs']['name'] == f['name']: + if m['elem'] == 'Field': + fattrs = self.xref[m['attrs']['type']]['attrs'] + if fattrs.has_key('extra') : fattrs['extra']['autoselect'] = 'true' + else : fattrs['extra'] = {'autoselect':'true'} + else : + print '--->> genreflex: WARNING: AUTOSELECT selection functionality for %s not implemented yet' % m['elem'] + self.warnings += 1 + if self_autoselect : + attrs = self.xref[c['id']]['attrs'] + if attrs.has_key('extra') : attrs['extra']['autoselect'] = 'true' + else : attrs['extra'] = {'autoselect':'true'} return #---------------------------------------------------------------------------------- def get_fields (self, c): -- GitLab