1 + | |
2 + | |
3 + | |
4 + | |
5 + | |
6 + | |
7 + | |
8 + | |
9 + | |
10 + | |
11 + | |
12 + | |
13 + | |
14 + | |
15 + | |
16 + | |
17 + | |
18 + | |
19 + | |
20 + | |
21 + | |
22 + | |
23 + | |
24 + | |
25 + | |
26 + | |
27 + | |
28 + | |
29 + | |
30 + | |
31 + | |
32 + | |
33 + | |
34 + | #include <vector> |
35 + | #include <set> |
36 + | |
37 + | #include <alma/ASDM/ASDM.h> |
38 + | #include <alma/ASDM/VLAWVRRow.h> |
39 + | #include <alma/ASDM/VLAWVRTable.h> |
40 + | |
41 + | #include <alma/ASDM/AntennaTable.h> |
42 + | #include <alma/ASDM/AntennaRow.h> |
43 + | |
44 + | |
45 + | using asdm::ASDM; |
46 + | using asdm::VLAWVRRow; |
47 + | using asdm::VLAWVRTable; |
48 + | |
49 + | using asdm::AntennaTable; |
50 + | using asdm::AntennaRow; |
51 + | |
52 + | |
53 + | #include <alma/ASDM/Parser.h> |
54 + | |
55 + | #include <alma/ASDM/EnumerationParser.h> |
56 + | #include <alma/ASDM/ASDMValuesParser.h> |
57 + | |
58 + | #include <alma/ASDM/InvalidArgumentException.h> |
59 + | |
60 + | using namespace std; |
61 + | |
62 + | namespace asdm { |
63 + | VLAWVRRow::~VLAWVRRow() { |
64 + | } |
65 + | |
66 + | |
67 + | |
68 + | |
69 + | VLAWVRTable &VLAWVRRow::getTable() const { |
70 + | return table; |
71 + | } |
72 + | |
73 + | bool VLAWVRRow::isAdded() const { |
74 + | return hasBeenAdded; |
75 + | } |
76 + | |
77 + | void VLAWVRRow::isAdded(bool added) { |
78 + | hasBeenAdded = added; |
79 + | } |
80 + | |
81 + | #ifndef WITHOUT_ACS |
82 + | using asdmIDL::VLAWVRRowIDL; |
83 + | #endif |
84 + | |
85 + | #ifndef WITHOUT_ACS |
86 + | |
87 + | |
88 + | |
89 + | |
90 + | VLAWVRRowIDL *VLAWVRRow::toIDL() const { |
91 + | VLAWVRRowIDL *x = new VLAWVRRowIDL (); |
92 + | |
93 + | |
94 + | |
95 + | |
96 + | |
97 + | |
98 + | |
99 + | |
100 + | |
101 + | x->timeInterval = timeInterval.toIDLArrayTimeInterval(); |
102 + | |
103 + | |
104 + | |
105 + | |
106 + | |
107 + | |
108 + | |
109 + | |
110 + | |
111 + | |
112 + | x->numChan = numChan; |
113 + | |
114 + | |
115 + | |
116 + | |
117 + | |
118 + | |
119 + | |
120 + | |
121 + | |
122 + | |
123 + | x->hiValues.length(hiValues.size()); |
124 + | for (unsigned int i = 0; i < hiValues.size(); ++i) { |
125 + | |
126 + | |
127 + | x->hiValues[i] = hiValues.at(i); |
128 + | |
129 + | |
130 + | } |
131 + | |
132 + | |
133 + | |
134 + | |
135 + | |
136 + | |
137 + | |
138 + | |
139 + | |
140 + | x->loValues.length(loValues.size()); |
141 + | for (unsigned int i = 0; i < loValues.size(); ++i) { |
142 + | |
143 + | |
144 + | x->loValues[i] = loValues.at(i); |
145 + | |
146 + | |
147 + | } |
148 + | |
149 + | |
150 + | |
151 + | |
152 + | |
153 + | |
154 + | |
155 + | x->chanFreqCenterExists = chanFreqCenterExists; |
156 + | |
157 + | |
158 + | |
159 + | x->chanFreqCenter.length(chanFreqCenter.size()); |
160 + | for (unsigned int i = 0; i < chanFreqCenter.size(); ++i) { |
161 + | |
162 + | x->chanFreqCenter[i] = chanFreqCenter.at(i).toIDLFrequency(); |
163 + | |
164 + | } |
165 + | |
166 + | |
167 + | |
168 + | |
169 + | |
170 + | |
171 + | |
172 + | x->chanWidthExists = chanWidthExists; |
173 + | |
174 + | |
175 + | |
176 + | x->chanWidth.length(chanWidth.size()); |
177 + | for (unsigned int i = 0; i < chanWidth.size(); ++i) { |
178 + | |
179 + | x->chanWidth[i] = chanWidth.at(i).toIDLFrequency(); |
180 + | |
181 + | } |
182 + | |
183 + | |
184 + | |
185 + | |
186 + | |
187 + | |
188 + | |
189 + | x->wvrIdExists = wvrIdExists; |
190 + | |
191 + | |
192 + | |
193 + | |
194 + | x->wvrId = CORBA::string_dup(wvrId.c_str()); |
195 + | |
196 + | |
197 + | |
198 + | |
199 + | |
200 + | |
201 + | |
202 + | |
203 + | |
204 + | |
205 + | |
206 + | |
207 + | |
208 + | |
209 + | x->antennaId = antennaId.toIDLTag(); |
210 + | |
211 + | |
212 + | |
213 + | |
214 + | |
215 + | |
216 + | |
217 + | |
218 + | |
219 + | return x; |
220 + | |
221 + | } |
222 + | |
223 + | void VLAWVRRow::toIDL(asdmIDL::VLAWVRRowIDL& x) const { |
224 + | |
225 + | |
226 + | |
227 + | |
228 + | |
229 + | |
230 + | |
231 + | |
232 + | x.timeInterval = timeInterval.toIDLArrayTimeInterval(); |
233 + | |
234 + | |
235 + | |
236 + | |
237 + | |
238 + | |
239 + | |
240 + | |
241 + | |
242 + | |
243 + | x.numChan = numChan; |
244 + | |
245 + | |
246 + | |
247 + | |
248 + | |
249 + | |
250 + | |
251 + | |
252 + | |
253 + | |
254 + | x.hiValues.length(hiValues.size()); |
255 + | for (unsigned int i = 0; i < hiValues.size(); ++i) { |
256 + | |
257 + | |
258 + | x.hiValues[i] = hiValues.at(i); |
259 + | |
260 + | |
261 + | } |
262 + | |
263 + | |
264 + | |
265 + | |
266 + | |
267 + | |
268 + | |
269 + | |
270 + | |
271 + | x.loValues.length(loValues.size()); |
272 + | for (unsigned int i = 0; i < loValues.size(); ++i) { |
273 + | |
274 + | |
275 + | x.loValues[i] = loValues.at(i); |
276 + | |
277 + | |
278 + | } |
279 + | |
280 + | |
281 + | |
282 + | |
283 + | |
284 + | |
285 + | |
286 + | x.chanFreqCenterExists = chanFreqCenterExists; |
287 + | |
288 + | |
289 + | |
290 + | x.chanFreqCenter.length(chanFreqCenter.size()); |
291 + | for (unsigned int i = 0; i < chanFreqCenter.size(); ++i) { |
292 + | |
293 + | x.chanFreqCenter[i] = chanFreqCenter.at(i).toIDLFrequency(); |
294 + | |
295 + | } |
296 + | |
297 + | |
298 + | |
299 + | |
300 + | |
301 + | |
302 + | |
303 + | x.chanWidthExists = chanWidthExists; |
304 + | |
305 + | |
306 + | |
307 + | x.chanWidth.length(chanWidth.size()); |
308 + | for (unsigned int i = 0; i < chanWidth.size(); ++i) { |
309 + | |
310 + | x.chanWidth[i] = chanWidth.at(i).toIDLFrequency(); |
311 + | |
312 + | } |
313 + | |
314 + | |
315 + | |
316 + | |
317 + | |
318 + | |
319 + | |
320 + | x.wvrIdExists = wvrIdExists; |
321 + | |
322 + | |
323 + | |
324 + | |
325 + | x.wvrId = CORBA::string_dup(wvrId.c_str()); |
326 + | |
327 + | |
328 + | |
329 + | |
330 + | |
331 + | |
332 + | |
333 + | |
334 + | |
335 + | |
336 + | |
337 + | |
338 + | |
339 + | |
340 + | x.antennaId = antennaId.toIDLTag(); |
341 + | |
342 + | |
343 + | |
344 + | |
345 + | |
346 + | |
347 + | |
348 + | |
349 + | |
350 + | } |
351 + | #endif |
352 + | |
353 + | |
354 + | #ifndef WITHOUT_ACS |
355 + | |
356 + | |
357 + | |
358 + | |
359 + | void VLAWVRRow::setFromIDL (VLAWVRRowIDL x){ |
360 + | try { |
361 + | |
362 + | |
363 + | |
364 + | |
365 + | |
366 + | |
367 + | |
368 + | setTimeInterval(ArrayTimeInterval (x.timeInterval)); |
369 + | |
370 + | |
371 + | |
372 + | |
373 + | |
374 + | |
375 + | |
376 + | |
377 + | |
378 + | setNumChan(x.numChan); |
379 + | |
380 + | |
381 + | |
382 + | |
383 + | |
384 + | |
385 + | |
386 + | |
387 + | |
388 + | hiValues .clear(); |
389 + | for (unsigned int i = 0; i <x.hiValues.length(); ++i) { |
390 + | |
391 + | hiValues.push_back(x.hiValues[i]); |
392 + | |
393 + | } |
394 + | |
395 + | |
396 + | |
397 + | |
398 + | |
399 + | |
400 + | |
401 + | |
402 + | |
403 + | loValues .clear(); |
404 + | for (unsigned int i = 0; i <x.loValues.length(); ++i) { |
405 + | |
406 + | loValues.push_back(x.loValues[i]); |
407 + | |
408 + | } |
409 + | |
410 + | |
411 + | |
412 + | |
413 + | |
414 + | |
415 + | |
416 + | chanFreqCenterExists = x.chanFreqCenterExists; |
417 + | if (x.chanFreqCenterExists) { |
418 + | |
419 + | |
420 + | |
421 + | chanFreqCenter .clear(); |
422 + | for (unsigned int i = 0; i <x.chanFreqCenter.length(); ++i) { |
423 + | |
424 + | chanFreqCenter.push_back(Frequency (x.chanFreqCenter[i])); |
425 + | |
426 + | } |
427 + | |
428 + | |
429 + | |
430 + | } |
431 + | |
432 + | |
433 + | |
434 + | |
435 + | |
436 + | chanWidthExists = x.chanWidthExists; |
437 + | if (x.chanWidthExists) { |
438 + | |
439 + | |
440 + | |
441 + | chanWidth .clear(); |
442 + | for (unsigned int i = 0; i <x.chanWidth.length(); ++i) { |
443 + | |
444 + | chanWidth.push_back(Frequency (x.chanWidth[i])); |
445 + | |
446 + | } |
447 + | |
448 + | |
449 + | |
450 + | } |
451 + | |
452 + | |
453 + | |
454 + | |
455 + | |
456 + | wvrIdExists = x.wvrIdExists; |
457 + | if (x.wvrIdExists) { |
458 + | |
459 + | |
460 + | |
461 + | setWvrId(string (x.wvrId)); |
462 + | |
463 + | |
464 + | |
465 + | } |
466 + | |
467 + | |
468 + | |
469 + | |
470 + | |
471 + | |
472 + | |
473 + | |
474 + | |
475 + | |
476 + | setAntennaId(Tag (x.antennaId)); |
477 + | |
478 + | |
479 + | |
480 + | |
481 + | |
482 + | |
483 + | |
484 + | |
485 + | |
486 + | } catch (const IllegalAccessException &err) { |
487 + | throw ConversionException (err.getMessage(),"VLAWVR"); |
488 + | } |
489 + | } |
490 + | #endif |
491 + | |
492 + | |
493 + | |
494 + | |
495 + | |
496 + | string VLAWVRRow::toXML() const { |
497 + | string buf; |
498 + | buf.append("<row> \n"); |
499 + | |
500 + | |
501 + | |
502 + | |
503 + | |
504 + | |
505 + | Parser::toXML(timeInterval, "timeInterval", buf); |
506 + | |
507 + | |
508 + | |
509 + | |
510 + | |
511 + | |
512 + | |
513 + | Parser::toXML(numChan, "numChan", buf); |
514 + | |
515 + | |
516 + | |
517 + | |
518 + | |
519 + | |
520 + | |
521 + | Parser::toXML(hiValues, "hiValues", buf); |
522 + | |
523 + | |
524 + | |
525 + | |
526 + | |
527 + | |
528 + | |
529 + | Parser::toXML(loValues, "loValues", buf); |
530 + | |
531 + | |
532 + | |
533 + | |
534 + | |
535 + | |
536 + | if (chanFreqCenterExists) { |
537 + | |
538 + | |
539 + | Parser::toXML(chanFreqCenter, "chanFreqCenter", buf); |
540 + | |
541 + | |
542 + | } |
543 + | |
544 + | |
545 + | |
546 + | |
547 + | |
548 + | if (chanWidthExists) { |
549 + | |
550 + | |
551 + | Parser::toXML(chanWidth, "chanWidth", buf); |
552 + | |
553 + | |
554 + | } |
555 + | |
556 + | |
557 + | |
558 + | |
559 + | |
560 + | if (wvrIdExists) { |
561 + | |
562 + | |
563 + | Parser::toXML(wvrId, "wvrId", buf); |
564 + | |
565 + | |
566 + | } |
567 + | |
568 + | |
569 + | |
570 + | |
571 + | |
572 + | |
573 + | |
574 + | |
575 + | |
576 + | Parser::toXML(antennaId, "antennaId", buf); |
577 + | |
578 + | |
579 + | |
580 + | |
581 + | |
582 + | |
583 + | |
584 + | |
585 + | |
586 + | buf.append("</row>\n"); |
587 + | return buf; |
588 + | } |
589 + | |
590 + | |
591 + | |
592 + | |
593 + | |
594 + | |
595 + | void VLAWVRRow::setFromXML (string rowDoc) { |
596 + | Parser row(rowDoc); |
597 + | string s = ""; |
598 + | try { |
599 + | |
600 + | |
601 + | |
602 + | |
603 + | |
604 + | setTimeInterval(Parser::getArrayTimeInterval("timeInterval","VLAWVR",rowDoc)); |
605 + | |
606 + | |
607 + | |
608 + | |
609 + | |
610 + | |
611 + | |
612 + | setNumChan(Parser::getInteger("numChan","VLAWVR",rowDoc)); |
613 + | |
614 + | |
615 + | |
616 + | |
617 + | |
618 + | |
619 + | |
620 + | |
621 + | setHiValues(Parser::get1DFloat("hiValues","VLAWVR",rowDoc)); |
622 + | |
623 + | |
624 + | |
625 + | |
626 + | |
627 + | |
628 + | |
629 + | |
630 + | |
631 + | setLoValues(Parser::get1DFloat("loValues","VLAWVR",rowDoc)); |
632 + | |
633 + | |
634 + | |
635 + | |
636 + | |
637 + | |
638 + | |
639 + | if (row.isStr("<chanFreqCenter>")) { |
640 + | |
641 + | |
642 + | setChanFreqCenter(Parser::get1DFrequency("chanFreqCenter","VLAWVR",rowDoc)); |
643 + | |
644 + | |
645 + | } |
646 + | |
647 + | |
648 + | |
649 + | |
650 + | |
651 + | if (row.isStr("<chanWidth>")) { |
652 + | |
653 + | |
654 + | setChanWidth(Parser::get1DFrequency("chanWidth","VLAWVR",rowDoc)); |
655 + | |
656 + | |
657 + | } |
658 + | |
659 + | |
660 + | |
661 + | |
662 + | |
663 + | if (row.isStr("<wvrId>")) { |
664 + | |
665 + | setWvrId(Parser::getString("wvrId","VLAWVR",rowDoc)); |
666 + | |
667 + | } |
668 + | |
669 + | |
670 + | |
671 + | |
672 + | |
673 + | |
674 + | |
675 + | |
676 + | |
677 + | setAntennaId(Parser::getTag("antennaId","Antenna",rowDoc)); |
678 + | |
679 + | |
680 + | |
681 + | |
682 + | |
683 + | |
684 + | |
685 + | |
686 + | } catch (const IllegalAccessException &err) { |
687 + | throw ConversionException (err.getMessage(),"VLAWVR"); |
688 + | } |
689 + | } |
690 + | |
691 + | void VLAWVRRow::toBin(EndianOSStream& eoss) { |
692 + | |
693 + | |
694 + | |
695 + | |
696 + | |
697 + | antennaId.toBin(eoss); |
698 + | |
699 + | |
700 + | |
701 + | |
702 + | |
703 + | |
704 + | timeInterval.toBin(eoss); |
705 + | |
706 + | |
707 + | |
708 + | |
709 + | |
710 + | |
711 + | |
712 + | eoss.writeInt(numChan); |
713 + | |
714 + | |
715 + | |
716 + | |
717 + | |
718 + | |
719 + | |
720 + | |
721 + | |
722 + | eoss.writeInt((int) hiValues.size()); |
723 + | for (unsigned int i = 0; i < hiValues.size(); i++) |
724 + | |
725 + | eoss.writeFloat(hiValues.at(i)); |
726 + | |
727 + | |
728 + | |
729 + | |
730 + | |
731 + | |
732 + | |
733 + | |
734 + | |
735 + | |
736 + | |
737 + | eoss.writeInt((int) loValues.size()); |
738 + | for (unsigned int i = 0; i < loValues.size(); i++) |
739 + | |
740 + | eoss.writeFloat(loValues.at(i)); |
741 + | |
742 + | |
743 + | |
744 + | |
745 + | |
746 + | |
747 + | |
748 + | |
749 + | |
750 + | eoss.writeBoolean(chanFreqCenterExists); |
751 + | if (chanFreqCenterExists) { |
752 + | |
753 + | |
754 + | |
755 + | |
756 + | Frequency::toBin(chanFreqCenter, eoss); |
757 + | |
758 + | |
759 + | |
760 + | } |
761 + | |
762 + | eoss.writeBoolean(chanWidthExists); |
763 + | if (chanWidthExists) { |
764 + | |
765 + | |
766 + | |
767 + | |
768 + | Frequency::toBin(chanWidth, eoss); |
769 + | |
770 + | |
771 + | |
772 + | } |
773 + | |
774 + | eoss.writeBoolean(wvrIdExists); |
775 + | if (wvrIdExists) { |
776 + | |
777 + | |
778 + | |
779 + | |
780 + | |
781 + | eoss.writeString(wvrId); |
782 + | |
783 + | |
784 + | |
785 + | |
786 + | } |
787 + | |
788 + | } |
789 + | |
790 + | void VLAWVRRow::antennaIdFromBin(EndianIStream& eis) { |
791 + | |
792 + | |
793 + | |
794 + | |
795 + | antennaId = Tag::fromBin(eis); |
796 + | |
797 + | |
798 + | |
799 + | } |
800 + | void VLAWVRRow::timeIntervalFromBin(EndianIStream& eis) { |
801 + | |
802 + | |
803 + | |
804 + | |
805 + | timeInterval = ArrayTimeInterval::fromBin(eis); |
806 + | |
807 + | |
808 + | |
809 + | } |
810 + | void VLAWVRRow::numChanFromBin(EndianIStream& eis) { |
811 + | |
812 + | |
813 + | |
814 + | |
815 + | |
816 + | numChan = eis.readInt(); |
817 + | |
818 + | |
819 + | |
820 + | |
821 + | } |
822 + | void VLAWVRRow::hiValuesFromBin(EndianIStream& eis) { |
823 + | |
824 + | |
825 + | |
826 + | |
827 + | |
828 + | |
829 + | hiValues.clear(); |
830 + | |
831 + | unsigned int hiValuesDim1 = eis.readInt(); |
832 + | for (unsigned int i = 0 ; i < hiValuesDim1; i++) |
833 + | |
834 + | hiValues.push_back(eis.readFloat()); |
835 + | |
836 + | |
837 + | |
838 + | |
839 + | |
840 + | |
841 + | } |
842 + | void VLAWVRRow::loValuesFromBin(EndianIStream& eis) { |
843 + | |
844 + | |
845 + | |
846 + | |
847 + | |
848 + | |
849 + | loValues.clear(); |
850 + | |
851 + | unsigned int loValuesDim1 = eis.readInt(); |
852 + | for (unsigned int i = 0 ; i < loValuesDim1; i++) |
853 + | |
854 + | loValues.push_back(eis.readFloat()); |
855 + | |
856 + | |
857 + | |
858 + | |
859 + | |
860 + | |
861 + | } |
862 + | |
863 + | void VLAWVRRow::chanFreqCenterFromBin(EndianIStream& eis) { |
864 + | |
865 + | chanFreqCenterExists = eis.readBoolean(); |
866 + | if (chanFreqCenterExists) { |
867 + | |
868 + | |
869 + | |
870 + | |
871 + | |
872 + | |
873 + | chanFreqCenter = Frequency::from1DBin(eis); |
874 + | |
875 + | |
876 + | |
877 + | |
878 + | |
879 + | } |
880 + | |
881 + | } |
882 + | void VLAWVRRow::chanWidthFromBin(EndianIStream& eis) { |
883 + | |
884 + | chanWidthExists = eis.readBoolean(); |
885 + | if (chanWidthExists) { |
886 + | |
887 + | |
888 + | |
889 + | |
890 + | |
891 + | |
892 + | chanWidth = Frequency::from1DBin(eis); |
893 + | |
894 + | |
895 + | |
896 + | |
897 + | |
898 + | } |
899 + | |
900 + | } |
901 + | void VLAWVRRow::wvrIdFromBin(EndianIStream& eis) { |
902 + | |
903 + | wvrIdExists = eis.readBoolean(); |
904 + | if (wvrIdExists) { |
905 + | |
906 + | |
907 + | |
908 + | |
909 + | |
910 + | wvrId = eis.readString(); |
911 + | |
912 + | |
913 + | |
914 + | |
915 + | } |
916 + | |
917 + | } |
918 + | |
919 + | |
920 + | VLAWVRRow* VLAWVRRow::fromBin(EndianIStream& eis, VLAWVRTable& table, const vector<string>& attributesSeq) { |
921 + | VLAWVRRow* row = new VLAWVRRow(table); |
922 + | |
923 + | map<string, VLAWVRAttributeFromBin>::iterator iter ; |
924 + | for (unsigned int i = 0; i < attributesSeq.size(); i++) { |
925 + | iter = row->fromBinMethods.find(attributesSeq.at(i)); |
926 + | if (iter != row->fromBinMethods.end()) { |
927 + | (row->*(row->fromBinMethods[ attributesSeq.at(i) ] ))(eis); |
928 + | } |
929 + | else { |
930 + | BinaryAttributeReaderFunctor* functorP = table.getUnknownAttributeBinaryReader(attributesSeq.at(i)); |
931 + | if (functorP) |
932 + | (*functorP)(eis); |
933 + | else |
934 + | throw ConversionException("There is not method to read an attribute '"+attributesSeq.at(i)+"'.", "VLAWVRTable"); |
935 + | } |
936 + | |
937 + | } |
938 + | return row; |
939 + | } |
940 + | |
941 + | |
942 + | |
943 + | |
944 + | |
945 + | |
946 + | |
947 + | void VLAWVRRow::antennaIdFromText(const string & s) { |
948 + | |
949 + | |
950 + | antennaId = ASDMValuesParser::parse<Tag>(s); |
951 + | |
952 + | |
953 + | } |
954 + | |
955 + | |
956 + | |
957 + | void VLAWVRRow::timeIntervalFromText(const string & s) { |
958 + | |
959 + | |
960 + | timeInterval = ASDMValuesParser::parse<ArrayTimeInterval>(s); |
961 + | |
962 + | |
963 + | } |
964 + | |
965 + | |
966 + | |
967 + | void VLAWVRRow::numChanFromText(const string & s) { |
968 + | |
969 + | |
970 + | numChan = ASDMValuesParser::parse<int>(s); |
971 + | |
972 + | |
973 + | } |
974 + | |
975 + | |
976 + | |
977 + | void VLAWVRRow::hiValuesFromText(const string & s) { |
978 + | |
979 + | |
980 + | hiValues = ASDMValuesParser::parse1D<float>(s); |
981 + | |
982 + | |
983 + | } |
984 + | |
985 + | |
986 + | |
987 + | void VLAWVRRow::loValuesFromText(const string & s) { |
988 + | |
989 + | |
990 + | loValues = ASDMValuesParser::parse1D<float>(s); |
991 + | |
992 + | |
993 + | } |
994 + | |
995 + | |
996 + | |
997 + | |
998 + | void VLAWVRRow::chanFreqCenterFromText(const string & s) { |
999 + | chanFreqCenterExists = true; |
1000 + | |
1001 + | |
1002 + | chanFreqCenter = ASDMValuesParser::parse1D<Frequency>(s); |
1003 + | |
1004 + | |
1005 + | } |
1006 + | |
1007 + | |
1008 + | |
1009 + | void VLAWVRRow::chanWidthFromText(const string & s) { |
1010 + | chanWidthExists = true; |
1011 + | |
1012 + | |
1013 + | chanWidth = ASDMValuesParser::parse1D<Frequency>(s); |
1014 + | |
1015 + | |
1016 + | } |
1017 + | |
1018 + | |
1019 + | |
1020 + | void VLAWVRRow::wvrIdFromText(const string & s) { |
1021 + | wvrIdExists = true; |
1022 + | |
1023 + | |
1024 + | wvrId = ASDMValuesParser::parse<string>(s); |
1025 + | |
1026 + | |
1027 + | } |
1028 + | |
1029 + | |
1030 + | |
1031 + | void VLAWVRRow::fromText(const std::string& attributeName, const std::string& t) { |
1032 + | map<string, VLAWVRAttributeFromText>::iterator iter; |
1033 + | if ((iter = fromTextMethods.find(attributeName)) == fromTextMethods.end()) |
1034 + | throw ConversionException("I do not know what to do with '"+attributeName+"' and its content '"+t+"' (while parsing an XML document)", "VLAWVRTable"); |
1035 + | (this->*(iter->second))(t); |
1036 + | } |
1037 + | |
1038 + | |
1039 + | |
1040 + | |
1041 + | |
1042 + | |
1043 + | |
1044 + | |
1045 + | |
1046 + | |
1047 + | |
1048 + | |
1049 + | ArrayTimeInterval VLAWVRRow::getTimeInterval() const { |
1050 + | |
1051 + | return timeInterval; |
1052 + | } |
1053 + | |
1054 + | |
1055 + | |
1056 + | |
1057 + | |
1058 + | |
1059 + | |
1060 + | |
1061 + | |
1062 + | |
1063 + | void VLAWVRRow::setTimeInterval (ArrayTimeInterval timeInterval) { |
1064 + | |
1065 + | |
1066 + | if (hasBeenAdded) { |
1067 + | |
1068 + | throw IllegalAccessException("timeInterval", "VLAWVR"); |
1069 + | |
1070 + | } |
1071 + | |
1072 + | this->timeInterval = timeInterval; |
1073 + | |
1074 + | } |
1075 + | |
1076 + | |
1077 + | |
1078 + | |
1079 + | |
1080 + | |
1081 + | |
1082 + | |
1083 + | |
1084 + | |
1085 + | int VLAWVRRow::getNumChan() const { |
1086 + | |
1087 + | return numChan; |
1088 + | } |
1089 + | |
1090 + | |
1091 + | |
1092 + | |
1093 + | |
1094 + | |
1095 + | |
1096 + | |
1097 + | void VLAWVRRow::setNumChan (int numChan) { |
1098 + | |
1099 + | |
1100 + | if (hasBeenAdded) { |
1101 + | |
1102 + | } |
1103 + | |
1104 + | this->numChan = numChan; |
1105 + | |
1106 + | } |
1107 + | |
1108 + | |
1109 + | |
1110 + | |
1111 + | |
1112 + | |
1113 + | |
1114 + | |
1115 + | |
1116 + | |
1117 + | std::vector<float > VLAWVRRow::getHiValues() const { |
1118 + | |
1119 + | return hiValues; |
1120 + | } |
1121 + | |
1122 + | |
1123 + | |
1124 + | |
1125 + | |
1126 + | |
1127 + | |
1128 + | |
1129 + | void VLAWVRRow::setHiValues (std::vector<float > hiValues) { |
1130 + | |
1131 + | |
1132 + | if (hasBeenAdded) { |
1133 + | |
1134 + | } |
1135 + | |
1136 + | this->hiValues = hiValues; |
1137 + | |
1138 + | } |
1139 + | |
1140 + | |
1141 + | |
1142 + | |
1143 + | |
1144 + | |
1145 + | |
1146 + | |
1147 + | |
1148 + | |
1149 + | std::vector<float > VLAWVRRow::getLoValues() const { |
1150 + | |
1151 + | return loValues; |
1152 + | } |
1153 + | |
1154 + | |
1155 + | |
1156 + | |
1157 + | |
1158 + | |
1159 + | |
1160 + | |
1161 + | void VLAWVRRow::setLoValues (std::vector<float > loValues) { |
1162 + | |
1163 + | |
1164 + | if (hasBeenAdded) { |
1165 + | |
1166 + | } |
1167 + | |
1168 + | this->loValues = loValues; |
1169 + | |
1170 + | } |
1171 + | |
1172 + | |
1173 + | |
1174 + | |
1175 + | |
1176 + | |
1177 + | |
1178 + | |
1179 + | bool VLAWVRRow::isChanFreqCenterExists() const { |
1180 + | return chanFreqCenterExists; |
1181 + | } |
1182 + | |
1183 + | |
1184 + | |
1185 + | |
1186 + | |
1187 + | |
1188 + | |
1189 + | |
1190 + | std::vector<Frequency > VLAWVRRow::getChanFreqCenter() const { |
1191 + | if (!chanFreqCenterExists) { |
1192 + | throw IllegalAccessException("chanFreqCenter", "VLAWVR"); |
1193 + | } |
1194 + | |
1195 + | return chanFreqCenter; |
1196 + | } |
1197 + | |
1198 + | |
1199 + | |
1200 + | |
1201 + | |
1202 + | |
1203 + | |
1204 + | void VLAWVRRow::setChanFreqCenter (std::vector<Frequency > chanFreqCenter) { |
1205 + | |
1206 + | this->chanFreqCenter = chanFreqCenter; |
1207 + | |
1208 + | chanFreqCenterExists = true; |
1209 + | |
1210 + | } |
1211 + | |
1212 + | |
1213 + | |
1214 + | |
1215 + | |
1216 + | void VLAWVRRow::clearChanFreqCenter () { |
1217 + | chanFreqCenterExists = false; |
1218 + | } |
1219 + | |
1220 + | |
1221 + | |
1222 + | |
1223 + | |
1224 + | |
1225 + | |
1226 + | bool VLAWVRRow::isChanWidthExists() const { |
1227 + | return chanWidthExists; |
1228 + | } |
1229 + | |
1230 + | |
1231 + | |
1232 + | |
1233 + | |
1234 + | |
1235 + | |
1236 + | |
1237 + | std::vector<Frequency > VLAWVRRow::getChanWidth() const { |
1238 + | if (!chanWidthExists) { |
1239 + | throw IllegalAccessException("chanWidth", "VLAWVR"); |
1240 + | } |
1241 + | |
1242 + | return chanWidth; |
1243 + | } |
1244 + | |
1245 + | |
1246 + | |
1247 + | |
1248 + | |
1249 + | |
1250 + | |
1251 + | void VLAWVRRow::setChanWidth (std::vector<Frequency > chanWidth) { |
1252 + | |
1253 + | this->chanWidth = chanWidth; |
1254 + | |
1255 + | chanWidthExists = true; |
1256 + | |
1257 + | } |
1258 + | |
1259 + | |
1260 + | |
1261 + | |
1262 + | |
1263 + | void VLAWVRRow::clearChanWidth () { |
1264 + | chanWidthExists = false; |
1265 + | } |
1266 + | |
1267 + | |
1268 + | |
1269 + | |
1270 + | |
1271 + | |
1272 + | |
1273 + | bool VLAWVRRow::isWvrIdExists() const { |
1274 + | return wvrIdExists; |
1275 + | } |
1276 + | |
1277 + | |
1278 + | |
1279 + | |
1280 + | |
1281 + | |
1282 + | |
1283 + | |
1284 + | std::string VLAWVRRow::getWvrId() const { |
1285 + | if (!wvrIdExists) { |
1286 + | throw IllegalAccessException("wvrId", "VLAWVR"); |
1287 + | } |
1288 + | |
1289 + | return wvrId; |
1290 + | } |
1291 + | |
1292 + | |
1293 + | |
1294 + | |
1295 + | |
1296 + | |
1297 + | |
1298 + | void VLAWVRRow::setWvrId (std::string wvrId) { |
1299 + | |
1300 + | this->wvrId = wvrId; |
1301 + | |
1302 + | wvrIdExists = true; |
1303 + | |
1304 + | } |
1305 + | |
1306 + | |
1307 + | |
1308 + | |
1309 + | |
1310 + | void VLAWVRRow::clearWvrId () { |
1311 + | wvrIdExists = false; |
1312 + | } |
1313 + | |
1314 + | |
1315 + | |
1316 + | |
1317 + | |
1318 + | |
1319 + | |
1320 + | |
1321 + | |
1322 + | |
1323 + | |
1324 + | |
1325 + | |
1326 + | |
1327 + | Tag VLAWVRRow::getAntennaId() const { |
1328 + | |
1329 + | return antennaId; |
1330 + | } |
1331 + | |
1332 + | |
1333 + | |
1334 + | |
1335 + | |
1336 + | |
1337 + | |
1338 + | |
1339 + | |
1340 + | |
1341 + | void VLAWVRRow::setAntennaId (Tag antennaId) { |
1342 + | |
1343 + | |
1344 + | if (hasBeenAdded) { |
1345 + | |
1346 + | throw IllegalAccessException("antennaId", "VLAWVR"); |
1347 + | |
1348 + | } |
1349 + | |
1350 + | this->antennaId = antennaId; |
1351 + | |
1352 + | } |
1353 + | |
1354 + | |
1355 + | |
1356 + | |
1357 + | |
1358 + | |
1359 + | |
1360 + | |
1361 + | |
1362 + | |
1363 + | |
1364 + | |
1365 + | |
1366 + | |
1367 + | |
1368 + | |
1369 + | |
1370 + | |
1371 + | |
1372 + | AntennaRow* VLAWVRRow::getAntennaUsingAntennaId() { |
1373 + | |
1374 + | return table.getContainer().getAntenna().getRowByKey(antennaId); |
1375 + | } |
1376 + | |
1377 + | |
1378 + | |
1379 + | |
1380 + | |
1381 + | |
1382 + | |
1383 + | |
1384 + | |
1385 + | |
1386 + | |
1387 + | |
1388 + | |
1389 + | VLAWVRRow::VLAWVRRow (VLAWVRTable &t) : table(t) { |
1390 + | hasBeenAdded = false; |
1391 + | |
1392 + | |
1393 + | |
1394 + | |
1395 + | |
1396 + | |
1397 + | |
1398 + | |
1399 + | |
1400 + | |
1401 + | |
1402 + | chanFreqCenterExists = false; |
1403 + | |
1404 + | |
1405 + | |
1406 + | chanWidthExists = false; |
1407 + | |
1408 + | |
1409 + | |
1410 + | wvrIdExists = false; |
1411 + | |
1412 + | |
1413 + | |
1414 + | |
1415 + | |
1416 + | |
1417 + | |
1418 + | |
1419 + | |
1420 + | |
1421 + | |
1422 + | |
1423 + | |
1424 + | |
1425 + | |
1426 + | |
1427 + | |
1428 + | |
1429 + | |
1430 + | |
1431 + | |
1432 + | |
1433 + | |
1434 + | |
1435 + | fromBinMethods["antennaId"] = &VLAWVRRow::antennaIdFromBin; |
1436 + | fromBinMethods["timeInterval"] = &VLAWVRRow::timeIntervalFromBin; |
1437 + | fromBinMethods["numChan"] = &VLAWVRRow::numChanFromBin; |
1438 + | fromBinMethods["hiValues"] = &VLAWVRRow::hiValuesFromBin; |
1439 + | fromBinMethods["loValues"] = &VLAWVRRow::loValuesFromBin; |
1440 + | |
1441 + | |
1442 + | fromBinMethods["chanFreqCenter"] = &VLAWVRRow::chanFreqCenterFromBin; |
1443 + | fromBinMethods["chanWidth"] = &VLAWVRRow::chanWidthFromBin; |
1444 + | fromBinMethods["wvrId"] = &VLAWVRRow::wvrIdFromBin; |
1445 + | |
1446 + | |
1447 + | |
1448 + | |
1449 + | |
1450 + | fromTextMethods["antennaId"] = &VLAWVRRow::antennaIdFromText; |
1451 + | |
1452 + | |
1453 + | |
1454 + | fromTextMethods["timeInterval"] = &VLAWVRRow::timeIntervalFromText; |
1455 + | |
1456 + | |
1457 + | |
1458 + | fromTextMethods["numChan"] = &VLAWVRRow::numChanFromText; |
1459 + | |
1460 + | |
1461 + | |
1462 + | fromTextMethods["hiValues"] = &VLAWVRRow::hiValuesFromText; |
1463 + | |
1464 + | |
1465 + | |
1466 + | fromTextMethods["loValues"] = &VLAWVRRow::loValuesFromText; |
1467 + | |
1468 + | |
1469 + | |
1470 + | |
1471 + | |
1472 + | fromTextMethods["chanFreqCenter"] = &VLAWVRRow::chanFreqCenterFromText; |
1473 + | |
1474 + | |
1475 + | |
1476 + | fromTextMethods["chanWidth"] = &VLAWVRRow::chanWidthFromText; |
1477 + | |
1478 + | |
1479 + | |
1480 + | fromTextMethods["wvrId"] = &VLAWVRRow::wvrIdFromText; |
1481 + | |
1482 + | |
1483 + | } |
1484 + | |
1485 + | VLAWVRRow::VLAWVRRow (VLAWVRTable &t, VLAWVRRow *row) : table(t) { |
1486 + | hasBeenAdded = false; |
1487 + | |
1488 + | if (row == 0) { |
1489 + | |
1490 + | |
1491 + | |
1492 + | |
1493 + | |
1494 + | |
1495 + | |
1496 + | |
1497 + | |
1498 + | |
1499 + | |
1500 + | chanFreqCenterExists = false; |
1501 + | |
1502 + | |
1503 + | |
1504 + | chanWidthExists = false; |
1505 + | |
1506 + | |
1507 + | |
1508 + | wvrIdExists = false; |
1509 + | |
1510 + | |
1511 + | |
1512 + | |
1513 + | |
1514 + | } |
1515 + | else { |
1516 + | |
1517 + | |
1518 + | antennaId = row->antennaId; |
1519 + | |
1520 + | timeInterval = row->timeInterval; |
1521 + | |
1522 + | |
1523 + | |
1524 + | |
1525 + | numChan = row->numChan; |
1526 + | |
1527 + | hiValues = row->hiValues; |
1528 + | |
1529 + | loValues = row->loValues; |
1530 + | |
1531 + | |
1532 + | |
1533 + | |
1534 + | if (row->chanFreqCenterExists) { |
1535 + | chanFreqCenter = row->chanFreqCenter; |
1536 + | chanFreqCenterExists = true; |
1537 + | } |
1538 + | else |
1539 + | chanFreqCenterExists = false; |
1540 + | |
1541 + | if (row->chanWidthExists) { |
1542 + | chanWidth = row->chanWidth; |
1543 + | chanWidthExists = true; |
1544 + | } |
1545 + | else |
1546 + | chanWidthExists = false; |
1547 + | |
1548 + | if (row->wvrIdExists) { |
1549 + | wvrId = row->wvrId; |
1550 + | wvrIdExists = true; |
1551 + | } |
1552 + | else |
1553 + | wvrIdExists = false; |
1554 + | |
1555 + | } |
1556 + | |
1557 + | fromBinMethods["antennaId"] = &VLAWVRRow::antennaIdFromBin; |
1558 + | fromBinMethods["timeInterval"] = &VLAWVRRow::timeIntervalFromBin; |
1559 + | fromBinMethods["numChan"] = &VLAWVRRow::numChanFromBin; |
1560 + | fromBinMethods["hiValues"] = &VLAWVRRow::hiValuesFromBin; |
1561 + | fromBinMethods["loValues"] = &VLAWVRRow::loValuesFromBin; |
1562 + | |
1563 + | |
1564 + | fromBinMethods["chanFreqCenter"] = &VLAWVRRow::chanFreqCenterFromBin; |
1565 + | fromBinMethods["chanWidth"] = &VLAWVRRow::chanWidthFromBin; |
1566 + | fromBinMethods["wvrId"] = &VLAWVRRow::wvrIdFromBin; |
1567 + | |
1568 + | } |
1569 + | |
1570 + | |
1571 + | bool VLAWVRRow::compareNoAutoInc(Tag antennaId, ArrayTimeInterval timeInterval, int numChan, std::vector<float > hiValues, std::vector<float > loValues) { |
1572 + | bool result; |
1573 + | result = true; |
1574 + | |
1575 + | |
1576 + | |
1577 + | result = result && (this->antennaId == antennaId); |
1578 + | |
1579 + | if (!result) return false; |
1580 + | |
1581 + | |
1582 + | |
1583 + | |
1584 + | result = result && (this->timeInterval.overlaps(timeInterval)); |
1585 + | |
1586 + | if (!result) return false; |
1587 + | |
1588 + | |
1589 + | |
1590 + | |
1591 + | result = result && (this->numChan == numChan); |
1592 + | |
1593 + | if (!result) return false; |
1594 + | |
1595 + | |
1596 + | |
1597 + | |
1598 + | result = result && (this->hiValues == hiValues); |
1599 + | |
1600 + | if (!result) return false; |
1601 + | |
1602 + | |
1603 + | |
1604 + | |
1605 + | result = result && (this->loValues == loValues); |
1606 + | |
1607 + | if (!result) return false; |
1608 + | |
1609 + | |
1610 + | return result; |
1611 + | } |
1612 + | |
1613 + | |
1614 + | |
1615 + | bool VLAWVRRow::compareRequiredValue(int numChan, std::vector<float > hiValues, std::vector<float > loValues) { |
1616 + | bool result; |
1617 + | result = true; |
1618 + | |
1619 + | |
1620 + | if (!(this->numChan == numChan)) return false; |
1621 + | |
1622 + | |
1623 + | |
1624 + | if (!(this->hiValues == hiValues)) return false; |
1625 + | |
1626 + | |
1627 + | |
1628 + | if (!(this->loValues == loValues)) return false; |
1629 + | |
1630 + | |
1631 + | return result; |
1632 + | } |
1633 + | |
1634 + | |
1635 + | |
1636 + | |
1637 + | |
1638 + | |
1639 + | |
1640 + | |
1641 + | |
1642 + | |
1643 + | |
1644 + | |
1645 + | bool VLAWVRRow::equalByRequiredValue(VLAWVRRow* x ) { |
1646 + | |
1647 + | |
1648 + | if (this->numChan != x->numChan) return false; |
1649 + | |
1650 + | if (this->hiValues != x->hiValues) return false; |
1651 + | |
1652 + | if (this->loValues != x->loValues) return false; |
1653 + | |
1654 + | |
1655 + | return true; |
1656 + | } |
1657 + | |
1658 + | |
1659 + | |
1660 + | |
1661 + | |
1662 + | |
1663 + | |
1664 + | |
1665 + | |
1666 + | |
1667 + | |
1668 + | |
1669 + | |
1670 + | |
1671 + | |
1672 + | |
1673 + | |
1674 + | |
1675 + | |
1676 + | |
1677 + | } |
1678 + | |