From 13f286925b1e9e34fe71413edcba23686c005f8a Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 25 Jan 2011 12:17:47 +0000 Subject: New database layout. --- server/src/journal.cc | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'server/src/journal.cc') diff --git a/server/src/journal.cc b/server/src/journal.cc index 1f79c9f..70dba2f 100644 --- a/server/src/journal.cc +++ b/server/src/journal.cc @@ -79,14 +79,19 @@ void Journal::addEntry(std::string resume, std::string macro, int index) std::string r = resume; std::string m = macro; + DEBUG(journal, "Add: %p %s - %s\n", this, m.c_str(), r.c_str()); + ResumeEntry re; re.resume = r; re.macro = m; + re.dirty = false; entrylist[index] = re; } std::string Journal::getEntry(std::string macro) { + DEBUG(journal, "Get: %p %s\n", this, macro.c_str()); + std::map< int, ResumeEntry >::iterator i = entrylist.begin(); while(i != entrylist.end()) { if(i->second.macro == macro) return i->second.resume; @@ -97,6 +102,8 @@ std::string Journal::getEntry(std::string macro) void Journal::removeEntry(std::string macro) { + DEBUG(journal, "Remove: %p %s\n", this, macro.c_str()); + std::map< int, ResumeEntry >::iterator i = entrylist.begin(); while(i != entrylist.end()) { if(i->second.macro == macro) { @@ -107,6 +114,31 @@ void Journal::removeEntry(std::string macro) } } +void Journal::setDirty(std::string macro) +{ + std::map< int, ResumeEntry >::iterator i = entrylist.begin(); + while(i != entrylist.end()) { + if(i->second.macro == macro) { + i->second.dirty = true; + break; + } + i++; + } +} + +bool Journal::dirty(std::string macro) +{ + std::map< int, ResumeEntry >::iterator i = entrylist.begin(); + while(i != entrylist.end()) { + if(i->second.macro == macro) { + return i->second.dirty; + break; + } + i++; + } + return false; +} + void Journal::setUser(std::string usr) { _user = usr; @@ -126,7 +158,3 @@ std::string Journal::patientID() { return _patientid; } - -#ifdef TEST_JOURNAL - -#endif/*TEST_JOURNAL*/ -- cgit v1.2.3