ServiceRequestState.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "config.h"
00031
00032 #include "ServiceRequestState.hpp"
00033
00034 #include <Exception.hpp>
00035
00036 #include <iostream>
00037
00038 using namespace mermaid::support::service;
00039 using mermaid::support::errorhandling::Exception;
00040
00041
00042 ServiceRequestState::ServiceRequestState() : state_ (READY_TO_SEND)
00043 {
00044
00045
00046 };
00047
00048 void ServiceRequestState::notifySent()
00049 {
00050 if (state_ == READY_TO_SEND) {
00051 std::cerr << "ServiceRequestState::notifySent : changing to WAITING_FOR_REPLY" << std::endl;
00052 state_ = WAITING_FOR_REPLY;
00053 }
00054 else {
00055
00056 throw Exception ("ServiceRequestState: invalid notifySent notification");
00057 }
00058 };
00059
00060 void ServiceRequestState::notifyReplyReceived()
00061 {
00062 if (state_ == WAITING_FOR_REPLY) {
00063 std::cerr << "ServiceRequestState::notifyReplyReceived : changing to GOT_REPLY" << std::endl;
00064 state_ = GOT_REPLY;
00065 }
00066 else {
00067
00068 throw Exception ("ServiceRequestState: invalid notifyReplyReceived notification");
00069 }
00070 }