Skip to content
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

Adding configurable attributes to methods #605

Open
kdoherty2 opened this issue Oct 12, 2018 · 4 comments
Open

Adding configurable attributes to methods #605

kdoherty2 opened this issue Oct 12, 2018 · 4 comments

Comments

@kdoherty2
Copy link

kdoherty2 commented Oct 12, 2018

Adding configurable attributes to methods

@mjpt777
Copy link
Contributor

mjpt777 commented Oct 12, 2018

Can you provide an example for reference?

@VSol-ll
Copy link

VSol-ll commented Oct 15, 2018

Time to time it's very beneficial to mark methods with attributes. E.g. [[gnu::always_inline]].
This can be done via macros (empty by default).

Would be really nice to categorize the functions to be able giving them different attributes:

  • getters
    • getters for constant fields (in some cases we need them to be static constexpr)
  • setters

@tmontgomery
Copy link
Contributor

For ease of use, it might be easiest to configure a String to be prepended to getters and setters. The fields that can be static const already have a String (macro). These strings can be macros or direct values. This might be also nice for Java as these could be annotations.

@VSol-ll
Copy link

VSol-ll commented Oct 16, 2018

You know, in case of C++ it can be basically a set of hardcoded macros:

#ifndef SBE_CFG_METHOD_PREFIX
#  define SBE_CFG_METHOD_PREFIX
#endif 
#ifndef SBE_CFG_GETTER_PREFIX
#  define SBE_CFG_GETTER_PREFIX SBE_CFG_METHOD_PREFIX
#endif 
#ifndef SBE_CFG_CONST_FLD_GETTER_PREFIX
#  define SBE_CFG_CONST_FLD_GETTER_PREFIX SBE_CFG_GETTER_PREFIX
#endif 
#ifndef SBE_CFG_SETTER_PREFIX
#  define SBE_CFG_SETTER_PREFIX SBE_CFG_METHOD_PREFIX
#endif 
....
  SBE_CFG_GETTER_PREFIX int getField(){...}

But if it's beneficial for other langs too it's better to go SbeTool parameters.

@kdoherty2 kdoherty2 changed the title Having configurable attributes to methods would be helpful Adding configurable attributes to methods Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants