Interfaces


[] introduction, legacy, interfaces, examples, conclusions, references, appendix
The IDL interfaces reflect to a large extent the functionality of the original hush and widgets interfaces. See Hush. In this section a partial listing of the interfaces will be given. Note that, in comparison with the corresponding C++ classes, the IDL interfaces are much more abstract in the sense of omitting many member functions that are required for the implementation of the actual hush framework.

The hush module

The hush module contains interfaces corresponding to the basic hush classes, handler, event, kit, widget and item, as well as the auxiliary classes for iterators and containers.
  interface handler {
          event dispatch( in event data );
  	};
  

slide: handler

The handler interface provides only a method for dispatching events. It may be extended in the future though. In hush almost every class is derived from handler. This is directly reflected in the hush IDL interfaces.
  interface event : handler {
  
  	attribute long type;
  
  	attribute long x;
  	attribute long y;
  	};
  

slide: event

The event interface offers attributes to determine the type of event and its location. Also the event interface will very likely be extended in the future, to allow for a greater variety of events.
  interface kit : handler {
  
  	void source(in string file);
  	void eval(in string command);
  	term result();
  
  	widget root();
  	};
  

slide: kit

In hush, a kit provides an interface to some embedded interpreter, such as a Tcl interpreter or a logic engine as provided by BinProlog. The kit gives also access to the underlying window environment, in particular it may be asked to provide a reference to the root window.
  interface widget : handler {
  
     string path();
  
     void eval( in string cmd );
  
     void configure( in string options );
     void pack( in string options );
  };
  

slide: widget

A widget is a user interface gadget. The widget interface collects the functions that all these gadgets have in common.
  interface item : handler {
  
          void move( in long x, in long y );
  	};
  

slide: item

An item is obtained when creating a graphical object for a canvas. Subsequently, the item reference suffices to manipulate such objects. Also the item interface will very likely be extended in the future.

Iterators and lists

As an alternative for CORBA arrays and sequences, the hush module offers interfaces for iterators, containers and syntactic objects called terms.
  interface iterator {
          Object next();
  	};
  

slide: iterator

From a client's perspective, an iterator is a data generator. To deal with typed iterators, the hush C++ library offers template client-side adaptor classes encapsulating the untyped CORBA iterators. See section Items and the code in Iter.
  interface container {
  
          long length();
  
          Object first();
          Object next();
          Object current();
  
          iterator walk();
  	};
  

slide: container

The container interface offers access to the famous hush list class. It offers functions for cursor-based list traversal as well as the walk function that may be used to obtain an iterator.
  interface term {
  
          string next();
  
  };
  

slide: term

Currently, the term interface offers only the functionality to use a term as an iterator for strings. The idea is that one can obtain strings from a term as long as the term, for example the result of a logic query, still contains information.

Factories and distributed object tables

To obtain references to objects, clients may use either factory object or distributed object tables.
  interface factory {
          hush::kit kit(in string name);
          hush::event event(in long type);
  };
  

slide: factory

The factory interface allows only for creating a kit and for creating an event. Note that handler objects may not be created directly.
  interface dot {
  
          hush::kit kit(in string name);
  
          hush::container container(in string name);
          hush::iterator iterator(in string name);
  
          hush::factory hush(in string name);
  };
  

slide: dot

Apart from giving access to a hush factory, the dot interface allows for getting access to a kit, a container and an iterator. When obtaining references through a dot object, these objects are assumed to exist within the server.

The widgets module

The widgets module provides the actual user interface gadgets for hush. Below we have included only the (partial) interfaces for a canvas and a message widget.
  module widgets {
  
  interface canvas : hush::widget {
  
  	widgets::canvas create( in hush::widget anc, in string path );
  
  	hush::item circle( in long x, in long y, in long radius, in string options );
  	// other items ...
  	};
  
  
  interface message : hush::widget {
  	message create( in hush::widget anc, in string path );
  	void text(in string txt);
  	};
  
  
  interface factory : hush::factory {
  
   	widgets::canvas  canvas(in string name, in string options);
   	widgets::message message(in string name, in string options);
  	};
  
  interface dot : hush::dot {
  
  	widgets::canvas  canvas(in string name);
   	widgets::message message(in string name);
  
  	widgets::factory widgets(in string name);
  	};
  
  
  };
  

slide: module widgets

Note that each widget type has a method create, with which an actual widget of that type can be created. In effect this means that each widget object may act as a factory for widget objects of that type. (The server may however refuse to create such objects!) In addition to the specific gadget interfaces, the widgets module provides a factory and dot interface, extending the respective hush interfaces.
[] introduction, legacy, interfaces, examples, conclusions, references, appendix