ServiceReply.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright 2007, 2008, 2009, 2010, 2011 Instituto de Sistemas e Robotica, Instituto Superior Tecnico
00003 
00004 This file is part of MeRMaID.
00005 
00006 MeRMaID is free software: you can redistribute it and/or modify
00007 it under the terms of the GNU Lesser General Public License as published by
00008 the Free Software Foundation, either version 3 of the License, or
00009 (at your option) any later version.
00010 
00011 MeRMaID is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU Lesser General Public License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public License
00017 along with MeRMaID.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 
00021 
00022 /**
00023  * @Filename ServiceReply.cpp
00024  * @Description ServiceReply implementation
00025  * @Status Work in Progress
00026  * @Version $Id: ServiceReply.cpp 1 2011-03-04 18:13:18Z jreis $
00027  * @Maintainer
00028  */
00029 
00030 #include "config.h"
00031 
00032 #include "ServiceReply.hpp"
00033 
00034 #include "EntityDescriptionRepository.hpp"
00035 #include "ServiceTypeDescription.hpp"
00036 #include "ServiceInterfaceDescription.hpp"
00037 #include "ServiceInstanceDescription.hpp"
00038 
00039 
00040 #include <DataFactory.hpp>
00041 #include <Exception.hpp>
00042 #include <Service.hpp>
00043 
00044 
00045 using namespace mermaid::support::service;
00046 
00047 using mermaid::support::data::DataFactory;
00048 using mermaid::support::errorhandling::Exception;
00049 
00050 ServiceReply::ServiceReply()
00051 {
00052 };
00053 
00054 //ServiceReply::ServiceReply(std::string requesterEntityName, std::string requesterServiceName,std::string targetEntityName, std::string targetServiceName, std::string targetServiceInterfaceName, int requestId, std::string executionStatus)
00055 ServiceReply::ServiceReply (shared_ptr<ServiceRequest> originalRequest, std::string executionStatus)
00056 {
00057   requesterEntityName_ = originalRequest->getRequesterEntityName();
00058   requesterServiceName_ = originalRequest->getRequesterServiceName();
00059   targetEntityName_ = originalRequest->getTargetEntityName();
00060   targetServiceName_ = originalRequest->getTargetServiceName();
00061   targetServiceInterfaceName_ = originalRequest->getTargetServiceInterfaceName();
00062   requestId_ = originalRequest->getRequestId();
00063   executionStatus_ = executionStatus;
00064   
00065   
00066   std::string outputDataName = EntityDescriptionRepository::getInstance()->getEntityDescription (targetEntityName_)->getServiceInstanceDescription (targetServiceName_)->getServiceTypeDescriptionWithInterfaceName (targetServiceInterfaceName_)->getServiceInterfaceDescription (targetServiceInterfaceName_)->getServiceInterfaceOutputDataName();
00067   
00068   replyDataBox_ = DataFactory::buildDataBox (outputDataName);
00069 }; // ServiceReply()
00070 
00071 ServiceReply::ServiceReply (const ServiceReply &sr)
00072 {
00073   throw Exception ("ServiceReply::ServiceReply(const ServiceReply &sr)");
00074 }; // copy constructor
00075 
00076 ServiceReply& ServiceReply::operator= (const ServiceReply & sr)
00077 {
00078   throw Exception ("ServiceReply::operator=(const ServiceReply &sr)");
00079 }; // assignment operator
00080 
00081 std::string ServiceReply::getRequesterEntityName()
00082 {
00083   return requesterEntityName_;
00084 }; // getRequesterEntityName()
00085 
00086 std::string ServiceReply::getRequesterServiceName()
00087 {
00088   return requesterServiceName_;
00089 }; // getRequesterServiceName()
00090 
00091 std::string ServiceReply::getTargetEntityName()
00092 {
00093   return targetEntityName_;
00094 }; // getTargetEntityName()
00095 
00096 std::string ServiceReply::getTargetServiceName()
00097 {
00098   return targetServiceName_;;
00099 }; // getTargetServiceName()
00100 
00101 std::string ServiceReply::getTargetServiceInterfaceName()
00102 {
00103   return targetServiceInterfaceName_;
00104 }; // getTargetServiceInterfaceName()
00105 
00106 int ServiceReply::getRequestId()
00107 {
00108   return requestId_;
00109 }; // getRequestId()
00110 
00111 bool ServiceReply::executionIsOk()
00112 {
00113   return executionStatus_.compare ("OK") == 0;
00114 }; // executionIsOk()
00115 
00116 std::string ServiceReply::getExecutionStatus()
00117 {
00118   return executionStatus_;
00119 }; // getExecutionStatus()
00120 
00121 /*shared_ptr<DataValueVector> ServiceReply::getReplyValueVector()
00122 {
00123     if(replyValueVector_ == false)
00124     {
00125         throw Exception("ServiceReply::getReplyValueVector() : reply value vector is not valid");
00126     }
00127     return replyValueVector_;
00128     return replyDataBox_->getDataValueVector();
00129 }; // getReplyData()*/
00130 
00131 /*void ServiceReply::setReplyValueVector(shared_ptr<DataValueVector> valueVector)
00132 {
00133     replyValueVector_ = valueVector;
00134 }; // setReplyValueVector()*/
00135 
00136 shared_ptr<DataBox> ServiceReply::getReplyDataBox()
00137 {
00138   if (replyDataBox_ == false) {
00139     throw Exception ("ServiceReply::getReplyDataBox() : reply data box is not valid");
00140   }
00141   return replyDataBox_;
00142 }; // getReplyDataBox()
00143 
00144 void ServiceReply::setReplyDataBox (shared_ptr<DataBox> dataBox)
00145 {
00146   replyDataBox_ = dataBox;
00147 }; // setReplyDataBox()
Generated on Fri Mar 4 22:14:58 2011 for MeRMaID::support by  doxygen 1.6.3