Stable version of the xDot library for mbed 5. This version of the library is suitable for deployment scenarios.

Dependents:   Dot-Examples XDOT-Devicewise Dot-Examples-delujoc Dot-Examples_receive ... more

Fork of libxDot-dev-mbed5-deprecated by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Utils.h Source File

Utils.h

00001 #ifndef UTILS_H
00002 #define UTILS_H
00003 
00004 #include <string>
00005 
00006 //Defines a max function that can be used.
00007 inline int mts_max(int a, int b) { return a > b ? a : b; }
00008 
00009 //Defines a min function that can be used.
00010 inline int mts_min(int a, int b) { return a < b ? a : b; }
00011 
00012 ///An enumeration for relational operators
00013 enum RelationalOperator {
00014     GREATER, LESS, EQUAL, GREATER_EQUAL, LESS_EQUAL
00015 };
00016 
00017 /** A static method for getting a string representation for the RelationalOperator
00018 * enumeration.
00019 *
00020 * @param relationalOperator a RelationalOperator enumeration.
00021 * @returns the enumeration name as a string.
00022 */
00023 static inline std::string getRelationalOperatorNames(RelationalOperator relationalOperator)
00024 {
00025     switch(relationalOperator) {
00026         case GREATER:
00027             return "GREATER";
00028         case LESS:
00029             return "LESS";
00030         case EQUAL:
00031             return "EQUAL";
00032         case GREATER_EQUAL:
00033             return "GREATER_EQUAL";
00034         case LESS_EQUAL:
00035             return "LESS_EQUAL";
00036         default:
00037             return "UNKNOWN ENUM";
00038     }
00039 }
00040 
00041 #endif