make filters pointers (for inheritance)

This commit is contained in:
Bernhard Amann 2011-11-22 11:39:27 -08:00
parent f82bf3f35f
commit 3c40f00a53
7 changed files with 507 additions and 160 deletions

View file

@ -23,10 +23,19 @@ export {
## 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;
};
## for "normalized" events
# ev: any &optional;
# ev_description: any &optional;
type EventFilter: record {
## descriptive name. for later removal
name: string;
# the event
ev: any;
# record describing the fields
fields: any;
# does the event want the field unrolled (default) or as a simple record value?
want_record: bool &default=F;
};
#const no_filter: Filter = [$name="<not found>", $idx="", $val="", $destination=""]; # Sentinel.
@ -36,6 +45,8 @@ export {
global force_update: function(id: Log::ID) : bool;
global add_tablefilter: function(id: Log::ID, filter: Input::TableFilter) : bool;
global remove_tablefilter: function(id: Log::ID, name: string) : bool;
global add_eventfilter: function(id: Log::ID, filter: Input::EventFilter) : bool;
global remove_eventfilter: function(id: Log::ID, name: string) : bool;
#global get_filter: function(id: ID, name: string) : Filter;
}
@ -74,6 +85,18 @@ function remove_tablefilter(id: Log::ID, name: string) : bool
return __remove_tablefilter(id, name);
}
function add_eventfilter(id: Log::ID, filter: Input::EventFilter) : bool
{
# filters[id, filter$name] = filter;
return __add_eventfilter(id, filter);
}
function remove_eventfilter(id: Log::ID, name: string) : bool
{
# delete filters[id, name];
return __remove_eventfilter(id, name);
}
#function get_filter(id: ID, name: string) : Filter
# {
# if ( [id, name] in filters )