Closed dogoepp closed 7 years ago
Any other idea than creating one program for each version of the protocol ?
If Protocol1 and Protocol2 have the same functionality (i.e. the same commands and only the template changes), then you can use preprocessor directives (#ifdef) to just change the template. You need to modify the wscript to compile 2 targets (with different defines --- it's easy), but the source file will be one.
#ifdef PROTOCOL2
using Protocol = protocols::Protocol2;
#else
using Protocol = protocols::Protocol1;
#endif
typedef Utility<Protocol>::id_t id_t;
....
Yes, we can create 2 binaries from a single file.
Jean-Baptiste Mouret - Inria researcher www: http://members.loria.fr/JBMouret ERC ResiBots: http://www.resibots.eu
On Tue, Nov 15, 2016 at 8:10 PM Konstantinos Chatzilygeroudis < notifications@github.com> wrote:
Any other idea than creating one program for each version of the protocol ?
If Protocol1 and Protocol2 have the same functionality (i.e. the same commands and only the template changes), then you can use preprocessor directives (#ifdef) to just change the template. You need to modify the wscript to compile 2 targets (with different defines --- it's easy), but the source file will be one.
ifdef PROTOCOL2using Protocol = protocols::Protocol2;
elseusing Protocol = protocols::Protocol1;
endiftypedef Utility
::id_t id_t; ....
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/resibots/libdynamixel/pull/22#issuecomment-260736126, or mute the thread https://github.com/notifications/unsubscribe-auth/AFu8v-XE_3gqqwtd9ne0sIr87V7xUllNks5q-gNngaJpZM4Kyn89 .
Thanks for the advice, done.
Anything else needing changes ?
OK to merge ?
It's ok for me...
OK, will merge, but in another pull request. I messed a bit with the history of this branch.
Fixes #20 (hopefully).
Any other idea than creating one program for each version of the protocol ?