RosCpp.java
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2008, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 
00035 // author: Jason Wolfe
00036 
00037 
00038 package ros.roscpp;
00039 
00040 import java.util.Map;
00041 import java.util.concurrent.ExecutionException;
00042 
00043 import ros.NodeHandle;
00044 import ros.Publisher;
00045 import ros.Ros;
00046 import ros.RosException;
00047 import ros.ServiceClient;
00048 import ros.ServiceServer;
00049 import ros.Subscriber;
00050 import ros.Topic;
00051 import ros.communication.Time;
00052 
00053 public class RosCpp extends Ros {
00054     private static class SingletonHolder { 
00055         private static final RosCpp instance = new RosCpp();
00056     }
00057     
00058     private boolean isInitialized;
00059     
00060     private RosCpp() {}
00061     
00062         public static RosCpp getInstance() {return SingletonHolder.instance; }
00063 
00064     
00065         @Override
00066         public void init(String name, boolean noSigintHandler, boolean anonymousName, boolean noRosout, String [] args) {
00067                 if (isInitialized) throw new IllegalArgumentException("ROS has already been initialized.");
00068                 if (args == null) args = new String[0];
00069                 JNI.init(name, noSigintHandler, anonymousName, noRosout, args);
00070                 isInitialized = true;
00071         }
00072     
00073         @Override
00074   public boolean isInitialized() {
00075     return isInitialized;
00076   }
00077 
00078   @Override
00079   public boolean ok() { return JNI.rosOk(); }
00080   
00081   @Override
00082         public NodeHandle createNodeHandle(String ns, Map<String, String> remappings) {
00083                 if (!isInitialized) throw new IllegalArgumentException("ROS has not been initialized.");
00084                 return new CppNodeHandle(this, ns, remappings);
00085         }
00086 
00087         @Override
00088         public Time now() { return JNI.now(); }
00089 
00090         @Override
00091         public void spin() { JNI.spin(); }
00092 
00093         @Override
00094         public void spinOnce() { JNI.spinOnce(); }
00095         
00096         @Override
00097         public String getPackageLocation(String pkgName) {return JNI.getPackageLocation(pkgName);} 
00098         
00099         
00100         public void logDebug(String message) { JNI.logDebug(message); }
00101         public void logInfo(String message)  { JNI.logInfo(message); }
00102         public void logWarn(String message)  { JNI.logWarn(message); }
00103         public void logError(String message) { JNI.logError(message); }
00104         public void logFatal(String message) { JNI.logFatal(message); }
00105 
00106 }


rosjava_jni
Author(s): Maintained by Gheorghe Lisca (lisca@cs.uni-bremen.de) and developed by Jason Wolfe (jawolfe@willowgarage.com), Nicholas Butko (nbutko@cogsci.ucsd.edu), Lorenz Moesenlechner (moesenle@in.tum.de)
autogenerated on Sun Oct 5 2014 22:54:14