Main MRPT website > C++ reference
MRPT logo

mrpt::utils Namespace Reference

Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL. More...

Namespaces

namespace  metaprogramming
 

A set of utility objects for metaprogramming with STL algorithms.


namespace  net
 

A set of useful routines for networking.


Classes

struct  TTypeName< mrpt::math::CArrayNumeric< T, N > >
struct  TTypeName< mrpt::math::CArrayDouble< N > >
struct  TTypeName< mrpt::math::CArrayFloat< N > >
struct  TTypeName< mrpt::math::CMatrixFixedNumeric< T, N, M > >
struct  TTypeName< mrpt::math::CMatrixTemplateNumeric< T > >
class  bimap
 A bidirectional version of std::map, declared as bimap<KEY,VALUE> and which actually contains two std::map's, one for keys and another for values. More...
class  CCanvas
 This virtual class defines the interface of any object accepting drawing primitives on it. More...
class  CClientTCPSocket
 A TCP socket that can be connected to a TCP server, implementing MRPT's CStream interface for passing objects as well as generic read/write methods. More...
class  CConfigFile
 This class allows loading and storing values and vectors of different types from ".ini" files easily. More...
class  CConfigFileBase
 This class allows loading and storing values and vectors of different types from a configuration text, which can be implemented as a ".ini" file, a memory-stored string, etc. More...
class  CConfigFileMemory
 This class implements a config file-like interface over a memory-stored string list. More...
class  CConsoleRedirector
 By creating an object of this class, all the output to std::cout (and std::cerr) will be redirected to a text file, and optionally also shown on the console. More...
class  CDebugOutputCapable
 This base class provides a common printf-like method to send debug information to std::cout, with the purpose of allowing its redirection to other streams if desired. More...
class  CDynamicGrid
 A 2D grid of dynamic size which stores any kind of data at each cell. More...
class  CEnhancedMetaFile
 This class represents a Windows Enhanced Meta File (EMF) for generating and saving graphics. More...
class  CFileGZInputStream
 Transparently opens a compressed "gz" file and reads uncompressed data from it. More...
class  CFileInputStream
 This CStream derived class allow using a file as a read-only, binary stream. More...
class  CFileOutputStream
 This CStream derived class allow using a file as a write-only, binary stream. More...
class  CFileStream
 This CStream derived class allow using a file as a read/write binary stream, creating it if the file didn't exist. More...
class  CImage
 A class for storing images as grayscale or RGB bitmaps. More...
class  CImageFloat
 In this class a grayscale image can be stored with float-type pixels. More...
class  circular_buffer
 A circular buffer of fixed size (defined at construction-time), implemented with a std::vector as the underlying storage. More...
class  CListOfClasses
 A list (actually based on a std::set) of MRPT classes, capable of keeping any class registered by the mechanism of CSerializable classes. More...
class  CLoadableOptions
 This is a virtual base class for sets of options than can be loaded from and/or saved to configuration plain-text files. More...
class  CLog
 A decorator of CStringList special for keeping logs. More...
class  CMappedImage
 This class encapsulates a MRPT Image and allows the sampling of individual pixels with sub-pixel accuracy and with a change of coordinates (eg, meters). More...
class  CMemoryChunk
 A memory buffer (implements CStream) which can be itself serialized. More...
class  CMemoryStream
 This CStream derived class allow using a memory buffer as a CStream. More...
class  CMessage
 A class that contain generic messages, that can be sent and received from a "CClientTCPSocket" object. More...
struct  TPropertyValueIDTriplet
 Internal triplet for each property in utils::CMHPropertiesValuesList. More...
class  CMHPropertiesValuesList
 An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable object (Multi-hypotheses version). More...
class  CObjectPtr
 A smart pointer to a CObject object. More...
struct  TRuntimeClassId
 A structure that holds runtime class type information. More...
struct  CLASSINIT
 Auxiliary structure used for CObject-based RTTI. More...
class  CObject
 The virtual base class of all MRPT classes with a unified RTTI system. More...
class  CObservable
 Inherit from this class for those objects capable of being observed by a CObserver class. More...
class  CObserver
 Inherit from this class to get notified about events from any CObservable object after subscribing to it. More...
class  CProbabilityDensityFunction
 A generic template for probability density distributions (PDFs). More...
class  CPropertiesValuesList
 An arbitrary list of "annotations", or named attributes, each being an instance of any CSerializable object. More...
class  CReferencedMemBlock
 Represents a memory block (via "void*") that can be shared between several objects through copy operator (=). More...
class  CRobotSimulator
 This class can be used to simulate the kinematics and dynamics of a differential driven planar mobile robot, including odometry errors and dynamics limitations. More...
class  CSerializable
 The virtual base class which provides a unified interface for all persistent objects in MRPT. More...
struct  TTypeName
 A template to obtain the type of its argument as a string at compile time. More...
struct  TTypeName< std::pair< T1, T2 > >
class  CServerTCPSocket
 A TCP socket that can be wait for client connections to enter. More...
class  CSimpleDatabaseTable
 This class implements the tables of databases. More...
class  CSimpleDatabase
 This class impements a very simple database system. More...
class  CStartUpClassesRegister
 A helper class that automatically register at start up a custom function to register all the CObject-derived classes in a given MRPT library or user application. More...
class  CStdOutStream
 This CStdOutStream derived class allow printing to standard out, normally the console text output. More...
class  CStream
 This base class is used to provide a unified interface to files,memory buffers,..Please see the derived classes. More...
class  CStringList
 A class for storing a list of text lines. More...
class  CThreadSafeQueue
 A thread-safe template queue for object passing between threads, with objects being passed being "T*". More...
class  CTicTac
 This class implements a high-performance stopwatch. More...
class  CTimeLogger
 A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X), among other stats. More...
class  CTypeSelector
 This class represents a std::string derived class which is also CSerializable. More...
class  CUncopiable
 The base class of classes that cannot be copied: compile-time errors will be issued on any copy operation. More...
class  CMRPTException
 The base for MRPT-especific exceptions. More...
class  CExceptionExternalImageNotFound
 Used in mrpt::utils::CImage. More...
class  CExceptionEOF
 Used in mrpt::utils::CStream. More...
class  list_searchable
 This class implements a STL container with features of both, a std::set and a std::list. More...
class  mrptEvent
 The basic event type for the observer-observable pattern in MRPT. More...
class  mrptEventOnDestroy
 An event sent by any CObservable object (automatically) just before being destroyed and telling its observers to unsubscribe. More...
struct  safe_ptr_basic
 A wrapper class for pointers that can be safely copied with "=" operator without problems. More...
struct  safe_ptr
 A wrapper class for pointers that can be safely copied with "=" operator without problems. More...
struct  non_copiable_ptr_basic
 A wrapper class for pointers that can NOT be copied with "=" operator, raising an exception at runtime if a copy is attempted. More...
struct  non_copiable_ptr
 A wrapper class for pointers that can NOT be copied with "=" operator, raising an exception at runtime if a copy is attempted. More...
struct  copiable_NULL_ptr_basic
 A wrapper class for pointers that, if copied with the "=" operator, should be set to NULL in the copy. More...
struct  copiable_NULL_ptr
 A wrapper class for pointers that, if copied with the "=" operator, should be set to NULL in the new copy. More...
struct  ci_less
 A case-insensitive comparator struct for usage within STL containers, eg: map<string,string,ci_less>. More...
class  TCamera
 Structure to hold the parameters of a pinhole camera model. More...
struct  TMatchingPair
 A structure for holding correspondences between two sets of points or points-like entities in 2D or 3D. More...
class  TMatchingPairList
 A list of TMatchingPair. More...
struct  TColor
 A RGB color - 8bit. More...
struct  TColorf
 A RGB color - floats in the range [0,1]. More...
struct  TPixelCoordf
 A pair (x,y) of pixel coordinates (subpixel resolution). More...
struct  TPixelCoord
 A pair (x,y) of pixel coordinates (integer resolution). More...
struct  TParameters
 For usage when passing a dynamic number of (numeric) arguments to a function, by name. More...
struct  CProfilerProxy

Typedefs

typedef CCanvas CMRPTCanvas
 Deprecated name.
typedef std::ios_base::openmode TFileOpenModes
 File open modes are used in CFileStream Posible values are:

  • fomRead
  • fomWrite (creates the file if it didn't exist, otherwise truncates it).

typedef CImage CMRPTImage
 Deprecated name.
typedef CImageFloat CMRPTImageFloat
 Deprecated name.
typedef CThreadSafeQueue
< CMessage
CMessageQueue
 A thread-safe class for message passing between threads.
typedef safe_ptr< TRuntimeClassIdTRuntimeClassIdPtr
 A wrapper class for a "TRuntimeClassId *", well-defined with respect to copy operators and constructors.
typedef safe_ptr_basic< void > void_ptr
typedef non_copiable_ptr_basic
< void > 
void_ptr_noncopy
typedef TMatchingPairTMatchingPairPtr
typedef void(* TFunctor_noRet_1inputs )(const void *)
 A generic functor type for functions accepting 1 input arguments and returning nothing.
typedef void(* TFunctor_noRet_2inputs )(const void *, const void *)
 A generic functor type for functions accepting 2 input arguments and returning nothing.
typedef void(* TFunctor_noRet_3inputs )(const void *, const void *, const void *)
 A generic functor type for functions accepting 3 input arguments and returning nothing.
typedef double(* TFunctor_retDouble_1inputs )(const void *)
 A generic functor type for functions accepting 1 input arguments and returning a double value.
typedef double(* TFunctor_retDouble_2inputs )(const void *, const void *)
 A generic functor type for functions accepting 2 input arguments and returning a double value.
typedef double(* TFunctor_retDouble_3inputs )(const void *, const void *, const void *)
 A generic functor type for functions accepting 3 input arguments and returning a double value.
typedef void(* TFunctor_retVecDbl_inpVecDbl )(const vector_double &in, vector_double &out)
 A generic functor type for functions accepting 1 vector and returning 1 vector.
typedef void(* TFunctor_retVecFlt_inpVecFlt )(const vector_float &in, vector_float &out)
 A generic functor type for functions accepting 1 vector and returning 1 vector.
typedef void(* TFunctor_retVecInt_inpVecInt )(const vector_int &in, vector_int &out)
 A generic functor type for functions accepting 1 vector and returning 1 vector.
typedef void(* TFunctor_retVecDbl_inp2VecDbl )(const vector_double &x, const vector_double &y, vector_double &out)
 A generic functor type for functions accepting 2 vectors and returning 1 vector.
typedef void(* TFunctor_retVecFlt_inp2VecFlt )(const vector_float &x, const vector_float &y, vector_float &out)
 A generic functor type for functions accepting 2 vectors and returning 1 vector.
typedef void(* TFunctor_retVecInt_inp2VecInt )(const vector_int &x, const vector_int &y, vector_int &out)
 A generic functor type for functions accepting 2 vectors and returning 1 vector.
typedef double(* TFunctor_retDbl_inp1VecDbl )(const vector_double &in1)
 A generic functor type for functions accepting 1 vector and returning 1 double.
typedef double(* TFunctor_retDbl_inp2VecDbl )(const vector_double &in1, const vector_double &in2)
 A generic functor type for functions accepting 2 vectors and returning 1 double.
typedef double(* TFunctor_retDbl_inp3VecDbl )(const vector_double &in1, const vector_double &in2, const vector_double &in3)
 A generic functor type for functions accepting 3 vectors and returning 1 double.
typedef unsigned long POINTER_TYPE
 For performing type casting from a pointer to its numeric value.
typedef TPixelCoord TImageSize
 A type for image sizes.

Enumerations

enum  TInterpolationMethod { IMG_INTERP_NN = 0, IMG_INTERP_LINEAR = 1, IMG_INTERP_CUBIC = 2, IMG_INTERP_AREA = 3 }
 

Interpolation methods for images.

More...
enum  TColormap { cmGRAYSCALE = 0, cmJET }
 

Different colormaps.

More...

Functions

template<class T >
square (const T &x)
 Inline function for the square of a number.
void BASE_IMPEXP registerClass (const mrpt::utils::TRuntimeClassId *pNewClass)
 Register a class into the MRPT internal list of "CSerializable" descendents.
void BASE_IMPEXP registerClassCustomName (const char *customName, const TRuntimeClassId *pNewClass)
 Mostly for internal use within mrpt sources, to handle exceptional cases with multiple serialization names for backward compatibility (CMultiMetricMaps, CImage,.
std::vector< const
mrpt::utils::TRuntimeClassId * >
BASE_IMPEXP 
getAllRegisteredClasses ()
 Returns a list with all the classes registered in the system through mrpt::utils::registerClass.
const TRuntimeClassId BASE_IMPEXP * findRegisteredClass (const std::string &className)
 Return info about a given class by its name, or NULL if the class is not registered.
void BASE_IMPEXP hsv2rgb (float h, float s, float v, float &r, float &g, float &b)
 Transform HSV color components to RGB, all of them in the range [0,1].
void BASE_IMPEXP rgb2hsv (float r, float g, float b, float &h, float &s, float &v)
 Transform RGB color components to HSV, all of them in the range [0,1].
void BASE_IMPEXP colormap (const TColormap &color_map, const float color_index, float &r, float &g, float &b)
 Transform a float number in the range [0,1] into RGB components.
void BASE_IMPEXP jet2rgb (const float color_index, float &r, float &g, float &b)
 Computes the RGB color components (range [0,1]) for the corresponding color index in the range [0,1] using the MATLAB 'jet' colormap.
uint16_t BASE_IMPEXP compute_CRC16 (const std::vector< uint8_t > &data, const uint16_t gen_pol=0x8005)
 Computes the CRC16 checksum of a block of data.
uint16_t BASE_IMPEXP compute_CRC16 (const uint8_t *data, const size_t len, const uint16_t gen_pol=0x8005)
 Computes the CRC16 checksum of a block of data.
BASE_IMPEXP CStreamoperator<< (CStream &, const char *a)
BASE_IMPEXP CStreamoperator<< (CStream &, const std::string &str)
BASE_IMPEXP CStreamoperator<< (CStream &, const vector_int &a)
BASE_IMPEXP CStreamoperator<< (CStream &, const vector_bool &a)
CStreamoperator<< (CStream &s, const std::vector< float > &a)
CStreamoperator<< (CStream &s, const std::vector< double > &a)
CStreamoperator<< (CStream &s, const std::vector< int8_t > &a)
CStreamoperator<< (CStream &s, const std::vector< int16_t > &a)
CStreamoperator<< (CStream &s, const std::vector< int32_t > &a)
CStreamoperator<< (CStream &s, const std::vector< int64_t > &a)
CStreamoperator<< (CStream &s, const std::vector< uint8_t > &a)
CStreamoperator<< (CStream &s, const std::vector< uint16_t > &a)
CStreamoperator<< (CStream &s, const std::vector< uint32_t > &a)
CStreamoperator<< (CStream &s, const std::vector< size_t > &a)
BASE_IMPEXP CStreamoperator>> (CStream &in, char *a)
BASE_IMPEXP CStreamoperator>> (CStream &in, std::string &str)
BASE_IMPEXP CStreamoperator>> (CStream &in, vector_int &a)
BASE_IMPEXP CStreamoperator>> (CStream &in, vector_bool &a)
BASE_IMPEXP CStreamoperator<< (CStream &, const std::vector< std::string > &)
BASE_IMPEXP CStreamoperator>> (CStream &, std::vector< std::string > &)
CStreamoperator>> (CStream &s, std::vector< float > &a)
CStreamoperator>> (CStream &s, std::vector< double > &a)
CStreamoperator>> (CStream &s, std::vector< int8_t > &a)
CStreamoperator>> (CStream &s, std::vector< int16_t > &a)
CStreamoperator>> (CStream &s, std::vector< int32_t > &a)
CStreamoperator>> (CStream &s, std::vector< int64_t > &a)
CStreamoperator>> (CStream &s, std::vector< uint8_t > &a)
CStreamoperator>> (CStream &s, std::vector< uint16_t > &a)
CStreamoperator>> (CStream &s, std::vector< uint32_t > &a)
CStreamoperator>> (CStream &s, std::vector< size_t > &a)
std::string BASE_IMPEXP md5 (const std::string str)
 Computes the md5 of a block of data.
 MRPTSTL_SERIALIZABLE_SEQ_CONTAINER (std::vector) MRPTSTL_SERIALIZABLE_SEQ_CONTAINER(std
 Template method to serialize an associative STL container.
template<class T1 , class T2 >
CStreamoperator>> (CStream &in, std::pair< T1, T2 > &obj)
 Template method to deserialize a STL pair.
template<class T , class CONTAINER >
size_t find_in_vector (const T &value, const CONTAINER &vect)
 Returns the index of the value "T" in the container "vect" (std::vector,std::deque,etc), or string::npos if not found.
template<class CONTAINER >
CONTAINER::iterator erase_return_next (CONTAINER &cont, typename CONTAINER::iterator &it)
 Calls the standard "erase" method of a STL container, but also returns an iterator to the next element in the container (or end if none).
template<typename T >
std::string sprintf_vector (const char *fmt, const std::vector< T > &V)
 Generates a string for a vector in the format [A,B,C,.
template<typename T >
void printf_vector (const char *fmt, const std::vector< T > &V)
 Prints a vector in the format [A,B,C,.
bool BASE_IMPEXP operator< (const TMatchingPair &a, const TMatchingPair &b)
 A comparison operator, for sorting lists of TMatchingPair's, first order by this_idx, if equals, by other_idx.
bool BASE_IMPEXP operator== (const TMatchingPair &a, const TMatchingPair &b)
 A comparison operator.
bool BASE_IMPEXP operator== (const TMatchingPairList &a, const TMatchingPairList &b)
 A comparison operator.
int BASE_IMPEXP run_unittests (int argc, char **argv)
 Run all the unit tests in mrpt::core classes.
double DEG2RAD (const double x)
 Degrees to radians.
float DEG2RAD (const float x)
 Degrees to radians.
float DEG2RAD (const int x)
 Degrees to radians.
double RAD2DEG (const double x)
 Radians to degrees.
float RAD2DEG (const float x)
 Radians to degrees.
template<typename T >
int sign (T x)
 Returns the sign of X as "1" or "-1".
template<typename T >
int signWithZero (T x)
 Returns the sign of X as "0", "1" or "-1".
template<typename T >
int round (const T value)
 Returns the closer integer (int) to x.
template<typename T >
long round_long (const T value)
 Returns the closer integer (long) to x.
template<typename T >
int fix (T x)
 Rounds toward zero.
template<class R , class P >
R * getAs (stlplus::smart_ptr_clone< P > &o)
 Utility to get a cast'ed pointer from a smart pointer.
template<class R , class P >
const R * getAs (const stlplus::smart_ptr_clone< P > &o)
 Utility to get a cast'ed pointer from a smart pointer.
template<class T >
void reverseBytes (const T &v_in, T &v_out)
 Reverse the order of the bytes of a given type (useful for transforming btw little/big endian).
template<typename T , typename K >
void keep_min (T &var, const K test_val)
 If the second argument is below the first one, set the first argument to this lower value.
template<typename T , typename K >
void keep_max (T &var, const K test_val)
 If the second argument is above the first one, set the first argument to this higher value.
template<class T >
void delete_safe (T *&ptr)
 Calls "delete" to free an object only if the pointer is not NULL, then set the pointer to NULL.
Non-streaming serialization functions



std::string BASE_IMPEXP ObjectToString (const CSerializable *o)
 Used to pass MRPT objects into a CORBA-like object (strings).
void BASE_IMPEXP StringToObject (const std::string &str, CSerializablePtr &obj)
 Used to pass CORBA-like objects (strings) into a MRPT object.
void BASE_IMPEXP ObjectToOctetVector (const CSerializable *o, vector_byte &out_vector)
 Converts (serializes) an MRPT object into an array of bytes.
void BASE_IMPEXP OctetVectorToObject (const vector_byte &in_data, CSerializablePtr &obj)
 Converts back (de-serializes) a sequence of binary data into a MRPT object, without prior information about the object's class.
void BASE_IMPEXP ObjectToRawString (const CSerializable *o, std::string &out_str)
 Converts (serializes) an MRPT object into an array of bytes within a std::string, without codifying to avoid NULL characters.
void BASE_IMPEXP RawStringToObject (const std::string &in_str, CSerializablePtr &obj)
 Converts back (de-serializes) a sequence of binary data within a std::string into a MRPT object, without prior information about the object's class.

Variables

class BASE_IMPEXP CStream
static const TFileOpenModes fomRead = std::ios_base::in
static const TFileOpenModes fomWrite = std::ios_base::out | std::ios_base::trunc
static const TFileOpenModes fomAppend = std::ios_base::app | std::ios_base::out
class BASE_IMPEXP CObject
class BASE_IMPEXP CSerializable
struct BASE_IMPEXP CSerializablePtr

Auxiliary stuff for the global profiler used in MRPT_START / MRPT_END macros.



CTimeLogger BASE_IMPEXP global_profiler
void BASE_IMPEXP global_profiler_enter (const char *func_name) MRPT_NO_THROWS
void BASE_IMPEXP global_profiler_leave (const char *func_name) MRPT_NO_THROWS

Detailed Description

Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.


Typedef Documentation

A thread-safe class for message passing between threads.

See also:
CThreadSafeQueue

Definition at line 41 of file CMessageQueue.h.

Deprecated name.

Definition at line 334 of file CCanvas.h.

Deprecated name.

Definition at line 674 of file CImage.h.

Deprecated name.

Definition at line 200 of file CImageFloat.h.

typedef unsigned long mrpt::utils::POINTER_TYPE

For performing type casting from a pointer to its numeric value.

Definition at line 223 of file types.h.

typedef std::ios_base::openmode mrpt::utils::TFileOpenModes

File open modes are used in CFileStream Posible values are:

  • fomRead
  • fomWrite (creates the file if it didn't exist, otherwise truncates it).

  • fomAppend (creates the file if it didn't exist)

Definition at line 49 of file CFileStream.h.

typedef void(* mrpt::utils::TFunctor_noRet_1inputs)(const void *)

A generic functor type for functions accepting 1 input arguments and returning nothing.

Definition at line 198 of file types.h.

typedef void(* mrpt::utils::TFunctor_noRet_2inputs)(const void *, const void *)

A generic functor type for functions accepting 2 input arguments and returning nothing.

Definition at line 199 of file types.h.

typedef void(* mrpt::utils::TFunctor_noRet_3inputs)(const void *, const void *, const void *)

A generic functor type for functions accepting 3 input arguments and returning nothing.

Definition at line 200 of file types.h.

A generic functor type for functions accepting 1 vector and returning 1 double.

Definition at line 214 of file types.h.

typedef double(* mrpt::utils::TFunctor_retDbl_inp2VecDbl)(const vector_double &in1, const vector_double &in2)

A generic functor type for functions accepting 2 vectors and returning 1 double.

Definition at line 215 of file types.h.

typedef double(* mrpt::utils::TFunctor_retDbl_inp3VecDbl)(const vector_double &in1, const vector_double &in2, const vector_double &in3)

A generic functor type for functions accepting 3 vectors and returning 1 double.

Definition at line 216 of file types.h.

typedef double(* mrpt::utils::TFunctor_retDouble_1inputs)(const void *)

A generic functor type for functions accepting 1 input arguments and returning a double value.

Definition at line 202 of file types.h.

typedef double(* mrpt::utils::TFunctor_retDouble_2inputs)(const void *, const void *)

A generic functor type for functions accepting 2 input arguments and returning a double value.

Definition at line 203 of file types.h.

typedef double(* mrpt::utils::TFunctor_retDouble_3inputs)(const void *, const void *, const void *)

A generic functor type for functions accepting 3 input arguments and returning a double value.

Definition at line 204 of file types.h.

A generic functor type for functions accepting 2 vectors and returning 1 vector.

Definition at line 210 of file types.h.

A generic functor type for functions accepting 1 vector and returning 1 vector.

Definition at line 206 of file types.h.

A generic functor type for functions accepting 2 vectors and returning 1 vector.

Definition at line 211 of file types.h.

A generic functor type for functions accepting 1 vector and returning 1 vector.

Definition at line 207 of file types.h.

A generic functor type for functions accepting 2 vectors and returning 1 vector.

Definition at line 212 of file types.h.

A generic functor type for functions accepting 1 vector and returning 1 vector.

Definition at line 208 of file types.h.

A type for image sizes.

Definition at line 270 of file types.h.

Definition at line 66 of file TMatchingPair.h.

A wrapper class for a "TRuntimeClassId *", well-defined with respect to copy operators and constructors.

Definition at line 73 of file CObject.h.

Definition at line 219 of file safe_pointers.h.

Definition at line 220 of file safe_pointers.h.


Enumeration Type Documentation

Different colormaps.

See also:
mrpt::vision::colormap
Enumerator:
cmGRAYSCALE 
cmJET 

Definition at line 63 of file color_maps.h.

Interpolation methods for images.

Used for OpenCV related operations with images, but also with MRPT native classes.

See also:
mrpt::utils::CMappedImage, CImage::scaleImage
Enumerator:
IMG_INTERP_NN 
IMG_INTERP_LINEAR 
IMG_INTERP_CUBIC 
IMG_INTERP_AREA 

Definition at line 47 of file CImage.h.


Function Documentation

void BASE_IMPEXP mrpt::utils::colormap ( const TColormap &  color_map,
const float  color_index,
float &  r,
float &  g,
float &  b 
)

Transform a float number in the range [0,1] into RGB components.

Different colormaps are available.

uint16_t BASE_IMPEXP mrpt::utils::compute_CRC16 ( const uint8_t *  data,
const size_t  len,
const uint16_t  gen_pol = 0x8005 
)

Computes the CRC16 checksum of a block of data.

uint16_t BASE_IMPEXP mrpt::utils::compute_CRC16 ( const std::vector< uint8_t > &  data,
const uint16_t  gen_pol = 0x8005 
)

Computes the CRC16 checksum of a block of data.

float mrpt::utils::DEG2RAD ( const int  x  )  [inline]

Degrees to radians.

Definition at line 554 of file utils_defs.h.

References M_PIf.

float mrpt::utils::DEG2RAD ( const float  x  )  [inline]

Degrees to radians.

Definition at line 551 of file utils_defs.h.

References M_PIf.

double mrpt::utils::DEG2RAD ( const double  x  )  [inline]
template<class T >
void mrpt::utils::delete_safe ( T *&  ptr  )  [inline]

Calls "delete" to free an object only if the pointer is not NULL, then set the pointer to NULL.

Definition at line 661 of file utils_defs.h.

Referenced by mrpt::slam::PF_implementation< CRBPFParticleData >::PF_SLAM_implementation_replaceByNewParticleSet().

template<class CONTAINER >
CONTAINER::iterator mrpt::utils::erase_return_next ( CONTAINER &  cont,
typename CONTAINER::iterator &  it 
) [inline]

Calls the standard "erase" method of a STL container, but also returns an iterator to the next element in the container (or end if none).

Definition at line 201 of file stl_extensions.h.

template<class T , class CONTAINER >
size_t mrpt::utils::find_in_vector ( const T &  value,
const CONTAINER &  vect 
) [inline]

Returns the index of the value "T" in the container "vect" (std::vector,std::deque,etc), or string::npos if not found.

Definition at line 190 of file stl_extensions.h.

References mrpt::math::distance().

Referenced by mrpt::bayes::CKalmanFilterCapable< 7, 3, 3, 7 >::runOneKalmanIteration().

const TRuntimeClassId BASE_IMPEXP* mrpt::utils::findRegisteredClass ( const std::string &  className  ) 

Return info about a given class by its name, or NULL if the class is not registered.

See also:
registerClass, getAllRegisteredClasses
template<typename T >
int mrpt::utils::fix ( x  )  [inline]

Rounds toward zero.

Definition at line 623 of file utils_defs.h.

std::vector<const mrpt::utils::TRuntimeClassId*> BASE_IMPEXP mrpt::utils::getAllRegisteredClasses (  ) 

Returns a list with all the classes registered in the system through mrpt::utils::registerClass.

See also:
registerClass, findRegisteredClass
template<class R , class P >
const R* mrpt::utils::getAs ( const stlplus::smart_ptr_clone< P > &  o  )  [inline]

Utility to get a cast'ed pointer from a smart pointer.

Definition at line 636 of file utils_defs.h.

template<class R , class P >
R* mrpt::utils::getAs ( stlplus::smart_ptr_clone< P > &  o  )  [inline]

Utility to get a cast'ed pointer from a smart pointer.

Definition at line 632 of file utils_defs.h.

void BASE_IMPEXP mrpt::utils::global_profiler_enter ( const char *  func_name  ) 
void BASE_IMPEXP mrpt::utils::global_profiler_leave ( const char *  func_name  ) 
void BASE_IMPEXP mrpt::utils::hsv2rgb ( float  h,
float  s,
float  v,
float &  r,
float &  g,
float &  b 
)

Transform HSV color components to RGB, all of them in the range [0,1].

See also:
rgb2hsv
void BASE_IMPEXP mrpt::utils::jet2rgb ( const float  color_index,
float &  r,
float &  g,
float &  b 
)

Computes the RGB color components (range [0,1]) for the corresponding color index in the range [0,1] using the MATLAB 'jet' colormap.

See also:
colormap
template<typename T , typename K >
void mrpt::utils::keep_max ( T &  var,
const K  test_val 
) [inline]

If the second argument is above the first one, set the first argument to this higher value.

Definition at line 655 of file utils_defs.h.

template<typename T , typename K >
void mrpt::utils::keep_min ( T &  var,
const K  test_val 
) [inline]

If the second argument is below the first one, set the first argument to this lower value.

Definition at line 649 of file utils_defs.h.

std::string BASE_IMPEXP mrpt::utils::md5 ( const std::string  str  ) 

Computes the md5 of a block of data.

mrpt::utils::MRPTSTL_SERIALIZABLE_SEQ_CONTAINER ( std::vector   ) 

Template method to serialize an associative STL container.

Template method to deserialize an associative STL container Template method to serialize an associative STL container Template method to deserialize an associative STL container Template method to serialize a STL pair

Definition at line 119 of file stl_extensions.h.

References mrpt::utils::TTypeName< T >::get(), and MRPTSTL_SERIALIZABLE_SIMPLE_ASSOC_CONTAINER.

void BASE_IMPEXP mrpt::utils::ObjectToOctetVector ( const CSerializable *  o,
vector_byte &  out_vector 
)

Converts (serializes) an MRPT object into an array of bytes.

Parameters:
o The object to be serialized.
out_vector The vector which at return will contain the data. Size will be set automatically.
See also:
OctetVectorToObject, ObjectToString
void BASE_IMPEXP mrpt::utils::ObjectToRawString ( const CSerializable *  o,
std::string &  out_str 
)

Converts (serializes) an MRPT object into an array of bytes within a std::string, without codifying to avoid NULL characters.

This is therefore more efficient than ObjectToString

Parameters:
o The object to be serialized.
out_vector The string which at return will contain the data. Size will be set automatically.
See also:
RawStringToObject, ObjectToOctetVector
std::string BASE_IMPEXP mrpt::utils::ObjectToString ( const CSerializable *  o  ) 

Used to pass MRPT objects into a CORBA-like object (strings).

See doc about "Integration with BABEL".

Parameters:
o The object to be serialized.
Returns:
The string containing the binay version of object.
See also:
StringToObject, Integration with BABEL
void BASE_IMPEXP mrpt::utils::OctetVectorToObject ( const vector_byte &  in_data,
CSerializablePtr &  obj 
)

Converts back (de-serializes) a sequence of binary data into a MRPT object, without prior information about the object's class.

Parameters:
in_data The serialized input data representing the object.
obj The newly created object will be stored in this smart pointer.
Exceptions:
None On any internal exception, this function returns a NULL pointer.
See also:
ObjectToOctetVector, StringToObject
bool BASE_IMPEXP mrpt::utils::operator< ( const TMatchingPair &  a,
const TMatchingPair &  b 
)

A comparison operator, for sorting lists of TMatchingPair's, first order by this_idx, if equals, by other_idx.

BASE_IMPEXP CStream& mrpt::utils::operator<< ( CStream &  ,
const std::vector< std::string > &   
)
CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< size_t > &  a 
) [inline]

Definition at line 214 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< uint32_t > &  a 
) [inline]

Definition at line 211 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< uint16_t > &  a 
) [inline]

Definition at line 210 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< uint8_t > &  a 
) [inline]

Definition at line 209 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< int64_t > &  a 
) [inline]

Definition at line 208 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< int32_t > &  a 
) [inline]

Definition at line 207 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< int16_t > &  a 
) [inline]

Definition at line 206 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< int8_t > &  a 
) [inline]

Definition at line 205 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< double > &  a 
) [inline]

Definition at line 204 of file CStream.h.

CStream& mrpt::utils::operator<< ( CStream &  s,
const std::vector< float > &  a 
) [inline]

Definition at line 203 of file CStream.h.

BASE_IMPEXP CStream& mrpt::utils::operator<< ( CStream &  ,
const vector_bool &  a 
)
BASE_IMPEXP CStream& mrpt::utils::operator<< ( CStream &  ,
const vector_int &  a 
)
BASE_IMPEXP CStream& mrpt::utils::operator<< ( CStream &  ,
const std::string &  str 
)
BASE_IMPEXP CStream& mrpt::utils::operator<< ( CStream &  ,
const char *  a 
)
bool BASE_IMPEXP mrpt::utils::operator== ( const TMatchingPairList &  a,
const TMatchingPairList &  b 
)

A comparison operator.

bool BASE_IMPEXP mrpt::utils::operator== ( const TMatchingPair &  a,
const TMatchingPair &  b 
)

A comparison operator.

template<class T1 , class T2 >
CStream& mrpt::utils::operator>> ( CStream &  in,
std::pair< T1, T2 > &  obj 
) [inline]

Template method to deserialize a STL pair.

Definition at line 173 of file stl_extensions.h.

References mrpt::format(), mrpt::utils::TTypeName< T >::get(), and THROW_EXCEPTION.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< size_t > &  a 
) [inline]

Definition at line 244 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< uint32_t > &  a 
) [inline]

Definition at line 241 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< uint16_t > &  a 
) [inline]

Definition at line 240 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< uint8_t > &  a 
) [inline]

Definition at line 239 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< int64_t > &  a 
) [inline]

Definition at line 238 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< int32_t > &  a 
) [inline]

Definition at line 237 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< int16_t > &  a 
) [inline]

Definition at line 236 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< int8_t > &  a 
) [inline]

Definition at line 235 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< double > &  a 
) [inline]

Definition at line 234 of file CStream.h.

CStream& mrpt::utils::operator>> ( CStream &  s,
std::vector< float > &  a 
) [inline]

Definition at line 233 of file CStream.h.

BASE_IMPEXP CStream& mrpt::utils::operator>> ( CStream &  ,
std::vector< std::string > &   
)
BASE_IMPEXP CStream& mrpt::utils::operator>> ( CStream &  in,
vector_bool &  a 
)
BASE_IMPEXP CStream& mrpt::utils::operator>> ( CStream &  in,
vector_int &  a 
)
BASE_IMPEXP CStream& mrpt::utils::operator>> ( CStream &  in,
std::string &  str 
)
BASE_IMPEXP CStream& mrpt::utils::operator>> ( CStream &  in,
char *  a 
)
template<typename T >
void mrpt::utils::printf_vector ( const char *  fmt,
const std::vector< T > &  V 
) [inline]

Prints a vector in the format [A,B,C,.

..] to std::cout, and the fmt string for each vector element.

Definition at line 226 of file stl_extensions.h.

References sprintf_vector().

float mrpt::utils::RAD2DEG ( const float  x  )  [inline]

Radians to degrees.

Definition at line 560 of file utils_defs.h.

References M_PIf.

double mrpt::utils::RAD2DEG ( const double  x  )  [inline]
void BASE_IMPEXP mrpt::utils::RawStringToObject ( const std::string &  in_str,
CSerializablePtr &  obj 
)

Converts back (de-serializes) a sequence of binary data within a std::string into a MRPT object, without prior information about the object's class.

Parameters:
in_data The serialized input data representing the object.
obj The newly created object will be stored in this smart pointer.
Exceptions:
None On any internal exception, this function returns a NULL pointer.
See also:
ObjectToRawString
void BASE_IMPEXP mrpt::utils::registerClass ( const mrpt::utils::TRuntimeClassId pNewClass  ) 

Register a class into the MRPT internal list of "CSerializable" descendents.

Used internally in the macros DEFINE_SERIALIZABLE, etc...

See also:
getAllRegisteredClasses, CStartUpClassesRegister

Referenced by mrpt::utils::CLASSINIT::CLASSINIT(), and mrpt::hwdrivers::CGenericSensor::CLASSINIT_GENERIC_SENSOR::CLASSINIT_GENERIC_SENSOR().

void BASE_IMPEXP mrpt::utils::registerClassCustomName ( const char *  customName,
const TRuntimeClassId *  pNewClass 
)

Mostly for internal use within mrpt sources, to handle exceptional cases with multiple serialization names for backward compatibility (CMultiMetricMaps, CImage,.

..)

template<class T >
void mrpt::utils::reverseBytes ( const T &  v_in,
T &  v_out 
) [inline]

Reverse the order of the bytes of a given type (useful for transforming btw little/big endian).

Definition at line 640 of file utils_defs.h.

void BASE_IMPEXP mrpt::utils::rgb2hsv ( float  r,
float  g,
float  b,
float &  h,
float &  s,
float &  v 
)

Transform RGB color components to HSV, all of them in the range [0,1].

See also:
hsv2rgb
template<typename T >
int mrpt::utils::round ( const T  value  )  [inline]
template<typename T >
long mrpt::utils::round_long ( const T  value  )  [inline]

Returns the closer integer (long) to x.

Definition at line 601 of file utils_defs.h.

Referenced by mrpt::math::round_10power().

int BASE_IMPEXP mrpt::utils::run_unittests ( int  argc,
char **  argv 
)

Run all the unit tests in mrpt::core classes.

template<typename T >
int mrpt::utils::sign ( x  )  [inline]
template<typename T >
int mrpt::utils::signWithZero ( x  )  [inline]

Returns the sign of X as "0", "1" or "-1".

Definition at line 575 of file utils_defs.h.

References sign().

template<typename T >
std::string mrpt::utils::sprintf_vector ( const char *  fmt,
const std::vector< T > &  V 
) [inline]

Generates a string for a vector in the format [A,B,C,.

..] to std::cout, and the fmt string for each vector element.

Definition at line 211 of file stl_extensions.h.

References mrpt::format().

Referenced by mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute(), and printf_vector().

template<class T >
T mrpt::utils::square ( const T &  x  )  [inline]
void BASE_IMPEXP mrpt::utils::StringToObject ( const std::string &  str,
CSerializablePtr &  obj 
)

Used to pass CORBA-like objects (strings) into a MRPT object.

Parameters:
str An string generated with ObjectToString
obj A currently empty pointer, where a pointer to the newly created object will be stored.
Exceptions:
None On any internal exception, this function returns NULL.
See also:
ObjectToString, Integration with BABEL

Variable Documentation

class BASE_IMPEXP mrpt::utils::CObject

Definition at line 38 of file CObject.h.

class BASE_IMPEXP mrpt::utils::CSerializable

Definition at line 40 of file CStream.h.

struct BASE_IMPEXP mrpt::utils::CSerializablePtr

Definition at line 41 of file CStream.h.

Referenced by mrpt::utils::CMHPropertiesValuesList::getAs().

class BASE_IMPEXP mrpt::utils::CStream

Definition at line 47 of file math_frwds.h.

const TFileOpenModes mrpt::utils::fomAppend = std::ios_base::app | std::ios_base::out [static]

Definition at line 53 of file CFileStream.h.

const TFileOpenModes mrpt::utils::fomRead = std::ios_base::in [static]

Definition at line 51 of file CFileStream.h.

const TFileOpenModes mrpt::utils::fomWrite = std::ios_base::out | std::ios_base::trunc [static]

Definition at line 52 of file CFileStream.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010