/home/thomas/projects/usc/libirobot-create/_build/libirobot-create-0.1/src/irobot-create-ctl.cc File Reference

#include <sstream>
#include <string>
#include <irobot-create.hh>
#include "config.h"

Include dependency graph for irobot-create-ctl.cc:


Classes

struct  Application

Defines

#define APPLY_ON_OPCODES(Macro)
#define CASTARG_ENUM(ENUM_TYPE)
#define SEND_CMD(OPCODE, OPCODE_STRING, NARGMIN, NARGMAX, CODE)
#define STR_TO_OPCODE(OPCODE, OPCODE_STRING, NARGMIN, NARGMAX, CODE)
#define PRINT_ACTIONS(OPCODE, OPCODE_STRING, NARGMIN, NARGMAX, CODE)   std::cout << "\t" << OPCODE_STRING << std::endl
#define SENSOR_CMD(CALL)

Functions

template<typename T>
castArg (const char *)
 CASTARG_ENUM (bool)
 CASTARG_ENUM (int)
 CASTARG_ENUM (unsigned char)
int main (int argc, char **argv)

Define Documentation

#define APPLY_ON_OPCODES ( Macro   ) 

#define CASTARG_ENUM ( ENUM_TYPE   ) 

Value:

template <>                                   \
  ENUM_TYPE castArg (const char* arg)           \
  {                                             \
    std::istringstream i (arg);                 \
    int res = 0;                                \
    if (!(i >> res))                            \
      res = 0;                                  \
    return static_cast<ENUM_TYPE> (res);        \
  }

#define PRINT_ACTIONS ( OPCODE,
OPCODE_STRING,
NARGMIN,
NARGMAX,
CODE   )     std::cout << "\t" << OPCODE_STRING << std::endl

#define SEND_CMD ( OPCODE,
OPCODE_STRING,
NARGMIN,
NARGMAX,
CODE   ) 

Value:

case OPCODE:                                                     \
  if (argc < (NARGMIN) + 2)                                        \
    usage ();                                                      \
  if (argc > (NARGMAX) + 2)                                        \
    usage ();                                                      \
  CODE;                                                            \
  break

#define SENSOR_CMD ( CALL   ) 

Value:

Create::sensorPackets_t sensors;                                      \
  for (int i = 2; i < argc; ++i)                                        \
    sensors.push_back (castArg<Create::SensorPacket> (argv[i]));        \
  CALL

#define STR_TO_OPCODE ( OPCODE,
OPCODE_STRING,
NARGMIN,
NARGMAX,
CODE   ) 

Value:

if (m == OPCODE_STRING)                                               \
    return static_cast<Create::Opcode> (OPCODE)


Function Documentation

template<typename T>
T castArg ( const char *   )  [inline]

00146 {
00147   std::cerr << "Invalid conversion." << std::endl;
00148   exit (-1);
00149 }

CASTARG_ENUM ( unsigned  char  ) 

CASTARG_ENUM ( int   ) 

CASTARG_ENUM ( bool   ) 

int main ( int  argc,
char **  argv 
)

00451 {
00452   std::stringstream stream;
00453   Application app (argc, argv, stream);
00454   std::cout << stream.str ();
00455 }


Generated on Thu Aug 28 13:54:20 2008 for iRobot Create library by  doxygen 1.5.4