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