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