libMDot form for loop/dht22 project

Dependents:   mDot_LoRa_Connect_ABPA_DHT22_sleep mDot_LoRa_Connect_ABPA FrostyBoySensor mDot_LoRa_Connect_ABPA_Lux ... more

Fork of libmDot-mbed5 by MultiTech

MTS-Lora/vendor/multitech/MTS-Utils/Utils.h

Committer:
kellybs1
Date:
2017-08-21
Revision:
63:af2fa55cbace
Parent:
16:b630e18103e5

File content as of revision 63:af2fa55cbace:

#ifndef UTILS_H
#define UTILS_H

#include <string>

//Defines a max function that can be used.
inline int mts_max(int a, int b) { return a > b ? a : b; }

//Defines a min function that can be used.
inline int mts_min(int a, int b) { return a < b ? a : b; }

///An enumeration for relational operators
enum RelationalOperator {
    GREATER, LESS, EQUAL, GREATER_EQUAL, LESS_EQUAL
};

/** A static method for getting a string representation for the RelationalOperator
* enumeration.
*
* @param relationalOperator a RelationalOperator enumeration.
* @returns the enumeration name as a string.
*/
static inline std::string getRelationalOperatorNames(RelationalOperator relationalOperator)
{
    switch(relationalOperator) {
        case GREATER:
            return "GREATER";
        case LESS:
            return "LESS";
        case EQUAL:
            return "EQUAL";
        case GREATER_EQUAL:
            return "GREATER_EQUAL";
        case LESS_EQUAL:
            return "LESS_EQUAL";
        default:
            return "UNKNOWN ENUM";
    }
}

#endif