Skip to content

[C++]: Composite type generation #641

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ksergey opened this issue Feb 5, 2019 · 3 comments
Closed

[C++]: Composite type generation #641

ksergey opened this issue Feb 5, 2019 · 3 comments

Comments

@ksergey
Copy link
Contributor

ksergey commented Feb 5, 2019

C++ generator produce*Id() fields for composite type elements. Is there any reason for that?
Elements from composite type don't have property id and generated methods always return 0.

@ksergey
Copy link
Contributor Author

ksergey commented Feb 5, 2019

I think code below should be if-ed

    private void generateFieldCommonMethods(                                                                                                                   
        final String indent,                                                                                                                                   
        final StringBuilder sb,                                                                                                                                
        final Token fieldToken,                                                                                                                                
        final Token encodingToken,                                                                                                                             
        final String propertyName)                                                                                                                             
    {                                                                                                                                                          
        sb.append(String.format("\n" +                                                                                                                         
            indent + "    static SBE_CONSTEXPR std::uint16_t %1$sId() SBE_NOEXCEPT\n" +                                                                        
            indent + "    {\n" +                                                                                                                               
            indent + "        return %2$d;\n" +                                                                                                                
            indent + "    }\n",                                                                                                                                
            propertyName,                                                                                                                                      
            fieldToken.id()));     

@tmontgomery
Copy link
Contributor

Things could be re-arranged so that the method is not generated by treating the composite differently than the normal messages. And probably could make a few other optimizations while at it.

@mjpt777
Copy link
Contributor

mjpt777 commented Feb 5, 2019

Correct @tmontgomery.

@mjpt777 mjpt777 closed this as completed Feb 5, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants