SDHLibrary-CPP 0.0.2.10 C++ access library for SCHUNK Dextrous Hand SDH

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Classes | Namespaces

# sdh/util.h File Reference

Interface of auxilliary utility functions for SDHLibrary-CPP. More...

`#include <math.h>`
`#include <vector>`
`#include <algorithm>`
`#include <iostream>`
`#include "sdhlibrary_settings.h"`
`#include "simplevector.h"`
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

## Classes
class | SDH::cSetValueTemporarily< T >
| helper class to set value on construction and reset to previous value on destruction. (RAII-idiom) More...
## Namespaces
namespace | SDH
## Auxiliary functions
#define | DEFINE_TO_CASECOMMAND(_c) case _c: return (#_c)
#define | DEFINE_TO_CASECOMMAND_MSG(_c,...) case _c: return (#_c ": " __VA_ARGS__)
bool | SDH::InIndex (int v, int max)
bool | SDH::InRange (double v, double min, double max)
bool | SDH::InRange (int n, double const *v, double const *min, double const *max)
double | SDH::ToRange (double v, double min, double max)
void | SDH::ToRange (int n, double *v, double const *min, double const *max)
void | SDH::ToRange (std::vector< double > &v, std::vector< double > const &min, std::vector< double > const &max)
void | SDH::ToRange (cSimpleVector &v, std::vector< double > const &min, std::vector< double > const &max)
double | SDH::Approx (double a, double b, double eps)
bool | SDH::Approx (int n, double *a, double *b, double *eps)
double | SDH::DegToRad (double d)
double | SDH::RadToDeg (double r)
void | SDH::SleepSec (double t)
template<typename Function , typename Tp >
void | SDH::apply (Function f, Tp &sequence)
template<typename Function , typename InputIterator >
Function | SDH::apply (Function f, InputIterator first, InputIterator last)
template<typename Function , typename Tp >
Tp | SDH::map (Function f, Tp sequence)
template<typename T >
std::ostream & | SDH::operator<< (std::ostream &stream, std::vector< T > const &v)
int | SDH::CompareReleases (char const *rev1, char const *rev2)
| compare release strings

## Detailed Description

Interface of auxilliary utility functions for SDHLibrary-CPP.

## General file information

Author:
  Dirk Osswald

Date:
  2007-02-19

## Copyright

- Copyright (c) 2007 SCHUNK GmbH & Co. KG

## Define Documentation

#define DEFINE_TO_CASECOMMAND | ( |  | _c | ) | case _c: return (#_c)

Just a macro for the very lazy programmer to convert an enum or a DEFINE macro into a case command that returns the name of the macro as string.

Usage:

     char const* eSomeEnumType_ToString( eSomeEnumType rc )
     {
       switch (rc)
       {
       DEFINE_TO_CASECOMMAND( AN_ENUM );
       DEFINE_TO_CASECOMMAND( AN_OTHER_ENUM );
       ...
       default:               return "unknown return code";
       }
     }

Remarks:
  You must use the enum or macro directly (not a variable with that value) since CPP-stringification is used.

See also DEFINE_TO_CASECOMMAND_MSG

#define DEFINE_TO_CASECOMMAND_MSG | ( |  | _c,
|  |  | ...
| ) |  | case _c: return (#_c ": " __VA_ARGS__)

Just a macro for the very lazy programmer to convert an enum or a DEFINE macro and a message into a case command that returns the name of the macro and the message as string.

Usage:

     char const* eSomeEnumType_ToString( eSomeEnumType rc )
     {
       switch (rc)
       {
       DEFINE_TO_CASECOMMAND_MSG( AN_ENUM, "some mighty descriptive message" );
       DEFINE_TO_CASECOMMAND_MSG( AN_OTHER_ENUM, "guess what" );
       ...
       default:               return "unknown return code";
       }
     }

Remarks:
  You must use the enum or macro directly (not a variable with that value) since CPP-stringification is used.

See also DEFINE_TO_CASECOMMAND