martinandrovich / rb-pro5

The project combines the fields of robotic path planning, computer vision and artificial intelligence, to be implemented as algorithms with the purpose of controlling a robot within a simulated environment.
3 stars 0 forks source link

Move all custom types into modules/types/ with each type having own header #2

Closed martinandrovich closed 4 years ago

martinandrovich commented 4 years ago

Maybe have a separate directory such as modules/types/ for all custom types, such that struct lidar_t is defined in modules/types/lidar.h. A common include file could be used to include all common types, i.e. #include "module/types/common.h, instead of including all header files manually.

EDIT: Started work; populating the /modules/types/ directory. The file /modules/types/common.h will include all custom types + using defines. Furthermore, a modules/constants.h file will be added.

All classes/structs must also be made thread-safe, in accordance with #3.

martinandrovich commented 4 years ago

I propose that each type is fully implemented in its own, single .h file, something like:

#pragma once

// delcarations
class mytype_t
{
public:
    std::atomic<int> a;
    std::atomic<float> b;

private:
   void hello();
};

// definitions
inline void
mytype_t::hello()
{
    return;
}
martinandrovich commented 4 years ago

Also create a constants.h for, well, constants in the core:: namespace.