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 DelayModelVariableParametersTable.h
32 : */
33 :
34 : #ifndef DelayModelVariableParametersTable_CLASS
35 : #define DelayModelVariableParametersTable_CLASS
36 :
37 : #include <string>
38 : #include <vector>
39 : #include <map>
40 :
41 :
42 :
43 :
44 : #include <alma/ASDM/Angle.h>
45 :
46 :
47 :
48 : #include <alma/ASDM/AngularRate.h>
49 :
50 :
51 :
52 : #include <alma/ASDM/ArrayTime.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 : #include <alma/Enumerations/CDifferenceType.h>
72 :
73 :
74 :
75 :
76 :
77 :
78 :
79 :
80 :
81 : #include <alma/Enumerations/CDifferenceType.h>
82 :
83 :
84 :
85 :
86 :
87 :
88 :
89 :
90 :
91 :
92 :
93 :
94 : #include <alma/ASDM/ConversionException.h>
95 : #include <alma/ASDM/DuplicateKey.h>
96 : #include <alma/ASDM/UniquenessViolationException.h>
97 : #include <alma/ASDM/NoSuchRow.h>
98 : #include <alma/ASDM/DuplicateKey.h>
99 :
100 :
101 : #ifndef WITHOUT_ACS
102 : #include <asdmIDLC.h>
103 : #endif
104 :
105 : #include <alma/ASDM/Representable.h>
106 :
107 : #include <pthread.h>
108 :
109 : namespace asdm {
110 :
111 : //class asdm::ASDM;
112 : //class asdm::DelayModelVariableParametersRow;
113 :
114 : class ASDM;
115 : class DelayModelVariableParametersRow;
116 : /**
117 : * The DelayModelVariableParametersTable class is an Alma table.
118 : * <BR>
119 : *
120 : * \par Role
121 : *
122 : * <BR>
123 :
124 : * Generated from model's revision "-1", branch ""
125 : *
126 : * <TABLE BORDER="1">
127 : * <CAPTION> Attributes of DelayModelVariableParameters </CAPTION>
128 : * <TR BGCOLOR="#AAAAAA"> <TH> Name </TH> <TH> Type </TH> <TH> Expected shape </TH> <TH> Comment </TH></TR>
129 :
130 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" align="center"> Key </TD></TR>
131 :
132 : * <TR>
133 :
134 : * <TD><I> delayModelVariableParametersId </I></TD>
135 :
136 : * <TD> Tag</TD>
137 : * <TD> </TD>
138 : * <TD> identifies a unique row in the table. </TD>
139 : * </TR>
140 :
141 :
142 :
143 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" valign="center"> Value <br> (Mandatory) </TH></TR>
144 :
145 : * <TR>
146 : * <TD> time </TD>
147 : * <TD> ArrayTime </TD>
148 : * <TD> </TD>
149 : * <TD> the day and time relevant for the data in this row. </TD>
150 : * </TR>
151 :
152 : * <TR>
153 : * <TD> ut1_utc </TD>
154 : * <TD> double </TD>
155 : * <TD> </TD>
156 : * <TD> \f$ UT1 - UTC \f$ in \f$ second \f$. </TD>
157 : * </TR>
158 :
159 : * <TR>
160 : * <TD> iat_utc </TD>
161 : * <TD> double </TD>
162 : * <TD> </TD>
163 : * <TD> \f$ IAT - UTC \f$ in \f$ second \f$. </TD>
164 : * </TR>
165 :
166 : * <TR>
167 : * <TD> timeType </TD>
168 : * <TD> DifferenceTypeMod::DifferenceType </TD>
169 : * <TD> </TD>
170 : * <TD> the type of the two time differences expressed in ut1_utc and iat_utc </TD>
171 : * </TR>
172 :
173 : * <TR>
174 : * <TD> gstAtUt0 </TD>
175 : * <TD> Angle </TD>
176 : * <TD> </TD>
177 : * <TD> in \f$ radian \f$. </TD>
178 : * </TR>
179 :
180 : * <TR>
181 : * <TD> earthRotationRate </TD>
182 : * <TD> AngularRate </TD>
183 : * <TD> </TD>
184 : * <TD> in \f$ radian \ s^{-1} \f$ (the seconds are in \f$ IAT \f$). </TD>
185 : * </TR>
186 :
187 : * <TR>
188 : * <TD> polarOffsets </TD>
189 : * <TD> std::vector<double > </TD>
190 : * <TD> 2 </TD>
191 : * <TD> the \f$ X, Y \f$ polar offsets in \f$ arcsec \f$. </TD>
192 : * </TR>
193 :
194 : * <TR>
195 : * <TD> polarOffsetsType </TD>
196 : * <TD> DifferenceTypeMod::DifferenceType </TD>
197 : * <TD> </TD>
198 : * <TD> the type of the polar offsets (values found in polarOffsets). </TD>
199 : * </TR>
200 :
201 : * <TR>
202 : * <TD> delayModelFixedParametersId </TD>
203 : * <TD> Tag </TD>
204 : * <TD> </TD>
205 : * <TD> refers to a unique row of the DelayModelFixedParameters table. </TD>
206 : * </TR>
207 :
208 :
209 :
210 : * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" valign="center"> Value <br> (Optional) </TH></TR>
211 :
212 : * <TR>
213 : * <TD> nutationInLongitude</TD>
214 : * <TD> Angle </TD>
215 : * <TD> </TD>
216 : * <TD> the nutation in longitude ( the part parallel to the ecliptic) in \f$ radian \f$. </TD>
217 : * </TR>
218 :
219 : * <TR>
220 : * <TD> nutationInLongitudeRate</TD>
221 : * <TD> AngularRate </TD>
222 : * <TD> </TD>
223 : * <TD> the rate of nutation in longitude in \f$ radian \ s^{-1} \f$. </TD>
224 : * </TR>
225 :
226 : * <TR>
227 : * <TD> nutationInObliquity</TD>
228 : * <TD> Angle </TD>
229 : * <TD> </TD>
230 : * <TD> the nutation in obliquity (the part perpendicular to the ecliptic) in \f$ radian \f$. </TD>
231 : * </TR>
232 :
233 : * <TR>
234 : * <TD> nutationInObliquityRate</TD>
235 : * <TD> AngularRate </TD>
236 : * <TD> </TD>
237 : * <TD> the rate of nutation in obliquity in \f$ radian \ s^{-1} \f$. </TD>
238 : * </TR>
239 :
240 :
241 : * </TABLE>
242 : */
243 : class DelayModelVariableParametersTable : public Representable {
244 : friend class ASDM;
245 :
246 : public:
247 :
248 :
249 : /**
250 : * Return the list of field names that make up key key
251 : * as an array of strings.
252 : * @return a vector of string.
253 : */
254 : static const std::vector<std::string>& getKeyName();
255 :
256 :
257 : virtual ~DelayModelVariableParametersTable();
258 :
259 : /**
260 : * Return the container to which this table belongs.
261 : *
262 : * @return the ASDM containing this table.
263 : */
264 : ASDM &getContainer() const;
265 :
266 : /**
267 : * Return the number of rows in the table.
268 : *
269 : * @return the number of rows in an unsigned int.
270 : */
271 : unsigned int size() const;
272 :
273 : /**
274 : * Return the name of this table.
275 : *
276 : * This is a instance method of the class.
277 : *
278 : * @return the name of this table in a string.
279 : */
280 : std::string getName() const;
281 :
282 : /**
283 : * Return the name of this table.
284 : *
285 : * This is a static method of the class.
286 : *
287 : * @return the name of this table in a string.
288 : */
289 : static std::string name() ;
290 :
291 : /**
292 : * Return the version information about this table.
293 : *
294 : */
295 : std::string getVersion() const ;
296 :
297 : /**
298 : * Return the names of the attributes of this table.
299 : *
300 : * @return a vector of string
301 : */
302 : static const std::vector<std::string>& getAttributesNames();
303 :
304 : /**
305 : * Return the default sorted list of attributes names in the binary representation of the table.
306 : *
307 : * @return a const reference to a vector of string
308 : */
309 : static const std::vector<std::string>& defaultAttributesNamesInBin();
310 :
311 : /**
312 : * Return this table's Entity.
313 : */
314 : Entity getEntity() const;
315 :
316 : /**
317 : * Set this table's Entity.
318 : * @param e An entity.
319 : */
320 : void setEntity(Entity e);
321 :
322 : /**
323 : * Produces an XML representation conform
324 : * to the schema defined for DelayModelVariableParameters (DelayModelVariableParametersTable.xsd).
325 : *
326 : * @returns a string containing the XML representation.
327 : * @throws ConversionException
328 : */
329 : std::string toXML() ;
330 :
331 : #ifndef WITHOUT_ACS
332 : // Conversion Methods
333 : /**
334 : * Convert this table into a DelayModelVariableParametersTableIDL CORBA structure.
335 : *
336 : * @return a pointer to a DelayModelVariableParametersTableIDL
337 : */
338 : asdmIDL::DelayModelVariableParametersTableIDL *toIDL() ;
339 :
340 : /**
341 : * Fills the CORBA data structure passed in parameter
342 : * with the content of this table.
343 : *
344 : * @param x a reference to the asdmIDL::DelayModelVariableParametersTableIDL to be populated
345 : * with the content of this.
346 : */
347 : void toIDL(asdmIDL::DelayModelVariableParametersTableIDL& x) const;
348 :
349 : #endif
350 :
351 : #ifndef WITHOUT_ACS
352 : /**
353 : * Populate this table from the content of a DelayModelVariableParametersTableIDL Corba structure.
354 : *
355 : * @throws DuplicateKey Thrown if the method tries to add a row having a key that is already in the table.
356 : * @throws ConversionException
357 : */
358 : void fromIDL(asdmIDL::DelayModelVariableParametersTableIDL x) ;
359 : #endif
360 :
361 : //
362 : // ====> Row creation.
363 : //
364 :
365 : /**
366 : * Create a new row with default values.
367 : * @return a pointer on a DelayModelVariableParametersRow
368 : */
369 : DelayModelVariableParametersRow *newRow();
370 :
371 :
372 : /**
373 : * Create a new row initialized to the specified values.
374 : * @return a pointer on the created and initialized row.
375 :
376 : * @param time
377 :
378 : * @param ut1_utc
379 :
380 : * @param iat_utc
381 :
382 : * @param timeType
383 :
384 : * @param gstAtUt0
385 :
386 : * @param earthRotationRate
387 :
388 : * @param polarOffsets
389 :
390 : * @param polarOffsetsType
391 :
392 : * @param delayModelFixedParametersId
393 :
394 : */
395 : DelayModelVariableParametersRow *newRow(ArrayTime time, double ut1_utc, double iat_utc, DifferenceTypeMod::DifferenceType timeType, Angle gstAtUt0, AngularRate earthRotationRate, std::vector<double > polarOffsets, DifferenceTypeMod::DifferenceType polarOffsetsType, Tag delayModelFixedParametersId);
396 :
397 :
398 :
399 : /**
400 : * Create a new row using a copy constructor mechanism.
401 : *
402 : * The method creates a new DelayModelVariableParametersRow owned by this. Each attribute of the created row
403 : * is a (deep) copy of the corresponding attribute of row. The method does not add
404 : * the created row to this, its simply parents it to this, a call to the add method
405 : * has to be done in order to get the row added (very likely after having modified
406 : * some of its attributes).
407 : * If row is null then the method returns a new DelayModelVariableParametersRow with default values for its attributes.
408 : *
409 : * @param row the row which is to be copied.
410 : */
411 : DelayModelVariableParametersRow *newRow(DelayModelVariableParametersRow *row);
412 :
413 : //
414 : // ====> Append a row to its table.
415 : //
416 :
417 :
418 :
419 :
420 : /**
421 : * Add a row.
422 : * If there table contains a row whose key's fields are equal
423 : * to x's ones then return a pointer on this row (i.e. no actual insertion is performed)
424 : * otherwise add x to the table and return x.
425 : * @param x . A pointer on the row to be added.
426 : * @returns a pointer to a DelayModelVariableParametersRow.
427 : */
428 :
429 : DelayModelVariableParametersRow* add(DelayModelVariableParametersRow* x) ;
430 :
431 :
432 :
433 : //
434 : // ====> Methods returning rows.
435 : //
436 :
437 : /**
438 : * Get a collection of pointers on the rows of the table.
439 : * @return Alls rows in a vector of pointers of DelayModelVariableParametersRow. The elements of this vector are stored in the order
440 : * in which they have been added to the DelayModelVariableParametersTable.
441 : */
442 : std::vector<DelayModelVariableParametersRow *> get() ;
443 :
444 : /**
445 : * Get a const reference on the collection of rows pointers internally hold by the table.
446 : * @return A const reference of a vector of pointers of DelayModelVariableParametersRow. The elements of this vector are stored in the order
447 : * in which they have been added to the DelayModelVariableParametersTable.
448 : *
449 : */
450 : const std::vector<DelayModelVariableParametersRow *>& get() const ;
451 :
452 :
453 :
454 :
455 :
456 : /**
457 : * Returns a DelayModelVariableParametersRow* given a key.
458 : * @return a pointer to the row having the key whose values are passed as parameters, or 0 if
459 : * no row exists for that key.
460 :
461 : * @param delayModelVariableParametersId
462 :
463 : *
464 : */
465 : DelayModelVariableParametersRow* getRowByKey(Tag delayModelVariableParametersId);
466 :
467 :
468 :
469 :
470 :
471 : /**
472 : * Look up the table for a row whose all attributes except the autoincrementable one
473 : * are equal to the corresponding parameters of the method.
474 : * @return a pointer on this row if any, null otherwise.
475 : *
476 :
477 : * @param time
478 :
479 : * @param ut1_utc
480 :
481 : * @param iat_utc
482 :
483 : * @param timeType
484 :
485 : * @param gstAtUt0
486 :
487 : * @param earthRotationRate
488 :
489 : * @param polarOffsets
490 :
491 : * @param polarOffsetsType
492 :
493 : * @param delayModelFixedParametersId
494 :
495 : */
496 : DelayModelVariableParametersRow* lookup(ArrayTime time, double ut1_utc, double iat_utc, DifferenceTypeMod::DifferenceType timeType, Angle gstAtUt0, AngularRate earthRotationRate, std::vector<double > polarOffsets, DifferenceTypeMod::DifferenceType polarOffsetsType, Tag delayModelFixedParametersId);
497 :
498 :
499 : void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
500 : BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
501 :
502 : private:
503 :
504 : /**
505 : * Create a DelayModelVariableParametersTable.
506 : * <p>
507 : * This constructor is private because only the
508 : * container can create tables. All tables must know the container
509 : * to which they belong.
510 : * @param container The container to which this table belongs.
511 : */
512 : DelayModelVariableParametersTable (ASDM & container);
513 :
514 : ASDM & container;
515 :
516 : bool archiveAsBin; // If true archive binary else archive XML
517 : bool fileAsBin ; // If true file binary else file XML
518 :
519 : std::string version ;
520 :
521 : Entity entity;
522 :
523 :
524 :
525 :
526 :
527 : // A map for the autoincrementation algorithm
528 : std::map<std::string,int> noAutoIncIds;
529 : void autoIncrement(std::string key, DelayModelVariableParametersRow* x);
530 :
531 :
532 : /**
533 : * If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and throw exception if not.
534 : * Check if *x verifies the key uniqueness rule and throw an exception if not.
535 : * Append x to its table.
536 : * @throws DuplicateKey
537 :
538 : * @throws UniquenessViolationException
539 :
540 : */
541 : DelayModelVariableParametersRow* checkAndAdd(DelayModelVariableParametersRow* x, bool skipCheckUniqueness=false) ;
542 :
543 : /**
544 : * Brutally append an DelayModelVariableParametersRow x to the collection of rows already stored in this table. No uniqueness check is done !
545 : *
546 : * @param DelayModelVariableParametersRow* x a pointer onto the DelayModelVariableParametersRow to be appended.
547 : */
548 : void append(DelayModelVariableParametersRow* x) ;
549 :
550 : /**
551 : * Brutally append an DelayModelVariableParametersRow x to the collection of rows already stored in this table. No uniqueness check is done !
552 : *
553 : * @param DelayModelVariableParametersRow* x a pointer onto the DelayModelVariableParametersRow to be appended.
554 : */
555 : void addWithoutCheckingUnique(DelayModelVariableParametersRow* x) ;
556 :
557 :
558 :
559 :
560 :
561 : // A data structure to store the pointers on the table's rows.
562 :
563 : // In all cases we maintain a private vector of DelayModelVariableParametersRow s.
564 : std::vector<DelayModelVariableParametersRow * > privateRows;
565 :
566 :
567 :
568 : std::vector<DelayModelVariableParametersRow *> row;
569 :
570 :
571 : void error() ; //throw(ConversionException);
572 :
573 :
574 : /**
575 : * Populate this table from the content of a XML document that is required to
576 : * be conform to the XML schema defined for a DelayModelVariableParameters (DelayModelVariableParametersTable.xsd).
577 : * @throws ConversionException
578 : *
579 : */
580 : void fromXML(std::string& xmlDoc) ;
581 :
582 : std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
583 :
584 : /**
585 : * Private methods involved during the build of this table out of the content
586 : * of file(s) containing an external representation of a DelayModelVariableParameters table.
587 : */
588 : void setFromMIMEFile(const std::string& directory);
589 : /*
590 : void openMIMEFile(const std::string& directory);
591 : */
592 : void setFromXMLFile(const std::string& directory);
593 :
594 : /**
595 : * Serialize this into a stream of bytes and encapsulates that stream into a MIME message.
596 : * @returns a string containing the MIME message.
597 : *
598 : * @param byteOrder a const pointer to a static instance of the class ByteOrder.
599 : *
600 : */
601 : std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
602 :
603 :
604 : /**
605 : * Extracts the binary part of a MIME message and deserialize its content
606 : * to fill this with the result of the deserialization.
607 : * @param mimeMsg the string containing the MIME message.
608 : * @throws ConversionException
609 : */
610 : void setFromMIME(const std::string & mimeMsg);
611 :
612 : /**
613 : * Private methods involved during the export of this table into disk file(s).
614 : */
615 : std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
616 :
617 : /**
618 : * Stores a representation (binary or XML) of this table into a file.
619 : *
620 : * Depending on the boolean value of its private field fileAsBin a binary serialization of this (fileAsBin==true)
621 : * will be saved in a file "DelayModelVariableParameters.bin" or an XML representation (fileAsBin==false) will be saved in a file "DelayModelVariableParameters.xml".
622 : * The file is always written in a directory whose name is passed as a parameter.
623 : * @param directory The name of directory where the file containing the table's representation will be saved.
624 : *
625 : */
626 : void toFile(std::string directory);
627 :
628 : /**
629 : * Load the table in memory if necessary.
630 : */
631 : bool loadInProgress;
632 0 : void checkPresenceInMemory() {
633 0 : if (!presentInMemory && !loadInProgress) {
634 0 : loadInProgress = true;
635 0 : setFromFile(getContainer().getDirectory());
636 0 : presentInMemory = true;
637 0 : loadInProgress = false;
638 : }
639 0 : }
640 : /**
641 : * Reads and parses a file containing a representation of a DelayModelVariableParametersTable as those produced by the toFile method.
642 : * This table is populated with the result of the parsing.
643 : * @param directory The name of the directory containing the file te be read and parsed.
644 : * @throws ConversionException If any error occurs while reading the
645 : * files in the directory or parsing them.
646 : *
647 : */
648 : void setFromFile(const std::string& directory);
649 :
650 : };
651 :
652 : } // End namespace asdm
653 :
654 : #endif /* DelayModelVariableParametersTable_CLASS */
|