< Summary

Information
Class: Ice.Internal.EndpointFactoryWithUnderlying
Assembly: Ice
File(s): /_/csharp/src/Ice/Internal/EndpointFactory.cs
Tag: 91_21789722663
Line coverage
88%
Covered lines: 16
Uncovered lines: 2
Coverable lines: 18
Total lines: 76
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)

/_/csharp/src/Ice/Internal/EndpointFactory.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3namespace Ice.Internal;
 4
 5public interface EndpointFactory
 6{
 7    void initialize();
 8
 9    short type();
 10
 11    string protocol();
 12
 13    EndpointI create(List<string> args, bool oaEndpoint);
 14
 15    EndpointI read(Ice.InputStream s);
 16
 17    EndpointFactory clone(ProtocolInstance instance);
 18}
 19
 20public abstract class EndpointFactoryWithUnderlying : EndpointFactory
 21{
 122    protected EndpointFactoryWithUnderlying(ProtocolInstance instance, short type)
 23    {
 124        instance_ = instance;
 125        _type = type;
 126    }
 27
 28    public void initialize()
 29    {
 30        //
 31        // Get the endpoint factory for the underlying type and clone it with
 32        // our protocol instance.
 33        //
 134        EndpointFactory factory = instance_.getEndpointFactory(_type);
 135        if (factory != null)
 36        {
 137            _underlying = factory.clone(instance_);
 138            _underlying.initialize();
 39        }
 140    }
 41
 142    public short type() => instance_.type();
 43
 144    public string protocol() => instance_.protocol();
 45
 46    public EndpointI create(List<string> args, bool oaEndpoint)
 47    {
 148        if (_underlying == null)
 49        {
 050            return null; // Can't create an endpoint without underlying factory.
 51        }
 152        return createWithUnderlying(_underlying.create(args, oaEndpoint), args, oaEndpoint);
 53    }
 54
 55    public EndpointI read(Ice.InputStream s)
 56    {
 157        if (_underlying == null)
 58        {
 059            return null; // Can't create an endpoint without underlying factory.
 60        }
 161        return readWithUnderlying(_underlying.read(s), s);
 62    }
 63
 164    public EndpointFactory clone(ProtocolInstance instance) => cloneWithUnderlying(instance, _type);
 65
 66    public abstract EndpointFactory cloneWithUnderlying(ProtocolInstance instance, short underlying);
 67
 68    protected abstract EndpointI createWithUnderlying(EndpointI underlying, List<string> args, bool oaEndpoint);
 69
 70    protected abstract EndpointI readWithUnderlying(EndpointI underlying, Ice.InputStream s);
 71
 72    protected readonly ProtocolInstance instance_;
 73
 74    private readonly short _type;
 75    private EndpointFactory _underlying;
 76}