Line data Source code
1 :
2 : /*
3 : * ALMA - Atacama Large Millimeter Array
4 : * (c) European Southern Observatory, 2002
5 : * (c) Associated Universities Inc., 2002
6 : * Copyright by ESO (in the framework of the ALMA collaboration),
7 : * Copyright by AUI (in the framework of the ALMA collaboration),
8 : * All rights reserved.
9 : *
10 : * This library is free software; you can redistribute it and/or
11 : * modify it under the terms of the GNU Lesser General Public
12 : * License as published by the Free software Foundation; either
13 : * version 2.1 of the License, or (at your option) any later version.
14 : *
15 : * This library is distributed in the hope that it will be useful,
16 : * but WITHOUT ANY WARRANTY, without even the implied warranty of
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 : * Lesser General Public License for more details.
19 : *
20 : * You should have received a copy of the GNU Lesser General Public
21 : * License along with this library; if not, write to the Free Software
22 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 : * MA 02111-1307 USA
24 : *
25 : * Warning!
26 : * --------------------------------------------------------------------
27 : * | This is generated code! Do not modify this file. |
28 : * | If you do, all changes will be lost when the file is re-generated. |
29 : * --------------------------------------------------------------------
30 : *
31 : * File CalBandpassTable.h
32 : */
33 :
34 : #ifndef CalBandpassTable_CLASS
35 : #define CalBandpassTable_CLASS
36 :
37 : #include <string>
38 : #include <vector>
39 : #include <map>
40 :
41 :
42 :
43 :
44 : #include <alma/ASDM/ArrayTime.h>
45 :
46 :
47 :
48 : #include <alma/ASDM/Frequency.h>
49 :
50 :
51 :
52 : #include <alma/ASDM/Tag.h>
53 :
54 :
55 :
56 :
57 :
58 :
59 : #include <alma/Enumerations/CBasebandName.h>
60 :
61 :
62 :
63 : #include <alma/Enumerations/CNetSideband.h>
64 :
65 :
66 :
67 : #include <alma/Enumerations/CAtmPhaseCorrection.h>
68 :
69 :
70 :
71 : #include <alma/Enumerations/CCalCurveType.h>
72 :
73 :
74 :
75 : #include <alma/Enumerations/CReceiverBand.h>
76 :
77 :
78 :
79 :
80 :
81 :
82 :
83 :
84 :
85 :
86 :
87 :
88 :
89 :
90 :
91 :
92 :
93 :
94 :
95 : #include <alma/Enumerations/CPolarizationType.h>
96 :
97 :
98 :
99 :
100 :
101 :
102 :
103 :
104 :
105 :
106 :
107 :
108 :
109 :
110 :
111 :
112 :
113 :
114 :
115 :
116 :
117 :
118 :
119 :
120 :
121 :
122 : #include <alma/ASDM/ConversionException.h>
123 : #include <alma/ASDM/DuplicateKey.h>
124 : #include <alma/ASDM/UniquenessViolationException.h>
125 : #include <alma/ASDM/NoSuchRow.h>
126 : #include <alma/ASDM/DuplicateKey.h>
127 :
128 :
129 : #ifndef WITHOUT_ACS
130 : #include <asdmIDLC.h>
131 : #endif
132 :
133 : #include <alma/ASDM/Representable.h>
134 :
135 : #include <pthread.h>
136 :
137 : namespace asdm {
138 :
139 : //class asdm::ASDM;
140 : //class asdm::CalBandpassRow;
141 :
142 : class ASDM;
143 : class CalBandpassRow;
144 : /**
145 : * The CalBandpassTable class is an Alma table.
146 : * <BR>
147 : *
148 : * \par Role
149 : * Result of passband calibration performed on-line by TelCal.
150 : * <BR>
151 :
152 : * Generated from model's revision "-1", branch ""
153 : *
154 : * <TABLE BORDER="1">
155 : * <CAPTION> Attributes of CalBandpass </CAPTION>
156 : * <TR BGCOLOR="#AAAAAA"> <TH> Name </TH> <TH> Type </TH> <TH> Expected shape </TH> <TH> Comment </TH></TR>
157 :
158 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" align="center"> Key </TD></TR>
159 :
160 : * <TR>
161 :
162 : * <TD> basebandName </TD>
163 :
164 : * <TD> BasebandNameMod::BasebandName</TD>
165 : * <TD> </TD>
166 : * <TD> identifies the baseband. </TD>
167 : * </TR>
168 :
169 : * <TR>
170 :
171 : * <TD> sideband </TD>
172 :
173 : * <TD> NetSidebandMod::NetSideband</TD>
174 : * <TD> </TD>
175 : * <TD> identifies the first LO sideband. </TD>
176 : * </TR>
177 :
178 : * <TR>
179 :
180 : * <TD> atmPhaseCorrection </TD>
181 :
182 : * <TD> AtmPhaseCorrectionMod::AtmPhaseCorrection</TD>
183 : * <TD> </TD>
184 : * <TD> qualifies how the atmospheric phase correction has been applied. </TD>
185 : * </TR>
186 :
187 : * <TR>
188 :
189 : * <TD> typeCurve </TD>
190 :
191 : * <TD> CalCurveTypeMod::CalCurveType</TD>
192 : * <TD> </TD>
193 : * <TD> identifies the type of curve. </TD>
194 : * </TR>
195 :
196 : * <TR>
197 :
198 : * <TD> receiverBand </TD>
199 :
200 : * <TD> ReceiverBandMod::ReceiverBand</TD>
201 : * <TD> </TD>
202 : * <TD> identifies the receiver band. </TD>
203 : * </TR>
204 :
205 : * <TR>
206 :
207 : * <TD> calDataId </TD>
208 :
209 : * <TD> Tag</TD>
210 : * <TD> </TD>
211 : * <TD> refers to a unique row in CalData Table. </TD>
212 : * </TR>
213 :
214 : * <TR>
215 :
216 : * <TD> calReductionId </TD>
217 :
218 : * <TD> Tag</TD>
219 : * <TD> </TD>
220 : * <TD> refers to a unique row in CalReduction Table. </TD>
221 : * </TR>
222 :
223 :
224 :
225 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" valign="center"> Value <br> (Mandatory) </TH></TR>
226 :
227 : * <TR>
228 : * <TD> startValidTime </TD>
229 : * <TD> ArrayTime </TD>
230 : * <TD> </TD>
231 : * <TD> the start time of result validity period. </TD>
232 : * </TR>
233 :
234 : * <TR>
235 : * <TD> endValidTime </TD>
236 : * <TD> ArrayTime </TD>
237 : * <TD> </TD>
238 : * <TD> the end time of result validity period. </TD>
239 : * </TR>
240 :
241 : * <TR>
242 : * <TD> numAntenna (numAntenna)</TD>
243 : * <TD> int </TD>
244 : * <TD> </TD>
245 : * <TD> the number of antennas. </TD>
246 : * </TR>
247 :
248 : * <TR>
249 : * <TD> numPoly (numPoly)</TD>
250 : * <TD> int </TD>
251 : * <TD> </TD>
252 : * <TD> the number of coefficients of the polynomial. </TD>
253 : * </TR>
254 :
255 : * <TR>
256 : * <TD> numReceptor (numReceptor)</TD>
257 : * <TD> int </TD>
258 : * <TD> </TD>
259 : * <TD> the number of receptors. </TD>
260 : * </TR>
261 :
262 : * <TR>
263 : * <TD> antennaNames </TD>
264 : * <TD> std::vector<std::string > </TD>
265 : * <TD> numAntenna </TD>
266 : * <TD> the names of the antennas. </TD>
267 : * </TR>
268 :
269 : * <TR>
270 : * <TD> refAntennaName </TD>
271 : * <TD> std::string </TD>
272 : * <TD> </TD>
273 : * <TD> the name of the reference antenna. </TD>
274 : * </TR>
275 :
276 : * <TR>
277 : * <TD> freqLimits </TD>
278 : * <TD> std::vector<Frequency > </TD>
279 : * <TD> 2 </TD>
280 : * <TD> the frequency range for the polynomial description of the passband. </TD>
281 : * </TR>
282 :
283 : * <TR>
284 : * <TD> polarizationTypes </TD>
285 : * <TD> std::vector<PolarizationTypeMod::PolarizationType > </TD>
286 : * <TD> numReceptor </TD>
287 : * <TD> the polarizations of the receptors (one value per receptor). </TD>
288 : * </TR>
289 :
290 : * <TR>
291 : * <TD> curve </TD>
292 : * <TD> std::vector<std::vector<std::vector<float > > > </TD>
293 : * <TD> numAntenna, numReceptor, numPoly </TD>
294 : * <TD> the amplitude or phase coefficients, depending on the value of typeCurve (one array of numPoly values per antenna per receptor). </TD>
295 : * </TR>
296 :
297 : * <TR>
298 : * <TD> reducedChiSquared </TD>
299 : * <TD> std::vector<double > </TD>
300 : * <TD> numReceptor </TD>
301 : * <TD> measures the quality of the least squares fits (one value per receptor). </TD>
302 : * </TR>
303 :
304 :
305 :
306 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" valign="center"> Value <br> (Optional) </TH></TR>
307 :
308 : * <TR>
309 : * <TD> numBaseline(numBaseline)</TD>
310 : * <TD> int </TD>
311 : * <TD> </TD>
312 : * <TD> the number of baselines. </TD>
313 : * </TR>
314 :
315 : * <TR>
316 : * <TD> numFreq(numFreq)</TD>
317 : * <TD> int </TD>
318 : * <TD> </TD>
319 : * <TD> the number of frequency points. </TD>
320 : * </TR>
321 :
322 : * <TR>
323 : * <TD> rms</TD>
324 : * <TD> std::vector<std::vector<float > > </TD>
325 : * <TD> numReceptor, numBaseline </TD>
326 : * <TD> the amplitude or phase residuals ( one array of numBaseline values per receptor). </TD>
327 : * </TR>
328 :
329 : * <TR>
330 : * <TD> frequencyRange</TD>
331 : * <TD> std::vector<Frequency > </TD>
332 : * <TD> 2 </TD>
333 : * <TD> the frequency range over which the result is valid. </TD>
334 : * </TR>
335 :
336 : * <TR>
337 : * <TD> numSpectralWindow(numSpectralWindow)</TD>
338 : * <TD> int </TD>
339 : * <TD> </TD>
340 : * <TD> The number of spectral windows. </TD>
341 : * </TR>
342 :
343 : * <TR>
344 : * <TD> chanFreqStart</TD>
345 : * <TD> std::vector<Frequency > </TD>
346 : * <TD> numSpectralWindow </TD>
347 : * <TD> the frequency of the first channel. </TD>
348 : * </TR>
349 :
350 : * <TR>
351 : * <TD> chanFreqStep</TD>
352 : * <TD> std::vector<Frequency > </TD>
353 : * <TD> numSpectralWindow </TD>
354 : * <TD> the increment between two successive frequencies. </TD>
355 : * </TR>
356 :
357 : * <TR>
358 : * <TD> numSpectralWindowChan(numSpectralWindowChan)</TD>
359 : * <TD> std::vector<int > </TD>
360 : * <TD> numSpectralWindow </TD>
361 : * <TD> The number of channels for each spectral window. </TD>
362 : * </TR>
363 :
364 : * <TR>
365 : * <TD> spectrum</TD>
366 : * <TD> std::vector<std::vector<std::vector<float > > > </TD>
367 : * <TD> numAntenna, numReceptor, numFreq </TD>
368 : * <TD> The antenna-based spectrum per receptor averaging over the entire scan range. </TD>
369 : * </TR>
370 :
371 :
372 : * </TABLE>
373 : */
374 : class CalBandpassTable : public Representable {
375 : friend class ASDM;
376 :
377 : public:
378 :
379 :
380 : /**
381 : * Return the list of field names that make up key key
382 : * as an array of strings.
383 : * @return a vector of string.
384 : */
385 : static const std::vector<std::string>& getKeyName();
386 :
387 :
388 : virtual ~CalBandpassTable();
389 :
390 : /**
391 : * Return the container to which this table belongs.
392 : *
393 : * @return the ASDM containing this table.
394 : */
395 : ASDM &getContainer() const;
396 :
397 : /**
398 : * Return the number of rows in the table.
399 : *
400 : * @return the number of rows in an unsigned int.
401 : */
402 : unsigned int size() const;
403 :
404 : /**
405 : * Return the name of this table.
406 : *
407 : * This is a instance method of the class.
408 : *
409 : * @return the name of this table in a string.
410 : */
411 : std::string getName() const;
412 :
413 : /**
414 : * Return the name of this table.
415 : *
416 : * This is a static method of the class.
417 : *
418 : * @return the name of this table in a string.
419 : */
420 : static std::string name() ;
421 :
422 : /**
423 : * Return the version information about this table.
424 : *
425 : */
426 : std::string getVersion() const ;
427 :
428 : /**
429 : * Return the names of the attributes of this table.
430 : *
431 : * @return a vector of string
432 : */
433 : static const std::vector<std::string>& getAttributesNames();
434 :
435 : /**
436 : * Return the default sorted list of attributes names in the binary representation of the table.
437 : *
438 : * @return a const reference to a vector of string
439 : */
440 : static const std::vector<std::string>& defaultAttributesNamesInBin();
441 :
442 : /**
443 : * Return this table's Entity.
444 : */
445 : Entity getEntity() const;
446 :
447 : /**
448 : * Set this table's Entity.
449 : * @param e An entity.
450 : */
451 : void setEntity(Entity e);
452 :
453 : /**
454 : * Produces an XML representation conform
455 : * to the schema defined for CalBandpass (CalBandpassTable.xsd).
456 : *
457 : * @returns a string containing the XML representation.
458 : * @throws ConversionException
459 : */
460 : std::string toXML() ;
461 :
462 : #ifndef WITHOUT_ACS
463 : // Conversion Methods
464 : /**
465 : * Convert this table into a CalBandpassTableIDL CORBA structure.
466 : *
467 : * @return a pointer to a CalBandpassTableIDL
468 : */
469 : asdmIDL::CalBandpassTableIDL *toIDL() ;
470 :
471 : /**
472 : * Fills the CORBA data structure passed in parameter
473 : * with the content of this table.
474 : *
475 : * @param x a reference to the asdmIDL::CalBandpassTableIDL to be populated
476 : * with the content of this.
477 : */
478 : void toIDL(asdmIDL::CalBandpassTableIDL& x) const;
479 :
480 : #endif
481 :
482 : #ifndef WITHOUT_ACS
483 : /**
484 : * Populate this table from the content of a CalBandpassTableIDL Corba structure.
485 : *
486 : * @throws DuplicateKey Thrown if the method tries to add a row having a key that is already in the table.
487 : * @throws ConversionException
488 : */
489 : void fromIDL(asdmIDL::CalBandpassTableIDL x) ;
490 : #endif
491 :
492 : //
493 : // ====> Row creation.
494 : //
495 :
496 : /**
497 : * Create a new row with default values.
498 : * @return a pointer on a CalBandpassRow
499 : */
500 : CalBandpassRow *newRow();
501 :
502 :
503 : /**
504 : * Create a new row initialized to the specified values.
505 : * @return a pointer on the created and initialized row.
506 :
507 : * @param basebandName
508 :
509 : * @param sideband
510 :
511 : * @param atmPhaseCorrection
512 :
513 : * @param typeCurve
514 :
515 : * @param receiverBand
516 :
517 : * @param calDataId
518 :
519 : * @param calReductionId
520 :
521 : * @param startValidTime
522 :
523 : * @param endValidTime
524 :
525 : * @param numAntenna
526 :
527 : * @param numPoly
528 :
529 : * @param numReceptor
530 :
531 : * @param antennaNames
532 :
533 : * @param refAntennaName
534 :
535 : * @param freqLimits
536 :
537 : * @param polarizationTypes
538 :
539 : * @param curve
540 :
541 : * @param reducedChiSquared
542 :
543 : */
544 : CalBandpassRow *newRow(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband sideband, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numAntenna, int numPoly, int numReceptor, std::vector<std::string > antennaNames, std::string refAntennaName, std::vector<Frequency > freqLimits, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<std::vector<std::vector<float > > > curve, std::vector<double > reducedChiSquared);
545 :
546 :
547 :
548 : /**
549 : * Create a new row using a copy constructor mechanism.
550 : *
551 : * The method creates a new CalBandpassRow owned by this. Each attribute of the created row
552 : * is a (deep) copy of the corresponding attribute of row. The method does not add
553 : * the created row to this, its simply parents it to this, a call to the add method
554 : * has to be done in order to get the row added (very likely after having modified
555 : * some of its attributes).
556 : * If row is null then the method returns a new CalBandpassRow with default values for its attributes.
557 : *
558 : * @param row the row which is to be copied.
559 : */
560 : CalBandpassRow *newRow(CalBandpassRow *row);
561 :
562 : //
563 : // ====> Append a row to its table.
564 : //
565 :
566 :
567 : /**
568 : * Add a row.
569 : * @param x a pointer to the CalBandpassRow to be added.
570 : *
571 : * @return a pointer to a CalBandpassRow. If the table contains a CalBandpassRow whose attributes (key and mandatory values) are equal to x ones
572 : * then returns a pointer on that CalBandpassRow, otherwise returns x.
573 : *
574 : * @throw DuplicateKey { thrown when the table contains a CalBandpassRow with a key equal to the x one but having
575 : * and a value section different from x one }
576 : *
577 :
578 : */
579 : CalBandpassRow* add(CalBandpassRow* x) ;
580 :
581 :
582 :
583 :
584 :
585 : //
586 : // ====> Methods returning rows.
587 : //
588 :
589 : /**
590 : * Get a collection of pointers on the rows of the table.
591 : * @return Alls rows in a vector of pointers of CalBandpassRow. The elements of this vector are stored in the order
592 : * in which they have been added to the CalBandpassTable.
593 : */
594 : std::vector<CalBandpassRow *> get() ;
595 :
596 : /**
597 : * Get a const reference on the collection of rows pointers internally hold by the table.
598 : * @return A const reference of a vector of pointers of CalBandpassRow. The elements of this vector are stored in the order
599 : * in which they have been added to the CalBandpassTable.
600 : *
601 : */
602 : const std::vector<CalBandpassRow *>& get() const ;
603 :
604 :
605 :
606 :
607 :
608 : /**
609 : * Returns a CalBandpassRow* given a key.
610 : * @return a pointer to the row having the key whose values are passed as parameters, or 0 if
611 : * no row exists for that key.
612 :
613 : * @param basebandName
614 :
615 : * @param sideband
616 :
617 : * @param atmPhaseCorrection
618 :
619 : * @param typeCurve
620 :
621 : * @param receiverBand
622 :
623 : * @param calDataId
624 :
625 : * @param calReductionId
626 :
627 : *
628 : */
629 : CalBandpassRow* getRowByKey(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband sideband, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
630 :
631 :
632 :
633 :
634 :
635 : /**
636 : * Look up the table for a row whose all attributes
637 : * are equal to the corresponding parameters of the method.
638 : * @return a pointer on this row if any, null otherwise.
639 : *
640 :
641 : * @param basebandName
642 :
643 : * @param sideband
644 :
645 : * @param atmPhaseCorrection
646 :
647 : * @param typeCurve
648 :
649 : * @param receiverBand
650 :
651 : * @param calDataId
652 :
653 : * @param calReductionId
654 :
655 : * @param startValidTime
656 :
657 : * @param endValidTime
658 :
659 : * @param numAntenna
660 :
661 : * @param numPoly
662 :
663 : * @param numReceptor
664 :
665 : * @param antennaNames
666 :
667 : * @param refAntennaName
668 :
669 : * @param freqLimits
670 :
671 : * @param polarizationTypes
672 :
673 : * @param curve
674 :
675 : * @param reducedChiSquared
676 :
677 : */
678 : CalBandpassRow* lookup(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband sideband, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numAntenna, int numPoly, int numReceptor, std::vector<std::string > antennaNames, std::string refAntennaName, std::vector<Frequency > freqLimits, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<std::vector<std::vector<float > > > curve, std::vector<double > reducedChiSquared);
679 :
680 :
681 : void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
682 : BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
683 :
684 : private:
685 :
686 : /**
687 : * Create a CalBandpassTable.
688 : * <p>
689 : * This constructor is private because only the
690 : * container can create tables. All tables must know the container
691 : * to which they belong.
692 : * @param container The container to which this table belongs.
693 : */
694 : CalBandpassTable (ASDM & container);
695 :
696 : ASDM & container;
697 :
698 : bool archiveAsBin; // If true archive binary else archive XML
699 : bool fileAsBin ; // If true file binary else file XML
700 :
701 : std::string version ;
702 :
703 : Entity entity;
704 :
705 :
706 :
707 :
708 :
709 :
710 : /**
711 : * If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and throw exception if not.
712 : * Check if *x verifies the key uniqueness rule and throw an exception if not.
713 : * Append x to its table.
714 : * @throws DuplicateKey
715 :
716 : */
717 : CalBandpassRow* checkAndAdd(CalBandpassRow* x, bool skipCheckUniqueness=false) ;
718 :
719 : /**
720 : * Brutally append an CalBandpassRow x to the collection of rows already stored in this table. No uniqueness check is done !
721 : *
722 : * @param CalBandpassRow* x a pointer onto the CalBandpassRow to be appended.
723 : */
724 : void append(CalBandpassRow* x) ;
725 :
726 : /**
727 : * Brutally append an CalBandpassRow x to the collection of rows already stored in this table. No uniqueness check is done !
728 : *
729 : * @param CalBandpassRow* x a pointer onto the CalBandpassRow to be appended.
730 : */
731 : void addWithoutCheckingUnique(CalBandpassRow* x) ;
732 :
733 :
734 :
735 :
736 :
737 : // A data structure to store the pointers on the table's rows.
738 :
739 : // In all cases we maintain a private vector of CalBandpassRow s.
740 : std::vector<CalBandpassRow * > privateRows;
741 :
742 :
743 :
744 : std::vector<CalBandpassRow *> row;
745 :
746 :
747 : void error() ; //throw(ConversionException);
748 :
749 :
750 : /**
751 : * Populate this table from the content of a XML document that is required to
752 : * be conform to the XML schema defined for a CalBandpass (CalBandpassTable.xsd).
753 : * @throws ConversionException
754 : *
755 : */
756 : void fromXML(std::string& xmlDoc) ;
757 :
758 : std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
759 :
760 : /**
761 : * Private methods involved during the build of this table out of the content
762 : * of file(s) containing an external representation of a CalBandpass table.
763 : */
764 : void setFromMIMEFile(const std::string& directory);
765 : /*
766 : void openMIMEFile(const std::string& directory);
767 : */
768 : void setFromXMLFile(const std::string& directory);
769 :
770 : /**
771 : * Serialize this into a stream of bytes and encapsulates that stream into a MIME message.
772 : * @returns a string containing the MIME message.
773 : *
774 : * @param byteOrder a const pointer to a static instance of the class ByteOrder.
775 : *
776 : */
777 : std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
778 :
779 :
780 : /**
781 : * Extracts the binary part of a MIME message and deserialize its content
782 : * to fill this with the result of the deserialization.
783 : * @param mimeMsg the string containing the MIME message.
784 : * @throws ConversionException
785 : */
786 : void setFromMIME(const std::string & mimeMsg);
787 :
788 : /**
789 : * Private methods involved during the export of this table into disk file(s).
790 : */
791 : std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
792 :
793 : /**
794 : * Stores a representation (binary or XML) of this table into a file.
795 : *
796 : * Depending on the boolean value of its private field fileAsBin a binary serialization of this (fileAsBin==true)
797 : * will be saved in a file "CalBandpass.bin" or an XML representation (fileAsBin==false) will be saved in a file "CalBandpass.xml".
798 : * The file is always written in a directory whose name is passed as a parameter.
799 : * @param directory The name of directory where the file containing the table's representation will be saved.
800 : *
801 : */
802 : void toFile(std::string directory);
803 :
804 : /**
805 : * Load the table in memory if necessary.
806 : */
807 : bool loadInProgress;
808 0 : void checkPresenceInMemory() {
809 0 : if (!presentInMemory && !loadInProgress) {
810 0 : loadInProgress = true;
811 0 : setFromFile(getContainer().getDirectory());
812 0 : presentInMemory = true;
813 0 : loadInProgress = false;
814 : }
815 0 : }
816 : /**
817 : * Reads and parses a file containing a representation of a CalBandpassTable as those produced by the toFile method.
818 : * This table is populated with the result of the parsing.
819 : * @param directory The name of the directory containing the file te be read and parsed.
820 : * @throws ConversionException If any error occurs while reading the
821 : * files in the directory or parsing them.
822 : *
823 : */
824 : void setFromFile(const std::string& directory);
825 :
826 : };
827 :
828 : } // End namespace asdm
829 :
830 : #endif /* CalBandpassTable_CLASS */
|