+ if (dynamic_pointer_cast<data::Logic>(data)) {
+ // All logic channels share the same data segments
+ shared_ptr<data::Logic> ldata = dynamic_pointer_cast<data::Logic>(data);
+
+ const deque< shared_ptr<data::LogicSegment> > &lsegments =
+ ldata->logic_segments();
+
+ if (lsegments.empty()) {
+ error_ = tr("Can't save logic channel without data.");
+ return false;
+ }
+
+ lsegment = lsegments.front();
+ any_segment = lsegment;
+ }
+
+ if (dynamic_pointer_cast<data::Analog>(data)) {
+ // Each analog channel has its own segments
+ shared_ptr<data::Analog> adata =
+ dynamic_pointer_cast<data::Analog>(data);
+
+ const deque< shared_ptr<data::AnalogSegment> > &asegments =
+ adata->analog_segments();
+
+ if (asegments.empty()) {
+ error_ = tr("Can't save analog channel without data.");
+ return false;
+ }
+
+ asegment_list.push_back(asegments.front());
+ any_segment = asegments.front();
+
+ achannel_list.push_back(signal->channel());
+ }