Web Wispers 1.2.2 C++ Unit Test Coverage
Current view: top level - ssrc/wispers/service - protocol.h (source / functions) Hit Total Coverage
Test: Web Wispers 1.2.2 C++ Unit Tests Lines: 3 3 100.0 %
Date: 2012-04-09 Functions: 21 21 100.0 %
Branches: 3 4 75.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright 2006-2009 Savarese Software Research Corporation
       3                 :            :  *
       4                 :            :  * Licensed under the Apache License, Version 2.0 (the "License");
       5                 :            :  * you may not use this file except in compliance with the License.
       6                 :            :  * You may obtain a copy of the License at
       7                 :            :  *
       8                 :            :  *     https://www.savarese.com/software/ApacheLicense-2.0
       9                 :            :  *
      10                 :            :  * Unless required by applicable law or agreed to in writing, software
      11                 :            :  * distributed under the License is distributed on an "AS IS" BASIS,
      12                 :            :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13                 :            :  * See the License for the specific language governing permissions and
      14                 :            :  * limitations under the License.
      15                 :            :  */
      16                 :            : 
      17                 :            : /**
      18                 :            :  * @file
      19                 :            :  * This header defines the general service messaging protocol.
      20                 :            :  */
      21                 :            : 
      22                 :            : #ifndef __SSRC_WSPR_SERVICE_PROTOCOL_H
      23                 :            : #define __SSRC_WSPR_SERVICE_PROTOCOL_H
      24                 :            : 
      25                 :            : #include <ssrc/wispers/protocol.h>
      26                 :            : #include <ssrc/wispers/utility/properties_ptr.h>
      27                 :            : 
      28                 :            : __BEGIN_NS_SSRC_WSPR_PROTOCOL
      29                 :            : 
      30   [ +  +  +  - ]:         82 : WSPR_DEFINE_PROTOCOL(Service,service);
      31                 :            : 
      32                 :            : __END_NS_SSRC_WSPR_PROTOCOL
      33                 :            : 
      34                 :            : __BEGIN_NS_SSRC_WSPR_SERVICE
      35                 :            : 
      36                 :            : using std::string;
      37                 :            : using NS_SSRC_WSPR_UTILITY::properties_ptr;
      38                 :            : 
      39                 :            : struct ServiceProtocol : public protocol::ServiceProtocol<protocol::Service> {
      40                 :            :   enum MessageType {
      41                 :            :     Stop, EchoRequest, EchoReply, Reregister, StatusRequest, StatusReply
      42                 :            :   };
      43                 :            : 
      44                 :            :   typedef protocol::MessageService<Stop> MessageStop;
      45                 :            :   typedef protocol::MessageService<EchoRequest> MessageEchoRequest;
      46                 :            :   typedef protocol::MessageService<EchoReply> MessageEchoReply;
      47                 :            :   typedef protocol::MessageService<StatusRequest> MessageStatusRequest;
      48                 :            : 
      49                 :            :   WISP_PROTOCOL_MESSAGE(Reregister, protocol::MessageService,
      50                 :          6 :                        ((string, registry)));
      51                 :            : 
      52                 :            :   WISP_PROTOCOL_MESSAGE(StatusReply, protocol::MessageService,
      53                 :          6 :                         ((properties_ptr, status)));
      54                 :            : 
      55                 :            :   WISP_ONE_WAY_CALL(caller_type, Stop);
      56                 :            :   WISP_ONE_WAY_CALL(caller_type, EchoReply);
      57                 :            :   WISP_TWO_WAY_CALL(caller_type, EchoRequest, EchoReply);
      58                 :            :   WISP_ONE_WAY_CALL(caller_type, Reregister);
      59                 :            :   WISP_ONE_WAY_CALL(caller_type, StatusRequest);
      60                 :            :   WISP_ONE_WAY_CALL(caller_type, StatusReply);
      61                 :            : };
      62                 :            : 
      63                 :            : __END_NS_SSRC_WSPR_SERVICE
      64                 :            : 
      65                 :            : #endif