c++ macro for saving enum element names and values to file
Normally I try to avoid the use of macros, so I actually don't know how to
use them beyond the very most basic ones, but I'm trying to do some
meta-manipulation so I assume macros are needed.
I have an enum listing various log entries and their respective id, e.g.
enum LogID
{
LOG_ID_ITEM1=0,
LOG_ID_ITEM2,
LOG_ID_ITEM3=10,
...
}
which is used within my program when writing data to the log file. Note
that they will not, in general, be in any order.
I do most of my log file post-processing in Matlab so I'd like to write
the same variable names and values to a file for Matlab to load in. e.g.,
a file looking like
LOG_ID_ITEM1=0;
LOG_ID_ITEM2=1;
LOG_ID_ITEM3=10;
...
I have no idea how to go about doing this, but it seems like it shouldn't
be too complicated. If it helps, I am using c++11.
No comments:
Post a Comment