Project: engagement_recognition License: BSD Dependencies:
Used by:
None |
engagement_recognition/src/recognition/response/ap_service_response.cppGo to the documentation of this file.00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2010, Worcester Polytechnic Institute 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 Worcester Polytechnic Institute. nor the names 00018 * of its contributors may be used to endorse or promote products 00019 * derived 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 // @author Brett Ponsler (bponsler (at) wpi (dot) edu) 00035 #include "ap_service_response.h" 00036 00037 APServiceResponse::APServiceResponse() 00038 : ServiceResponse() 00039 { 00040 this->action_ = Action::noAction(); 00041 } 00042 00043 APServiceResponse::APServiceResponse(Action action) 00044 : ServiceResponse(ServiceResponse::SUCCEEDED) 00045 { 00046 this->action_ = action; 00047 } 00048 00049 APServiceResponse APServiceResponse::cycle() 00050 { 00051 // Return the no action, cycle type 00052 return APServiceResponse(); 00053 } 00054 00055 APServiceResponse APServiceResponse::failed() 00056 { 00057 // Create the no action type, and set it to fail 00058 APServiceResponse resp = APServiceResponse(); 00059 resp.set(ServiceResponse::failed()); 00060 00061 // Return the type 00062 return resp; 00063 } 00064 00065 std::string APServiceResponse::getData() 00066 { 00067 return this->action_.getData(); 00068 } 00069 00070 APServiceResponse APServiceResponse::noAction() 00071 { 00072 return APServiceResponse(Action::noAction()); 00073 } 00074 00075 APServiceResponse APServiceResponse::nod() 00076 { 00077 return APServiceResponse(Action::nod()); 00078 } 00079 00080 APServiceResponse APServiceResponse::shake() 00081 { 00082 return APServiceResponse(Action::shake()); 00083 } 00084 00085 APServiceResponse APServiceResponse::speech() 00086 { 00087 return APServiceResponse(Action::speech()); 00088 } 00089 00090 APServiceResponse APServiceResponse::point() 00091 { 00092 return APServiceResponse(Action::point()); 00093 } 00094 00095 APServiceResponse APServiceResponse::look() 00096 { 00097 return APServiceResponse(Action::look()); 00098 } 00099 00100 APServiceResponse APServiceResponse::extendedAction() 00101 { 00102 return APServiceResponse(Action::extendedAction()); 00103 } 00104 00105 void APServiceResponse::setData(std::string data) 00106 { 00107 this->action_.setData(data); 00108 } 00109 00110 void APServiceResponse::setCycle() 00111 { 00112 this->status_ = ServiceResponse::CYCLE; 00113 this->action_ = Action::noAction(); 00114 } 00115 00116 void APServiceResponse::setFailed() 00117 { 00118 this->status_ = ServiceResponse::FAILED; 00119 this->action_ = Action::noAction(); 00120 } 00121 00122 void APServiceResponse::setNoAction() 00123 { 00124 this->status_ = ServiceResponse::SUCCEEDED; 00125 this->action_ = Action::noAction(); 00126 } 00127 00128 void APServiceResponse::setNod() 00129 { 00130 this->status_ = ServiceResponse::SUCCEEDED; 00131 this->action_ = Action::nod(); 00132 } 00133 00134 void APServiceResponse::setShake() 00135 { 00136 this->status_ = ServiceResponse::SUCCEEDED; 00137 this->action_ = Action::shake(); 00138 } 00139 00140 void APServiceResponse::setSpeech(std::string data) 00141 { 00142 this->status_ = ServiceResponse::SUCCEEDED; 00143 this->action_ = Action::speech(data); 00144 } 00145 00146 void APServiceResponse::setPoint(std::string data) 00147 { 00148 this->status_ = ServiceResponse::SUCCEEDED; 00149 this->action_ = Action::point(data); 00150 } 00151 00152 void APServiceResponse::setLook(std::string data) 00153 { 00154 this->status_ = ServiceResponse::SUCCEEDED; 00155 this->action_ = Action::look(data); 00156 } 00157 00158 void APServiceResponse::setExtendedAction(std::string data) 00159 { 00160 this->status_ = ServiceResponse::SUCCEEDED; 00161 this->action_ = Action::extendedAction(data); 00162 } 00163 00164 bool APServiceResponse::isNoAction() 00165 { 00166 return this->action_.isNoAction(); 00167 } 00168 00169 bool APServiceResponse::isNod() 00170 { 00171 return this->action_.isNod(); 00172 } 00173 00174 bool APServiceResponse::isShake() 00175 { 00176 return this->action_.isShake(); 00177 } 00178 00179 bool APServiceResponse::isSpeech() 00180 { 00181 return this->action_.isSpeech(); 00182 } 00183 00184 bool APServiceResponse::isPoint() 00185 { 00186 return this->action_.isPoint(); 00187 } 00188 00189 bool APServiceResponse::isLook() 00190 { 00191 return this->action_.isLook(); 00192 } 00193 00194 bool APServiceResponse::isExtendedAction() 00195 { 00196 return this->action_.isExtendedAction(); 00197 } |