Functions
UStl.h File Reference

Wrappers of STL for convenient functions. More...

#include <list>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
Include dependency graph for UStl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class V >
void uAppend (std::list< V > &list, const std::list< V > &newItems)
template<class V >
bool uContains (const std::list< V > &list, const V &value)
template<class K , class V >
bool uContains (const std::map< K, V > &map, const K &key)
template<class K , class V >
bool uContains (const std::multimap< K, V > &map, const K &key)
template<class V >
int uIndexOf (const std::vector< V > &list, const V &value)
template<class K , class V >
void uInsert (std::map< K, V > &map, const std::pair< K, V > &pair)
bool uIsDigit (const char c)
template<class V >
std::list< V >::iterator uIteratorAt (std::list< V > &list, const unsigned int &pos)
template<class V >
std::list< V >::const_iterator uIteratorAt (const std::list< V > &list, const unsigned int &pos)
template<class V >
std::set< V >::iterator uIteratorAt (std::set< V > &set, const unsigned int &pos)
template<class V >
std::set< V >::const_iterator uIteratorAt (const std::set< V > &set, const unsigned int &pos)
template<class V >
std::vector< V >::iterator uIteratorAt (std::vector< V > &v, const unsigned int &pos)
template<class V >
std::vector< V >::const_iterator uIteratorAt (const std::vector< V > &v, const unsigned int &pos)
template<class K , class V >
std::vector< K > uKeys (const std::multimap< K, V > &mm)
template<class K , class V >
std::vector< K > uKeys (const std::map< K, V > &m)
template<class K , class V >
std::list< K > uKeysList (const std::multimap< K, V > &mm)
template<class K , class V >
std::list< K > uKeysList (const std::map< K, V > &m)
template<class K , class V >
std::set< K > uKeysSet (const std::map< K, V > &m)
template<class V >
std::vector< V > uListToVector (const std::list< V > &list)
std::list< std::string > uSplit (const std::string &str, char separator= ' ')
std::list< std::string > uSplitNumChar (const std::string &str)
bool uStrContains (const std::string &string, const std::string &substring)
int uStrNumCmp (const std::string &a, const std::string &b)
template<class K , class V >
uTake (std::map< K, V > &m, const K &key, const V &defaultValue=V())
template<class K , class V >
std::list< K > uUniqueKeys (const std::multimap< K, V > &mm)
template<class K , class V >
uValue (const std::map< K, V > &m, const K &key, const V &defaultValue=V())
template<class V >
V & uValueAt (std::list< V > &list, const unsigned int &pos)
template<class V >
const V & uValueAt (const std::list< V > &list, const unsigned int &pos)
template<class K , class V >
std::vector< V > uValues (const std::multimap< K, V > &mm)
template<class K , class V >
std::list< V > uValues (const std::multimap< K, V > &mm, const K &key)
template<class K , class V >
std::vector< V > uValues (const std::map< K, V > &m)
template<class K , class V >
std::list< V > uValuesList (const std::multimap< K, V > &mm)
template<class K , class V >
std::list< V > uValuesList (const std::map< K, V > &m)
template<class V >
std::list< V > uVectorToList (const std::vector< V > &v)

Detailed Description

Wrappers of STL for convenient functions.

All functions you will find here are here for the use of STL in a more convenient way.

Definition in file UStl.h.


Function Documentation

template<class V >
void uAppend ( std::list< V > &  list,
const std::list< V > &  newItems 
) [inline]

Append a list to another list.

Parameters:
listthe list on which the other list will be appended
newItemsthe list of items to be appended

Definition at line 479 of file UStl.h.

template<class V >
bool uContains ( const std::list< V > &  list,
const V &  value 
) [inline]

Check if the list contains the specified value.

Parameters:
listthe list
valuethe value
Returns:
true if the value is found in the list, otherwise false

Definition at line 408 of file UStl.h.

template<class K , class V >
bool uContains ( const std::map< K, V > &  map,
const K &  key 
) [inline]

Check if the map contains the specified key.

Parameters:
mapthe map
keythe key
Returns:
true if the value is found in the map, otherwise false

Definition at line 420 of file UStl.h.

template<class K , class V >
bool uContains ( const std::multimap< K, V > &  map,
const K &  key 
) [inline]

Check if the multimap contains the specified key.

Parameters:
mapthe map
keythe key
Returns:
true if the value is found in the map, otherwise false

Definition at line 432 of file UStl.h.

template<class V >
int uIndexOf ( const std::vector< V > &  list,
const V &  value 
) [inline]

Get the index in the list of the specified value. S negative index is returned if the value is not found.

Parameters:
listthe list
valuethe value
Returns:
the index of the value in the list

Definition at line 492 of file UStl.h.

template<class K , class V >
void uInsert ( std::map< K, V > &  map,
const std::pair< K, V > &  pair 
) [inline]

Insert an item in the map. Contrary to the insert in the STL, if the key already exists, the value will be replaced by the new one.

Definition at line 442 of file UStl.h.

bool uIsDigit ( const char  c) [inline]

Check if a character is a digit.

Parameters:
cthe character
Returns:
if the character is a digit (if c >= '0' && c <= '9')

Definition at line 547 of file UStl.h.

template<class V >
std::list<V>::iterator uIteratorAt ( std::list< V > &  list,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::list. If the position is out of range, the result is the end iterator of the list.

Parameters:
listthe list
posthe index position in the list
Returns:
the iterator at the specified index

Definition at line 283 of file UStl.h.

template<class V >
std::list<V>::const_iterator uIteratorAt ( const std::list< V > &  list,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::list. If the position is out of range, the result is the end iterator of the list.

Parameters:
listthe list
posthe index position in the list
Returns:
the iterator at the specified index

Definition at line 301 of file UStl.h.

template<class V >
std::set<V>::iterator uIteratorAt ( std::set< V > &  set,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::set. If the position is out of range, the result is the end iterator of the set.

Parameters:
setthe set
posthe index position in the set
Returns:
the iterator at the specified index

Definition at line 319 of file UStl.h.

template<class V >
std::set<V>::const_iterator uIteratorAt ( const std::set< V > &  set,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::set. If the position is out of range, the result is the end iterator of the set.

Parameters:
setthe set
posthe index position in the set
Returns:
the iterator at the specified index

Definition at line 337 of file UStl.h.

template<class V >
std::vector<V>::iterator uIteratorAt ( std::vector< V > &  v,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::vector. If the position is out of range, the result is the end iterator of the vector.

Parameters:
vthe vector
posthe index position in the vector
Returns:
the iterator at the specified index

Definition at line 355 of file UStl.h.

template<class V >
std::vector<V>::const_iterator uIteratorAt ( const std::vector< V > &  v,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::vector. If the position is out of range, the result is the end iterator of the vector.

Parameters:
vthe vector
posthe index position in the vector
Returns:
the iterator at the specified index

Definition at line 368 of file UStl.h.

template<class K , class V >
std::vector<K> uKeys ( const std::multimap< K, V > &  mm) [inline]

Get all keys from a std::multimap.

Parameters:
mmthe multimap
Returns:
the vector which contains all keys (may contains duplicated keys)

Definition at line 66 of file UStl.h.

template<class K , class V >
std::vector<K> uKeys ( const std::map< K, V > &  m) [inline]

Get all keys from a std::map.

Parameters:
mthe map
Returns:
the vector of keys

Definition at line 151 of file UStl.h.

template<class K , class V >
std::list<K> uKeysList ( const std::multimap< K, V > &  mm) [inline]

Get all keys from a std::multimap.

Parameters:
mmthe multimap
Returns:
the list which contains all keys (may contains duplicated keys)

Definition at line 83 of file UStl.h.

template<class K , class V >
std::list<K> uKeysList ( const std::map< K, V > &  m) [inline]

Get all keys from a std::map.

Parameters:
mthe map
Returns:
the list of keys

Definition at line 169 of file UStl.h.

template<class K , class V >
std::set<K> uKeysSet ( const std::map< K, V > &  m) [inline]

Get all keys from a std::map.

Parameters:
mthe map
Returns:
the set of keys

Definition at line 185 of file UStl.h.

template<class V >
std::vector<V> uListToVector ( const std::list< V > &  list) [inline]

Convert a std::list to a std::vector.

Parameters:
listthe list
Returns:
the vector

Definition at line 457 of file UStl.h.

std::list<std::string> uSplit ( const std::string &  str,
char  separator = ' ' 
) [inline]

Split a string into multiple string around the specified separator. Example:

                std::list<std::string> v = split("Hello the world!", ' ');

The list v will contain {"Hello", "the", "world!"}

Parameters:
strthe string
separatorthe separator character
Returns:
the list of strings

Definition at line 519 of file UStl.h.

std::list<std::string> uSplitNumChar ( const std::string &  str) [inline]

Split a string into number and character strings. Example:

                std::list<std::string> v = uSplit("Hello 03 my 65 world!");

The list v will contain {"Hello ", "03", " my ", "65", " world!"}

Parameters:
strthe string
Returns:
the list of strings

Definition at line 562 of file UStl.h.

bool uStrContains ( const std::string &  string,
const std::string &  substring 
) [inline]

Check if a string contains a specified substring.

Definition at line 677 of file UStl.h.

int uStrNumCmp ( const std::string &  a,
const std::string &  b 
) [inline]

Compare two alphanumeric strings. Useful to sort filenames (human-like sorting). Example:

        std::string a = "Image9.jpg";
        std::string b = "Image10.jpg";
        int r = uStrNumCmp(a, b); // r returns -1 (a is smaller than b). In contrast, std::strcmp(a, b) would return 1.
Parameters:
athe first string
bthe second string
Returns:
-1 if a<b, 0 if a=b and 1 if a>b

Definition at line 609 of file UStl.h.

template<class K , class V >
V uTake ( std::map< K, V > &  m,
const K &  key,
const V &  defaultValue = V() 
) [inline]

Get the value of a specified key from a std::map. This will remove the value from the map;

Parameters:
mthe map
keythe key
defaultValuethe default value used if the key is not found
Returns:
the value

Definition at line 259 of file UStl.h.

template<class K , class V >
std::list<K> uUniqueKeys ( const std::multimap< K, V > &  mm) [inline]

Get unique keys from a std::multimap.

Parameters:
mmthe multimap
Returns:
the list which contains unique keys

Definition at line 45 of file UStl.h.

template<class K , class V >
V uValue ( const std::map< K, V > &  m,
const K &  key,
const V &  defaultValue = V() 
) [inline]

Get the value of a specified key from a std::map.

Parameters:
mthe map
keythe key
defaultValuethe default value used if the key is not found
Returns:
the value

Definition at line 239 of file UStl.h.

template<class V >
V& uValueAt ( std::list< V > &  list,
const unsigned int &  pos 
) [inline]

Get the value at a specified position in a std::list. If the position is out of range, the result is undefined.

Parameters:
listthe list
posthe index position in the list
Returns:
the value at the specified index

Definition at line 381 of file UStl.h.

template<class V >
const V& uValueAt ( const std::list< V > &  list,
const unsigned int &  pos 
) [inline]

Get the value at a specified position in a std::list. If the position is out of range, the result is undefined.

Parameters:
listthe list
posthe index position in the list
Returns:
the value at the specified index

Definition at line 395 of file UStl.h.

template<class K , class V >
std::vector<V> uValues ( const std::multimap< K, V > &  mm) [inline]

Get all values from a std::multimap.

Parameters:
mmthe multimap
Returns:
the vector which contains all values (contains values from duplicated keys)

Definition at line 99 of file UStl.h.

template<class K , class V >
std::list<V> uValues ( const std::multimap< K, V > &  mm,
const K &  key 
) [inline]

Get values for a specified key from a std::multimap.

Parameters:
mmthe multimap
keythe key
Returns:
the list which contains the values of the key

Definition at line 133 of file UStl.h.

template<class K , class V >
std::vector<V> uValues ( const std::map< K, V > &  m) [inline]

Get all values from a std::map.

Parameters:
mthe map
Returns:
the vector of values

Definition at line 203 of file UStl.h.

template<class K , class V >
std::list<V> uValuesList ( const std::multimap< K, V > &  mm) [inline]

Get all values from a std::multimap.

Parameters:
mmthe multimap
Returns:
the list which contains all values (contains values from duplicated keys)

Definition at line 116 of file UStl.h.

template<class K , class V >
std::list<V> uValuesList ( const std::map< K, V > &  m) [inline]

Get all values from a std::map.

Parameters:
mthe map
Returns:
the list of values

Definition at line 221 of file UStl.h.

template<class V >
std::list<V> uVectorToList ( const std::vector< V > &  v) [inline]

Convert a std::vector to a std::list.

Parameters:
vthe vector
Returns:
the list

Definition at line 468 of file UStl.h.



rtabmap
Author(s): Mathieu Labbe
autogenerated on Fri Aug 28 2015 12:51:43