Parametrization for decoder/encoder generation
Hi, is it possible to parametrize generated encoder/decoder? In particular, I'm asking for some way to replace current exception throwing in C++ generator for something. Right now, the only way for a decoder/encoder to generate an error is throwing std::runtime_error. So, the idea is to let a developer decide what to do, raise std::runtime_error exception or raise some platform-specific exception or legacy way with setjump/longjump. As an addition, this idea may require some additional headers to be included (for custom exceptions, for example). How it may be solved. Pass both additional classpath at sbe-tool start (for loading developer's code) and some '-D' argument which make an sbe-tool to instance custom developer's code and to execute some callbacks from developer's code which generates whatever developer wants.
Would you like to submit a PR with your ideas for how this can be implemented?
Something like:
if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))
{
SBE_BOUNDS_CHECK_ERROR("buffer too short [E100]");
}
sbe.h
#ifndef SBE_BOUNDS_CHECK_ERROR
# define SBE_BOUNDS_CHECK_ERROR(msg) { throw std::runtime_error(msg); }
#endif
This has been requested before. Probably a clean way to handle it.