AMF refactoring
So far no really no C++ features has been used. Files has been renamed so that the C++ compiler is used and new/delete is used instead of malloc/free (where appropriate).
In this ticket it is time to make use of C++ features to get a more maintainable and understandable code base. We should aim for many small changes instead of few big ones.
A list of things to work on:
1. Use bool which is a native type in C++ (and remove SaBoolT)
2. Reduce number of casts in the code (introduced because of C++ files)
2. Use stl::maps (instead of patricia trees)
3. Use stl::vector/list (instead of legacy/home made lists)
4. Change struct AVD_SU to class, functions and macros to methods
5. Change struct AVD_SI to class, functions and macros to methods
6. Change struct AVD_SG to class, functions and macros to methods
Other yet non prioritized items:
- Remove use of EDU and do direct encode/decode
- Clean run of google's cpplint on the code base
- Convert model derived C structs to classes and change functions into methods
- Change macros to (inline) methods
- Change bit fields (flags) to boolean attributes (see https://sourceforge.net/p/opensaf/tickets/717/#d4b2)
- Use references instead of pointers
- ...
Non C++ related changes:
- split up long functions into smaller ones doing one things and not many
- use pmccabe complexity analysis to aid refactoring
- set a goal for pmccabe complexity
- use const as much as possible
- ...
Tickets: #418
Tickets: #421
Tickets: #424
Wiki: Home
FYI I am exploring polymorphism for service group. One base class and subtype classes for each redundancy model. We basically already have this today with function pointers from struct SG to red model specific functions. With use of C++ this will make the code much nicer. One showstopper was use of EDU for SG.