3570
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
2 |
/*
|
|
3 |
* Copyright (c) 2008 Drexel University
|
|
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 version 2 as
|
|
7 |
* published by the Free Software Foundation;
|
|
8 |
*
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
* GNU General Public License for more details.
|
|
13 |
*
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
15 |
* along with this program; if not, write to the Free Software
|
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
*
|
|
18 |
* Author: Joe Kopena (tjkopena@cs.drexel.edu)
|
|
19 |
*/
|
|
20 |
|
|
21 |
#ifndef __SQLITE_DATA_OUTPUT_H__
|
|
22 |
#define __SQLITE_DATA_OUTPUT_H__
|
|
23 |
|
|
24 |
#include "ns3/nstime.h"
|
|
25 |
|
|
26 |
#include "data-output-interface.h"
|
|
27 |
|
|
28 |
#define STATS_HAS_SQLITE3
|
|
29 |
|
|
30 |
class sqlite3;
|
|
31 |
|
|
32 |
namespace ns3 {
|
|
33 |
|
|
34 |
//------------------------------------------------------------
|
|
35 |
//--------------------------------------------
|
|
36 |
class SqliteDataOutput : public DataOutputInterface {
|
|
37 |
public:
|
|
38 |
SqliteDataOutput();
|
|
39 |
virtual ~SqliteDataOutput();
|
|
40 |
|
|
41 |
virtual void Output(DataCollector &dc);
|
|
42 |
|
|
43 |
void SetDBFile(const std::string file);
|
|
44 |
std::string GetDBFile() const;
|
|
45 |
|
|
46 |
protected:
|
|
47 |
virtual void DoDispose();
|
|
48 |
|
|
49 |
private:
|
|
50 |
class SqliteOutputCallback : public DataOutputCallback {
|
|
51 |
public:
|
|
52 |
SqliteOutputCallback(Ptr<SqliteDataOutput> owner, std::string run);
|
|
53 |
|
|
54 |
void OutputSingleton(std::string key,
|
|
55 |
std::string variable,
|
|
56 |
int val);
|
|
57 |
|
|
58 |
void OutputSingleton(std::string key,
|
|
59 |
std::string variable,
|
|
60 |
uint32_t val);
|
|
61 |
|
|
62 |
void OutputSingleton(std::string key,
|
|
63 |
std::string variable,
|
|
64 |
double val);
|
|
65 |
|
|
66 |
void OutputSingleton(std::string key,
|
|
67 |
std::string variable,
|
|
68 |
std::string val);
|
|
69 |
|
|
70 |
void OutputSingleton(std::string key,
|
|
71 |
std::string variable,
|
|
72 |
Time val);
|
|
73 |
|
|
74 |
private:
|
|
75 |
Ptr<SqliteDataOutput> m_owner;
|
|
76 |
std::string m_runLabel;
|
|
77 |
|
|
78 |
// end class SqliteOutputCallback
|
|
79 |
};
|
|
80 |
|
|
81 |
|
|
82 |
sqlite3 *m_db;
|
|
83 |
int Exec(std::string exe);
|
|
84 |
|
|
85 |
std::string m_dbFile;
|
|
86 |
// end class SqliteDataOutput
|
|
87 |
};
|
|
88 |
|
|
89 |
// end namespace ns3
|
|
90 |
};
|
|
91 |
|
|
92 |
|
|
93 |
#endif // __SQLITE_DATA_OUTPUT_H__
|