MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / first_payload

Method first_payload

DSView/pv/data/logicsnapshot.cpp:114–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114void LogicSnapshot::first_payload(const sr_datafeed_logic &logic, uint64_t total_sample_count, GSList *channels, bool able_free)
115{
116 bool channel_changed = false;
117 uint16_t channel_num = 0;
118 _able_free = able_free;
119 _lst_free_block_index = 0;
120
121 for(void *p : _free_block_list){
122 free(p);
123 }
124 _free_block_list.clear();
125
126 for (const GSList *l = channels; l; l = l->next) {
127 sr_channel *const probe = (sr_channel*)l->data;
128 if (probe->type == SR_CHANNEL_LOGIC && probe->enabled) {
129 channel_num++;
130 if (!channel_changed){
131 channel_changed = !has_data(probe->index);
132 }
133 }
134 }
135
136 if (total_sample_count != _total_sample_count
137 || channel_num != _channel_num
138 || channel_changed
139 || _is_loop) {
140
141 free_data();
142 _ch_index.clear();
143
144 _total_sample_count = total_sample_count;
145 _channel_num = channel_num;
146 uint64_t rootnode_size = (_total_sample_count + RootNodeSamples - 1) / RootNodeSamples;
147
148 if (_is_loop){
149 rootnode_size += 2;
150 }
151
152 for (const GSList *l = channels; l; l = l->next) {
153 sr_channel *const probe = (sr_channel*)l->data;
154
155 if (probe->type == SR_CHANNEL_LOGIC && probe->enabled) {
156 std::vector<struct RootNode> root_vector;
157
158 for (uint64_t j = 0; j < rootnode_size; j++) {
159 struct RootNode rn;
160 rn.tog = 0;
161 rn.first = 0;
162 rn.last = 0;
163 memset(rn.lbp, 0, sizeof(rn.lbp));
164 root_vector.push_back(rn);
165 }
166
167 _ch_data.push_back(root_vector);
168 _ch_index.push_back(probe->index);
169 }
170 }
171

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected