00001 /* 00002 * This file is part of the rc_dynamics_api package. 00003 * 00004 * Copyright (c) 2017 Roboception GmbH 00005 * All rights reserved 00006 * 00007 * Author: Christian Emmerich 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright notice, 00013 * this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 00019 * 3. Neither the name of the copyright holder nor the names of its contributors 00020 * may be used to endorse or promote products derived from this software without 00021 * specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00024 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00025 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00026 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00027 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00028 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00029 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00030 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00031 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00032 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00033 * POSSIBILITY OF SUCH DAMAGE. 00034 */ 00035 00036 #ifndef RC_DYNAMICS_API_TRAJECTORY_TIME_H 00037 #define RC_DYNAMICS_API_TRAJECTORY_TIME_H 00038 00039 namespace rc 00040 { 00056 class TrajectoryTime 00057 { 00058 public: 00065 static TrajectoryTime Absolute(unsigned long sec, unsigned long nsec); 00066 00074 static TrajectoryTime RelativeToStart(unsigned long sec = 0, unsigned long nsec = 0); 00075 00083 static TrajectoryTime RelativeToEnd(unsigned long sec = 0, unsigned long nsec = 0); 00084 00095 TrajectoryTime(long sec, long nsec, bool relative); 00096 00097 inline bool isRelative() const 00098 { 00099 return relative_; 00100 } 00101 00102 inline long getSec() const 00103 { 00104 return sec_; 00105 } 00106 00107 inline long getNsec() const 00108 { 00109 return nsec_; 00110 } 00111 00112 protected: 00113 bool relative_; 00114 long sec_, nsec_; 00115 }; 00116 } 00117 00118 #endif // RC_DYNAMICS_API_TRAJECTORY_TIME_H