move channel's implementation in cpp file
fixed errors made when moving from C-style casts to C++-style cast
refactoring most "for" loops to avoid doing declaration on 3 lines + using astyle on modified files
fixed some wrong encapsulation problems and cycling header includes