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 DelayModelTable.h
32 : */
33 :
34 : #ifndef DelayModelTable_CLASS
35 : #define DelayModelTable_CLASS
36 :
37 : #include <string>
38 : #include <vector>
39 : #include <map>
40 :
41 :
42 :
43 :
44 : #include <alma/ASDM/ArrayTimeInterval.h>
45 :
46 :
47 :
48 : #include <alma/ASDM/ArrayTime.h>
49 :
50 :
51 :
52 : #include <alma/ASDM/Frequency.h>
53 :
54 :
55 :
56 : #include <alma/ASDM/Tag.h>
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 : #include <alma/Enumerations/CPolarizationType.h>
106 :
107 :
108 :
109 :
110 :
111 :
112 :
113 :
114 :
115 :
116 :
117 :
118 :
119 :
120 :
121 :
122 : #include <alma/ASDM/ConversionException.h>
123 : #include <alma/ASDM/DuplicateKey.h>
124 : #include <alma/ASDM/UniquenessViolationException.h>
125 : #include <alma/ASDM/NoSuchRow.h>
126 : #include <alma/ASDM/DuplicateKey.h>
127 :
128 :
129 : #ifndef WITHOUT_ACS
130 : #include <asdmIDLC.h>
131 : #endif
132 :
133 : #include <alma/ASDM/Representable.h>
134 :
135 : #include <pthread.h>
136 :
137 : namespace asdm {
138 :
139 : //class asdm::ASDM;
140 : //class asdm::DelayModelRow;
141 :
142 : class ASDM;
143 : class DelayModelRow;
144 : /**
145 : * The DelayModelTable class is an Alma table.
146 : * <BR>
147 : *
148 : * \par Role
149 : * Contains the delay model components. For ALMA this includes all TMCDB delay model components.
150 : * <BR>
151 :
152 : * Generated from model's revision "-1", branch ""
153 : *
154 : * <TABLE BORDER="1">
155 : * <CAPTION> Attributes of DelayModel </CAPTION>
156 : * <TR BGCOLOR="#AAAAAA"> <TH> Name </TH> <TH> Type </TH> <TH> Expected shape </TH> <TH> Comment </TH></TR>
157 :
158 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" align="center"> Key </TD></TR>
159 :
160 : * <TR>
161 :
162 : * <TD> antennaId </TD>
163 :
164 : * <TD> Tag</TD>
165 : * <TD> </TD>
166 : * <TD> refers to a unique row in AntennaTable. </TD>
167 : * </TR>
168 :
169 : * <TR>
170 :
171 : * <TD> spectralWindowId </TD>
172 :
173 : * <TD> Tag</TD>
174 : * <TD> </TD>
175 : * <TD> refers to a unique row in SpectraWindowTable. </TD>
176 : * </TR>
177 :
178 : * <TR>
179 :
180 : * <TD> timeInterval </TD>
181 :
182 : * <TD> ArrayTimeInterval</TD>
183 : * <TD> </TD>
184 : * <TD> time interval for which the row's content is valid. </TD>
185 : * </TR>
186 :
187 :
188 :
189 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" valign="center"> Value <br> (Mandatory) </TH></TR>
190 :
191 : * <TR>
192 : * <TD> numPoly (numPoly)</TD>
193 : * <TD> int </TD>
194 : * <TD> </TD>
195 : * <TD> the number of coefficients of the polynomials. </TD>
196 : * </TR>
197 :
198 : * <TR>
199 : * <TD> phaseDelay </TD>
200 : * <TD> std::vector<double > </TD>
201 : * <TD> numPoly </TD>
202 : * <TD> the phase delay polynomial (rad). </TD>
203 : * </TR>
204 :
205 : * <TR>
206 : * <TD> phaseDelayRate </TD>
207 : * <TD> std::vector<double > </TD>
208 : * <TD> numPoly </TD>
209 : * <TD> Phase delay rate polynomial (rad/s). </TD>
210 : * </TR>
211 :
212 : * <TR>
213 : * <TD> groupDelay </TD>
214 : * <TD> std::vector<double > </TD>
215 : * <TD> numPoly </TD>
216 : * <TD> Group delay polynomial (s). </TD>
217 : * </TR>
218 :
219 : * <TR>
220 : * <TD> groupDelayRate </TD>
221 : * <TD> std::vector<double > </TD>
222 : * <TD> numPoly </TD>
223 : * <TD> Group delay rate polynomial (s/s) </TD>
224 : * </TR>
225 :
226 : * <TR>
227 : * <TD> fieldId </TD>
228 : * <TD> Tag </TD>
229 : * <TD> </TD>
230 : * <TD> </TD>
231 : * </TR>
232 :
233 :
234 :
235 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" valign="center"> Value <br> (Optional) </TH></TR>
236 :
237 : * <TR>
238 : * <TD> timeOrigin</TD>
239 : * <TD> ArrayTime </TD>
240 : * <TD> </TD>
241 : * <TD> value used as the origin for the evaluation of the polynomials. </TD>
242 : * </TR>
243 :
244 : * <TR>
245 : * <TD> atmosphericGroupDelay</TD>
246 : * <TD> double </TD>
247 : * <TD> </TD>
248 : * <TD> Atmosphere group delay. </TD>
249 : * </TR>
250 :
251 : * <TR>
252 : * <TD> atmosphericGroupDelayRate</TD>
253 : * <TD> double </TD>
254 : * <TD> </TD>
255 : * <TD> Atmosphere group delay rate. </TD>
256 : * </TR>
257 :
258 : * <TR>
259 : * <TD> geometricDelay</TD>
260 : * <TD> double </TD>
261 : * <TD> </TD>
262 : * <TD> Geometric delay. </TD>
263 : * </TR>
264 :
265 : * <TR>
266 : * <TD> geometricDelayRate</TD>
267 : * <TD> double </TD>
268 : * <TD> </TD>
269 : * <TD> Geometric delay. </TD>
270 : * </TR>
271 :
272 : * <TR>
273 : * <TD> numLO(numLO)</TD>
274 : * <TD> int </TD>
275 : * <TD> </TD>
276 : * <TD> the number of local oscillators. </TD>
277 : * </TR>
278 :
279 : * <TR>
280 : * <TD> LOOffset</TD>
281 : * <TD> std::vector<Frequency > </TD>
282 : * <TD> numLO </TD>
283 : * <TD> Local oscillator offset. </TD>
284 : * </TR>
285 :
286 : * <TR>
287 : * <TD> LOOffsetRate</TD>
288 : * <TD> std::vector<Frequency > </TD>
289 : * <TD> numLO </TD>
290 : * <TD> Local oscillator offset rate. </TD>
291 : * </TR>
292 :
293 : * <TR>
294 : * <TD> dispersiveDelay</TD>
295 : * <TD> double </TD>
296 : * <TD> </TD>
297 : * <TD> Dispersive delay. </TD>
298 : * </TR>
299 :
300 : * <TR>
301 : * <TD> dispersiveDelayRate</TD>
302 : * <TD> double </TD>
303 : * <TD> </TD>
304 : * <TD> Dispersive delay rate. </TD>
305 : * </TR>
306 :
307 : * <TR>
308 : * <TD> atmosphericDryDelay</TD>
309 : * <TD> double </TD>
310 : * <TD> </TD>
311 : * <TD> the dry atmospheric delay component. </TD>
312 : * </TR>
313 :
314 : * <TR>
315 : * <TD> atmosphericWetDelay</TD>
316 : * <TD> double </TD>
317 : * <TD> </TD>
318 : * <TD> the wet atmospheric delay. </TD>
319 : * </TR>
320 :
321 : * <TR>
322 : * <TD> padDelay</TD>
323 : * <TD> double </TD>
324 : * <TD> </TD>
325 : * <TD> Pad delay. </TD>
326 : * </TR>
327 :
328 : * <TR>
329 : * <TD> antennaDelay</TD>
330 : * <TD> double </TD>
331 : * <TD> </TD>
332 : * <TD> Antenna delay. </TD>
333 : * </TR>
334 :
335 : * <TR>
336 : * <TD> numReceptor(numReceptor)</TD>
337 : * <TD> int </TD>
338 : * <TD> </TD>
339 : * <TD> </TD>
340 : * </TR>
341 :
342 : * <TR>
343 : * <TD> polarizationType</TD>
344 : * <TD> std::vector<PolarizationTypeMod::PolarizationType > </TD>
345 : * <TD> numReceptor </TD>
346 : * <TD> describes the polarizations of the receptors (one value per receptor). </TD>
347 : * </TR>
348 :
349 : * <TR>
350 : * <TD> electronicDelay</TD>
351 : * <TD> std::vector<double > </TD>
352 : * <TD> numReceptor </TD>
353 : * <TD> the electronic delay. </TD>
354 : * </TR>
355 :
356 : * <TR>
357 : * <TD> electronicDelayRate</TD>
358 : * <TD> std::vector<double > </TD>
359 : * <TD> numReceptor </TD>
360 : * <TD> the electronic delay rate. </TD>
361 : * </TR>
362 :
363 : * <TR>
364 : * <TD> receiverDelay</TD>
365 : * <TD> std::vector<double > </TD>
366 : * <TD> numReceptor </TD>
367 : * <TD> the receiver delay. </TD>
368 : * </TR>
369 :
370 : * <TR>
371 : * <TD> IFDelay</TD>
372 : * <TD> std::vector<double > </TD>
373 : * <TD> numReceptor </TD>
374 : * <TD> the intermediate frequency delay. </TD>
375 : * </TR>
376 :
377 : * <TR>
378 : * <TD> LODelay</TD>
379 : * <TD> std::vector<double > </TD>
380 : * <TD> numReceptor </TD>
381 : * <TD> the local oscillator delay. </TD>
382 : * </TR>
383 :
384 : * <TR>
385 : * <TD> crossPolarizationDelay</TD>
386 : * <TD> double </TD>
387 : * <TD> </TD>
388 : * <TD> the cross polarization delay. </TD>
389 : * </TR>
390 :
391 :
392 : * </TABLE>
393 : */
394 : class DelayModelTable : public Representable {
395 : friend class ASDM;
396 :
397 : public:
398 :
399 :
400 : /**
401 : * Return the list of field names that make up key key
402 : * as an array of strings.
403 : * @return a vector of string.
404 : */
405 : static const std::vector<std::string>& getKeyName();
406 :
407 :
408 : virtual ~DelayModelTable();
409 :
410 : /**
411 : * Return the container to which this table belongs.
412 : *
413 : * @return the ASDM containing this table.
414 : */
415 : ASDM &getContainer() const;
416 :
417 : /**
418 : * Return the number of rows in the table.
419 : *
420 : * @return the number of rows in an unsigned int.
421 : */
422 : unsigned int size() const;
423 :
424 : /**
425 : * Return the name of this table.
426 : *
427 : * This is a instance method of the class.
428 : *
429 : * @return the name of this table in a string.
430 : */
431 : std::string getName() const;
432 :
433 : /**
434 : * Return the name of this table.
435 : *
436 : * This is a static method of the class.
437 : *
438 : * @return the name of this table in a string.
439 : */
440 : static std::string name() ;
441 :
442 : /**
443 : * Return the version information about this table.
444 : *
445 : */
446 : std::string getVersion() const ;
447 :
448 : /**
449 : * Return the names of the attributes of this table.
450 : *
451 : * @return a vector of string
452 : */
453 : static const std::vector<std::string>& getAttributesNames();
454 :
455 : /**
456 : * Return the default sorted list of attributes names in the binary representation of the table.
457 : *
458 : * @return a const reference to a vector of string
459 : */
460 : static const std::vector<std::string>& defaultAttributesNamesInBin();
461 :
462 : /**
463 : * Return this table's Entity.
464 : */
465 : Entity getEntity() const;
466 :
467 : /**
468 : * Set this table's Entity.
469 : * @param e An entity.
470 : */
471 : void setEntity(Entity e);
472 :
473 : /**
474 : * Produces an XML representation conform
475 : * to the schema defined for DelayModel (DelayModelTable.xsd).
476 : *
477 : * @returns a string containing the XML representation.
478 : * @throws ConversionException
479 : */
480 : std::string toXML() ;
481 :
482 : #ifndef WITHOUT_ACS
483 : // Conversion Methods
484 : /**
485 : * Convert this table into a DelayModelTableIDL CORBA structure.
486 : *
487 : * @return a pointer to a DelayModelTableIDL
488 : */
489 : asdmIDL::DelayModelTableIDL *toIDL() ;
490 :
491 : /**
492 : * Fills the CORBA data structure passed in parameter
493 : * with the content of this table.
494 : *
495 : * @param x a reference to the asdmIDL::DelayModelTableIDL to be populated
496 : * with the content of this.
497 : */
498 : void toIDL(asdmIDL::DelayModelTableIDL& x) const;
499 :
500 : #endif
501 :
502 : #ifndef WITHOUT_ACS
503 : /**
504 : * Populate this table from the content of a DelayModelTableIDL Corba structure.
505 : *
506 : * @throws DuplicateKey Thrown if the method tries to add a row having a key that is already in the table.
507 : * @throws ConversionException
508 : */
509 : void fromIDL(asdmIDL::DelayModelTableIDL x) ;
510 : #endif
511 :
512 : //
513 : // ====> Row creation.
514 : //
515 :
516 : /**
517 : * Create a new row with default values.
518 : * @return a pointer on a DelayModelRow
519 : */
520 : DelayModelRow *newRow();
521 :
522 :
523 : /**
524 : * Create a new row initialized to the specified values.
525 : * @return a pointer on the created and initialized row.
526 :
527 : * @param antennaId
528 :
529 : * @param spectralWindowId
530 :
531 : * @param timeInterval
532 :
533 : * @param numPoly
534 :
535 : * @param phaseDelay
536 :
537 : * @param phaseDelayRate
538 :
539 : * @param groupDelay
540 :
541 : * @param groupDelayRate
542 :
543 : * @param fieldId
544 :
545 : */
546 : DelayModelRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, std::vector<double > phaseDelay, std::vector<double > phaseDelayRate, std::vector<double > groupDelay, std::vector<double > groupDelayRate, Tag fieldId);
547 :
548 :
549 :
550 : /**
551 : * Create a new row using a copy constructor mechanism.
552 : *
553 : * The method creates a new DelayModelRow owned by this. Each attribute of the created row
554 : * is a (deep) copy of the corresponding attribute of row. The method does not add
555 : * the created row to this, its simply parents it to this, a call to the add method
556 : * has to be done in order to get the row added (very likely after having modified
557 : * some of its attributes).
558 : * If row is null then the method returns a new DelayModelRow with default values for its attributes.
559 : *
560 : * @param row the row which is to be copied.
561 : */
562 : DelayModelRow *newRow(DelayModelRow *row);
563 :
564 : //
565 : // ====> Append a row to its table.
566 : //
567 :
568 :
569 : /**
570 : * Add a row.
571 : * @param x a pointer to the DelayModelRow to be added.
572 : *
573 : * @return a pointer to a DelayModelRow. If the table contains a DelayModelRow whose attributes (key and mandatory values) are equal to x ones
574 : * then returns a pointer on that DelayModelRow, otherwise returns x.
575 : *
576 : * @throw DuplicateKey { thrown when the table contains a DelayModelRow with a key equal to the x one but having
577 : * and a value section different from x one }
578 : *
579 :
580 : * @note The row is inserted in the table in such a way that all the rows having the same value of
581 : * ( antennaId, spectralWindowId ) are stored by ascending time.
582 : * @see method getByContext.
583 :
584 : */
585 : DelayModelRow* add(DelayModelRow* x) ;
586 :
587 :
588 :
589 :
590 :
591 : //
592 : // ====> Methods returning rows.
593 : //
594 :
595 : /**
596 : * Get a collection of pointers on the rows of the table.
597 : * @return Alls rows in a vector of pointers of DelayModelRow. The elements of this vector are stored in the order
598 : * in which they have been added to the DelayModelTable.
599 : */
600 : std::vector<DelayModelRow *> get() ;
601 :
602 : /**
603 : * Get a const reference on the collection of rows pointers internally hold by the table.
604 : * @return A const reference of a vector of pointers of DelayModelRow. The elements of this vector are stored in the order
605 : * in which they have been added to the DelayModelTable.
606 : *
607 : */
608 : const std::vector<DelayModelRow *>& get() const ;
609 :
610 :
611 : /**
612 : * Returns all the rows sorted by ascending startTime for a given context.
613 : * The context is defined by a value of ( antennaId, spectralWindowId ).
614 : *
615 : * @return a pointer on a vector<DelayModelRow *>. A null returned value means that the table contains
616 : * no DelayModelRow for the given ( antennaId, spectralWindowId ).
617 : *
618 : * @throws IllegalAccessException when a call is done to this method when it's called while the dataset has been imported with the
619 : * option checkRowUniqueness set to false.
620 : */
621 : std::vector <DelayModelRow*> *getByContext(Tag antennaId, Tag spectralWindowId);
622 :
623 :
624 :
625 :
626 :
627 : /**
628 : * Returns a DelayModelRow* given a key.
629 : * @return a pointer to the row having the key whose values are passed as parameters, or 0 if
630 : * no row exists for that key.
631 :
632 : * @param antennaId
633 :
634 : * @param spectralWindowId
635 :
636 : * @param timeInterval
637 :
638 : *
639 : */
640 : DelayModelRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval);
641 :
642 :
643 :
644 :
645 :
646 : /**
647 : * Look up the table for a row whose all attributes
648 : * are equal to the corresponding parameters of the method.
649 : * @return a pointer on this row if any, null otherwise.
650 : *
651 :
652 : * @param antennaId
653 :
654 : * @param spectralWindowId
655 :
656 : * @param timeInterval
657 :
658 : * @param numPoly
659 :
660 : * @param phaseDelay
661 :
662 : * @param phaseDelayRate
663 :
664 : * @param groupDelay
665 :
666 : * @param groupDelayRate
667 :
668 : * @param fieldId
669 :
670 : */
671 : DelayModelRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, std::vector<double > phaseDelay, std::vector<double > phaseDelayRate, std::vector<double > groupDelay, std::vector<double > groupDelayRate, Tag fieldId);
672 :
673 :
674 : void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
675 : BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
676 :
677 : private:
678 :
679 : /**
680 : * Create a DelayModelTable.
681 : * <p>
682 : * This constructor is private because only the
683 : * container can create tables. All tables must know the container
684 : * to which they belong.
685 : * @param container The container to which this table belongs.
686 : */
687 : DelayModelTable (ASDM & container);
688 :
689 : ASDM & container;
690 :
691 : bool archiveAsBin; // If true archive binary else archive XML
692 : bool fileAsBin ; // If true file binary else file XML
693 :
694 : std::string version ;
695 :
696 : Entity entity;
697 :
698 :
699 :
700 :
701 :
702 :
703 : /**
704 : * If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and throw exception if not.
705 : * Check if *x verifies the key uniqueness rule and throw an exception if not.
706 : * Append x to its table.
707 : * @throws DuplicateKey
708 :
709 : */
710 : DelayModelRow* checkAndAdd(DelayModelRow* x, bool skipCheckUniqueness=false) ;
711 :
712 : /**
713 : * Brutally append an DelayModelRow x to the collection of rows already stored in this table. No uniqueness check is done !
714 : *
715 : * @param DelayModelRow* x a pointer onto the DelayModelRow to be appended.
716 : */
717 : void append(DelayModelRow* x) ;
718 :
719 : /**
720 : * Brutally append an DelayModelRow x to the collection of rows already stored in this table. No uniqueness check is done !
721 : *
722 : * @param DelayModelRow* x a pointer onto the DelayModelRow to be appended.
723 : */
724 : void addWithoutCheckingUnique(DelayModelRow* x) ;
725 :
726 :
727 :
728 :
729 :
730 :
731 : /**
732 : * Insert a DelayModelRow* in a vector of DelayModelRow* so that it's ordered by ascending time.
733 : *
734 : * @param DelayModelRow* x . The pointer to be inserted.
735 : * @param vector <DelayModelRow*>& row . A reference to the vector where to insert x.
736 : *
737 : */
738 : DelayModelRow * insertByStartTime(DelayModelRow* x, std::vector<DelayModelRow* >& row);
739 :
740 :
741 :
742 : // A data structure to store the pointers on the table's rows.
743 :
744 : // In all cases we maintain a private vector of DelayModelRow s.
745 : std::vector<DelayModelRow * > privateRows;
746 :
747 :
748 :
749 :
750 :
751 :
752 :
753 :
754 : typedef std::vector <DelayModelRow* > TIME_ROWS;
755 : std::map<std::string, TIME_ROWS > context;
756 :
757 : /**
758 : * Returns a string built by concatenating the ascii representation of the
759 : * parameters values suffixed with a "_" character.
760 : */
761 : std::string Key(Tag antennaId, Tag spectralWindowId) ;
762 :
763 :
764 :
765 :
766 : /**
767 : * Fills the vector vout (passed by reference) with pointers on elements of vin
768 : * whose attributes are equal to the corresponding parameters of the method.
769 : *
770 : */
771 : void getByKeyNoAutoIncNoTime(std::vector <DelayModelRow*>& vin, std::vector <DelayModelRow*>& vout, Tag antennaId, Tag spectralWindowId);
772 :
773 :
774 :
775 : void error() ; //throw(ConversionException);
776 :
777 :
778 : /**
779 : * Populate this table from the content of a XML document that is required to
780 : * be conform to the XML schema defined for a DelayModel (DelayModelTable.xsd).
781 : * @throws ConversionException
782 : *
783 : */
784 : void fromXML(std::string& xmlDoc) ;
785 :
786 : std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
787 :
788 : /**
789 : * Private methods involved during the build of this table out of the content
790 : * of file(s) containing an external representation of a DelayModel table.
791 : */
792 : void setFromMIMEFile(const std::string& directory);
793 : /*
794 : void openMIMEFile(const std::string& directory);
795 : */
796 : void setFromXMLFile(const std::string& directory);
797 :
798 : /**
799 : * Serialize this into a stream of bytes and encapsulates that stream into a MIME message.
800 : * @returns a string containing the MIME message.
801 : *
802 : * @param byteOrder a const pointer to a static instance of the class ByteOrder.
803 : *
804 : */
805 : std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
806 :
807 :
808 : /**
809 : * Extracts the binary part of a MIME message and deserialize its content
810 : * to fill this with the result of the deserialization.
811 : * @param mimeMsg the string containing the MIME message.
812 : * @throws ConversionException
813 : */
814 : void setFromMIME(const std::string & mimeMsg);
815 :
816 : /**
817 : * Private methods involved during the export of this table into disk file(s).
818 : */
819 : std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
820 :
821 : /**
822 : * Stores a representation (binary or XML) of this table into a file.
823 : *
824 : * Depending on the boolean value of its private field fileAsBin a binary serialization of this (fileAsBin==true)
825 : * will be saved in a file "DelayModel.bin" or an XML representation (fileAsBin==false) will be saved in a file "DelayModel.xml".
826 : * The file is always written in a directory whose name is passed as a parameter.
827 : * @param directory The name of directory where the file containing the table's representation will be saved.
828 : *
829 : */
830 : void toFile(std::string directory);
831 :
832 : /**
833 : * Load the table in memory if necessary.
834 : */
835 : bool loadInProgress;
836 0 : void checkPresenceInMemory() {
837 0 : if (!presentInMemory && !loadInProgress) {
838 0 : loadInProgress = true;
839 0 : setFromFile(getContainer().getDirectory());
840 0 : presentInMemory = true;
841 0 : loadInProgress = false;
842 : }
843 0 : }
844 : /**
845 : * Reads and parses a file containing a representation of a DelayModelTable as those produced by the toFile method.
846 : * This table is populated with the result of the parsing.
847 : * @param directory The name of the directory containing the file te be read and parsed.
848 : * @throws ConversionException If any error occurs while reading the
849 : * files in the directory or parsing them.
850 : *
851 : */
852 : void setFromFile(const std::string& directory);
853 :
854 : };
855 :
856 : } // End namespace asdm
857 :
858 : #endif /* DelayModelTable_CLASS */
|