MADARA  3.2.3
Utility.inl File Reference
#include "Utility.h"
#include "SimTime.h"
#include <pthread.h>

Go to the source code of this file.

Namespaces

 madara
 Copyright (c) 2015 Carnegie Mellon University.
 
 madara::utility
 Provides utility functions and classes for common tasks and needs.
 

Macros

#define _MADARA_UTILITY_INL_
 

Functions

TimeValue madara::utility::add_seconds (const TimeValue &start, double seconds)
 Returns an offset of a time by seconds in double format. More...
 
bool madara::utility::approx_equal (double value1, double value2, double epsilon=0.0001)
 Checks two doubles for approximate equality. More...
 
MADARA_EXPORT bool madara::utility::begins_with (const std::string &input, const std::string &prefix)
 Check if input contains prefix at the beginning. More...
 
template<typename T >
madara::utility::bitmask_add (T mask, T values)
 Adds values to a bit mask. More...
 
template<typename T >
bool madara::utility::bitmask_check (T mask, T values)
 Returns true if mask contains values. More...
 
template<typename T >
madara::utility::bitmask_remove (T mask, T values)
 Removes values from a bit mask. More...
 
std::string & madara::utility::dds_topicify (std::string &input)
 Changes periods to underscores in compliance with OpenSplice needs. More...
 
bool madara::utility::endian_is_little ()
 
uint64_t madara::utility::endian_swap (uint64_t value)
 Converts a host format uint64_t into big endian. More...
 
int64_t madara::utility::endian_swap (int64_t value)
 Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian. More...
 
uint32_t madara::utility::endian_swap (uint32_t value)
 Converts a host format uint64_t into big endian. More...
 
int32_t madara::utility::endian_swap (int32_t value)
 Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian. More...
 
uint16_t madara::utility::endian_swap (uint16_t value)
 Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian. More...
 
int16_t madara::utility::endian_swap (int16_t value)
 Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian. More...
 
double madara::utility::endian_swap (double value)
 Converts a host format double precision into big endian. More...
 
MADARA_EXPORT bool madara::utility::ends_with (const std::string &input, const std::string &ending)
 Check if input contains a pattern at the end. More...
 
bool madara::utility::file_exists (const std::string &filename)
 Checks if a file exists. More...
 
unsigned int madara::utility::file_size (const std::string &filename)
 Returns the size of a file. More...
 
int64_t madara::utility::get_time (void)
 Returns a time of day in nanoseconds If simtime feature is enabled, this may be simulation time instead of real rtime. More...
 
TimeValue madara::utility::get_time_value (void)
 Returns a time of day as a chrono time value If simtime feature is enabled, this may be simulation time instead of real rtime. More...
 
template<typename T >
bool madara::utility::greater_compare (const T &left, const T &right)
 Returns true if right < left. More...
 
template<typename T >
void madara::utility::heap_sort (T *input, int size, bool(*comparator)(const T &left, const T &right)=greater_compare< T >)
 Sorts an array with heap sort. More...
 
template<typename T >
void madara::utility::heapify (T *input, int size, bool(*comparator)(const T &left, const T &right)=greater_compare< T >)
 Builds a heap out of an array of elements. More...
 
template<typename T >
bool madara::utility::less_compare (const T &left, const T &right)
 Returns true if left < right. More...
 
std::string & madara::utility::lower (std::string &input)
 Converts the string to lower. More...
 
Duration madara::utility::seconds_to_duration (double seconds)
 Returns seconds in double format as nanosecond duration. More...
 
SecondsDuration madara::utility::seconds_to_seconds_duration (double seconds)
 Returns seconds in double format as seconds duration. More...
 
TimeValue madara::utility::seconds_to_time (double seconds)
 Returns seconds in double format as nanosecond since epoch. More...
 
MADARA_EXPORT bool madara::utility::set_thread_priority (int priority=20)
 Sets the thread priority in a FIFO scheme. More...
 
template<typename T >
void madara::utility::sift_down (T *input, int start, int end, bool(*comparator)(const T &left, const T &right)=greater_compare< T >)
 Sifts elements down a heap according to a comparator. More...
 
std::string madara::utility::strip_prefix (const std::string &input, const std::string &prefix)
 Strips a prefix from an input string and returns the result. More...
 
std::string & madara::utility::upper (std::string &input)
 Converts the string to upper. More...
 

Variables

static const uint64_t madara::utility::micro_per = milli_per * 1000
 
static const uint64_t madara::utility::milli_per = 1000
 
static const uint64_t madara::utility::nano_per = micro_per * 1000
 
static const uint64_t madara::utility::simtime_min_sleep = 100 * (nano_per / milli_per)
 

Macro Definition Documentation

#define _MADARA_UTILITY_INL_

Definition at line 2 of file Utility.inl.