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

C++: Avoid name collisions and add missing const begin()/end() methods to VLA #287

Merged
merged 5 commits into from
Mar 4, 2023

Conversation

pavel-kirienko
Copy link
Member

@pavel-kirienko pavel-kirienko commented Mar 3, 2023

Fixes #286

In C++, serialize and deserialize are now free-standing functions. The alternative would be to name them _serialize_ and _deserialize_, but I imagine this to be bad form.

One unused error tag SERIALIZATION_INVALID_ARGUMENT has been removed. The others have been renamed into CamelCase for consistency, as ALL_CAPS is reserved for macros.

I also added _traits_::TypeOf for introspection; it is often helpful in user code as the alternative requires the use of decltype:

image

We may also introduce a wrapper like nunavut::traits<T> if direct usage of _traits_ is considered hard to read.

@pavel-kirienko pavel-kirienko requested review from thirtytwobits and removed request for thirtytwobits March 3, 2023 16:29
@pavel-kirienko pavel-kirienko requested review from asmfreak and thirtytwobits and removed request for asmfreak March 3, 2023 17:01
@pavel-kirienko pavel-kirienko marked this pull request as ready for review March 3, 2023 17:04
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@pavel-kirienko
Copy link
Member Author

pavel-kirienko commented Mar 3, 2023 via email

@pavel-kirienko pavel-kirienko merged commit 6c0a42a into main Mar 4, 2023
@pavel-kirienko pavel-kirienko deleted the cpp branch March 4, 2023 17:02
pavel-kirienko added a commit that referenced this pull request Mar 5, 2023
…or mistake introduced in the prior PR (#290)

- Do not lose blank lines in doc comments.
- Move `Request`/`Response` aliases out of the `_traits_`; this was
changed by mistake in #287
- Repair the vscode run/debug configuration

The naming of the service pseudo-type
`Service_{{major}}_{{minor}}` non-obvious and I would like to suggest
renaming it such that the service pseudo-type is named after the service
itself suffixed with the version numbers. This would be in line with the
way it is implemented in Python. Instead of this:

```c++
uavcan::_register::Access::Request_1_0
uavcan::_register::Access::Response_1_0
uavcan::_register::Access::Service_1_0
```

We now have this:

```c++
uavcan::_register::Access::Request_1_0
uavcan::_register::Access::Response_1_0
uavcan::_register::Access_1_0
```

Then there already are aliases inside `Access_1_0` which means that the
full set of the available names is as follows:

```c++
uavcan::_register::Access::Request_1_0
uavcan::_register::Access::Response_1_0
uavcan::_register::Access_1_0
uavcan::_register::Access_1_0::Request
uavcan::_register::Access_1_0::Response
```

See related discussion in #155 and #190
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

Successfully merging this pull request may close these issues.

C++: name collision between DSDL attributes and generated entities
2 participants