Feature #40

Feature #76: Code reorganization

Replace THa prefix with namespaces

Added by Ole Hansen about 3 years ago. Updated over 2 years ago.

Status:In ProgressStart date:
Priority:NormalDue date:
Assignee:-% Done:

50%

Category:-Estimated time:16.00 hours
Target version:1.7Spent time:23.00 hours
Responsible:

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.

History

#1 Updated by Ole Hansen about 3 years ago

  • Start date deleted (10/17/2013)

#2 Updated by Ole Hansen over 2 years ago

  • Parent task set to #76

#3 Updated by Ole Hansen over 2 years ago

  • % 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

#4 Updated by Ole Hansen over 2 years ago

  • 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