Used a more uniform of logging and added a commandline parser.
[UnsignedByte.git] / src / DB / Savables / Trace.cpp
blobb0810626fee709723a03076eafda133c418af9d9
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "Trace.h"
22 #include "Global.h"
23 #include "FieldImpls.h"
24 #include "Account.h"
25 #include "AccountManager.h"
26 #include "TableImpls.h"
28 using mud::Trace;
29 using namespace mud;
31 Trace::Trace(SavableManagerPtr trace) :
32 m_trace(trace)
34 Assert(trace);
37 Trace::~Trace(void)
39 Unlock();
42 const std::string& Trace::getDiff() const
44 return m_trace->getValue(db::TableImpls::Get()->TRACES->DIFF)->getStringValue();
47 const std::string& Trace::getDescription() const
49 return m_trace->getValue(db::TableImpls::Get()->TRACES->DESCRIPTION)->getStringValue();
52 value_type Trace::getAccount() const
54 return m_trace->getValue(db::TableImpls::Get()->TRACES->FKACCOUNTS)->getIntegerValue();
57 time_t Trace::getTime() const
59 return m_trace->getValue(db::TableImpls::Get()->TRACES->TIME)->getIntegerValue();
62 void Trace::setDiff(const std::string& diff)
64 Lock();
65 ValuePtr value(new FieldValue(db::TableImpls::Get()->TRACES->DIFF, diff));
66 m_trace->setValue(value);
69 void Trace::setDescription(const std::string& description)
71 Lock();
72 ValuePtr value(new FieldValue(db::TableImpls::Get()->TRACES->DESCRIPTION, description));
73 m_trace->setValue(value);
76 void Trace::setTime(time_t time)
78 Lock();
79 ValuePtr value(new FieldValue(db::TableImpls::Get()->TRACES->TIME, time));
80 m_trace->setValue(value);
83 void Trace::setAccount(value_type account)
85 Lock();
86 ValuePtr value(new FieldValue(db::TableImpls::Get()->TRACES->FKACCOUNTS, account));
87 m_trace->setValue(value);
91 void Trace::Delete()
93 Lock();
94 m_trace->erase();
97 void Trace::Save()
99 Lock();
100 m_trace->save();
103 void Trace::Discard()
105 Lock();
106 m_trace->discard();
109 bool Trace::Exists()
111 return m_trace->exists();
114 TableImplPtr Trace::getTable() const
116 return m_trace->getTable();
119 SavableManagerPtr mud::Trace::getManager() const
121 return m_trace;