roscs.cpp
Go to the documentation of this file.
00001 #include "ros/ros.h"
00002 #include <iostream>
00003 #include <list>
00004 #include <map>
00005 #include "ros/time.h"
00006 #include "ros/duration.h"
00007 #include "ros/console.h"
00008 #include "CsAdvertiseService.h"
00009 <?messageIncludes?>
00010 
00011 using namespace std;
00012 
00013 list<ros::ServiceClient> client;
00014 
00015 extern "C" void rosInit(char* name, int argc, char** argv, uint32_t initOptions) {
00016         ros::init(argc, argv, name,initOptions);
00017         /*cout<<"Args: "<<argc<<endl;
00018         for(int i=0; i< argc; i++) {
00019                 cout << argv[i]<<endl;
00020         }*/
00021 }
00022 extern "C" void rosShutdown() {
00023         ros::shutdown();
00024 }
00025 extern "C" bool getRosOk() {
00026         return ros::ok();
00027 }
00028 extern "C" bool checkMaster() {
00029         return ros::master::check();
00030 }
00031 
00032 extern "C" ros::NodeHandle* getService(char* name) {
00033         return new ros::NodeHandle(name);
00034 }
00035 
00036 extern "C" void destroyService(ros::NodeHandle* node) { 
00037         if(node!=NULL && node->ok()) {
00038                 node->shutdown();       
00039                 delete node;
00040         }
00041 }
00042 
00043 extern "C"  ros::ServiceClient* serviceClient(ros::NodeHandle* node, char* topic, uint64_t messageId ) {
00044         ros::ServiceClient tmp;
00045         
00046         <?cppServiceClient?>
00047         
00048         client.push_back(tmp);
00049         return &(client.back());
00050 }
00051 
00052 <?cppGetSizeOfMessage?>
00053 
00054 <?cppArray2RosMethods?>
00055 
00056 <?cppServiceHandleMethods?>
00057 
00058 extern "C" bool callservice(ros::ServiceClient* service, uint64_t messageId, int* request, char** response) {
00059         switch(messageId) {
00060                 <?cppCallServiceBody?>
00061                 default:
00062                         std::cerr << "Unknown message id in sendmsg: "<<messageId<<std::endl;
00063                         return false;
00064         }
00065 }
00066 
00067 extern "C"  void advertiseService(ros::NodeHandle* node, char* topic, uint64_t messageId, bool (*handle)(char**,char**), void (*handleFree)(char*) ) {
00068         switch(messageId) {
00069                 <?advertiseService?>
00070                 default: std::cerr<<"Unknown message id: "<< messageId << std::endl;
00071         }
00072 //      RosCs::CsAdvertiseService<beginner_tutorials::AddTwoInts,beginner_tutorials::AddTwoIntsResponse,beginner_tutorials::AddTwoIntsRequest>(handle,translate,translate2Ros).AdvertiseAndListen(node,topic);
00073 }
00074 
00075 extern "C" void freePointer(char* pointer) {
00076         free(pointer);
00077 }
00078 
00079 extern "C" bool isServiceOk(ros::NodeHandle* node) {
00080         return (node!=NULL && node->ok());
00081 }


roscs
Author(s): hendrik
autogenerated on Sat Dec 28 2013 16:51:21