Feature #40
open
Feature #76: Code reorganization
Replace THa prefix with namespaces
Added by Ole Hansen over 7 years ago.
Updated over 6 years ago.
Description
The archaic THa prefix to class names should be replaced with appropriate namespaces like Podd and HallA. The old names may still be made available to legacy code via typedefs.
- Start date deleted (
10/17/2013)
- % Done changed from 0 to 30
Removed THa prefix. Renamed THa* files to files without that prefix. Changed code accordingly. Also, renamed all *.C (except scripts) to *.cxx for consistency with ROOT and hcana.
Todo:
- wrap all classes in namespaces (Podd, HallA)
- create wrapper THa*.h headers for backward compatibility
- typedef old names for backward compatibility
- Status changed from New to In Progress
- % Done changed from 30 to 50
Created wrapper THa*.h headers.
Typedefs do not work to alias the old names to the new because typedefs clash with class forward declarations. However, simply #define
'ing old names to the new ones does work right out of the box. Put these #define
's in src/CompatDefs.h
and hana_decode/dcCompatDefs.h
. The key is to have clients see all the #define
's as early as possible so that function arguments and class forward declarations are substituted properly.
The main caveat is that "THa" names may appear in strings, for example in calls to TClass::InheritsFrom
, TClonesArray
constructors or RVarDef
definitions (to indicate the class of objects inside a TClonesArray
). Those calls will fail to recognize the referenced class, and such instances will have to be modified and compiled conditionally, if necessary.
Admittedly, this business is a bit of a kludge; client classes should simply be modified to replace all instances of "THa" with "Podd::" or "HallA::". We should write a translation script for that.
Namespaces are not consistently implemented yet; that's next.
Also available in: Atom
PDF