Browse Source

clean up class vs. struct

pull/3/head
Eyck Jentzsch 2 years ago
parent
commit
db46dcd395

+ 2
- 1
incl/json/json.h View File

@@ -1025,7 +1025,8 @@ private:
Value &resolveReference(const char *key);
Value &resolveReference(const char *key, const char *end);

struct CommentInfo {
class CommentInfo {
public:
CommentInfo();
~CommentInfo();


+ 12
- 10
incl/scc/register.h View File

@@ -37,16 +37,18 @@ namespace scc {

namespace impl {

template <typename T, bool = std::is_integral<T>::value> struct helper {};
template <typename T, bool = std::is_integral<T>::value> class helper {};

template <typename T> struct helper<T, true> {
template <typename T> class helper<T, true> {
public:
using Type = T;
template <typename Type> constexpr Type get_max_uval() {
return std::numeric_limits<Type>::is_signed ? -1 : std::numeric_limits<Type>::max();
}
};

template <typename T> struct helper<T, false> {
template <typename T> class helper<T, false> {
public:
using Type = typename T::StorageType;
template <typename Type> constexpr Type get_max_uval() {
return std::numeric_limits<Type>::is_signed ? -1 : std::numeric_limits<Type>::max();
@@ -58,9 +60,9 @@ template <typename Type> constexpr Type get_max_uval() {
}

template <typename DATATYPE>
struct sc_register : public sc_core::sc_object, public resource_access_if, public traceable {
using this_type = struct sc_register<DATATYPE>;
class sc_register : public sc_core::sc_object, public resource_access_if, public traceable {
public:
using this_type = class sc_register<DATATYPE>;
/**
*
* @param nm
@@ -226,8 +228,8 @@ private:
template <typename DATATYPE> using sc_register = impl::sc_register<typename impl::helper<DATATYPE>::Type>;

template <typename DATATYPE, size_t SIZE, size_t START = 0>
struct sc_register_indexed : public indexed_resource_access_if {
class sc_register_indexed : public indexed_resource_access_if {
public:
using BASE_DATA_TYPE = typename impl::helper<DATATYPE>::Type;

using value_type = sc_register<DATATYPE>;
@@ -288,8 +290,8 @@ private:

template <typename DATATYPE, DATATYPE WRMASK = impl::get_max_uval<DATATYPE>(),
DATATYPE RDMASK = impl::get_max_uval<DATATYPE>()>
struct sc_register_masked : public sc_register<DATATYPE> {
class sc_register_masked : public sc_register<DATATYPE> {
public:
sc_register_masked(sc_core::sc_module_name nm, DATATYPE &storage, const DATATYPE reset_val, resetable &owner)
: sc_register<DATATYPE>(nm, storage, reset_val, owner, RDMASK, WRMASK) {}
};

+ 1
- 1
incl/scc/report.h View File

@@ -30,7 +30,7 @@
#include "scc/utilities.h"

namespace logging {
struct SystemC {};
class SystemC {};
}
namespace scc {


+ 2
- 1
incl/scc/resetable.h View File

@@ -28,7 +28,8 @@

namespace scc {

struct resetable {
class resetable {
public:
/**
*
*/

+ 4
- 2
incl/scc/resource_access_if.h View File

@@ -28,7 +28,8 @@

namespace scc {

struct resource_access_if {
class resource_access_if {
public:
/**
*
*/
@@ -78,7 +79,8 @@ struct resource_access_if {
virtual bool read_dbg(uint8_t *data, std::size_t length, uint64_t offset = 0) const = 0;
};

struct indexed_resource_access_if {
class indexed_resource_access_if {
public:
using value_type = resource_access_if;
using pointer = value_type *;
using const_pointer = const value_type *;

+ 5
- 8
incl/scc/router.h View File

@@ -23,23 +23,20 @@
#ifndef _SYSC_ROUTER_H_
#define _SYSC_ROUTER_H_

#include <util/range_lut.h>
#include "util/range_lut.h"
#include "scc/utilities.h"
// pragmas to disable the deprecated warnings for SystemC headers
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <scv4tlm/tlm_rec_initiator_socket.h>
#include <scv4tlm/tlm_rec_target_socket.h>
#include "scv4tlm/tlm_rec_initiator_socket.h"
#include "scv4tlm/tlm_rec_target_socket.h"
#include "scc/initiator_mixin.h"
#include "scc/target_mixin.h"
#include <sysc/utils/sc_vector.h>
#include <tlm.h>
#pragma GCC diagnostic pop
#include <limits>

namespace scc {

template <unsigned BUSWIDTH = 32> struct router : sc_core::sc_module {
template <unsigned BUSWIDTH = 32> class router : sc_core::sc_module {
public:
using intor_sckt = scc::initiator_mixin<scv4tlm::tlm_rec_initiator_socket<BUSWIDTH>>;
using target_sckt = scc::target_mixin<scv4tlm::tlm_rec_target_socket<BUSWIDTH>>;
/**

+ 2
- 1
incl/scc/target_mixin.h View File

@@ -467,7 +467,8 @@ private:
}

private:
struct mm_end_event_ext : public tlm::tlm_extension<mm_end_event_ext> {
class mm_end_event_ext : public tlm::tlm_extension<mm_end_event_ext> {
public:
tlm::tlm_extension_base *clone() const { return NULL; }
void free() {}
void copy_from(tlm::tlm_extension_base const &) {}

+ 4
- 2
incl/scc/tlm_target.h View File

@@ -37,7 +37,8 @@ struct addr_range {
uint64_t base, size;
};

template <unsigned int BUSWIDTH = 32> struct tlm_target {
template <unsigned int BUSWIDTH = 32> class tlm_target {
public:
using this_type = tlm_target<BUSWIDTH>;
/**
*
@@ -91,7 +92,8 @@ template <unsigned BUSWIDTH = 32> struct target_memory_map_entry {
sc_dt::uint64 size;
};

template <unsigned int BUSWIDTH = 32, unsigned RANGES = 1> struct tlm_multi_rangetarget : public tlm_target<BUSWIDTH> {
template <unsigned int BUSWIDTH = 32, unsigned RANGES = 1> class tlm_multi_rangetarget : public tlm_target<BUSWIDTH> {
public:
using this_type = tlm_multi_rangetarget<BUSWIDTH, RANGES>;

tlm_multi_rangetarget(sc_core::sc_time &clock, std::array<addr_range, RANGES> addr_rngs)

+ 2
- 1
incl/scc/tracer.h View File

@@ -37,7 +37,8 @@ class sc_trace_file;

namespace scc {

struct tracer : public sc_core::sc_module {
class tracer : public sc_core::sc_module {
public:
/**
*
*/

+ 10
- 7
incl/scv4tlm/tlm2_recorder.h View File

@@ -35,7 +35,8 @@ namespace scv4tlm {
* register custom recorder functionality
* to also record the payload extensions
*/
template <typename TYPES = tlm::tlm_base_protocol_types> struct tlm2_extensions_recording_if {
template <typename TYPES = tlm::tlm_base_protocol_types> class tlm2_extensions_recording_if {
public:
/*! \brief recording attributes in extensions at the beginning, it is intended
* to be overload as it does nothing
*
@@ -85,9 +86,9 @@ public:
* If this database is not initialized (e.g. by not calling
* scv_tr_db::set_default_db() ) recording is disabled.
*/
tlm2_recorder(bool recording_enabled = true, scv_tr_db *tr_db = scv_tr_db::get_default_db()) {
this->tlm2_recorder::tlm2_recorder(sc_core::sc_gen_unique_name("tlm2_recorder"), recording_enabled, tr_db);
}
tlm2_recorder(bool recording_enabled = true, scv_tr_db *tr_db = scv_tr_db::get_default_db())
: tlm2_recorder(sc_core::sc_gen_unique_name("tlm2_recorder"), recording_enabled, tr_db)
{ }
/*! \brief The constructor of the component
*
* \param name is the SystemC module name of the recorder
@@ -206,9 +207,10 @@ public:
}

private:
//! \brief the struct to hold the information to be recorded on the timed
//! \brief the class to hold the information to be recorded on the timed
//! streams
struct tlm_recording_payload : public TYPES::tlm_payload_type {
class tlm_recording_payload : public TYPES::tlm_payload_type {
public:
scv_tr_handle parent;
uint64 id;
tlm_recording_payload &operator=(const typename TYPES::tlm_payload_type &x) {
@@ -229,7 +231,8 @@ private:
, id(0) {}
};
//! \brief Memory manager for the tlm_recording_payload
struct RecodingMemoryManager : public tlm::tlm_mm_interface {
class RecodingMemoryManager : public tlm::tlm_mm_interface {
public:
RecodingMemoryManager()
: free_list(0)
, empties(0) {}

+ 4
- 2
incl/scv4tlm/tlm_gp_data.h View File

@@ -22,7 +22,8 @@

namespace scv4tlm {

struct tlm_gp_data {
class tlm_gp_data {
public:
//---------------
// Constructors
//---------------
@@ -435,7 +436,8 @@ private:
unsigned int m_ref_count{0};
};

struct tlm_dmi_data {
class tlm_dmi_data {
public:
tlm_dmi_data() = default;

tlm_dmi_data(tlm::tlm_dmi &dmi_data)

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

@@ -43,7 +43,8 @@ inline const char *rel_str(tx_rel rel) { return (tx_rel_str[rel]); }
* containing a valid handle it links the generated
* SCV transdaction to the found one using the \ref PREDECESSOR releationship
*/
struct tlm_recording_extension : public tlm::tlm_extension<tlm_recording_extension> {
class tlm_recording_extension : public tlm::tlm_extension<tlm_recording_extension> {
public:
/*! \brief clone the given extension and duplicate the SCV transaction handle.
*
*/

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

@@ -31,7 +31,8 @@ freely, subject to the following restrictions:
// All members are public to simplify compliance with sections 9.0.7 and
// 9.5.1 of the C++11 standard, thereby avoiding undefined behavior.
//---------------------------------------------------------
template <typename T, int Offset, int Bits> struct BitFieldMember {
template <typename T, int Offset, int Bits> class BitFieldMember {
public:
T value;

static_assert(Offset + Bits <= (int)sizeof(T) * 8, "Member exceeds bitfield boundaries");
@@ -81,7 +82,8 @@ template <typename T, int Offset, int Bits> struct BitFieldMember {
// All members are public to simplify compliance with sections 9.0.7 and
// 9.5.1 of the C++11 standard, thereby avoiding undefined behavior.
//---------------------------------------------------------
template <typename T, int BaseOffset, int BitsPerItem, int NumItems> struct BitFieldArray {
template <typename T, int BaseOffset, int BitsPerItem, int NumItems> class BitFieldArray {
public:
T value;

static_assert(BaseOffset + BitsPerItem * NumItems <= (int)sizeof(T) * 8, "Array exceeds bitfield boundaries");

+ 7
- 6
incl/util/delegate.h View File

@@ -188,7 +188,7 @@ public:
}

private:
friend struct ::std::hash<delegate>;
friend class ::std::hash<delegate>;

using deleter_type = void (*)(void *);

@@ -221,14 +221,14 @@ private:
return (static_cast<C const *>(object_ptr)->*method_ptr)(::std::forward<A>(args)...);
}

template <typename> struct is_member_pair : std::false_type {};
template <typename> class is_member_pair : std::false_type {};

template <class C> struct is_member_pair<::std::pair<C *const, R (C::*const)(A...)>> : std::true_type {};
template <class C> class is_member_pair<::std::pair<C *const, R (C::*const)(A...)>> : std::true_type {};

template <typename> struct is_const_member_pair : std::false_type {};
template <typename> class is_const_member_pair : std::false_type {};

template <class C>
struct is_const_member_pair<::std::pair<C const *const, R (C::*const)(A...) const>> : std::true_type {};
class is_const_member_pair<::std::pair<C const *const, R (C::*const)(A...) const>> : std::true_type {};

template <typename T>
static typename ::std::enable_if<!(is_member_pair<T>{} || is_const_member_pair<T>{}), R>::type
@@ -245,7 +245,8 @@ private:
} // namespace util

namespace std {
template <typename R, typename... A> struct hash<util::delegate<R(A...)>> {
template <typename R, typename... A> class hash<util::delegate<R(A...)>> {
public:
size_t operator()(util::delegate<R(A...)> const &d) const noexcept {
auto const seed(hash<void *>()(d.object_ptr_));


+ 2
- 1
incl/util/logging.h View File

@@ -105,7 +105,8 @@ protected:
std::ostringstream os;
};

template <typename CATEGORY> struct Output2FILE : CATEGORY {
template <typename CATEGORY> class Output2FILE : CATEGORY {
public:
static FILE *&stream() {
static FILE *pStream = stderr;
return pStream;

+ 2
- 2
incl/util/sparse_array.h View File

@@ -25,8 +25,8 @@ namespace util {
/**
* a simple array which allocates memory in 16MB chunks
*/
template <typename T, uint64_t SIZE, int lower_width = 24> struct sparse_array {
template <typename T, uint64_t SIZE, int lower_width = 24> class sparse_array {
public:
const uint64_t page_addr_mask = (1 << lower_width) - 1;

const uint64_t page_size = (1 << lower_width);

+ 4
- 2
src/scv_tr_sqlite/scv_tr_sqlite.cpp View File

@@ -29,8 +29,10 @@
// ----------------------------------------------------------------------------
using namespace std;

struct SQLiteDB {
struct SQLiteException : public runtime_error {
class SQLiteDB {
public:
class SQLiteException : public runtime_error {
public:
SQLiteException(const int nErrCode, const char *msg, bool doFree = true)
: runtime_error(msg)
, mnErrCode(0) {

Loading…
Cancel
Save