Skip to content

Replace all DataNames with a CURE_ prefix #37

Description

@Elan456
  • Some of the data names in the include/data_handling/DataNames.h have name conflicts with the sensor drivers and other systems.
  • To avoid ambiguity, it would be better to add the CURE_ prefix to all their names.
  • Perhaps there is a better prefix such as CURE_DATALOG_, but I want to avoid the names getting too long.

Example

#define ACCELEROMETER_X 0
#define ACCELEROMETER_Y 1

Should be replaced with

#define CURE_ACCELEROMETER_X 0
#define CURE_ACCELEROMETER_Y 1

OR (for even less ambiguity)

#define CURE_DATA_ACCELEROMETER_X 0
#define CURE_DATA_ACCELEROMETER_Y 1

Question

Can you think a situation where it would make sense for CURE_ACCELEROMETER_X and CURE_DATA_ACCELEROMETER_X to have two different definitions? If not, then we should just use CURE_ACCELEROMETER_X.

Alternative

You could instead put the data names as an Enum Class in C++, so you automatically get the class's name as a namespace.

Example:

enum class DataName {
    AccelerometerX = 0,
    AccelerometerY = 1,
    AccelerometerZ = 2,
    GyroscopeX = 3,
    GyroscopeY = 4,
    GyroscopeZ = 5,
};

// To reference you use the :: operator

if (dataStreamID == DataNames::AccelerometerX) {
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

  • Status
    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions