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