001    package toolbus.communication;
002    
003    import aterm.ATerm;
004    
005    /**
006     * IOHandlers facilitate the transfer of terms from and to the ToolBus and tools.
007     * 
008     * @author Arnold Lankamp
009     */
010    public interface IIOHandler{
011    
012            /**
013             * Sends a term to the remote location.
014             * 
015             * @param operation
016             *            The operation associated with the term we need to send.
017             * @param aTerm
018             *            The term that needs to be send.
019             */
020            void send(byte operation, ATerm aTerm);
021    
022            /**
023             * Receives a term from the remote location.
024             * 
025             * @param operation
026             *            The operation associated with the term we received.
027             * @param aTerm
028             *            The term that was received.
029             */
030            void receive(byte operation, ATerm aTerm);
031    
032            /**
033             * Requests the termination of this ioHandler.
034             */
035            void terminate();
036    
037            /**
038             * Shuts down this ioHandler and it's associated datahandler. IMPORTANT: This method should not
039             * be called from outside the ioHandler. Manual invokation will lead to undefined behaviour.
040             */
041            void shutDown();
042            
043            /**
044             * Notifies the I/O handler that an exception has occured so it can take the nessacary steps.
045             */
046            void exceptionOccured();
047    }