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