001package edu.wpi.first.wpilibj.networktables2;
002
003
004/**
005 * A transaction receiver that marks all Table entries as dirty in the entry store. Entries will not be passed to the continuing receiver if they are already dirty
006 * 
007 * @author Mitchell
008 *
009 */
010public class TransactionDirtier implements OutgoingEntryReceiver {
011        private final OutgoingEntryReceiver continuingReceiver;
012        
013        public TransactionDirtier(final OutgoingEntryReceiver continuingReceiver) {
014                this.continuingReceiver = continuingReceiver;
015        }
016
017
018
019        public void offerOutgoingAssignment(NetworkTableEntry entry) {
020                if(entry.isDirty())
021                        return;
022                entry.makeDirty();
023                continuingReceiver.offerOutgoingAssignment(entry);
024        }
025
026
027
028
029        public void offerOutgoingUpdate(NetworkTableEntry entry) {
030                if(entry.isDirty())
031                        return;
032                entry.makeDirty();
033                continuingReceiver.offerOutgoingUpdate(entry);
034        }
035
036}