Exemple #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);
        }
 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.");
     }
 }
Exemple #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>.");
     }
 }
Exemple #4
0
 protected override void OnDeserializedCore(StreamingContext ctx)
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { TryAddCore, TryUpdateCore, thisGetCore, thisSetCore, TryRemoveCore, CountGetCore });
 }
Exemple #5
0
 public DistributedDictionary()
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { TryAddCore, TryUpdateCore, thisGetCore, thisSetCore, TryRemoveCore, CountGetCore });
 }
 public int Exchange(int value)
 {
     return((int)RuntimeHost.DoCommunication(Id, ExchangeCore, value));
 }
Exemple #7
0
 public TSender GetSender <TSender>(MachineId machineId) where TSender : class, IMethodizedMachineSender
 {
     return(RuntimeHost.GetSender <TSender>(Id, machineId));
 }
Exemple #8
0
 public TSender[] GetSender <TSender>(MonitorId[] monitorIds) where TSender : class, IMethodizedMonitorSender
 {
     return(RuntimeHost.GetSender <TSender>(Id, monitorIds));
 }
 public DistributedCounter()
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { IncrementCore, DecrementCore, GetValueCore, AddCore, ExchangeCore, CompareExchangeCore });
 }
Exemple #10
0
 public bool TryUpdate(TKey key, TValue newValue, TValue comparisonValue)
 {
     return((bool)RuntimeHost.DoCommunication(Id, TryUpdateCore, key, newValue, comparisonValue));
 }
 public DistributedRegister()
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { UpdateCore, GetValueCore, SetValueCore });
 }
 protected virtual void OnLinkedTo(RuntimeHost runtimeHost)
 {
 }
 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));
 }
 public void Decrement()
 {
     RuntimeHost.DoCommunication(Id, DecrementCore);
 }
 protected override void OnDeserializedCore(StreamingContext ctx)
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { IncrementCore, DecrementCore, GetValueCore, AddCore, ExchangeCore, CompareExchangeCore });
 }
Exemple #18
0
 public void SetSender <TSender>(ref MachineId[] machineIds, TSender[] machines) where TSender : class, IMethodizedMachineSender
 {
     RuntimeHost.SetSender(ref machineIds, machines);
 }
Exemple #19
0
 public bool TryAdd(TKey key, TValue value)
 {
     return((bool)RuntimeHost.DoCommunication(Id, TryAddCore, key, value));
 }
Exemple #20
0
 protected virtual void OnLinkedTo(RuntimeHost runtimeHost, params object[] args)
 {
 }
 protected override void OnDeserializedCore(StreamingContext ctx)
 {
     RuntimeHost.RegisterCommunication(Id, new Func <object[], object>[] { UpdateCore, GetValueCore, SetValueCore });
 }
 public int CompareExchange(int value, int comparand)
 {
     return((int)RuntimeHost.DoCommunication(Id, CompareExchangeCore, value, comparand));
 }
Exemple #23
0
 internal void LinkTo(RuntimeHost runtimeHost, params object[] args)
 {
     Id.LinkTo(runtimeHost.Id);
     OnLinkedTo(runtimeHost, args);
 }
 public T Update(Func <T, T> func)
 {
     return((T)RuntimeHost.DoCommunication(Id, UpdateCore, func));
 }
Exemple #25
0
 public void SetSender <TSender>(ref MonitorId monitorId, TSender monitor) where TSender : class, IMethodizedMonitorSender
 {
     RuntimeHost.SetSender(ref monitorId, monitor);
 }
 public T GetValue()
 {
     return((T)RuntimeHost.DoCommunication(Id, GetValueCore));
 }
Exemple #27
0
 public void SetSender <TSender>(ref MonitorId[] monitorIds, TSender[] monitors) where TSender : class, IMethodizedMonitorSender
 {
     RuntimeHost.SetSender(ref monitorIds, monitors);
 }
 public void SetValue(T value)
 {
     RuntimeHost.DoCommunication(Id, SetValueCore, value);
 }
Exemple #29
0
 public void SetSender <TSender>(ref MachineId machineId, TSender machine) where TSender : class, IMethodizedMachineSender
 {
     RuntimeHost.SetSender(ref machineId, machine);
 }
 public int Add(int value)
 {
     return((int)RuntimeHost.DoCommunication(Id, AddCore, value));
 }