Added a generic csv writter

Added a generic writter to handle non homogeneous data
Fix coding style
Refactor for PR
Merge pull request #1135 from solivier/feature/export-csv

Feature/export csv