Beispiel #1
0
 public HeavySingleContextHandler(RdContext <T> context, ProtocolContexts handler)
 {
     myHandler                    = handler;
     Context                      = context;
     myInternRoot                 = new InternRoot <T>(context.ReadDelegate, context.WriteDelegate);
     myProtocolValueSet           = new RdSet <T>(context.ReadDelegate, context.WriteDelegate, new ViewableSet <T>(new ConcurrentSet <T>()));
     myModificationCookieValueSet = new ModificationCookieViewableSet <T, ProtocolContexts.SendWithoutContextsCookie>(myHandler.CreateSendWithoutContextsCookie, myProtocolValueSet);
 }
Beispiel #2
0
 public SendWithoutContextsCookie(ProtocolContexts contexts)
 {
     myContexts  = contexts;
     myPrevValue = contexts.mySendWithoutContexts.Value;
     contexts.mySendWithoutContexts.Value = true;
 }
Beispiel #3
0
 public MessageContextCookie(ProtocolContexts handler, int numContextValues)
 {
     myHandler          = handler;
     myNumContextValues = numContextValues;
 }
Beispiel #4
0
        internal Protocol([NotNull] string name, [NotNull] ISerializers serializers, [NotNull] IIdentities identities, [NotNull] IScheduler scheduler,
                          [NotNull] IWire wire, Lifetime lifetime, SerializationCtx?serializationCtx = null, [CanBeNull] ProtocolContexts parentContexts = null, params RdContextBase[] initialContexts)
        {
            Name     = name ?? throw new ArgumentNullException(nameof(name));
            Location = new RName(name);

            Serializers          = serializers ?? throw new ArgumentNullException(nameof(serializers));
            Identities           = identities ?? throw new ArgumentNullException(nameof(identities));
            Scheduler            = scheduler ?? throw new ArgumentNullException(nameof(scheduler));
            Wire                 = wire ?? throw new ArgumentNullException(nameof(wire));
            SerializationContext = serializationCtx ?? new SerializationCtx(this, new Dictionary <string, IInternRoot <object> >()
            {
                { ProtocolInternScopeStringId, CreateProtocolInternRoot(lifetime) }
            });
            Contexts      = parentContexts ?? new ProtocolContexts(SerializationContext);
            wire.Contexts = Contexts;
            if (serializationCtx == null)
            {
                SerializationContext.InternRoots[ProtocolInternScopeStringId].Bind(lifetime, this, ProtocolInternRootRdId);
            }
            foreach (var rdContextBase in initialContexts)
            {
                rdContextBase.RegisterOn(Contexts);
            }
            if (parentContexts == null)
            {
                BindContexts(lifetime);
            }
            OutOfSyncModels = new ViewableSet <RdExtBase>();
        }