< Summary

Information
Class: Ice.Internal.EndpointFactoryWithUnderlying
Assembly: Ice
File(s): /home/runner/work/ice/ice/csharp/src/Ice/Internal/EndpointFactory.cs
Tag: 71_18251537082
Line coverage
88%
Covered lines: 16
Uncovered lines: 2
Coverable lines: 18
Total lines: 78
Line coverage: 88.8%
Branch coverage
66%
Covered branches: 4
Total branches: 6
Branch coverage: 66.6%
Method coverage
100%
Covered methods: 7
Total methods: 7
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
initialize()100%22100%
type()100%11100%
protocol()100%11100%
create(...)50%2.15266.67%
read(...)50%2.15266.67%
clone(...)100%11100%

File(s)

/home/runner/work/ice/ice/csharp/src/Ice/Internal/EndpointFactory.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Collections.Generic;
 4
 5namespace Ice.Internal;
 6
 7public interface EndpointFactory
 8{
 9    void initialize();
 10
 11    short type();
 12
 13    string protocol();
 14
 15    EndpointI create(List<string> args, bool oaEndpoint);
 16
 17    EndpointI read(Ice.InputStream s);
 18
 19    EndpointFactory clone(ProtocolInstance instance);
 20}
 21
 22public abstract class EndpointFactoryWithUnderlying : EndpointFactory
 23{
 124    protected EndpointFactoryWithUnderlying(ProtocolInstance instance, short type)
 25    {
 126        instance_ = instance;
 127        _type = type;
 128    }
 29
 30    public void initialize()
 31    {
 32        //
 33        // Get the endpoint factory for the underlying type and clone it with
 34        // our protocol instance.
 35        //
 136        EndpointFactory factory = instance_.getEndpointFactory(_type);
 137        if (factory != null)
 38        {
 139            _underlying = factory.clone(instance_);
 140            _underlying.initialize();
 41        }
 142    }
 43
 144    public short type() => instance_.type();
 45
 146    public string protocol() => instance_.protocol();
 47
 48    public EndpointI create(List<string> args, bool oaEndpoint)
 49    {
 150        if (_underlying == null)
 51        {
 052            return null; // Can't create an endpoint without underlying factory.
 53        }
 154        return createWithUnderlying(_underlying.create(args, oaEndpoint), args, oaEndpoint);
 55    }
 56
 57    public EndpointI read(Ice.InputStream s)
 58    {
 159        if (_underlying == null)
 60        {
 061            return null; // Can't create an endpoint without underlying factory.
 62        }
 163        return readWithUnderlying(_underlying.read(s), s);
 64    }
 65
 166    public EndpointFactory clone(ProtocolInstance instance) => cloneWithUnderlying(instance, _type);
 67
 68    public abstract EndpointFactory cloneWithUnderlying(ProtocolInstance instance, short underlying);
 69
 70    protected abstract EndpointI createWithUnderlying(EndpointI underlying, List<string> args, bool oaEndpoint);
 71
 72    protected abstract EndpointI readWithUnderlying(EndpointI underlying, Ice.InputStream s);
 73
 74    protected readonly ProtocolInstance instance_;
 75
 76    private readonly short _type;
 77    private EndpointFactory _underlying;
 78}