Comments (1)
Unfortunately at its current state the CommsChampion Ecosystem doesn't provide good means to deal with your specific use case.
After some consideration I would advise you to stick with the sequence of the <optional>
fields. Although handling the values will require some boilerplate code, but I think it's a lesser evil. Doing what you need with <variant>
fields is also possible, but it will require a custom code injection and it is very easy to make it wrong. Such approach will just move complexity and "manual" boilerplate code from one place to another, probably even increase it.
Just to give you an idea how to make <variant>
based solution work, you need to perform the following steps:
- Make your
<variant>
field a global one to allow code injection. - Extend the default field implementation with the .extend file.
- In the extended class there must be an ability to access the transport field stored in the message interface, i.e. there must be an extra pointer to the relevant field in the private data member. When message object is created, the constructor code of the latter needs also to be custom to set the pointer to the transport field.
- There is a need to fully re-implement
read()
andrefresh()
member functions ("manual" boilerplate code), similar to what is performed by the code generator (see tutorial4), but instead of reading the "key" field, access the transport field via stored pointer. Therefresh()
functionality also needs to update the transport field stored in the interface. - The
write()
(and probablylength()
) functionality can be inherited, but will probably require using pseudo keyword on the "key" fields to prevent them to be written during the serialization.
from commsdsl.
Related Issues (20)
- Question: List without length and message size HOT 2
- ICD generation HOT 7
- Missing copyright holder in license HOT 5
- ASN.1 Parsing/Serialization HOT 2
- Adding constexpr to static const functions HOT 2
- Bit Order in `<bitfield>` and `<set>` HOT 4
- `optional` field with `cond` depending on another `optional` field. HOT 7
- Field Extension Support in Lists with termSuffix HOT 4
- Need Help HOT 21
- Creating Frame with `id` that is less than one byte HOT 3
- Can a (serial) protocol with character escaping be realized using the custom code feature? HOT 2
- Schema name cannot start with a capital HOT 4
- noexcept error with gcc 9 HOT 5
- Unexpected max serialisation length HOT 4
- Dead links in the Readme HOT 1
- vcpkg integration HOT 16
- error when using COMMSDSL_NO_TESTS HOT 2
- Undefined behaviour on "out of range" values of ID layer. HOT 4
- "Unexpected max serialisation length" on variable length field inside variant HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commsdsl.