(truncate_entries::flush): Fix so that --head and --tail can be used
at the same time. (export_walk): Added TruncateEntries for Python.
This commit is contained in:
parent
4faed720b5
commit
396491c568
1 changed files with 13 additions and 4 deletions
17
walk.cc
17
walk.cc
|
|
@ -86,22 +86,24 @@ void truncate_entries::flush()
|
||||||
|
|
||||||
bool print = false;
|
bool print = false;
|
||||||
if (head_count) {
|
if (head_count) {
|
||||||
if (count > 0 && i < count)
|
if (head_count > 0 && i < head_count)
|
||||||
print = true;
|
print = true;
|
||||||
else if (count < 0 && i >= - count)
|
else if (head_count < 0 && i >= - head_count)
|
||||||
print = true;
|
print = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! print && tail_count) {
|
if (! print && tail_count) {
|
||||||
if (count > 0 && l - i <= count)
|
if (tail_count > 0 && l - i <= tail_count)
|
||||||
print = true;
|
print = true;
|
||||||
else if (count < 0 && l - i > - count)
|
else if (tail_count < 0 && l - i > - tail_count)
|
||||||
print = true;
|
print = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (print)
|
if (print)
|
||||||
item_handler<transaction_t>::operator()(**x);
|
item_handler<transaction_t>::operator()(**x);
|
||||||
}
|
}
|
||||||
|
xacts.clear();
|
||||||
|
|
||||||
item_handler<transaction_t>::flush();
|
item_handler<transaction_t>::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -991,6 +993,13 @@ void export_walk()
|
||||||
.def("__call__", &ignore_transactions::operator());
|
.def("__call__", &ignore_transactions::operator());
|
||||||
;
|
;
|
||||||
|
|
||||||
|
class_< truncate_entries, bases<xact_handler_t> >
|
||||||
|
("TruncateEntries", init<xact_handler_t *, int, int>()
|
||||||
|
[with_custodian_and_ward<1, 2>()])
|
||||||
|
.def("flush", &truncate_entries::flush)
|
||||||
|
.def("__call__", &truncate_entries::operator());
|
||||||
|
;
|
||||||
|
|
||||||
class_< set_account_value, bases<xact_handler_t> > ("SetAccountValue")
|
class_< set_account_value, bases<xact_handler_t> > ("SetAccountValue")
|
||||||
.def(init<xact_handler_t *>()[with_custodian_and_ward<1, 2>()])
|
.def(init<xact_handler_t *>()[with_custodian_and_ward<1, 2>()])
|
||||||
.def("flush", &xact_handler_t::flush)
|
.def("flush", &xact_handler_t::flush)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue