Skip to content

Commit

Permalink
Messdaten zu Laufzeiten gesammelt; Regelprotokolle vorbereitet
Browse files Browse the repository at this point in the history
  • Loading branch information
drolbr committed Jan 29, 2009
1 parent a92a151 commit 835a13e
Show file tree
Hide file tree
Showing 27 changed files with 567 additions and 115 deletions.
5 changes: 5 additions & 0 deletions .cvsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cgi-bin/add_rule
cgi-bin/get_rule
cgi-bin/interpreter
cgi-bin/update_rule
testfiles
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
stmts = \
union_$(suffix) \
query_$(suffix) \
id_query_$(suffix) \
recurse_$(suffix) \
coord_query_$(suffix) \
conflict_$(suffix) \
detect_odd_nodes_$(suffix) \
foreach_$(suffix) \
id_query_$(suffix) \
item_$(suffix) \
make_area_$(suffix) \
coord_query_$(suffix) \
print_$(suffix) \
conflict_$(suffix) \
query_$(suffix) \
recurse_$(suffix) \
report_$(suffix) \
detect_odd_nodes_$(suffix)
union_$(suffix)

objects = expat_justparse_interface.o cgi-helper.o user_interface.o script_queries.o script_tools.o vigilance_control.o $(stmts)
executables_objects = script-interpreter.o add_rule.o get_rule.o update_rule.o osm2load_infile.o
executable_objects = script-interpreter.o add_rule.o get_rule.o update_rule.o osm2load_infile.o
executables = cgi-bin/interpreter cgi-bin/add_rule cgi-bin/get_rule cgi-bin/update_rule import_osm osmy_vigilance
tool_headers = expat_justparse_interface.h script_datatypes.h script_queries.h script_tools.h user_interface.h

Expand Down
4 changes: 4 additions & 0 deletions cgi-bin/.cvsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_rule
get_rule
interpreter
update_rule
7 changes: 6 additions & 1 deletion detect_odd_nodes_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "script_datatypes.h"
#include "script_queries.h"
#include "script_tools.h"
#include "user_interface.h"
#include "detect_odd_nodes_statement.h"

#include <mysql.h>
Expand Down Expand Up @@ -77,8 +78,12 @@ void Detect_Odd_Nodes_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
if (nit != in_nodes.end())
nodes.insert(*nit);
else
cout<<"Error: Node "<<*it
{
ostringstream temp;
temp<<"Error in detect-odd-nodes: Node "<<*it
<<" is not contained in set \""<<input<<"\".\n";
runtime_error(temp.str(), cout);
}
}
}

Expand Down
25 changes: 25 additions & 0 deletions doc/conflict_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
conflict

* desc
The conflict statement adds for every element in the set _from_ the error message which is composed of the text inside the element and the item-subelements within the element.

* properties
exec:yes
ret_set:
control_flow:no

* substatements
:item

* depending_on
input = set:from:nodes,ways,relations
text

* changes
db:conflicts

* time
<0.01 + 0.0001*set:from

* space
0
25 changes: 25 additions & 0 deletions doc/coord_query_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
coord_query

* desc
Returns all the areas for which the provided coordinates are inside.

* properties
exec:yes
ret_set:into
control_flow:no

* substatements

* depending_on
db:areas
lat = arg:float[-90.0, 90.0]:lat
lon = arg:float[-180.0, 180.0]:lon

* changes
output = set:into:areas (nr:areas)

* time
<0.01

* space
0
23 changes: 23 additions & 0 deletions doc/detect_odd_nodes_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
detect_odd_nodes

* desc
This statement filters from its input the nodes that are contained in an odd number of segments and therefore obstruct the construction of areas or superways.

* properties
exec:yes
ret_set:into
control_flow:no

* substatements

* depending_on
input = set:from:nodes,ways

* changes
output = union set:from set:into:nodes (set:from:nodes)

* time
<0.001 + 0.00001*set:from

* space
0
25 changes: 25 additions & 0 deletions doc/foreach_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
foreach

* desc
Loops for each element in _from_ over its substatements. In particular, it stores in the beginning the elements from the _from_ set, then it runs the loop once for each element and makes this element available in _into_ during the loop. After the last loop, _into_ remains unchanged.

* properties
exec:yes
ret_set:
control_flow:yes

* substatements
exec:

* depending_on
input = set:from

* changes
output = set:into
(There also might be changes by the substatements to other sets)

* time
(time_of_substatements * set:into)

* space
set:from
28 changes: 28 additions & 0 deletions doc/id_query_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
id_query

* desc
The Id-Query returns the node, way or relation specified by the given reference.

* properties
exec:yes
ret_set:into
control_flow:no

* substatements

* depending_on
db:nodes,ways,relations
type = arg:[node|way|relation]:type
ref = arg:int:ref

* changes
output = set:into

* time
(depending on type)
nodes: 0.4
ways: 0.3
relations: 0.2

* space
0
22 changes: 22 additions & 0 deletions doc/item_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
item

* desc
The item represents a set so that it can be adressed by statements that use the return set.

* properties
exec:no
ret_set:set
control_flow:no

* substatements

* depending_on
output = set:set

* changes

* time
0

* space
0
25 changes: 25 additions & 0 deletions doc/make_area_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
make_area

* desc
The make-area statement produces if possible from the given set of ways and nodes an area, tags it from the item in _tags_ and writes it into the database. The creation of an area is possible if and only if every node referenced by any way is contained in the set, every node that appears as first or last node of a way does so for an even number of times and the tags set contains exactly one item. If it is sucessful it returns the newly created area.

* properties
exec:yes
ret_set:
control_flow:no

* substatements

* depending_on
input = set:from:nodes,ways
tags = set:tags

* changes
db:areas
output = union set:from set:into:nodes (set:from:nodes)

* time
1.5 + 0.001*set:into:nodes,ways

* space
0
27 changes: 27 additions & 0 deletions doc/print_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
print

* desc
The print statement prints the objects in the given set to the output. The format depends on the parameter _mode_.

* properties
exec:yes
ret_set:
control_flow:no

* substatements

* depending_on
db_node_tags,way_tags,relation_tags,area_tags
from = set:from:*
mode = arg:[ids_only:skeleton:body]:mode

* changes
web:

* time
mode:ids_only: <0.001 + 0.00005*set:from
mode:skeleton: <0.001 + 0.0002*set:from
mode:body: <0.01 + 0.001*set:from

* space
0
28 changes: 28 additions & 0 deletions doc/query_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
query

* desc
Queries the database for objects matching the given conditions.

* properties
exec:yes
ret_set:into
control_flow:no

* substatements
:has_kv

* depending_on
db:nodes,ways,relations
type = arg:[node,way,relation]:type
:has_kv

* changes
into = set:nodes,ways,relations:into

* time
node: 24s + 0.001s*db:nodes
way: 90s + 0.001s*db:ways
relation: 0.1s + 0.001s*db:relations

* space
0
31 changes: 31 additions & 0 deletions doc/recurse_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
recurse

* desc
The recurse statement queries for a given set of relations or ways their members.

* properties
exec:yes
ret_set:into
control_flow:no

* substatements

* depending_on
from = set:ways,relations:from
type = arg:[way-node,relation-relation,relation-way,relation-node]:type

* changes
into = union set:from set:into:nodes,ways,relations (set:from:ways,relations)
way-node: 28 nodes per way
relation-relation: 1 relation per relation
relation-way: 22 ways per relation
relation-node: 2 nodes per relation

* time
way-node: 2s per way
relation-relation: 0.1s per relation
relation-way: 0.1s per relation
relation-node: 0.1s per relation

* space
0
18 changes: 18 additions & 0 deletions doc/statement_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$(lowercase)

* desc

* properties
exec:yes
ret_set:
control_flow:no

* substatements

* depending_on

* changes

* time

* space
24 changes: 24 additions & 0 deletions doc/union_statement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
union

* desc
The union statement collects all the return statements of its substatements in its output.

* properties
exec:yes
ret_set:into
control_flow:yes

* substatements
:ret_set != ""

* depending_on
substatements:ret_set

* changes
output = union of all substatement:ret_set

* time
0

* space
set:into
17 changes: 6 additions & 11 deletions expat_justparse_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,13 @@ void parse(const string& input,
int pos(0);
while ((!done) && (pos < len))
{
if (len > BUFFSIZE-1)
{
strcpy(Buff, input.substr(pos, BUFFSIZE-1).c_str());
pos += BUFFSIZE-1;
}
else
{
strcpy(Buff, input.c_str());
pos += len;
}
int buff_len(len - pos);
if (buff_len > BUFFSIZE-1)
buff_len = BUFFSIZE-1;
strcpy(Buff, input.substr(pos, buff_len).c_str());
pos += buff_len;

if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR)
if (XML_Parse(p, Buff, buff_len, done) == XML_STATUS_ERROR)
{
add_parse_error(XML_ErrorString(XML_GetErrorCode(p)));
return;
Expand Down
Loading

0 comments on commit 835a13e

Please sign in to comment.