start reworking input framework...

does not compile at the moment, but there are a few uncommitted changes that will be reverted in the next commit.
This commit is contained in:
Bernhard Amann 2011-11-18 10:49:20 -08:00
parent 988f859761
commit e2c521fc4e
6 changed files with 208 additions and 217 deletions

View file

@ -4,30 +4,36 @@ module Input;
export {
const default_reader = READER_ASCII &redef;
type ReaderDescription: record {
type StreamDescription: record {
source: string;
idx: any;
val: any;
destination: any;
want_record: bool &default=T;
reader: Reader &default=default_reader;
};
type Filter: record {
name: string;
## descriptive name. for later removal
name: string;
## for tables
idx: any &optional;
val: any &optional;
destination: any &optional;
want_record: bool &default=T;
table_ev: any &optional; # event containing idx, val as values.
## decision function, that decides if an insertion, update or removal should really be executed.
## or events should be thought
pred: function(typ: Input::Event, left: any, right: any): bool &optional;
## decision function, that decides if an inserton, update or removal should really be executed
## for "normalized" events
ev: any &optional;
ev_description: any &optional;
};
const no_filter: Filter = [$name="<not found>"]; # Sentinel.
global create_reader: function(id: Log::ID, description: Input::ReaderDescription) : bool;
global remove_reader: function(id: Log::ID) : bool;
global create_stream: function(id: Log::ID, description: Input::ReaderDescription) : bool;
global remove_stream: function(id: Log::ID) : bool;
global force_update: function(id: Log::ID) : bool;
global add_event: function(id: Log::ID, name: string) : bool;
global remove_event: function(id: Log::ID, name: string) : bool;
global add_filter: function(id: Log::ID, filter: Input::Filter) : bool;
global remove_filter: function(id: Log::ID, name: string) : bool;
global get_filter: function(id: ID, name: string) : Filter;
@ -41,14 +47,14 @@ module Input;
global filters: table[ID, string] of Filter;
function create_reader(id: Log::ID, description: Input::ReaderDescription) : bool
function create_stream(id: Log::ID, description: Input::ReaderDescription) : bool
{
return __create_reader(id, description);
return __create_stream(id, description);
}
function remove_reader(id: Log::ID) : bool
function remove_stream(id: Log::ID) : bool
{
return __remove_reader(id);
return __remove_stream(id);
}
function force_update(id: Log::ID) : bool
@ -56,16 +62,6 @@ function force_update(id: Log::ID) : bool
return __force_update(id);
}
function add_event(id: Log::ID, name: string) : bool
{
return __add_event(id, name);
}
function remove_event(id: Log::ID, name: string) : bool
{
return __remove_event(id, name);
}
function add_filter(id: Log::ID, filter: Input::Filter) : bool
{
filters[id, filter$name] = filter;