00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
#ifndef WeatherTable_CLASS
00035
#define WeatherTable_CLASS
00036
00037
#include <string>
00038
#include <vector>
00039
#include <map>
00040
#include <set>
00041
using std::string;
00042
using std::vector;
00043
using std::map;
00044
00045
#include <Angle.h>
00046
#include <AngularRate.h>
00047
#include <ArrayTime.h>
00048
#include <ArrayTimeInterval.h>
00049
#include <Complex.h>
00050
#include <Entity.h>
00051
#include <EntityId.h>
00052
#include <EntityRef.h>
00053
#include <Flux.h>
00054
#include <Frequency.h>
00055
#include <Humidity.h>
00056
#include <Interval.h>
00057
#include <Length.h>
00058
#include <PartId.h>
00059
#include <Pressure.h>
00060
#include <Speed.h>
00061
#include <Tag.h>
00062
#include <Temperature.h>
00063
#include <ConversionException.h>
00064
#include <DuplicateKey.h>
00065
#include <UniquenessViolationException.h>
00066
#include <NoSuchRow.h>
00067
#include <DuplicateKey.h>
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
#ifndef WITHOUT_ACS
00109
#include <asdmIDLC.h>
00110
using asdmIDL::WeatherTableIDL;
00111
#endif
00112
00113
using asdm::Angle;
00114
using asdm::AngularRate;
00115
using asdm::ArrayTime;
00116
using asdm::Complex;
00117
using asdm::Entity;
00118
using asdm::EntityId;
00119
using asdm::EntityRef;
00120
using asdm::Flux;
00121
using asdm::Frequency;
00122
using asdm::Humidity;
00123
using asdm::Interval;
00124
using asdm::Length;
00125
using asdm::PartId;
00126
using asdm::Pressure;
00127
using asdm::Speed;
00128
using asdm::Tag;
00129
using asdm::Temperature;
00130
00131
using asdm::DuplicateKey;
00132
using asdm::ConversionException;
00133
using asdm::NoSuchRow;
00134
using asdm::DuplicateKey;
00135
00136
#include <Representable.h>
00137
00138
namespace asdm {
00139
00140
00141
00142
00143
class ASDM;
00144
class WeatherRow;
00267 class WeatherTable :
public Representable {
00268
friend class asdm::ASDM;
00269
00270
public:
00271
00272
00278
static vector<string>
getKeyName();
00279
00280
00281
virtual ~
WeatherTable();
00282
00288
ASDM &
getContainer()
const;
00289
00295
unsigned int size() ;
00296
00302 string
getName()
const;
00303
00307
Entity getEntity()
const;
00308
00313
void setEntity(
Entity e);
00314
00315
00316
00317
00318
00323
WeatherRow *
newRow();
00324
00329
WeatherRow*
newRowEmpty();
00330
00331
00365
WeatherRow *
newRow(
Tag stationId,
ArrayTimeInterval timeInterval,
Pressure pressure,
Humidity relHumidity,
Temperature temperature,
Angle windDirection,
Speed windSpeed,
Speed windMax,
bool pressureFlag,
bool relHumidityFlag,
bool temperatureFlag,
bool windDirectionFlag,
bool windSpeedFlag,
bool windMaxFlag);
00366
00371
WeatherRow *
newRowFull(
Tag stationId,
ArrayTimeInterval timeInterval,
Pressure pressure,
Humidity relHumidity,
Temperature temperature,
Angle windDirection,
Speed windSpeed,
Speed windMax,
bool pressureFlag,
bool relHumidityFlag,
bool temperatureFlag,
bool windDirectionFlag,
bool windSpeedFlag,
bool windMaxFlag);
00372
00373
00386
WeatherRow *
newRow(
WeatherRow *row);
00387
00392
WeatherRow *
newRowCopy(
WeatherRow *row);
00393
00394
00395
00396
00397
00398
00415
WeatherRow*
add(
WeatherRow* x) ;
00416
00417
00418
00419
00420
00421
00422
00423
00424
00430 vector<WeatherRow *>
get() ;
00431
00432
00440 vector <WeatherRow*> *
getByContext(
Tag stationId);
00441
00442
00443
00444
00445
00457
WeatherRow*
getRowByKey(
Tag stationId,
ArrayTimeInterval timeInterval);
00458
00459
00460
00461
00462
00498
WeatherRow*
lookup(
Tag stationId,
ArrayTimeInterval timeInterval,
Pressure pressure,
Humidity relHumidity,
Temperature temperature,
Angle windDirection,
Speed windSpeed,
Speed windMax,
bool pressureFlag,
bool relHumidityFlag,
bool temperatureFlag,
bool windDirectionFlag,
bool windSpeedFlag,
bool windMaxFlag);
00499
00500
00501
#ifndef WITHOUT_ACS
00502
00508 WeatherTableIDL *
toIDL() ;
00509
#endif
00510
00511
#ifndef WITHOUT_ACS
00512
00518
void fromIDL(WeatherTableIDL x)
throw(
DuplicateKey,
ConversionException);
00519
#endif
00520
00524
char *
toFITS()
const throw(
ConversionException);
00525
00529
void fromFITS(
char *fits)
throw(
ConversionException);
00530
00534 string
toVOTable()
const throw(
ConversionException);
00535
00539
void fromVOTable(string vo)
throw(
ConversionException);
00540
00547 string
toXML()
throw(
ConversionException);
00548
00554
void fromXML(string xmlDoc)
throw(
ConversionException);
00555
00561 string
toMIME();
00562
00569
void setFromMIME(
const string & mimeMsg);
00570
00580
void toFile(string directory);
00581
00590
void setFromFile(
const string& directory);
00591
00592
private:
00593
00602
WeatherTable (
ASDM & container);
00603
00604
ASDM & container;
00605
00606
bool archiveAsBin;
00607
bool fileAsBin ;
00608
00609
Entity entity;
00610
00611
00612
00616
static string tableName;
00617
00618
00622
static vector<string> key;
00623
00624
00630
WeatherRow* checkAndAdd(
WeatherRow* x)
throw (
DuplicateKey);
00631
00632
00633
00634
00642
WeatherRow * insertByStartTime(
WeatherRow* x, vector<WeatherRow* >& row);
00643
00644
00645
00646
00647
00648
00649 vector<WeatherRow * > privateRows;
00650
00651
00652
00653
00654
00655
00656
00657
00658
typedef vector <WeatherRow* > TIME_ROWS;
00659 map<string, TIME_ROWS > context;
00660
00665 string Key(
Tag stationId) ;
00666
00667
00668
00669
00675
void getByKeyNoAutoIncNoTime(vector <WeatherRow*>& vin, vector <WeatherRow*>& vout,
Tag stationId);
00676
00677
00678
00679
void error()
throw(
ConversionException);
00680
00681 };
00682
00683 }
00684
00685
#endif