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

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> | |
| T | castArg (const char *) |
| CASTARG_ENUM (bool) | |
| CASTARG_ENUM (int) | |
| CASTARG_ENUM (unsigned char) | |
| int | main (int argc, char **argv) |
| #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)
| T castArg | ( | const char * | ) | [inline] |
| 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 }
1.5.4