Ejemplo n.º 1
0
        public bool TryGetValue(TKey key, out TValue value)
        {
            var tmp    = new object[1];
            var result = (bool)RuntimeHost.DoCommunication(Id, TryGetValue, key, tmp);

            value = (TValue)tmp[0];
            return(result);
        }
Ejemplo n.º 2
0
 protected override void OnLinkedTo(RuntimeHost runtimeHost, params object[] args)
 {
     if (args == null || args.Length == 0)
     {
         m_reg = SharedRegister.Create <T>(runtimeHost.Runtime);
     }
     else if (args.Length == 1 && args[0] is T value)
     {
         m_reg = SharedRegister.Create <T>(runtimeHost.Runtime, value);
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(args), "The value needs to translate in null, empty or the array that has just one element as T.");
     }
 }
Ejemplo n.º 3
0
 protected override void OnLinkedTo(RuntimeHost runtimeHost, params object[] args)
 {
     if (args == null || args.Length == 0)
     {
         m_dic = SharedDictionary.Create <TKey, TValue>(runtimeHost.Runtime);
     }
     else if (args.Length == 1 && args[0] is IEqualityComparer <TKey> comparer)
     {
         m_dic = SharedDictionary.Create <TKey, TValue>(comparer, runtimeHost.Runtime);
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(args), "The value needs to translate in null, empty or the array that has just one element as IEqualityComparer<TKey>.");
     }
 }
Ejemplo n.º 4
0
 protected override void OnDeserializedCore(StreamingContext ctx)
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { TryAddCore, TryUpdateCore, thisGetCore, thisSetCore, TryRemoveCore, CountGetCore });
 }
Ejemplo n.º 5
0
 public DistributedDictionary()
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { TryAddCore, TryUpdateCore, thisGetCore, thisSetCore, TryRemoveCore, CountGetCore });
 }
Ejemplo n.º 6
0
 public int Exchange(int value)
 {
     return((int)RuntimeHost.DoCommunication(Id, ExchangeCore, value));
 }
Ejemplo n.º 7
0
 public TSender GetSender <TSender>(MachineId machineId) where TSender : class, IMethodizedMachineSender
 {
     return(RuntimeHost.GetSender <TSender>(Id, machineId));
 }
Ejemplo n.º 8
0
 public TSender[] GetSender <TSender>(MonitorId[] monitorIds) where TSender : class, IMethodizedMonitorSender
 {
     return(RuntimeHost.GetSender <TSender>(Id, monitorIds));
 }
Ejemplo n.º 9
0
 public DistributedCounter()
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { IncrementCore, DecrementCore, GetValueCore, AddCore, ExchangeCore, CompareExchangeCore });
 }
Ejemplo n.º 10
0
 public bool TryUpdate(TKey key, TValue newValue, TValue comparisonValue)
 {
     return((bool)RuntimeHost.DoCommunication(Id, TryUpdateCore, key, newValue, comparisonValue));
 }
Ejemplo n.º 11
0
 public DistributedRegister()
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { UpdateCore, GetValueCore, SetValueCore });
 }
Ejemplo n.º 12
0
 protected virtual void OnLinkedTo(RuntimeHost runtimeHost)
 {
 }
Ejemplo n.º 13
0
 internal void LinkTo(RuntimeHost runtimeHost)
 {
     Id.LinkTo(runtimeHost.Id);
     OnLinkedTo(runtimeHost);
 }
 protected InterProcessCommunicationProvider(RuntimeHost runtimeHost, string localEndpointName) :
     this(runtimeHost, new InterProcessCommunicationSetting(localEndpointName))
 {
 }
 public object DoCommunication(CommunicationId target, string name, params object[] args)
 {
     return(RuntimeHost.DoCommunication(target, name, args));
 }
Ejemplo n.º 16
0
 public void Decrement()
 {
     RuntimeHost.DoCommunication(Id, DecrementCore);
 }
Ejemplo n.º 17
0
 protected override void OnDeserializedCore(StreamingContext ctx)
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { IncrementCore, DecrementCore, GetValueCore, AddCore, ExchangeCore, CompareExchangeCore });
 }
Ejemplo n.º 18
0
 public void SetSender <TSender>(ref MachineId[] machineIds, TSender[] machines) where TSender : class, IMethodizedMachineSender
 {
     RuntimeHost.SetSender(ref machineIds, machines);
 }
Ejemplo n.º 19
0
 public bool TryAdd(TKey key, TValue value)
 {
     return((bool)RuntimeHost.DoCommunication(Id, TryAddCore, key, value));
 }
Ejemplo n.º 20
0
 protected virtual void OnLinkedTo(RuntimeHost runtimeHost, params object[] args)
 {
 }
Ejemplo n.º 21
0
 protected override void OnDeserializedCore(StreamingContext ctx)
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { UpdateCore, GetValueCore, SetValueCore });
 }
Ejemplo n.º 22
0
 public int CompareExchange(int value, int comparand)
 {
     return((int)RuntimeHost.DoCommunication(Id, CompareExchangeCore, value, comparand));
 }
Ejemplo n.º 23
0
 internal void LinkTo(RuntimeHost runtimeHost, params object[] args)
 {
     Id.LinkTo(runtimeHost.Id);
     OnLinkedTo(runtimeHost, args);
 }
Ejemplo n.º 24
0
 public T Update(Func <T, T> func)
 {
     return((T)RuntimeHost.DoCommunication(Id, UpdateCore, func));
 }
Ejemplo n.º 25
0
 public void SetSender <TSender>(ref MonitorId monitorId, TSender monitor) where TSender : class, IMethodizedMonitorSender
 {
     RuntimeHost.SetSender(ref monitorId, monitor);
 }
Ejemplo n.º 26
0
 public T GetValue()
 {
     return((T)RuntimeHost.DoCommunication(Id, GetValueCore));
 }
Ejemplo n.º 27
0
 public void SetSender <TSender>(ref MonitorId[] monitorIds, TSender[] monitors) where TSender : class, IMethodizedMonitorSender
 {
     RuntimeHost.SetSender(ref monitorIds, monitors);
 }
Ejemplo n.º 28
0
 public void SetValue(T value)
 {
     RuntimeHost.DoCommunication(Id, SetValueCore, value);
 }
Ejemplo n.º 29
0
 public void SetSender <TSender>(ref MachineId machineId, TSender machine) where TSender : class, IMethodizedMachineSender
 {
     RuntimeHost.SetSender(ref machineId, machine);
 }
Ejemplo n.º 30
0
 public int Add(int value)
 {
     return((int)RuntimeHost.DoCommunication(Id, AddCore, value));
 }