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

Add documentation for generators and API #640

Closed
wants to merge 1 commit into from

Conversation

gbiggs
Copy link
Member

@gbiggs gbiggs commented Dec 17, 2021

This PR adds documentation to the type support APIs and generators for C and C++.

The documentation needs review by someone with a good understanding of rosidl, to ensure it is correct and identify any missing documentation.

@gbiggs
Copy link
Member Author

gbiggs commented Dec 17, 2021

Should the code templates for the generated files also be documented so that the generated type support APIs get documented?

@gbiggs gbiggs requested a review from j-rivero December 17, 2021 01:21
@gbiggs gbiggs self-assigned this Dec 17, 2021
Comment on lines +28 to +29
"""
Generator class for generating the C implementation of the type support.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing because pep257 thinks this can all be on one line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's see if this is enough c41fbcd

@hidmic hidmic self-requested a review December 21, 2021 15:37
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass. Thanks for doing this @gbiggs !


Parameters
----------
argv : List[str]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs meta: if we're adding type annotations in docstrings, we may as well type annotate the code itself here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried here 1b972df

rosidl_typesupport_introspection_c__ROS_TYPE_CHAR = 4,
/// Wide character, large enough to support Unicode code points.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs nit: I think we should specify this is a 16 bit character, which doesn't necessarily match wchar_t size on every platform nor is enough for code points in every Unicode encoding.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const char * name_;
/// The type of the field as a value of the field types enum,
/// e.g. rosidl_typesupport_introspection_c__ROS_TYPE_FLOAT
uint8_t type_id_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs meta, preexisting: I wonder why don't we simply name that enum type and use it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried 739b377

size_t string_upper_bound_;
/// If the type_id_ value is rosidl_typesupport_introspection_c__ROS_TYPE_MESSAGE,
/// this points to an array describing the fields of the sub-interface.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs nit: here we talk about a sub-interface, above we talk about an embedded message.

Consider sticking to one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not find the place where we referenced it as "embedded message". Could you please point me to it?

const rosidl_message_type_support_t * members_;
/// True if this field is an array, false if it is a unary type. An array has the same value for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs hmm what do you mean by unary type? The IDL spec talks about base types, and rosidl_parser talks about basic types.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the reference to 'unary' type bd1c007

@@ -21,30 +21,53 @@
namespace rosidl_typesupport_introspection_cpp
{

/// Primitive (plain-old data) types supported by the ROS type system.

/// IEEE-754 binary32 format floating point number.
const uint8_t ROS_TYPE_FLOAT = rosidl_typesupport_introspection_c__ROS_TYPE_FLOAT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs meta, preexisting: this is weird. Why not defining an equivalent enum type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this one, skipped.

const char * name_;
/// The type of the field as a value of the field types enum,
/// e.g. rosidl_typesupport_introspection_c__ROS_TYPE_FLOAT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs I'd think this field deals with rosidl_typesupport_introspection_cpp::ROS_TYPE_* values? Same below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed here c22fabc

// This is implemented in the shared library provided by this package.
/// Returns a pointer to the type support structure provided by this library for introspecting
/// interfaces.
/// This is implemented in the shared library provided by this package.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs meta: this isn't strictly provided by librosidl_typesupport_introspection_cpp.so itself but fully specialized in the lib<package_name>__rosidl_typesupport_introspection_cpp.so libraries that can be found in downstream packages. See here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to clarify it here 1b1d634

"""
Generator class for generating the C++ implementation of the type support.

"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs meta: I think we have to separate things a bit here. These cli.py modules simply make up a CLI for convenient access to the generators. They are not used during builds (yet, #560).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve description here 5eb8f06

const void * default_value_;
/// If is_array_ is true, a pointer to a function that gives the size of one member of the array.
/// Only used for nested interface types.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs hmm, IIUC this function applies to array members (see here).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbiggs also, here and below, it may be worth mentioning that the first argument should be a pointer to the actual memory representation of the member.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment 2d013dc

@j-rivero j-rivero assigned j-rivero and unassigned gbiggs Jan 15, 2022
@j-rivero
Copy link
Contributor

I have the review changes ready but not sure if I can push them to this current PR from @gbiggs fork.

@j-rivero
Copy link
Contributor

I have the review changes ready but not sure if I can push them to this current PR from @gbiggs fork.

Follow here #646

@j-rivero j-rivero closed this Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants