26 #include "ns3/nstime.h"
65 res = sqlite3_get_table (
m_db,
67 &result, &nrows, &ncols,
70 if (res != SQLITE_OK) {
93 sqlite3_free_table (result);
105 if (sqlite3_open (m_dbFile.c_str (), &
m_db)) {
106 NS_LOG_ERROR (
"Could not open sqlite3 database \"" << m_dbFile <<
"\"");
108 sqlite3_close (
m_db);
115 Exec (
"create table if not exists Experiments (run, experiment, strategy, input, description text)");
116 Exec (
"insert into Experiments (run,experiment,strategy,input,description) values ('" +
123 Exec (
"create table if not exists Metadata ( run text, key text, value)");
127 std::pair<std::string, std::string> blob = (*i);
128 Exec (
"insert into Metadata (run,key,value) values ('" +
130 blob.first +
"', '" +
138 (*i)->Output (callback);
142 sqlite3_close (
m_db);
153 m_owner->Exec (
"create table if not exists Singletons ( run text, name text, variable text, value )");
160 std::string variable,
179 std::string variable,
183 std::stringstream sstr;
184 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
185 m_runLabel <<
"', '" <<
189 m_owner->Exec (sstr.str ());
195 std::string variable,
198 std::stringstream sstr;
199 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
200 m_runLabel <<
"', '" <<
204 m_owner->Exec (sstr.str ());
209 std::string variable,
212 std::stringstream sstr;
213 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
214 m_runLabel <<
"', '" <<
218 m_owner->Exec (sstr.str ());
223 std::string variable,
226 std::stringstream sstr;
227 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
228 m_runLabel <<
"', '" <<
230 variable <<
"', '" <<
232 m_owner->Exec (sstr.str ());
237 std::string variable,
240 std::stringstream sstr;
241 sstr <<
"insert into Singletons (run,name,variable,value) values ('" <<
242 m_runLabel <<
"', '" <<
246 m_owner->Exec (sstr.str ());
DataCalculatorList::iterator DataCalculatorEnd()
Returns an iterator to the past-the-end of the DataCalculator list.
keep track of time values and allow control of global simulation resolution
smart pointer class similar to boost::intrusive_ptr
virtual double getMin() const =0
Returns the minimum of the values.
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
virtual ~SqliteDataOutput()
Abstract class for calculating statistical data.
virtual double getSqrSum() const =0
std::string GetRunLabel() const
Return the runID label.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
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)
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.