コード例 #1
0
        // Function return InterModularDataSender object, through which data should be sent
        // So actual sender should save this object and use it
        public static InterModularDataSender RegisterDataSender(string label)
        {
            InterModularDataSender sender = new InterModularDataSender();
            sender.DataLabel = label;

            InterModularConnection connection = GetConnection(label);

            sender.DataArrived = connection.OnDataArrived;
            connection._senders.Add(sender);

            return sender;
        }
コード例 #2
0
 // Decrements reference counter on sender, and if this connection is no longer used
 // by any object, remove it
 public static void UnregisterDataSender(InterModularDataSender sender)
 {
     InterModularConnection connection = GetConnection(sender.DataLabel);
     if(connection.RemoveSender(sender))
         _connections.Remove(connection);
 }
コード例 #3
0
 // Removes sender from connection and returns true if connection is no longer used by any object
 public bool RemoveSender(InterModularDataSender sender)
 {
     _senders.Remove(sender);
     if (_receivers.Count == 0 && _senders.Count == 0)
         return true;
     return false;
 }