Coding style and naming conventions
Code style and Checks before raising PRs
Module Properties
- No hardcoding
- Dynamic support to change properties
Style
- Core logic should be in Detail class
- No declarations in .h file - only base class methods overriding is allowed
- Use mCamelCase
- Format the code using ctrl+shift+I
- No unused variables, unused header files
- No Commented Codes
- If any Detail class variable has to be accessed in module, don't use set, get - make the variables public
- No memcopy unless it is unavoidable
- Initialize everything in init
- Destroy everything in term
- Use object pool for temporary variables
Unit Tests
- Test for each supported color format
- If output is image - use saveorcompare
- Always use FileReader as input for transform modules
- Use step rather than pipeline.run_all_threaded()
- Test for dynamic change of props and validation
- Use external sink module wherever applicable
- Unit test should not have sleep
Naming conventions
Name modules classes as follows
[Name][Src/Xform/Sink]{_OptionalPlatform}
e.g.
- AudioRecordSrc
- AffineXform_NPPI
- etc.
A platform variant should be created in very rare scenario. As far as possible we should try to
- Consolidate all platform variants into a single module
- Offer a common interface
- Learn the users intentions via input/output pins or have explicit option about which variant to use.
Name modules properties as follows
Module properties should be named exactly like this: \<ModuleName>Props. This will be used in automation very soon
Step to Contribute to ApraPipes :- External Contributors
- Make your own fork
- Create a new branch for every feature/module
- Fetch from main repo and merge to new branch
- Push new branch to your fork
- Make new pull request (PR) from the branch
Step to Contribute to ApraPipes :- Apra Labs Contributors
- Contact code owners to be added as a collaborator
- Pick up an issue / create an issue and assign it to your self
- Create a branch from main repo and push your changes in the branch
- Create pull request from the new branch and assign a reviewer.
- Update branch from main whenever needed
- After all checks pass feel free to merge your changes to main
Doxygen Documentation Guidelines
-
Doxygen Official Documentation
-
Commenting Basics:
- Comment should be written using the Doxygen style.
- Use descriptive and meaningful comments to explain the purpose of functions, classes, variables, and complex logic.
- Comments should be concise but informative, providing enough context for someone unfamiliar with the code to understand its functionality.
- If any generative AI is used to create the comments, use it as a base to setup and then edit / clean up. Usually gen AI comments are local / superficial, so you will have to make sure the idea is described clearly.
-
Make use of Doxygen tags for all functions and classes. This should not be skipped.
-
Doxygen Tags:
- Doxygen uses special tags to recognize comments and generate documentation. Some common tags include:
/** ... */ for documenting functions, classes, and variables.
@brief for providing a brief description of the item being documented.
@param to describe function parameters.
@return to describe the return value of a function.
@code ... @endcode to include code snippets within comments.
@note for additional notes or remarks.
-
Begin each function with a Doxygen-style comment block. For example -
```cpp
/**
- @brief Calculate the sum of two numbers.
- @param num1 First number.
- @param num2 Second number.
- @return Sum of num1 and num2.
*/
int add(int num1, int num2);
-
Documenting Variables:
- Use Doxygen-style comments to document important variables, especially if their purpose is not immediately clear from their name or context.
- Describe the variable's purpose, data type, and any relevant details.
```cpp
/// Radius of the circle.
double radius;