Browse Source

clean up class vs. struct

Eyck Jentzsch 2 years ago
parent
commit
db46dcd395

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

@@ -1025,7 +1025,8 @@ private:
1025 1025
     Value &resolveReference(const char *key);
1026 1026
     Value &resolveReference(const char *key, const char *end);
1027 1027
 
1028
-    struct CommentInfo {
1028
+    class CommentInfo {
1029
+    public:
1029 1030
         CommentInfo();
1030 1031
         ~CommentInfo();
1031 1032
 

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

@@ -37,16 +37,18 @@ namespace scc {
37 37
 
38 38
 namespace impl {
39 39
 
40
-template <typename T, bool = std::is_integral<T>::value> struct helper {};
40
+template <typename T, bool = std::is_integral<T>::value> class helper {};
41 41
 
42
-template <typename T> struct helper<T, true> {
42
+template <typename T> class helper<T, true> {
43
+public:
43 44
     using Type = T;
44 45
     template <typename Type> constexpr Type get_max_uval() {
45 46
         return std::numeric_limits<Type>::is_signed ? -1 : std::numeric_limits<Type>::max();
46 47
     }
47 48
 };
48 49
 
49
-template <typename T> struct helper<T, false> {
50
+template <typename T> class helper<T, false> {
51
+public:
50 52
     using Type = typename T::StorageType;
51 53
     template <typename Type> constexpr Type get_max_uval() {
52 54
         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() {
58 60
 }
59 61
 
60 62
 template <typename DATATYPE>
61
-struct sc_register : public sc_core::sc_object, public resource_access_if, public traceable {
62
-
63
-    using this_type = struct sc_register<DATATYPE>;
63
+class sc_register : public sc_core::sc_object, public resource_access_if, public traceable {
64
+public:
65
+    using this_type = class sc_register<DATATYPE>;
64 66
     /**
65 67
      *
66 68
      * @param nm
@@ -226,8 +228,8 @@ private:
226 228
 template <typename DATATYPE> using sc_register = impl::sc_register<typename impl::helper<DATATYPE>::Type>;
227 229
 
228 230
 template <typename DATATYPE, size_t SIZE, size_t START = 0>
229
-struct sc_register_indexed : public indexed_resource_access_if {
230
-
231
+class sc_register_indexed : public indexed_resource_access_if {
232
+public:
231 233
     using BASE_DATA_TYPE = typename impl::helper<DATATYPE>::Type;
232 234
 
233 235
     using value_type = sc_register<DATATYPE>;
@@ -288,8 +290,8 @@ private:
288 290
 
289 291
 template <typename DATATYPE, DATATYPE WRMASK = impl::get_max_uval<DATATYPE>(),
290 292
           DATATYPE RDMASK = impl::get_max_uval<DATATYPE>()>
291
-struct sc_register_masked : public sc_register<DATATYPE> {
292
-
293
+class sc_register_masked : public sc_register<DATATYPE> {
294
+public:
293 295
     sc_register_masked(sc_core::sc_module_name nm, DATATYPE &storage, const DATATYPE reset_val, resetable &owner)
294 296
     : sc_register<DATATYPE>(nm, storage, reset_val, owner, RDMASK, WRMASK) {}
295 297
 };

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

@@ -30,7 +30,7 @@
30 30
 #include "scc/utilities.h"
31 31
 
32 32
 namespace logging {
33
-struct SystemC {};
33
+class SystemC {};
34 34
 }
35 35
 namespace scc {
36 36
 

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

@@ -28,7 +28,8 @@
28 28
 
29 29
 namespace scc {
30 30
 
31
-struct resetable {
31
+class resetable {
32
+public:
32 33
     /**
33 34
      *
34 35
      */

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

@@ -28,7 +28,8 @@
28 28
 
29 29
 namespace scc {
30 30
 
31
-struct resource_access_if {
31
+class resource_access_if {
32
+public:
32 33
     /**
33 34
      *
34 35
      */
@@ -78,7 +79,8 @@ struct resource_access_if {
78 79
     virtual bool read_dbg(uint8_t *data, std::size_t length, uint64_t offset = 0) const = 0;
79 80
 };
80 81
 
81
-struct indexed_resource_access_if {
82
+class indexed_resource_access_if {
83
+public:
82 84
     using value_type = resource_access_if;
83 85
     using pointer = value_type *;
84 86
     using const_pointer = const value_type *;

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

@@ -23,23 +23,20 @@
23 23
 #ifndef _SYSC_ROUTER_H_
24 24
 #define _SYSC_ROUTER_H_
25 25
 
26
-#include <util/range_lut.h>
26
+#include "util/range_lut.h"
27 27
 #include "scc/utilities.h"
28
-// pragmas to disable the deprecated warnings for SystemC headers
29
-#pragma GCC diagnostic push
30
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
31
-#include <scv4tlm/tlm_rec_initiator_socket.h>
32
-#include <scv4tlm/tlm_rec_target_socket.h>
28
+#include "scv4tlm/tlm_rec_initiator_socket.h"
29
+#include "scv4tlm/tlm_rec_target_socket.h"
33 30
 #include "scc/initiator_mixin.h"
34 31
 #include "scc/target_mixin.h"
35 32
 #include <sysc/utils/sc_vector.h>
36 33
 #include <tlm.h>
37
-#pragma GCC diagnostic pop
38 34
 #include <limits>
39 35
 
40 36
 namespace scc {
41 37
 
42
-template <unsigned BUSWIDTH = 32> struct router : sc_core::sc_module {
38
+template <unsigned BUSWIDTH = 32> class router : sc_core::sc_module {
39
+public:
43 40
     using intor_sckt = scc::initiator_mixin<scv4tlm::tlm_rec_initiator_socket<BUSWIDTH>>;
44 41
     using target_sckt = scc::target_mixin<scv4tlm::tlm_rec_target_socket<BUSWIDTH>>;
45 42
     /**

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

@@ -467,7 +467,8 @@ private:
467 467
         }
468 468
 
469 469
     private:
470
-        struct mm_end_event_ext : public tlm::tlm_extension<mm_end_event_ext> {
470
+        class mm_end_event_ext : public tlm::tlm_extension<mm_end_event_ext> {
471
+        public:
471 472
             tlm::tlm_extension_base *clone() const { return NULL; }
472 473
             void free() {}
473 474
             void copy_from(tlm::tlm_extension_base const &) {}

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

@@ -37,7 +37,8 @@ struct addr_range {
37 37
     uint64_t base, size;
38 38
 };
39 39
 
40
-template <unsigned int BUSWIDTH = 32> struct tlm_target {
40
+template <unsigned int BUSWIDTH = 32> class tlm_target {
41
+public:
41 42
     using this_type = tlm_target<BUSWIDTH>;
42 43
     /**
43 44
      *
@@ -91,7 +92,8 @@ template <unsigned BUSWIDTH = 32> struct target_memory_map_entry {
91 92
     sc_dt::uint64 size;
92 93
 };
93 94
 
94
-template <unsigned int BUSWIDTH = 32, unsigned RANGES = 1> struct tlm_multi_rangetarget : public tlm_target<BUSWIDTH> {
95
+template <unsigned int BUSWIDTH = 32, unsigned RANGES = 1> class tlm_multi_rangetarget : public tlm_target<BUSWIDTH> {
96
+public:
95 97
     using this_type = tlm_multi_rangetarget<BUSWIDTH, RANGES>;
96 98
 
97 99
     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;
37 37
 
38 38
 namespace scc {
39 39
 
40
-struct tracer : public sc_core::sc_module {
40
+class tracer : public sc_core::sc_module {
41
+public:
41 42
     /**
42 43
      *
43 44
      */

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

@@ -35,7 +35,8 @@ namespace scv4tlm {
35 35
  * register custom recorder functionality
36 36
  * to also record the payload extensions
37 37
  */
38
-template <typename TYPES = tlm::tlm_base_protocol_types> struct tlm2_extensions_recording_if {
38
+template <typename TYPES = tlm::tlm_base_protocol_types> class tlm2_extensions_recording_if {
39
+public:
39 40
     /*! \brief recording attributes in extensions at the beginning, it is intended
40 41
      * to be overload as it does nothing
41 42
      *
@@ -85,9 +86,9 @@ public:
85 86
      *        If this database is not initialized (e.g. by not calling
86 87
      * scv_tr_db::set_default_db() ) recording is disabled.
87 88
      */
88
-    tlm2_recorder(bool recording_enabled = true, scv_tr_db *tr_db = scv_tr_db::get_default_db()) {
89
-        this->tlm2_recorder::tlm2_recorder(sc_core::sc_gen_unique_name("tlm2_recorder"), recording_enabled, tr_db);
90
-    }
89
+    tlm2_recorder(bool recording_enabled = true, scv_tr_db *tr_db = scv_tr_db::get_default_db())
90
+    : tlm2_recorder(sc_core::sc_gen_unique_name("tlm2_recorder"), recording_enabled, tr_db)
91
+    { }
91 92
     /*! \brief The constructor of the component
92 93
      *
93 94
      * \param name is the SystemC module name of the recorder
@@ -206,9 +207,10 @@ public:
206 207
     }
207 208
 
208 209
 private:
209
-    //! \brief the struct to hold the information to be recorded on the timed
210
+    //! \brief the class to hold the information to be recorded on the timed
210 211
     //! streams
211
-    struct tlm_recording_payload : public TYPES::tlm_payload_type {
212
+    class tlm_recording_payload : public TYPES::tlm_payload_type {
213
+    public:
212 214
         scv_tr_handle parent;
213 215
         uint64 id;
214 216
         tlm_recording_payload &operator=(const typename TYPES::tlm_payload_type &x) {
@@ -229,7 +231,8 @@ private:
229 231
         , id(0) {}
230 232
     };
231 233
     //! \brief Memory manager for the tlm_recording_payload
232
-    struct RecodingMemoryManager : public tlm::tlm_mm_interface {
234
+    class RecodingMemoryManager : public tlm::tlm_mm_interface {
235
+    public:
233 236
         RecodingMemoryManager()
234 237
         : free_list(0)
235 238
         , empties(0) {}

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

@@ -22,7 +22,8 @@
22 22
 
23 23
 namespace scv4tlm {
24 24
 
25
-struct tlm_gp_data {
25
+class tlm_gp_data {
26
+public:
26 27
     //---------------
27 28
     // Constructors
28 29
     //---------------
@@ -435,7 +436,8 @@ private:
435 436
     unsigned int m_ref_count{0};
436 437
 };
437 438
 
438
-struct tlm_dmi_data {
439
+class tlm_dmi_data {
440
+public:
439 441
     tlm_dmi_data() = default;
440 442
 
441 443
     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]); }
43 43
  * containing a valid handle it links the generated
44 44
  * SCV transdaction to the found one using the \ref PREDECESSOR releationship
45 45
  */
46
-struct tlm_recording_extension : public tlm::tlm_extension<tlm_recording_extension> {
46
+class tlm_recording_extension : public tlm::tlm_extension<tlm_recording_extension> {
47
+public:
47 48
     /*! \brief clone the given extension and duplicate the SCV transaction handle.
48 49
      *
49 50
      */

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

@@ -31,7 +31,8 @@ freely, subject to the following restrictions:
31 31
 // All members are public to simplify compliance with sections 9.0.7 and
32 32
 // 9.5.1 of the C++11 standard, thereby avoiding undefined behavior.
33 33
 //---------------------------------------------------------
34
-template <typename T, int Offset, int Bits> struct BitFieldMember {
34
+template <typename T, int Offset, int Bits> class BitFieldMember {
35
+public:
35 36
     T value;
36 37
 
37 38
     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 {
81 82
 // All members are public to simplify compliance with sections 9.0.7 and
82 83
 // 9.5.1 of the C++11 standard, thereby avoiding undefined behavior.
83 84
 //---------------------------------------------------------
84
-template <typename T, int BaseOffset, int BitsPerItem, int NumItems> struct BitFieldArray {
85
+template <typename T, int BaseOffset, int BitsPerItem, int NumItems> class BitFieldArray {
86
+public:
85 87
     T value;
86 88
 
87 89
     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:
188 188
     }
189 189
 
190 190
 private:
191
-    friend struct ::std::hash<delegate>;
191
+    friend class ::std::hash<delegate>;
192 192
 
193 193
     using deleter_type = void (*)(void *);
194 194
 
@@ -221,14 +221,14 @@ private:
221 221
         return (static_cast<C const *>(object_ptr)->*method_ptr)(::std::forward<A>(args)...);
222 222
     }
223 223
 
224
-    template <typename> struct is_member_pair : std::false_type {};
224
+    template <typename> class is_member_pair : std::false_type {};
225 225
 
226
-    template <class C> struct is_member_pair<::std::pair<C *const, R (C::*const)(A...)>> : std::true_type {};
226
+    template <class C> class is_member_pair<::std::pair<C *const, R (C::*const)(A...)>> : std::true_type {};
227 227
 
228
-    template <typename> struct is_const_member_pair : std::false_type {};
228
+    template <typename> class is_const_member_pair : std::false_type {};
229 229
 
230 230
     template <class C>
231
-    struct is_const_member_pair<::std::pair<C const *const, R (C::*const)(A...) const>> : std::true_type {};
231
+    class is_const_member_pair<::std::pair<C const *const, R (C::*const)(A...) const>> : std::true_type {};
232 232
 
233 233
     template <typename T>
234 234
     static typename ::std::enable_if<!(is_member_pair<T>{} || is_const_member_pair<T>{}), R>::type
@@ -245,7 +245,8 @@ private:
245 245
 } // namespace util
246 246
 
247 247
 namespace std {
248
-template <typename R, typename... A> struct hash<util::delegate<R(A...)>> {
248
+template <typename R, typename... A> class hash<util::delegate<R(A...)>> {
249
+public:
249 250
     size_t operator()(util::delegate<R(A...)> const &d) const noexcept {
250 251
         auto const seed(hash<void *>()(d.object_ptr_));
251 252
 

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

@@ -105,7 +105,8 @@ protected:
105 105
     std::ostringstream os;
106 106
 };
107 107
 
108
-template <typename CATEGORY> struct Output2FILE : CATEGORY {
108
+template <typename CATEGORY> class Output2FILE : CATEGORY {
109
+public:
109 110
     static FILE *&stream() {
110 111
         static FILE *pStream = stderr;
111 112
         return pStream;

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

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

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

@@ -29,8 +29,10 @@
29 29
 // ----------------------------------------------------------------------------
30 30
 using namespace std;
31 31
 
32
-struct SQLiteDB {
33
-    struct SQLiteException : public runtime_error {
32
+class SQLiteDB {
33
+public:
34
+    class SQLiteException : public runtime_error {
35
+    public:
34 36
         SQLiteException(const int nErrCode, const char *msg, bool doFree = true)
35 37
         : runtime_error(msg)
36 38
         , mnErrCode(0) {