Skip to content

Commit

Permalink
Removed overly detailed comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfjlaros committed Oct 21, 2024
1 parent ecbe3dc commit 07cf676
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 59 deletions.
26 changes: 0 additions & 26 deletions src/interface.tcc
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
#pragma once

/*
* Template library for exporting native C and C++ functions as remote
* procedure calls.
*
* For more information about (variadic) templates:
* \li http://www.drdobbs.com/cpp/extracting-function-parameter-and-return/240000586
* \li https://eli.thegreenplace.net/2014/variadic-templates-in-c/
* \li https://en.cppreference.com/w/cpp/language/parameter_pack
*/

#include "rpcCall.tcc"
#include "signature.tcc"

Expand Down Expand Up @@ -55,11 +45,6 @@ inline void describe_(Stream& io) {
*/
template <class F, class D, class... Ts>
void describe_(Stream& io, F f, D doc, Ts... args) {
/*
* The first two parameters `f` and `doc` are isolated and passed to
* `writeDescription_()`. Then a recursive call to process the remaining
* parameters is made.
*/
writeDescription_(io, f, doc);
describe_(io, args...);
}
Expand Down Expand Up @@ -90,12 +75,6 @@ inline void select_(Stream&, uint8_t, uint8_t) {}
*/
template <class F, class D, class... Ts>
void select_(Stream& io, uint8_t number, uint8_t depth, F f, D, Ts... args) {
/*
* The parameter `f` and its documentation string are isolated, discarding
* the latter. If the selected function is encountered (i.e., if `depth`
* equals `number`), function `f` is called. Otherwise, a new try is made
* recursively.
*/
if (depth == number) {
rpcCall(io, f);
return;
Expand All @@ -118,11 +97,6 @@ void select_(Stream& io, uint8_t number, uint8_t depth, F f, D, Ts... args) {
*/
template <class... Ts>
void interface(Stream& io, Ts... args) {
/*
* One byte is read into `command`, if the value equals `LIST_REQ_`, the
* list of functions is described. Otherwise, the function indexed by
* `command` is called.
*/
if (io.available()) {
uint8_t command;

Expand Down
17 changes: 0 additions & 17 deletions src/rpcCall.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
*/
template <class T, class... Ts, class... Us>
void call_(Stream& io, void (*)(), T (*f)(Ts...), Us&... args) {
/*
* All parameters have been collected since function pointer `*f_` has no
* parameter types. All values are now present in the `args` parameter
* pack.
*/
T data {f(args...)};
rpcWrite(io, &data);
}
Expand Down Expand Up @@ -83,13 +78,6 @@ void call_(
*/
template <class T, class... Ts, class F, class... Us>
void call_(Stream& io, void (*)(T, Ts...), F f, Us&... args) {
/*
* The first parameter type `T` is isolated from the function pointer. This
* type is used to instantiate the variable `data`, which is used to
* receive `sizeof(T)` bytes. This value is passed recursively to `call_()`
* function, adding it to the `args` parameter pack. The first parameter
* type `T` is removed from the function pointer in the recursive call.
*/
T data;
rpcRead(io, &data);

Expand Down Expand Up @@ -158,11 +146,6 @@ void call_(Stream& io, void (*)(T*, Ts...), F f, Us&... args) {
*/
template <class T, class... Ts>
void rpcCall(Stream& io, T (*f)(Ts...)) {
/*
* A dummy function pointer is prepared, which will be used to isolate
* parameter types. The return type of this function pointer is removed to
* avoid unneeded template expansion.
*/
void (*f_)(Ts...) {};
call_(io, f_, f);
}
Expand Down
11 changes: 0 additions & 11 deletions src/signature.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ inline void parameterTypes_(Stream&, void (*)()) {}
*/
template <class T, class... Ts>
void parameterTypes_(Stream& io, void (*)(T, Ts...)) {
/*
* The first parameter type `T` is isolated from function pointer. This
* type is used to instantiate the variable `data`, which is passed to
* `rpcTypeOf()` to encode its type. The first parameter type `T` is
* removed from the function pointer in the recursive call.
*/
T data {};
rpcWrite(io, ' ');
rpcTypeOf(io, data);
Expand Down Expand Up @@ -55,11 +49,6 @@ void parameterTypes_(Stream& io, void (*)(T&, Ts...)) {
*/
template <class T, class... Ts>
void signature(Stream& io, T (*)(Ts...)) {
/*
* A dummy function pointer is prepared, which will be used to isolate
* parameter types. The return type of this function pointer is removed to
* avoid unneeded template expansion.
*/
T data {};
rpcTypeOf(io, data);
rpcWrite(io, ':');
Expand Down
5 changes: 0 additions & 5 deletions src/types.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ inline void rpcTypeOf(Stream& io, char const*) {
rpcWrite(io, 's');
}

/*
* The `int` and `double` type sizes vary between boards, see:
* https://www.arduino.cc/reference/en/language/variables/data-types/
*/

/*! \ingroup types
* \copydoc rpcTypeOf(Stream&, bool) */
inline void rpcTypeOf(Stream& io, int) {
Expand Down

0 comments on commit 07cf676

Please sign in to comment.