New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added semantic version as a static public member #931
Conversation
Hi, thank you for the PR. Pleas could you have a look at the failing builds. |
You need to run:
and commit the changes. |
Did I do it correctly? Added another commit with the generated files. |
9dc0efd
to
c99b3a2
Compare
c99b3a2
to
1a52247
Compare
I will check the C++ compiling errors as soon as possible |
It is fixed now. May you please run again the ci pipeline? |
@@ -1992,7 +1993,8 @@ private CharSequence generateMessageFlyweightCode(final String className, final | |||
" static const %1$s SBE_BLOCK_LENGTH = %2$s;\n" + | |||
" static const %3$s SBE_TEMPLATE_ID = %4$s;\n" + | |||
" static const %5$s SBE_SCHEMA_ID = %6$s;\n" + | |||
" static const %7$s SBE_SCHEMA_VERSION = %8$s;\n\n" + | |||
" static const %7$s SBE_SCHEMA_VERSION = %8$s;\n" + | |||
" static SBE_CONSTEXPR const char* SBE_SEMANTIC_VERSION = \"%13$s\";\n\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have a const expression here? Also why not have the type as const char * const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to use std::string and also I removed the const expression. I added it before to be able to declare and initialize the SBE_SEMANTIC_VERSION in one single line but it was failing the msvc compiler so I changed it. Now it is declaring the constant in one line and initializing it out of the class.
@@ -15,6 +15,7 @@ | |||
public static final int TEMPLATE_ID = 1; | |||
public static final int SCHEMA_ID = 1; | |||
public static final int SCHEMA_VERSION = 0; | |||
public static final String SEMANTIC_VERSION = "null"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not feel right. The string should be empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review. It is fixed now.
The MSVC build is broken. |
@@ -2039,6 +2042,11 @@ private CharSequence generateMessageFlyweightCode(final String className, final | |||
" return %8$s;\n" + | |||
" }\n\n" + | |||
|
|||
" SBE_NODISCARD static const std::string sbeSemanticVersion() SBE_NOEXCEPT\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be consistent with sbeSemanticType
and use a const char *
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
dd7e6d8
to
1d0a3a6
Compare
The semantic version is not currently accessible for the clients using the generated stubs. This pull request adds the semantic version as a static public member in the classes generated by the sbe-tool. It is now possible to obtain the value of the sbe template semantic version direct in the source code using the stubs.