MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / save_start

Method save_start

DSView/pv/storesession.cpp:137–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137bool StoreSession::save_start()
138{
139 assert(_sessionDataGetter);
140
141 std::set<int> type_set;
142 for(auto s : _session->get_signals()) {
143 type_set.insert(s->get_type());
144 }
145
146 if (type_set.size() > 1) {
147 _error = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_STORESESS_SAVESTART_ERROR1),
148 "DSView does not currently support\nfile saving for multiple data types.");
149 return false;
150
151 } else if (type_set.size() == 0) {
152 _error = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_STORESESS_SAVESTART_ERROR2), "No data to save.");
153 return false;
154 }
155
156 if (_file_name == ""){
157 _error = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_STORESESS_SAVESTART_ERROR3), "No file name.");
158 return false;
159 }
160
161 const auto snapshot = _session->get_snapshot(*type_set.begin());
162 assert(snapshot);
163 // Check we have data
164 if (snapshot->empty()) {
165 _error = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_STORESESS_SAVESTART_ERROR2), "No data to save.");
166 return false;
167 }
168
169 std::string meta_data;
170 std::string decoder_data;
171 std::string session_data;
172
173 meta_gen(snapshot, meta_data);
174 decoders_gen(decoder_data);
175 _sessionDataGetter->genSessionData(session_data);
176
177 if (meta_data.empty()) {
178 _error = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_STORESESS_SAVESTART_ERROR4), "Generate temp file data failed.");
179 QFile::remove(_file_name);
180 return false;
181 }
182 if (decoder_data.empty()){
183 _error = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_STORESESS_SAVESTART_ERROR5), "Generate decoder file data failed.");
184 QFile::remove(_file_name);
185 return false;
186 }
187 if (session_data.empty()){
188 _error = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_STORESESS_SAVESTART_ERROR6), "Generate session file data failed.");
189 QFile::remove(_file_name);
190 return false;
191 }
192
193 auto _filename = path::ConvertPath(_file_name);
194

Callers 1

acceptMethod · 0.80

Calls 9

ConvertPathFunction · 0.85
sizeMethod · 0.80
get_snapshotMethod · 0.80
emptyMethod · 0.80
genSessionDataMethod · 0.80
CreateNewMethod · 0.80
AddFromBufferMethod · 0.80
GetErrorMethod · 0.80
get_typeMethod · 0.45

Tested by

no test coverage detected