00001 /* 00002 * Copyright (c) 2013, Fraunhofer FKIE 00003 * 00004 * Authors: Bastian Gaspers 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * * Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * * Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * * Neither the name of the Fraunhofer FKIE nor the names of its 00015 * contributors may be used to endorse or promote products derived from 00016 * this software without specific prior written permission. 00017 * 00018 * This file is part of the StructureColoring ROS package. 00019 * 00020 * The StructureColoring ROS package is free software: 00021 * you can redistribute it and/or modify it under the terms of the 00022 * GNU Lesser General Public License as published by the Free 00023 * Software Foundation, either version 3 of the License, or 00024 * (at your option) any later version. 00025 * 00026 * The StructureColoring ROS package is distributed in the hope that it will be useful, 00027 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00028 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00029 * GNU Lesser General Public License for more details. 00030 * 00031 * You should have received a copy of the GNU Lesser General Public License 00032 * along with The StructureColoring ROS package. 00033 * If not, see <http://www.gnu.org/licenses/>. 00034 */ 00035 00036 #include <structureColoring/RoSeConnector/StrColRoSeService.h> 00037 00038 static RoSe::Service::Ptr service; 00039 00040 static void ctrlc(int) 00041 { 00042 if (service.ptr() != 0) service->dispose(); 00043 std::cout << "CTRL-C pressed" << std::endl; 00044 } 00045 00046 int main (int argc, char** argv) 00047 { 00048 struct sigaction sa; 00049 memset (&sa, 0, sizeof(sa)); 00050 sa.sa_handler = ctrlc; 00051 sa.sa_flags = SA_RESETHAND; 00052 sigaction (SIGINT, &sa, 0); 00053 sigaction (SIGTERM, &sa, 0); 00054 int ac=1; 00055 ros::init(ac, argv, "StructureColoring_RoSeService"); 00056 00057 try { 00058 service = RoSe::Service::create (argc, argv, StrColRoSeService::create); 00059 service->suspend(); 00060 return 0; 00061 } catch (RoSe::ConfigError& e) { 00062 std::cerr << "Configuration Error: " << e.what() << std::endl; 00063 } catch (std::exception& e) { 00064 std::cerr << "Exception: " << e.what() << std::endl; 00065 } 00066 return 1; 00067 }