MADARA  3.1.8
madara::utility Namespace Reference

Provides utility functions and classes for common tasks and needs. More...

Namespaces

 java
 Provides utility functions and classes for common Java tasks and needs.
 

Classes

class  LQueue
 Defines a generic "first-in/first-out" (FIFO) Abstract Data Type (ADT) using a circular linked list. More...
 
class  LQueueConstIterator
 Implements a forward iterator for LQueue type classes. More...
 
class  LQueueIterator
 Implements a forward iterator for LQueue type classes. More...
 
class  LQueueNode
 Defines a node in the LQueue that's implemented as a circular linked list. More...
 
class  LStack
 Defines a generic "last-in/first-out" (LIFO) Abstract Data Type (ADT) using a stack that's implemented as a linked list. More...
 
class  LStackConstIterator
 Implements a forward iterator for LStack type classes. More...
 
class  LStackIterator
 Implements a forward iterator for LStack type classes. More...
 
class  LStackNode
 Defines a node in the LStack that's implemented as a linked list. More...
 
class  Refcounter
 This template class provides transparent reference counting of its template parameter T. More...
 
class  ScopedArray
 This template class provides transparent reference counting of its template parameter T. More...
 
class  ThreadSafeVector
 Manages a thread safe STL vector. More...
 

Enumerations

enum  LogLevels {
  LOG_EMERGENCY = 0, LOG_TERMINAL_ERROR = 1, LOG_NONFATAL_ERROR = 2, LOG_ERROR = 3,
  LOG_WARNING = 4, LOG_MAJOR_EVENT = 5, LOG_MINOR_EVENT = 6, LOG_EVENT_TRACE = 7,
  LOG_MAJOR_DEBUG_INFO = 8, LOG_MINOR_DEBUG_INFO = 9, LOG_DETAILED_TRACE = 10
}
 Logging levels available for MADARA library. More...
 

Functions

MADARA_Export bool approx_equal (double value1, double value2, double epsilon=0.0001)
 Checks two doubles for approximate equality. More...
 
MADARA_Export bool begins_with (const std::string &input, const std::string &prefix)
 Check if input contains prefix at the beginning. More...
 
MADARA_Export int bind_to_ephemeral_port (ACE_SOCK_Dgram &socket, std::string &host, unsigned short &port, bool increase_until_bound=true)
 Binds to an ephemeral port. More...
 
template<typename T >
bitmask_add (T mask, T values)
 Adds values to a bit mask. More...
 
template<typename T >
bool bitmask_check (T mask, T values)
 Returns true if mask contains values. More...
 
template<typename T >
bitmask_remove (T mask, T values)
 Removes values from a bit mask. More...
 
MADARA_Export std::string clean_dir_name (const std::string &target)
 Substitutes the appropriate directory delimiter, which may help with portability between operating systems. More...
 
MADARA_Export std::string & dds_topicify (std::string &input)
 Changes periods to underscores in compliance with OpenSplice needs. More...
 
MADARA_Export uint64_t endian_swap (uint64_t value)
 Converts a host format uint64_t into big endian. More...
 
MADARA_Export int64_t endian_swap (int64_t value)
 Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian. More...
 
MADARA_Export uint32_t endian_swap (uint32_t value)
 Converts a host format uint64_t into big endian. More...
 
MADARA_Export int32_t endian_swap (int32_t value)
 Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian. More...
 
MADARA_Export uint16_t endian_swap (uint16_t value)
 Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian. More...
 
MADARA_Export int16_t endian_swap (int16_t value)
 Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian. More...
 
MADARA_Export double endian_swap (double value)
 Converts a host format double precision into big endian. More...
 
MADARA_Export bool ends_with (const std::string &input, const std::string &ending)
 Check if input contains a pattern at the end. More...
 
MADARA_Export std::string expand_envs (const std::string &source)
 Expands environment variables referenced in the string. More...
 
MADARA_Export std::string extract_filename (const std::string &name)
 Extracts the file name of an absolute or relative path. More...
 
MADARA_Export std::string extract_path (const std::string &name)
 Extracts the path of a filename. More...
 
MADARA_Export bool file_exists (const std::string &filename)
 Checks if a file exists. More...
 
MADARA_Export unsigned int file_size (const std::string &filename)
 Returns the size of a file. More...
 
MADARA_Export std::string file_to_string (const std::string &filename)
 Reads a file into a string. More...
 
int get_log_level (void)
 Gets the log level. More...
 
MADARA_Export int64_t get_time (void)
 Returns a time of day in nanoseconds. More...
 
MADARA_Export uint32_t get_uint_version (void)
 Gets the MADARA version number. More...
 
char * get_var (const std::string &source, size_t cur, size_t &end)
 Helper function for madara::utility::expand_envs which retrieves an environment variable. More...
 
MADARA_Export std::string get_version (void)
 Gets the MADARA version number. More...
 
template<typename T >
bool greater_compare (const T &left, const T &right)
 Returns true if right < left. More...
 
template<typename T >
void 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 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 less_compare (const T &left, const T &right)
 Returns true if left < right. More...
 
void log (int level, const char *message)
 Logs a simple string message. More...
 
MADARA_Export std::string & lower (std::string &input)
 Converts the string to lower. More...
 
MADARA_Export int merge_hostport_identifier (std::string &key, const std::string &host, const std::string &port)
 Merges a host and port into a host:port key. More...
 
MADARA_Export int merge_hostport_identifier (std::string &key, const std::string &host, unsigned short u_port)
 Merges a host and port into a host:port key. More...
 
MADARA_Export int64_t nearest_int (double input)
 Rounds a double to the nearest integer. More...
 
MADARA_Export double rand_double (double floor=0.0, double ceiling=1.0, bool set_seed_to_time=true)
 Returns a random double between floor and ceiling. More...
 
MADARA_Export int64_t rand_int (int64_t floor=0, int64_t ceiling=RAND_MAX, bool set_seed_to_time=true)
 Returns a random integer between a floor and ceiling. More...
 
MADARA_Export int read_file (const std::string &filename, void *&buffer, size_t &size, bool add_zero_char=false)
 Reads a file into a provided void pointer. More...
 
void set_log_level (int level)
 Sets the log level. More...
 
template<typename T >
void 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...
 
MADARA_Export double sleep (double sleep_time)
 Sleeps for a certain amount of time. More...
 
MADARA_Export ACE_Time_Value sleep (const ACE_Time_Value &sleep_time)
 Sleeps for a certain amount of time. More...
 
MADARA_Export int split_hostport_identifier (const std::string &key, std::string &host, std::string &port)
 Splits a key of host:port into a corresponding host and port. More...
 
MADARA_Export std::string & string_remove (std::string &input, char unwanted)
 Strips an unwanted character. More...
 
MADARA_Export size_t string_replace (std::string &source, const std::string &old_phrase, const std::string &new_phrase, bool replace_all=true)
 Replaces an old phrase with a new phrase within a string. More...
 
MADARA_Export std::string & strip_comments (std::string &input)
 Strips all comments (single-line and multi-line). More...
 
MADARA_Export std::string & strip_extra_white_space (std::string &input)
 Strips whitespace from front and end of string and also condenses multiple whitespace into a single space. More...
 
MADARA_Export std::string strip_prefix (const std::string &input, const std::string &prefix)
 Strips a prefix from an input string and returns the result. More...
 
MADARA_Export std::string & strip_white_space (std::string &input)
 Strips all whitespace characters from a string. More...
 
MADARA_Export std::string to_string_version (uint32_t version)
 Converts a MADARA uint32_t version number to human-readable. More...
 
MADARA_Export void tokenizer (const std::string &input, const ::std::vector< std::string > &splitters,::std::vector< std::string > &tokens,::std::vector< std::string > &pivot_list)
 Splits an input string into tokens. More...
 
MADARA_Export std::string & upper (std::string &input)
 Converts the string to upper. More...
 
MADARA_Export bool wait_false (knowledge::KnowledgeBase &knowledge, const std::string &variable, const knowledge::WaitSettings &settings=knowledge::WaitSettings())
 Waits on a knowledge record to be false without needing KaRL language. More...
 
MADARA_Export bool wait_true (knowledge::KnowledgeBase &knowledge, const std::string &variable, const knowledge::WaitSettings &settings=knowledge::WaitSettings())
 Waits on a knowledge record to be true without needing KaRL language. More...
 
MADARA_Export ssize_t write_file (const std::string &filename, void *buffer, size_t size)
 Writes a file with provided contents. More...
 

Detailed Description

Provides utility functions and classes for common tasks and needs.

Enumeration Type Documentation

Logging levels available for MADARA library.

Enumerator
LOG_EMERGENCY 
LOG_TERMINAL_ERROR 
LOG_NONFATAL_ERROR 
LOG_ERROR 
LOG_WARNING 
LOG_MAJOR_EVENT 
LOG_MINOR_EVENT 
LOG_EVENT_TRACE 
LOG_MAJOR_DEBUG_INFO 
LOG_MINOR_DEBUG_INFO 
LOG_DETAILED_TRACE 

Definition at line 186 of file LogMacros.h.

Function Documentation

bool madara::utility::approx_equal ( double  value1,
double  value2,
double  epsilon = 0.0001 
)

Checks two doubles for approximate equality.

Doubles, unlike integers, are approximations of fractions. Consequently, two doubles cannot be checked for equality as easily and as portably as integers. To compare doubles for equality, use this function with an epsilon, which by default is accurate to the 10,000th (4 decimal places)

Parameters
value1the first value to compare, order does not matter
value2the second value to compare, order does not matter
epsilonthe minimum difference between two values before equality does not hold.

Definition at line 887 of file Utility.cpp.

bool madara::utility::begins_with ( const std::string &  input,
const std::string &  prefix 
)
inline

Check if input contains prefix at the beginning.

Parameters
inputstring to check for prefix
prefixstring to match
Returns
true if input begins with prefix. False otherwise.

Definition at line 7 of file Utility.inl.

int madara::utility::bind_to_ephemeral_port ( ACE_SOCK_Dgram &  socket,
std::string &  host,
unsigned short &  port,
bool  increase_until_bound = true 
)

Binds to an ephemeral port.

Bind to an ephemeral port.

Parameters
socketsocket to bind to unique ephemeral
hostthe host name of this device or computer
portstarting port to try to bind to
increase_until_boundif true, increment port until success
Returns
0 if successful bind. -1 if unsuccessful bind.

Definition at line 397 of file Utility.cpp.

template<typename T >
T madara::utility::bitmask_add ( mask,
values 
)

Adds values to a bit mask.

Parameters
maskthe target bit mask
valuesvalues to bitwise add to mask
Returns
resulting mask

Definition at line 37 of file Utility.inl.

template<typename T >
bool madara::utility::bitmask_check ( mask,
values 
)

Returns true if mask contains values.

Parameters
maskthe bit mask to check
valuesvalues to check for inclusion in mask
Returns
true if values in exist in mask, false otherwise

Definition at line 46 of file Utility.inl.

template<typename T >
T madara::utility::bitmask_remove ( mask,
values 
)

Removes values from a bit mask.

Parameters
maskthe target bit mask
valuesvalues to bitwise remove from mask
Returns
resulting mask

Definition at line 55 of file Utility.inl.

std::string madara::utility::clean_dir_name ( const std::string &  target)

Substitutes the appropriate directory delimiter, which may help with portability between operating systems.

Parameters
targetthe string to modify
Returns
a more compliant directory path string

Definition at line 560 of file Utility.cpp.

std::string & madara::utility::dds_topicify ( std::string &  input)

Changes periods to underscores in compliance with OpenSplice needs.

Convert string to lowercase.

This function will modify and return the input, so make a copy if needed.

Parameters
inputthe string to change
Returns
a reference to the modified input

Definition at line 112 of file Utility.cpp.

uint64_t madara::utility::endian_swap ( uint64_t  value)

Converts a host format uint64_t into big endian.

Can also be used to convert back into host form.

Parameters
valuethe value to convert
Returns
the converted value

Definition at line 625 of file Utility.cpp.

int64_t madara::utility::endian_swap ( int64_t  value)

Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian.

Can also be used to convert back into host form.

Parameters
valuethe value to convert
Returns
the converted value

Definition at line 644 of file Utility.cpp.

uint32_t madara::utility::endian_swap ( uint32_t  value)

Converts a host format uint64_t into big endian.

Can also be used to convert back into host form.

Parameters
valuethe value to convert
Returns
the converted value

Definition at line 664 of file Utility.cpp.

int32_t madara::utility::endian_swap ( int32_t  value)

Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian.

Can also be used to convert back into host form.

Parameters
valuethe value to convert
Returns
the converted value

Definition at line 681 of file Utility.cpp.

uint16_t madara::utility::endian_swap ( uint16_t  value)

Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian.

Can also be used to convert back into host form.

Parameters
valuethe value to convert
Returns
the converted value

Definition at line 698 of file Utility.cpp.

int16_t madara::utility::endian_swap ( int16_t  value)

Converts a host format signed madara::knowledge::KnowledgeRecord::Integer into big endian.

Can also be used to convert back into host form.

Parameters
valuethe value to convert
Returns
the converted value

Definition at line 713 of file Utility.cpp.

double madara::utility::endian_swap ( double  value)

Converts a host format double precision into big endian.

Converts a host format double into big endian.

Can also be used to convert back into host form.

Parameters
valuethe value to convert
Returns
the converted value

Definition at line 728 of file Utility.cpp.

bool madara::utility::ends_with ( const std::string &  input,
const std::string &  ending 
)
inline

Check if input contains a pattern at the end.

Parameters
inputstring to check for prefix
endingstring to match
Returns
true if input ends with ending. False otherwise.

Definition at line 21 of file Utility.inl.

std::string madara::utility::expand_envs ( const std::string &  source)

Expands environment variables referenced in the string.

Expand any environment variables in a string.

The environment variables must be specified as and not $var.

Parameters
sourcethe string to expand
Returns
a string with environment variables expanded

Definition at line 524 of file Utility.cpp.

std::string madara::utility::extract_filename ( const std::string &  name)

Extracts the file name of an absolute or relative path.

Parameters
namename of the file to extract path of
Returns
the file name

Definition at line 503 of file Utility.cpp.

std::string madara::utility::extract_path ( const std::string &  name)

Extracts the path of a filename.

Parameters
namename of the file to extract path of
Returns
the directory path of the file

Definition at line 483 of file Utility.cpp.

bool madara::utility::file_exists ( const std::string &  filename)

Checks if a file exists.

Parameters
filenamepath and name of the file to open
Returns
true if file exists. false otherwise.

Definition at line 894 of file Utility.cpp.

unsigned int madara::utility::file_size ( const std::string &  filename)

Returns the size of a file.

Parameters
filenamepath and name of the file to open
Returns
size of the file

Definition at line 908 of file Utility.cpp.

std::string madara::utility::file_to_string ( const std::string &  filename)

Reads a file into a string.

Parameters
filenamename of the file to read
Returns
contents of the file. Null string if unsuccessful.

Definition at line 450 of file Utility.cpp.

int madara::utility::get_log_level ( void  )
inline

Gets the log level.

Returns
lthe log level being used
See also
LogLevels

Definition at line 214 of file LogMacros.h.

int64_t madara::utility::get_time ( void  )

Returns a time of day in nanoseconds.

Returns
time of day in nanoseconds

Definition at line 805 of file Utility.cpp.

uint32_t madara::utility::get_uint_version ( void  )

Gets the MADARA version number.

Returns
the MADARA 4 byte version number

Definition at line 35 of file Utility.cpp.

char * madara::utility::get_var ( const std::string &  source,
size_t  cur,
size_t &  end 
)

Helper function for madara::utility::expand_envs which retrieves an environment variable.

grab an environment variable value (

Parameters
sourcethe string to expand
curthe current focus position of expand_vars
endthe end of the variable
Returns
the value of the environment variable
See also
expand_envs)

Definition at line 545 of file Utility.cpp.

std::string madara::utility::get_version ( void  )

Gets the MADARA version number.

Returns
the MADARA version number

Definition at line 25 of file Utility.cpp.

template<typename T >
bool madara::utility::greater_compare ( const T &  left,
const T &  right 
)

Returns true if right < left.

Definition at line 70 of file Utility.inl.

template<typename T >
void madara::utility::heap_sort ( T *  input,
int  size,
bool(*)(const T &left, const T &right)  comparator = greater_compare<T> 
)

Sorts an array with heap sort.

Parameters
inputthe array to heapify
sizethe size of the array
comparatora function for comparing two elements

Definition at line 118 of file Utility.inl.

template<typename T >
void madara::utility::heapify ( T *  input,
int  size,
bool(*)(const T &left, const T &right)  comparator = greater_compare<T> 
)

Builds a heap out of an array of elements.

Parameters
inputthe array to heapify
sizethe size of the array
comparatora function for comparing two elements

Definition at line 106 of file Utility.inl.

template<typename T >
bool madara::utility::less_compare ( const T &  left,
const T &  right 
)

Returns true if left < right.

Definition at line 63 of file Utility.inl.

void madara::utility::log ( int  level,
const char *  message 
)
inline

Logs a simple string message.

Parameters
levelthe level to log the message at
messagethe message to print to the log

Definition at line 224 of file LogMacros.h.

std::string & madara::utility::lower ( std::string &  input)

Converts the string to lower.

Convert string to lowercase.

This function will modify and return the input, so make a copy if needed.

Parameters
inputthe string to change
Returns
a reference to the modified input

Definition at line 127 of file Utility.cpp.

int madara::utility::merge_hostport_identifier ( std::string &  key,
const std::string &  host,
const std::string &  port 
)

Merges a host and port into a host:port key.

Parameters
keya string containing a host:port
hostthe host in the key
portthe port in the key
Returns
0 if successful (always successful right now)

Definition at line 372 of file Utility.cpp.

int madara::utility::merge_hostport_identifier ( std::string &  key,
const std::string &  host,
unsigned short  u_port 
)

Merges a host and port into a host:port key.

Parameters
keya string containing a host:port
hostthe host in the key
u_portthe port in the key
Returns
0 if successful (always successful right now)

Definition at line 386 of file Utility.cpp.

int64_t madara::utility::nearest_int ( double  input)

Rounds a double to the nearest integer.

Parameters
inputreal number to round to integer
Returns
the nearest integer to the input

Definition at line 843 of file Utility.cpp.

double madara::utility::rand_double ( double  floor = 0.0,
double  ceiling = 1.0,
bool  set_seed_to_time = true 
)

Returns a random double between floor and ceiling.

Parameters
floorlowest possible double
ceilinghighest possible double
set_seed_to_timeif true, seed the random generator with time
Returns
a double between floor and ceiling (inclusive)

Definition at line 815 of file Utility.cpp.

int64_t madara::utility::rand_int ( int64_t  floor = 0,
int64_t  ceiling = RAND_MAX,
bool  set_seed_to_time = true 
)

Returns a random integer between a floor and ceiling.

Parameters
floorlowest possible integer
ceilinghighest possible integer
set_seed_to_timeif true, seed the random generator with time
Returns
a integer between floor and ceiling (inclusive)

Definition at line 835 of file Utility.cpp.

int madara::utility::read_file ( const std::string &  filename,
void *&  buffer,
size_t &  size,
bool  add_zero_char = false 
)

Reads a file into a provided void pointer.

The void pointer will point to an allocated buffer that the user will need to delete.

Parameters
filenamethe name of the file
buffera buffer that contains the contents of the file
sizethe size of the allocated buffer (will change)
add_zero_charadd a zero char to the end of the buffer
Returns
zero if successful

Definition at line 747 of file Utility.cpp.

void madara::utility::set_log_level ( int  level)
inline

Sets the log level.

Parameters
levelthe log level to use
See also
LogLevels

Definition at line 205 of file LogMacros.h.

template<typename T >
void madara::utility::sift_down ( T *  input,
int  start,
int  end,
bool(*)(const T &left, const T &right)  comparator = greater_compare<T> 
)

Sifts elements down a heap according to a comparator.

Parameters
inputthe array to heapify
startindex to start from
endindex that signifies end of range to sift
comparatora function for comparing two elements

Definition at line 77 of file Utility.inl.

double madara::utility::sleep ( double  sleep_time)

Sleeps for a certain amount of time.

Unlike other sleep timers this will sleep for the amount of time regardless of OS interrupts

Parameters
sleep_timetime in seconds to sleep for

Definition at line 856 of file Utility.cpp.

ACE_Time_Value madara::utility::sleep ( const ACE_Time_Value &  sleep_time)

Sleeps for a certain amount of time.

Unlike other sleep timers this will sleep for the amount of time regardless of OS interrupts

Parameters
sleep_timetime to sleep for

Definition at line 873 of file Utility.cpp.

int madara::utility::split_hostport_identifier ( const std::string &  key,
std::string &  host,
std::string &  port 
)

Splits a key of host:port into a corresponding host and port.

Parameters
keya string containing a host:port
hostthe host in the key
portthe port in the key
Returns
1 if there was no ":". 0 if both host and port are set.

Definition at line 347 of file Utility.cpp.

std::string & madara::utility::string_remove ( std::string &  input,
char  unwanted 
)

Strips an unwanted character.

This function will modify and return the input, so make a copy if needed.

Parameters
inputthe string to change
unwantedthe character value to remove from input
Returns
a reference to the modified input

This function will modify and return the input, so make a copy if needed.

Definition at line 209 of file Utility.cpp.

size_t madara::utility::string_replace ( std::string &  source,
const std::string &  old_phrase,
const std::string &  new_phrase,
bool  replace_all = true 
)

Replaces an old phrase with a new phrase within a string.

Parameters
sourcesource string to change
old_phraseold phrase in the source string to replace
new_phrasenew phrase to replace the old phrase
replace_allif true, replace all instances of old phrase. if false, replace first instance of old phrase.
Returns
the number of replacements made

Definition at line 232 of file Utility.cpp.

std::string & madara::utility::strip_comments ( std::string &  input)

Strips all comments (single-line and multi-line).

This function will modify and return the input, so make a copy if needed.

Parameters
inputthe string to change
Returns
a reference to the modified input

Definition at line 259 of file Utility.cpp.

std::string & madara::utility::strip_extra_white_space ( std::string &  input)

Strips whitespace from front and end of string and also condenses multiple whitespace into a single space.

Strip whitespace from front and end of string and also condense multiple whitespace into a single space.

This function will modify and return the input, so make a copy if needed.

Parameters
inputthe string to change
Returns
a reference to the modified input

Definition at line 139 of file Utility.cpp.

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.

Convert string to uppercase.

The prefix should be at the front of the input. This does not perform checks for speed reasons.

Parameters
inputthe string to change
prefixthe start of the string
Returns
a reference to the modified input

Definition at line 92 of file Utility.cpp.

std::string & madara::utility::strip_white_space ( std::string &  input)

Strips all whitespace characters from a string.

Strip all whitespace.

This function will modify and return the input, so make a copy if needed.

Parameters
inputthe string to change
Returns
a reference to the modified input

Definition at line 181 of file Utility.cpp.

std::string madara::utility::to_string_version ( uint32_t  version)

Converts a MADARA uint32_t version number to human-readable.

Parameters
versionthe 4 byte version number
Returns
the stringified version number

Definition at line 71 of file Utility.cpp.

void madara::utility::tokenizer ( const std::string &  input,
const ::std::vector< std::string > &  splitters,
::std::vector< std::string > &  tokens,
::std::vector< std::string > &  pivot_list 
)

Splits an input string into tokens.

Split a string into tokens.

Parameters
inputa string to be split by splitters
splittersa vector of strings to look for in input
tokensthe sections in between splitters
pivot_listthe actual splitters that were found between the tokens

Definition at line 291 of file Utility.cpp.

std::string & madara::utility::upper ( std::string &  input)

Converts the string to upper.

Convert string to uppercase.

This function will modify and return the input, so make a copy if needed.

Parameters
inputthe string to change
Returns
a reference to the modified input

Definition at line 101 of file Utility.cpp.

bool madara::utility::wait_false ( knowledge::KnowledgeBase knowledge,
const std::string &  variable,
const knowledge::WaitSettings settings = knowledge::WaitSettings () 
)

Waits on a knowledge record to be false without needing KaRL language.

Parameters
knowledgethe knowledge base
variablethe variable to wait on
settingsthe Wait Settings. Only uses poll_frequency and max_wait.

Definition at line 1016 of file Utility.cpp.

bool madara::utility::wait_true ( knowledge::KnowledgeBase knowledge,
const std::string &  variable,
const knowledge::WaitSettings settings = knowledge::WaitSettings () 
)

Waits on a knowledge record to be true without needing KaRL language.

Parameters
knowledgethe knowledge base
variablethe variable to wait on
settingsthe Wait Settings. Only uses poll_frequency and max_wait.

Definition at line 922 of file Utility.cpp.

ssize_t madara::utility::write_file ( const std::string &  filename,
void *  buffer,
size_t  size 
)

Writes a file with provided contents.

Parameters
filenamethe name of the file
buffera buffer that contains the contents of the file
sizethe size of the allocated buffer
Returns
amount of bytes written (-1 if unsuccessful)

Definition at line 779 of file Utility.cpp.