Coverage for /Syzygy/trace/service/service_rpc_impl.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%13130.C++source

Line-by-line coverage:

   1    :  // Copyright 2012 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  //
  15    :  // This file declares the RpcServiceInstanceManager which binds the call
  16    :  // trace service RPC handlers to a trace::service::Service instance.
  17    :  
  18    :  #ifndef SYZYGY_TRACE_SERVICE_SERVICE_RPC_IMPL_H_
  19    :  #define SYZYGY_TRACE_SERVICE_SERVICE_RPC_IMPL_H_
  20    :  
  21    :  #include "base/logging.h"
  22    :  
  23    :  namespace trace {
  24    :  namespace service {
  25    :  
  26    :  // Forward declaration.
  27    :  class Service;
  28    :  
  29    :  // A helper class to manage a "global" Service instance to which the RPC
  30    :  // callbacks are bound. You can create an instance of this manager to
  31    :  // bind and unbind a given instance to the callbacks within a particular
  32    :  // scope.
  33    :  class RpcServiceInstanceManager {
  34    :   public:
  35  E :    explicit RpcServiceInstanceManager(Service* svc) {
  36  E :      DCHECK(svc != NULL);
  37  E :      DCHECK(instance_ == NULL);
  38  E :      instance_ = svc;
  39  E :    }
  40    :  
  41  E :    ~RpcServiceInstanceManager() {
  42  E :      DCHECK(instance_ != NULL);
  43  E :      instance_ = NULL;
  44  E :    }
  45    :  
  46  E :    static Service* GetInstance() {
  47  E :      DCHECK(instance_ != NULL);
  48  E :      return instance_;
  49  E :    }
  50    :  
  51    :   protected:
  52    :    static Service* instance_;
  53    :  };
  54    :  
  55    :  }  // namespace service
  56    :  }  // namespace trace
  57    :  
  58    :  #endif  // SYZYGY_TRACE_SERVICE_SERVICE_RPC_IMPL_H_

Coverage information generated Thu Jul 04 09:34:53 2013.