added begin/end methods to asn1 arrays and fixed v2x bug

master
Francisco Paisana 5 years ago committed by Andre Puschmann
parent 26984c39b8
commit 514b9045ca

@ -125,6 +125,9 @@ class dyn_array
{ {
public: public:
typedef T item_type; typedef T item_type;
using iterator = T*;
using const_iterator = const T*;
dyn_array() = default; dyn_array() = default;
dyn_array(uint32_t new_size) : size_(new_size), cap_(new_size) { data_ = new T[size_]; } dyn_array(uint32_t new_size) : size_(new_size), cap_(new_size) { data_ = new T[size_]; }
dyn_array(const dyn_array<T>& other) dyn_array(const dyn_array<T>& other)
@ -186,17 +189,14 @@ public:
resize(size() + 1, size() * 2); resize(size() + 1, size() * 2);
data_[size() - 1] = elem; data_[size() - 1] = elem;
} }
T& back() { return data_[size() - 1]; } T& back() { return data_[size() - 1]; }
const T& back() const { return data_[size() - 1]; } const T& back() const { return data_[size() - 1]; }
T* data() { return &data_[0]; } T* data() { return &data_[0]; }
const T* data() const { return &data_[0]; } const T* data() const { return &data_[0]; }
iterator begin() { return &data_[0]; }
T* begin() { return &data_[0]; } iterator end() { return &data_[size()]; }
T* end() { return &data_[size()]; } const_iterator begin() const { return &data_[0]; }
const T* begin() const { return &data_[0]; } const_iterator end() const { return &data_[size()]; }
const T* end() const { return &data_[size()]; }
using iterator = T*;
using const_iterator = const T*;
private: private:
T* data_ = nullptr; T* data_ = nullptr;
@ -209,6 +209,9 @@ class bounded_array
{ {
public: public:
typedef T item_type; typedef T item_type;
using iterator = T*;
using const_iterator = const T*;
bounded_array(uint32_t size_ = 0) : current_size(size_) {} bounded_array(uint32_t size_ = 0) : current_size(size_) {}
static uint32_t capacity() { return MAX_N; } static uint32_t capacity() { return MAX_N; }
uint32_t size() const { return current_size; } uint32_t size() const { return current_size; }
@ -226,17 +229,14 @@ public:
} }
data_[current_size++] = elem; data_[current_size++] = elem;
} }
T& back() { return data_[current_size - 1]; } T& back() { return data_[current_size - 1]; }
const T& back() const { return data_[current_size - 1]; } const T& back() const { return data_[current_size - 1]; }
T* data() { return &data_[0]; } T* data() { return &data_[0]; }
const T* data() const { return &data_[0]; } const T* data() const { return &data_[0]; }
iterator begin() { return &data_[0]; }
T* begin() { return &data_[0]; } iterator end() { return &data_[size()]; }
T* end() { return &data_[size()]; } const_iterator begin() const { return &data_[0]; }
const T* begin() const { return &data_[0]; } const_iterator end() const { return &data_[size()]; }
const T* end() const { return &data_[size()]; }
using iterator = T*;
using const_iterator = const T*;
private: private:
T data_[MAX_N]; T data_[MAX_N];

@ -1989,7 +1989,7 @@ struct sl_comm_tx_pool_sensing_cfg_r14_s {
bool p2x_sensing_cfg_r14_present = false; bool p2x_sensing_cfg_r14_present = false;
bool sl_reselect_after_r14_present = false; bool sl_reselect_after_r14_present = false;
sl_pssch_tx_cfg_list_r14_l pssch_tx_cfg_list_r14; sl_pssch_tx_cfg_list_r14_l pssch_tx_cfg_list_r14;
copy_ptr<sl_thres_pssch_rsrp_list_r14_l> thres_pssch_rsrp_list_r14; sl_thres_pssch_rsrp_list_r14_l thres_pssch_rsrp_list_r14;
sl_restrict_res_reserv_period_list_r14_l restrict_res_reserv_period_r14; sl_restrict_res_reserv_period_list_r14_l restrict_res_reserv_period_r14;
prob_res_keep_r14_e_ prob_res_keep_r14; prob_res_keep_r14_e_ prob_res_keep_r14;
p2x_sensing_cfg_r14_s_ p2x_sensing_cfg_r14; p2x_sensing_cfg_r14_s_ p2x_sensing_cfg_r14;

@ -2776,10 +2776,8 @@ SRSASN_CODE sl_comm_tx_pool_sensing_cfg_r14_s::pack(bit_ref& bref) const
HANDLE_CODE(bref.pack(sl_reselect_after_r14_present, 1)); HANDLE_CODE(bref.pack(sl_reselect_after_r14_present, 1));
HANDLE_CODE(pack_dyn_seq_of(bref, pssch_tx_cfg_list_r14, 1, 16)); HANDLE_CODE(pack_dyn_seq_of(bref, pssch_tx_cfg_list_r14, 1, 16));
HANDLE_CODE(pack_fixed_seq_of(bref, HANDLE_CODE(pack_fixed_seq_of(
&(*thres_pssch_rsrp_list_r14)[0], bref, &(thres_pssch_rsrp_list_r14)[0], thres_pssch_rsrp_list_r14.size(), UnalignedIntegerPacker<uint8_t>(0, 66)));
thres_pssch_rsrp_list_r14->size(),
UnalignedIntegerPacker<uint8_t>(0, 66)));
if (restrict_res_reserv_period_r14_present) { if (restrict_res_reserv_period_r14_present) {
HANDLE_CODE(pack_dyn_seq_of(bref, restrict_res_reserv_period_r14, 1, 16, EnumPacker())); HANDLE_CODE(pack_dyn_seq_of(bref, restrict_res_reserv_period_r14, 1, 16, EnumPacker()));
} }
@ -2801,10 +2799,8 @@ SRSASN_CODE sl_comm_tx_pool_sensing_cfg_r14_s::unpack(bit_ref& bref)
HANDLE_CODE(bref.unpack(sl_reselect_after_r14_present, 1)); HANDLE_CODE(bref.unpack(sl_reselect_after_r14_present, 1));
HANDLE_CODE(unpack_dyn_seq_of(pssch_tx_cfg_list_r14, bref, 1, 16)); HANDLE_CODE(unpack_dyn_seq_of(pssch_tx_cfg_list_r14, bref, 1, 16));
HANDLE_CODE(unpack_fixed_seq_of(&(*thres_pssch_rsrp_list_r14)[0], HANDLE_CODE(unpack_fixed_seq_of(
bref, &(thres_pssch_rsrp_list_r14)[0], bref, thres_pssch_rsrp_list_r14.size(), UnalignedIntegerPacker<uint8_t>(0, 66)));
thres_pssch_rsrp_list_r14->size(),
UnalignedIntegerPacker<uint8_t>(0, 66)));
if (restrict_res_reserv_period_r14_present) { if (restrict_res_reserv_period_r14_present) {
HANDLE_CODE(unpack_dyn_seq_of(restrict_res_reserv_period_r14, bref, 1, 16, EnumPacker())); HANDLE_CODE(unpack_dyn_seq_of(restrict_res_reserv_period_r14, bref, 1, 16, EnumPacker()));
} }
@ -2828,8 +2824,8 @@ void sl_comm_tx_pool_sensing_cfg_r14_s::to_json(json_writer& j) const
} }
j.end_array(); j.end_array();
j.start_array("thresPSSCH-RSRP-List-r14"); j.start_array("thresPSSCH-RSRP-List-r14");
for (uint32_t i1 = 0; i1 < thres_pssch_rsrp_list_r14->size(); ++i1) { for (uint32_t i1 = 0; i1 < thres_pssch_rsrp_list_r14.size(); ++i1) {
j.write_int(((*thres_pssch_rsrp_list_r14)[i1])); j.write_int(thres_pssch_rsrp_list_r14[i1]);
} }
j.end_array(); j.end_array();
if (restrict_res_reserv_period_r14_present) { if (restrict_res_reserv_period_r14_present) {

Loading…
Cancel
Save