4.Coding Convention
Uli SDK codes follow the conventions below:
- The codes are to be built using Google bazel build tool.
- The directory and file path names are lower case with underscore between words. For example: uli_sdk/base_utils.
- Bazel Repository is at the top level of a path. For example: “uli_sdk” is the repository of the Uli SDK. Bazel Repository requires to have WORKSPACE file. Refer to Bazel user guides: https://docs.bazel.build/versions/master/getting-started.html.
- The header file path is starting from the directory in the Repository. For example: the header file, logger.h, in utils/base_utils is used in the file:
#include “utils/base_utils/logger.h” - Class name is following CamelCase convention that first letters of words are always upper case. For example: TheBigBrownBag.
- File name of the header that declares a class is in lower case with underscore between words. For example: the_big_brown_bag.h declares the class: TheBigBrownBag.
- Include guards is the file path to the include file, including the repository name, all in upper case. For example the logger.h has the include guard “ULI_SDK_UTILS_BASE_UTILS_LOGGER_H”
- Name space of a class is the path name, including Repository, to the directory, where the header file, that declares the class, resides. For example: the class “Logger” in the logger.h in utils/base_utils/ has the name space uli_sdk::utils::base_utils.
- The full name of a class is its name space prefixed to the class name. For example: uli_sdk::utils::base_utils::Logger.
- The names of the public methods of a class are in camel style, upper case letter between words and the first letter is in upper case. For example: “SetParams()”.
- The names of the protected and private methods of a class are, same as the public method names, in camel style, upper case letter between words and the first little is in upper case, but prefixed with “_”. For example: “_ProcessIEReceiveMessage()”.
- The names of the data members of a class are in camel style, upper case letter between words with the first letter in lower case. The name is appended a “_”. For example: “cycleInterval_”.
- The names of the function arguments and local variables are in lower case and underscore “_” between words. For example: “double cycle_interval”.
- The enum type names begin with an “e”. For example: “eStateID”.
- The elements of an enum type are in all upper case with underscore “_” between words. For example: “STAND_BY”.