26 #include "ns3/nstime.h"
68 res = sqlite3_get_table (
m_db,
70 &result, &nrows, &ncols,
73 if (res != SQLITE_OK) {
96 sqlite3_free_table (result);
110 if (sqlite3_open (m_dbFile.c_str (), &
m_db)) {
111 NS_LOG_ERROR (
"Could not open sqlite3 database \"" << m_dbFile <<
"\"");
113 sqlite3_close (
m_db);
120 Exec (
"create table if not exists Experiments (run, experiment, strategy, input, description text)");
121 Exec (
"insert into Experiments (run,experiment,strategy,input,description) values ('" +
128 Exec (
"create table if not exists Metadata ( run text, key text, value)");
132 std::pair<std::string, std::string> blob = (*i);
133 Exec (
"insert into Metadata (run,key,value) values ('" +
135 blob.first +
"', '" +
143 (*i)->Output (callback);
147 sqlite3_close (
m_db);
159 m_owner->Exec (
"create table if not exists Singletons ( run text, name text, variable text, value )");
166 std::string variable,
187 std::string variable,
192 std::stringstream sstr;
193 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
194 m_runLabel <<
"', '" <<
198 m_owner->Exec (sstr.str ());
204 std::string variable,
209 std::stringstream sstr;
210 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
211 m_runLabel <<
"', '" <<
215 m_owner->Exec (sstr.str ());
220 std::string variable,
225 std::stringstream sstr;
226 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
227 m_runLabel <<
"', '" <<
231 m_owner->Exec (sstr.str ());
236 std::string variable,
241 std::stringstream sstr;
242 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
243 m_runLabel <<
"', '" <<
245 variable <<
"', '" <<
247 m_owner->Exec (sstr.str ());
252 std::string variable,
257 std::stringstream sstr;
258 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
259 m_runLabel <<
"', '" <<
263 m_owner->Exec (sstr.str ());
DataCalculatorList::iterator DataCalculatorEnd()
Returns an iterator to the past-the-end of the DataCalculator list.
Simulation virtual time values and global simulation resolution.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual double getMin() const =0
Returns the minimum of the values.
virtual ~SqliteDataOutput()
Abstract class for calculating statistical data.
virtual double getSqrSum() const =0
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::string GetRunLabel() const
Return the runID label.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Class to generate OMNeT output.
virtual double getStddev() const =0
Returns the standard deviation of the (weighted) observations.
MetadataList::iterator MetadataBegin()
Returns an iterator to the beginning of the metadata list.
virtual double getMax() const =0
Returns the maximum of the values.
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
std::string GetStrategyLabel() const
Return the strategy label.
std::string GetExperimentLabel() const
Return the experiment label.
SqliteOutputCallback(Ptr< SqliteDataOutput > owner, std::string run)
Constructor.
std::string m_filePrefix
File prefix for the DataOutputInterface.
int64_t GetTimeStep(void) const
virtual double getSum() const =0
void OutputSingleton(std::string key, std::string variable, int val)
Generates a single data output.
std::string GetDescription() const
Return the description label.
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
DataCalculatorList::iterator DataCalculatorBegin()
Returns an iterator to the beginning of the DataCalculator list.
sqlite3 * m_db
pointer to the SQL database
bool isNaN(double x)
true if x is NaN
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
void OutputStatistic(std::string key, std::string variable, const StatisticalSummary *statSum)
Generates data statistics.
std::string GetInputLabel() const
Return the input label.
int Exec(std::string exe)
Execute a sqlite3 query.
virtual long getCount() const =0
Returns the number of observations.
virtual void Output(DataCollector &dc)
Outputs information from the provided DataCollector.
MetadataList::iterator MetadataEnd()
Returns an iterator to the past-the-end of the metadata list.