Loading

Uli SDK

Coding Convention

4.Coding Convention

Uli SDK codes follow the conventions below:

  1. The codes are to be built using Google bazel build tool.
  2. The directory and file path names are lower case with underscore between words. For example: uli_sdk/base_utils.
  3. 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.
  4. 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”
  5. Class name is following CamelCase convention that first letters of words are always upper case. For example: TheBigBrownBag.
  6. 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.
  7. 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”
  8. 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.
  9. The full name of a class is its name space prefixed to the class name. For example: uli_sdk::utils::base_utils::Logger.
  10. 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()”.
  11. 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()”.
  12. 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_”.
  13. The names of the function arguments and local variables are in lower case and underscore “_” between words. For example: “double cycle_interval”.
  14. The enum type names begin with an “e”. For example: “eStateID”.
  15. The elements of an enum type are in all upper case with underscore “_” between words. For example: “STAND_BY”.