Browse Source

C++11 refactoring

pull/3/head
Eyck Jentzsch 3 years ago
parent
commit
92802d5430
9 changed files with 112 additions and 90 deletions
  1. +7
    -6
      incl/scc/core/sc_logic_7.h
  2. +2
    -1
      incl/scv4tlm/tlm2_recorder.h
  3. +2
    -1
      incl/scv4tlm/tlm_recording_extension.h
  4. +4
    -2
      incl/util/ities.h
  5. +12
    -8
      incl/util/logging.h
  6. +3
    -2
      src/report.cpp
  7. +57
    -50
      src/sc_logic_7.cpp
  8. +7
    -6
      src/scv_tr_compressed.cpp
  9. +18
    -14
      src/scv_tr_sqlite/scv_tr_sqlite.cpp

+ 7
- 6
incl/scc/core/sc_logic_7.h View File

@ -23,6 +23,7 @@
#ifndef INCL_SYSC_CORE_SC_LOGIC_7_H_
#define INCL_SYSC_CORE_SC_LOGIC_7_H_
#include <cstdio>
#include <array>
#include "sysc/datatypes/bit/sc_bit.h"
#include "sysc/kernel/sc_macros.h"
@ -92,12 +93,12 @@ private:
public:
// conversion tables
static const sc_logic_7_value_t char_to_logic[128];
static const char logic_to_char[7];
static const sc_logic_7_value_t and_table[7][7];
static const sc_logic_7_value_t or_table[7][7];
static const sc_logic_7_value_t xor_table[7][7];
static const sc_logic_7_value_t not_table[7];
static std::array<const sc_logic_7_value_t, 128> char_to_logic;
static std::array<const char, 7> logic_to_char;
static std::array<std::array<const sc_logic_7_value_t, 7>, 7> and_table;
static std::array<std::array<const sc_logic_7_value_t, 7>, 7> or_table;
static std::array<std::array<const sc_logic_7_value_t, 7>, 7> xor_table;
static std::array<const sc_logic_7_value_t, 7> not_table;
// constructors

+ 2
- 1
incl/scv4tlm/tlm2_recorder.h View File

@ -26,6 +26,7 @@
#include <tlm>
#include <tlm_utils/peq_with_cb_and_phase.h>
#include <vector>
#include <array>
namespace scv4tlm {
@ -298,7 +299,7 @@ private:
//! blocking transaction recording stream handle
scv_tr_stream *b_streamHandle;
//! transaction generator handle for blocking transactions
scv_tr_generator<sc_dt::uint64, sc_dt::uint64> *b_trHandle[3];
class="n">std class="o">: class="o">: class="n">array<scv_tr_generator<sc_dt::uint64,sc_dt::uint64> *,3> b_trHandle;
//! timed blocking transaction recording stream handle
scv_tr_stream *b_streamHandleTimed;
//! transaction generator handle for blocking transactions with annotated

+ 2
- 1
incl/scv4tlm/tlm_recording_extension.h View File

@ -18,6 +18,7 @@
#define TLM_RECORDING_EXTENSION_H_
#include <scv.h>
#include <array>
namespace scv4tlm {
@ -27,7 +28,7 @@ enum tx_rel {
PREDECESSOR_SUCCESSOR /*!< indicates predecessor successor relationship */
};
//! the string representation of the tx_rel
static char const *tx_rel_str[] = {"PARENT/CHILD", "PRED/SUCC"};
static std::array<const char*, 2> tx_rel_str = { { "PARENT/CHILD", "PRED/SUCC" } };
/*! \brief cast the tx_rel enum to a string
*
* \param tc_rel is the relationship enum

+ 4
- 2
incl/util/ities.h View File

@ -20,6 +20,7 @@
#include <bitset>
#include <vector>
#include <type_traits>
#include <array>
// some helper functions
template <unsigned int bit, unsigned int width, typename T> inline constexpr T bit_sub(T v) {
@ -36,8 +37,9 @@ inline constexpr typename std::make_signed::type signed_bit_sub(T v) {
namespace util {
// according to
// http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup
static const int MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9};
static std::array<const int, 32> MultiplyDeBruijnBitPosition = { {
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 } };
template <size_t N> constexpr size_t find_first(std::bitset<N> &bits) {
static_assert(N <= 32, "find_first only supports bitsets smaller than 33");
return MultiplyDeBruijnBitPosition[((uint32_t)((bits.to_ulong() & -bits.to_ulong()) * 0x077CB531U)) >> 27];

+ 12
- 8
incl/util/logging.h View File

@ -33,12 +33,12 @@
namespace logging {
static const char *const buffer[] = {LEVELS(DO_DESCRIPTION)};
static std::array<const char*const ,7> buffer = { {LEVELS(DO_DESCRIPTION)} };
enum log_level { LEVELS(DO_ENUM) };
inline log_level as_log_level(int logLevel) {
assert(logLevel >= NONE && logLevel <= TRACE);
const log_level m[] = {NONE, FATAL, ERROR, WARNING, INFO, DEBUG, TRACE};
class="n">std class="o">: class="o">: class="n">array<const log_level, 7> m = { { NONE, FATAL, ERROR, WARNING, INFO, DEBUG, TRACE } };
return m[logLevel];
}
@ -101,7 +101,10 @@ protected:
static log_level level = TRACE;
return level;
}
static const char *const *get_log_level_cstr() { return buffer; };
static const char * const *get_log_level_cstr() {
return buffer.data();
}
;
std::ostringstream os;
};
@ -154,6 +157,7 @@ class DEFAULT {};
#if defined(WIN32)
#include <windows.h>
#include <array>
inline std::string now_time() {
const int MAX_LEN = 200;
@ -168,16 +172,16 @@ inline std::string now_time() {
#else
inline std::string now_time() {
char buffer[11];
static std::array<char, 11> buffer;
static std::array<char, 100> result;
time_t t;
time(&t);
tm r = {0};
strftime(buffer, sizeof(buffer), "%X", localtime_r(&t, &r));
strftime(buffer.data(), buffer.size(), "%X", localtime_r(&t, &r));
struct timeval tv;
gettimeofday(&tv, nullptr);
char result[100] = {0};
sprintf(result, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
return result;
sprintf(result.data(), "%s.%03ld", buffer.data(), (long) tv.tv_usec / 1000);
return result.data();
}
#endif // WIN32

+ 3
- 2
src/report.cpp View File

@ -1,3 +1,4 @@
#include <array>
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
@ -68,7 +69,7 @@ static const std::string compose_message(const sc_report &rep) {
os << rep.get_msg_type();
if (*rep.get_msg()) os << ": " << rep.get_msg();
if (rep.get_severity() > SC_INFO) {
char line_number_str[16];
std::array<char, 16> line_number_str;
os << " [FILE:" << rep.get_file_name() << ":" << rep.get_line_number() << "]";
sc_simcontext *simc = sc_get_curr_simcontext();
if (simc && sc_is_running()) {
@ -80,7 +81,7 @@ static const std::string compose_message(const sc_report &rep) {
}
static void report_handler(const sc_report &rep, const sc_actions &actions) {
const logging::log_level map[] = {logging::INFO, logging::WARNING, logging::ERROR, logging::FATAL};
class="n">std class="o">: class="o">: class="n">array<const logging::log_level, 4> map = { { logging::INFO, logging::WARNING, logging::ERROR, logging::FATAL } };
if (actions & SC_DISPLAY)
if (map[rep.get_severity()] <= logging::Log<logging::Output2FILE<logging::SystemC>>::reporting_level() &&
logging::Output2FILE<logging::SystemC>::stream())

+ 57
- 50
src/sc_logic_7.cpp View File

@ -1,3 +1,4 @@
#include <array>
/*******************************************************************************
* Copyright 2017 MINRES Technologies GmbH
*
@ -28,21 +29,21 @@ namespace scc {
namespace sc_dt {
void sc_logic_7::invalid_value(sc_logic_7_value_t v) {
char msg[BUFSIZ];
std::sprintf(msg, "sc_logic_7( %d )", v);
SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_, msg);
std::array<char, BUFSIZ> msg;
std::sprintf(msg.data(), "sc_logic_7( %d )", v);
msg.data();
}
void sc_logic_7::invalid_value(char c) {
char msg[BUFSIZ];
std::sprintf(msg, "sc_logic_7( '%c' )", c);
SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_, msg);
std::array<char, BUFSIZ> msg;
std::sprintf(msg.data(), "sc_logic_7( '%c' )", c);
msg.data();
}
void sc_logic_7::invalid_value(int i) {
char msg[BUFSIZ];
std::sprintf(msg, "sc_logic_7( %d )", i);
SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_, msg);
std::array<char, BUFSIZ> msg;
std::sprintf(msg.data(), "sc_logic_7( %d )", i);
msg.data();
}
void sc_logic_7::invalid_01() const {
@ -55,47 +56,53 @@ void sc_logic_7::invalid_01() const {
// conversion tables
const sc_logic_7_value_t sc_logic_7::char_to_logic[128] = {
Log_0, Log_1, Log_L, Log_H, Log_Z, Log_X, Log_U, Log_X, // 0
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 1
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 2
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_0, Log_1, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 3
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 4
Log_H, Log_X, Log_X, Log_X, Log_L, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_U, Log_X, Log_X, // 5
Log_X, Log_X, Log_Z, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 6
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 9
Log_X, Log_X, Log_Z, Log_X, Log_X, Log_X, Log_X, Log_X};
const char sc_logic_7::logic_to_char[7] = {'0', '1', 'L', 'H', 'Z', 'X', 'U'};
const sc_logic_7_value_t sc_logic_7::and_table[7][7] = { // 0 1 L H Z X U
/*0*/ {Log_0, Log_0, Log_0, Log_0, Log_0, Log_0, Log_0},
/*1*/ {Log_0, Log_1, Log_L, Log_1, Log_X, Log_X, Log_X},
/*L*/ {Log_0, Log_L, Log_L, Log_L, Log_L, Log_L, Log_L},
/*H*/ {Log_0, Log_1, Log_L, Log_H, Log_X, Log_X, Log_X},
/*Z*/ {Log_0, Log_X, Log_L, Log_X, Log_X, Log_X, Log_X},
/*X*/ {Log_0, Log_X, Log_L, Log_X, Log_X, Log_X, Log_X},
/*U*/ {Log_0, Log_X, Log_L, Log_X, Log_X, Log_X, Log_X}};
const sc_logic_7_value_t sc_logic_7::or_table[7][7] = { // 0 1 L H Z X U
/*0*/ {Log_0, Log_1, Log_L, Log_H, Log_Z, Log_X, Log_U},
/*1*/ {Log_1, Log_1, Log_1, Log_1, Log_1, Log_1, Log_1},
/*L*/ {Log_L, Log_1, Log_L, Log_H, Log_Z, Log_X, Log_U},
/*H*/ {Log_H, Log_1, Log_H, Log_H, Log_H, Log_H, Log_H},
/*Z*/ {Log_Z, Log_1, Log_Z, Log_H, Log_X, Log_X, Log_X},
/*X*/ {Log_X, Log_1, Log_X, Log_H, Log_X, Log_X, Log_X},
/*U*/ {Log_U, Log_1, Log_U, Log_H, Log_X, Log_X, Log_X}};
const sc_logic_7_value_t sc_logic_7::xor_table[7][7] = { // 0 1 L H Z X U
/*0*/ {Log_0, Log_1, Log_0, Log_1, Log_X, Log_X, Log_X},
/*1*/ {Log_1, Log_0, Log_1, Log_0, Log_X, Log_X, Log_X},
/*L*/ {Log_0, Log_1, Log_H, Log_L, Log_X, Log_X, Log_X},
/*H*/ {Log_1, Log_0, Log_L, Log_H, Log_X, Log_X, Log_X},
/*Z*/ {Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X},
/*X*/ {Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X},
/*U*/ {Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X}};
const sc_logic_7_value_t sc_logic_7::not_table[7] = {Log_1, Log_0, Log_H, Log_L, Log_X, Log_X, Log_X};
std::array<const sc_logic_7_value_t, 128> sc_logic_7::char_to_logic = { {
Log_0, Log_1, Log_L, Log_H, Log_Z, Log_X, Log_U, Log_X, // 0
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 1
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 2
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_0, Log_1, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 3
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 4
Log_H, Log_X, Log_X, Log_X, Log_L, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_U, Log_X, Log_X, // 5
Log_X, Log_X, Log_Z, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 6
Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, // 9
Log_X, Log_X, Log_Z, Log_X, Log_X, Log_X, Log_X, Log_X } };
std::array<const char, 7> sc_logic_7::logic_to_char = { { '0', '1', 'L', 'H', 'Z', 'X', 'U' } };
std::array<std::array<const sc_logic_7_value_t, 7>, 7> sc_logic_7::and_table = { {
// 0 1 L H Z X U
/*0*/ {Log_0, Log_0, Log_0, Log_0, Log_0, Log_0, Log_0},
/*1*/ {Log_0, Log_1, Log_L, Log_1, Log_X, Log_X, Log_X},
/*L*/ {Log_0, Log_L, Log_L, Log_L, Log_L, Log_L, Log_L},
/*H*/ {Log_0, Log_1, Log_L, Log_H, Log_X, Log_X, Log_X},
/*Z*/ {Log_0, Log_X, Log_L, Log_X, Log_X, Log_X, Log_X},
/*X*/ {Log_0, Log_X, Log_L, Log_X, Log_X, Log_X, Log_X},
/*U*/ {Log_0, Log_X, Log_L, Log_X, Log_X, Log_X, Log_X}
} };
std::array<std::array<const sc_logic_7_value_t, 7>, 7> sc_logic_7::or_table = { {
// 0 1 L H Z X U
/*0*/ {Log_0, Log_1, Log_L, Log_H, Log_Z, Log_X, Log_U},
/*1*/ {Log_1, Log_1, Log_1, Log_1, Log_1, Log_1, Log_1},
/*L*/ {Log_L, Log_1, Log_L, Log_H, Log_Z, Log_X, Log_U},
/*H*/ {Log_H, Log_1, Log_H, Log_H, Log_H, Log_H, Log_H},
/*Z*/ {Log_Z, Log_1, Log_Z, Log_H, Log_X, Log_X, Log_X},
/*X*/ {Log_X, Log_1, Log_X, Log_H, Log_X, Log_X, Log_X},
/*U*/ {Log_U, Log_1, Log_U, Log_H, Log_X, Log_X, Log_X}
} };
std::array<std::array<const sc_logic_7_value_t, 7>, 7> sc_logic_7::xor_table = { {
// 0 1 L H Z X U
/*0*/ {Log_0, Log_1, Log_0, Log_1, Log_X, Log_X, Log_X},
/*1*/ {Log_1, Log_0, Log_1, Log_0, Log_X, Log_X, Log_X},
/*L*/ {Log_0, Log_1, Log_H, Log_L, Log_X, Log_X, Log_X},
/*H*/ {Log_1, Log_0, Log_L, Log_H, Log_X, Log_X, Log_X},
/*Z*/ {Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X},
/*X*/ {Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X},
/*U*/ {Log_X, Log_X, Log_X, Log_X, Log_X, Log_X, Log_X}
} };
std::array<const sc_logic_7_value_t, 7> sc_logic_7::not_table = { { Log_1, Log_0, Log_H, Log_L, Log_X, Log_X, Log_X } };
// other methods

+ 7
- 6
src/scv_tr_compressed.cpp View File

@ -82,6 +82,7 @@
#include "scv/scv_tr.h"
// clang-format on
#include <zlib.h>
#include <array>
// ----------------------------------------------------------------------------
#ifdef _MSC_VER
@ -445,10 +446,10 @@ static void do_attributes(bool declare_attributes, // If false then print the va
} break;
default: {
char tmpString[100];
sprintf(tmpString, "Unsupported attribute type = %d", my_exts_p->get_type());
std::array<char, 100> tmpString;
sprintf(tmpString.data(), "Unsupported attribute type = %d", my_exts_p->get_type());
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, tmpString);
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, tmpString.data());
}
}
}
@ -584,9 +585,9 @@ static void scv_tr_handle_record_attribute_cbf(const scv_tr_handle &t, const cha
tmp_str = attribute_name;
}
char tmp_str2[100];
sprintf(tmp_str2, "tx_record_attribute " scv_tr_TEXT_LLU, t.get_id());
std::string exts_kind = tmp_str2;
std::array<char, 100> tmp_str2;
sprintf(tmp_str2.data(), "tx_record_attribute " scv_tr_TEXT_LLU, t.get_id());
std::string exts_kind = tmp_str2.data();
do_attributes(false, false, true, tmp_str, exts_kind, my_exts_p, 0);
}

+ 18
- 14
src/scv_tr_sqlite/scv_tr_sqlite.cpp View File

@ -19,6 +19,7 @@
#include <string>
#include <vector>
#include <sstream>
#include <array>
// clang-format off
#include "scv/scv_util.h"
#include "scv/scv_introspection.h"
@ -26,7 +27,7 @@
// clang-format on
#include "sqlite3.h"
// ----------------------------------------------------------------------------
#define SQLITEWRAPPER_ERROR 1000
constexpr auto SQLITEWRAPPER_ERROR = 1000;
// ----------------------------------------------------------------------------
using namespace std;
@ -65,7 +66,10 @@ public:
}
}
inline int exec(const string szSQL) { return exec(szSQL.c_str()); };
inline int exec(const string szSQL) {
return exec(szSQL);
}
;
int exec(const char *szSQL) {
checkDB();
@ -111,7 +115,7 @@ static void dbCb(const scv_tr_db &_scv_tr_db, scv_tr_db::callback_reason reason,
try {
if (fName.size() < 5 || fName.find(".txdb", fName.size() - 5) == string::npos) fName += ".txdb";
remove(fName.c_str());
db.open(fName.c_str());
db.open(fName);
// performance related according to
// http://blog.quibb.org/2010/08/fast-bulk-inserts-into-sqlite/
db.exec("PRAGMA synchronous=OFF");
@ -141,7 +145,7 @@ static void dbCb(const scv_tr_db &_scv_tr_db, scv_tr_db::callback_reason reason,
queryBuilder.str("");
queryBuilder << "INSERT INTO " SIM_PROPS " (time_resolution) values ("
<< (long)(sc_get_time_resolution().to_seconds() * 1e15) << ");";
db.exec(queryBuilder.str().c_str());
db.exec(queryBuilder.str());
} catch (SQLiteDB::SQLiteException &e) {
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, "Can't open recording file");
}
@ -167,7 +171,7 @@ static void streamCb(const scv_tr_stream &s, scv_tr_stream::callback_reason reas
queryBuilder.str("");
queryBuilder << "INSERT INTO " STREAM_TABLE " (id, name, kind) values (" << s.get_id() << ",'"
<< s.get_name() << "','" << (s.get_stream_kind() ? s.get_stream_kind() : "<unnamed>") << "');";
db.exec(queryBuilder.str().c_str());
db.exec(queryBuilder.str());
if (concurrencyLevel.size() <= s.get_id()) concurrencyLevel.resize(s.get_id() + 1);
concurrencyLevel[s.get_id()] = new vector<uint64_t>();
} catch (SQLiteDB::SQLiteException &e) {
@ -181,7 +185,7 @@ void recordAttribute(uint64_t id, EventType event, const string &name, data_type
queryBuilder.str("");
queryBuilder << "INSERT INTO " TX_ATTRIBUTE_TABLE " (tx,type,name,data_type,data_value)"
<< " values (" << id << "," << event << ",'" << name << "'," << type << ",'" << value << "');";
db.exec(queryBuilder.str().c_str());
db.exec(queryBuilder.str());
} catch (SQLiteDB::SQLiteException &e) {
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, "Can't create attribute entry");
}
@ -262,9 +266,9 @@ static void recordAttributes(uint64_t id, EventType eventType, string &prefix, c
}
break;
default: {
char tmpString[100];
sprintf(tmpString, "Unsupported attribute type = %d", my_exts_p->get_type());
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, tmpString);
std::array<char, 100> tmpString;
sprintf(tmpString.data(), "Unsupported attribute type = %d", my_exts_p->get_type());
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, tmpString.data());
}
}
}
@ -276,7 +280,7 @@ static void generatorCb(const scv_tr_generator_base &g, scv_tr_generator_base::c
queryBuilder << "INSERT INTO " GENERATOR_TABLE " (id,stream, name)"
<< " values (" << g.get_id() << "," << g.get_scv_tr_stream().get_id() << ",'" << g.get_name()
<< "');";
db.exec(queryBuilder.str().c_str());
db.exec(queryBuilder.str());
} catch (SQLiteDB::SQLiteException &e) {
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, "Can't create generator entry");
}
@ -311,12 +315,12 @@ static void transactionCb(const scv_tr_handle &t, scv_tr_handle::callback_reason
queryBuilder << "INSERT INTO " TX_TABLE " (id,generator,stream, concurrencyLevel)"
<< " values (" << id << "," << t.get_scv_tr_generator_base().get_id() << ","
<< t.get_scv_tr_stream().get_id() << "," << concurrencyIdx << ");";
db.exec(queryBuilder.str().c_str());
db.exec(queryBuilder.str());
queryBuilder.str("");
queryBuilder << "INSERT INTO " TX_EVENT_TABLE " (tx,type,time)"
<< " values (" << id << "," << BEGIN << "," << t.get_begin_sc_time().value() << ");";
db.exec(queryBuilder.str().c_str());
db.exec(queryBuilder.str());
} catch (SQLiteDB::SQLiteException &e) {
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, e.errorMessage());
@ -342,7 +346,7 @@ static void transactionCb(const scv_tr_handle &t, scv_tr_handle::callback_reason
queryBuilder.str("");
queryBuilder << "INSERT INTO " TX_EVENT_TABLE " (tx,type,time)"
<< " values (" << t.get_id() << "," << END << "," << t.get_end_sc_time().value() << ");";
db.exec(queryBuilder.str().c_str());
db.exec(queryBuilder.str());
} catch (SQLiteDB::SQLiteException &e) {
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, "Can't create transaction end");
@ -378,7 +382,7 @@ static void relationCb(const scv_tr_handle &tr_1, const scv_tr_handle &tr_2, voi
queryBuilder << "INSERT INTO " TX_RELATION_TABLE " (name,sink,src)"
<< "values ('" << tr_1.get_scv_tr_stream().get_scv_tr_db()->get_relation_name(relation_handle)
<< "'," << tr_1.get_id() << "," << tr_2.get_id() << ");";
db.exec(queryBuilder.str().c_str());
db.exec(queryBuilder.str());
} catch (SQLiteDB::SQLiteException &e) {
_scv_message::message(_scv_message::TRANSACTION_RECORDING_INTERNAL, "Can't create transaction relation");

Loading…
Cancel
Save