diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-03 04:34:50 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:40:47 -0400 |
commit | a32173ace60df5a1e9414f5e95b556c436f62718 (patch) | |
tree | fff5b881c657fddb8543b0f787bfa75cf009a0b7 /autoxact.h | |
parent | cc98b59d1e99238270eb307b117da8b0b35e6f27 (diff) | |
download | fork-ledger-a32173ace60df5a1e9414f5e95b556c436f62718.tar.gz fork-ledger-a32173ace60df5a1e9414f5e95b556c436f62718.tar.bz2 fork-ledger-a32173ace60df5a1e9414f5e95b556c436f62718.zip |
changes
Diffstat (limited to 'autoxact.h')
-rw-r--r-- | autoxact.h | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/autoxact.h b/autoxact.h deleted file mode 100644 index c85890c6..00000000 --- a/autoxact.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef _AUTOXACT_H -#define _AUTOXACT_H - -#include "journal.h" -#include "valexpr.h" - -#include <deque> - -namespace ledger { - -typedef std::deque<transaction_t *> transactions_deque; - -class automated_transaction_t -{ -public: - item_predicate<transaction_t> predicate; - transactions_deque transactions; - - automated_transaction_t(const std::string& _predicate, - transactions_deque& _transactions) - : predicate(_predicate) { - DEBUG_PRINT("ledger.memory.ctors", "ctor automated_transaction_t"); - transactions.insert(transactions.begin(), - _transactions.begin(), _transactions.end()); - // Take over ownership of the pointers - _transactions.clear(); - } - - ~automated_transaction_t() { - DEBUG_PRINT("ledger.memory.dtors", "dtor automated_transaction_t"); - for (transactions_deque::iterator i = transactions.begin(); - i != transactions.end(); - i++) - delete *i; - } - - void extend_entry(entry_t& entry); -}; - - -typedef std::deque<automated_transaction_t *> automated_transactions_deque; - -class automated_transactions_t -{ -#ifdef DEBUG_ENABLED - automated_transactions_t(const automated_transactions_t&); -#endif - -public: - automated_transactions_deque automated_transactions; - -#ifdef DEBUG_ENABLED - automated_transactions_t() { - DEBUG_PRINT("ledger.memory.ctors", "ctor automated_transactions_t"); - } -#endif - ~automated_transactions_t() { - DEBUG_PRINT("ledger.memory.dtors", "dtor automated_transactions_t"); - for (automated_transactions_deque::iterator i - = automated_transactions.begin(); - i != automated_transactions.end(); - i++) - delete *i; - } - - void extend_entry(entry_t& entry) { - for (automated_transactions_deque::iterator i - = automated_transactions.begin(); - i != automated_transactions.end(); - i++) - (*i)->extend_entry(entry); - } - - void add_automated_transaction(automated_transaction_t * auto_xact) { - automated_transactions.push_back(auto_xact); - } - bool remove_automated_transaction(automated_transaction_t * auto_xact) { - for (automated_transactions_deque::iterator i - = automated_transactions.begin(); - i != automated_transactions.end(); - i++) { - if (*i == auto_xact) { - automated_transactions.erase(i); - return true; - } - } - return false; - } -}; - -struct autoxact_finalizer_t : public entry_finalizer_t { - automated_transactions_t auto_xacts; - virtual bool operator()(entry_t& entry) { - if (! auto_xacts.automated_transactions.empty()) - auto_xacts.extend_entry(entry); - return true; - } -}; - -} // namespace ledger - -#endif // _AUTOXACT_H |