WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
VarSpec.h
1#ifndef _WINC_VARSPEC
2#define _WINC_VARSPEC
3
4#include <WXP/Date.h>
5#include <WXP/ForeTime.h>
6#include <WXP/Level.h>
7#include <WXP/String.h>
8#include <WXP/Timezone.h>
9#include <WXP/VarName.h>
10#include <WXP/Variable.h>
11
12namespace WXP {
13 class VarSpec {
14 int type; /* Type of variable */
15 int source; /* Source of variable */
16 bool abs;
17 int plot;
18 ForeTime fore; /* Forecast time */
19 Level level; /* Vertical level */
20 Variable var; /* Variable */
21 char format[100];
22 VarName vname;
23
24 int initResrc();
25 public:
26 static const int format_len = 100;
27
28 VarSpec();
29 VarSpec( const char *str );
30 int init();
31
32 int set( const char *str );
33 int set( VarSpec &vs );
34
36 inline int setType( int t ){ type = t; return 1; };
38 inline int getType(){ return type; };
39
41 inline int setPlot( int t ){ plot = t; return 1; };
43 inline int getPlot(){ return plot; };
44
45 inline int setFore( const char *str ){ return fore.set( str ); };
46 inline int set( ForeTime &rfore ){ fore = rfore; return 1; };
47 inline int get( ForeTime &rfore ){ rfore = fore; return 1; };
48 inline ForeTime getFore(){ return fore; };
49 inline int getForeType(){ return fore.getType(); };
50 inline float getForeTypeOffset(){ return fore.getTypeOffset(); };
51 inline float getForeHours(){ return fore.getHours(); };
52 inline int getForeSeconds(){ return fore.getSeconds(); };
53 inline int getForeString( String &str ){ return fore.toString( str ); };
54 inline bool isForeSet(){ return fore.isSet(); };
55
56 inline int setLevel( const char *str ){ return level.set( str ); };
57 inline int set( Level &rlevel ){ level = rlevel; return 1; };
58 inline int get( Level &rlevel ){ rlevel = level; return 1; };
59 inline int getLevelType1(){ return level.getType1(); };
60 inline Level getLevel(){ return level; };
61 inline int getLevelString( String &str ){ return level.toString( str ); };
62 inline bool isLevelSet(){ return level.isSet(); };
63
64 int setVar( int ind, const char *unit );
65 int setVar( const char *abbr, const char *unit );
66 int setVar( const char *str );
67 int set( Variable &rvar );
68 inline int get( Variable &rvar ){ rvar = var; return 1; };
69 inline Variable getVar(){ return var; };
70
71 inline int setUnits( const char *str ){ return var.setUnits( str ); };
72 inline const char *getUnits(){ return var.getUnits(); };
73
74 int setFormat( const char *str );
75 inline const char *getFormat(){ return format; };
76
77 inline int getForeCode(){ return fore.toCode(); };
78 inline int getLevelTypeCode(){ return level.toTypeCode(); };
79 inline int getLevelCode(){ return level.toLevelCode(); };
80 inline int getVarCode(){ return var.toIndCode(); };
81 inline int getVarType(){ return var.getType(); };
82 inline int getVarInd(){ return var.getInd(); };
83 inline const char *getVarAbbr(){ return var.getAbbr(); };
84
85 int decode( const char *str );
86 int toString( String &str );
87
88 inline int toForeLabel( String &str ){ return fore.toString( str ); };
89 inline int toLevelLabel( String &str ){ return level.toString( str ); };
90 inline int toVarLabel( String &str ){ return var.toString( str ); };
91 inline int toVarAbbr( String &str ){ return var.toAbbrCode( str ); };
92
93 int toInfoLabel( String &str );
94 int toDateLabel( Date &date, Timezone &tz, const char *src, String &str );
95 int toDateLabel( Date &date, const char *src, String &str );
96
97 int update( VarSpec &v1, int flag );
98 int update( VarSpec &v1 );
99 int update( ForeTime &ft, Level &lev );
100 int update( ForeTime &ft );
101 int update( Level &lev );
102 inline int printFore(){ return fore.print(); };
103 inline int printLevel(){ return level.print(); };
104 inline int printVar(){ return var.print(); };
105 int printDetails();
106 int print();
107
108 enum Type { NONE, PARAM, VECT, GROUP, FUNC, VECTFUNC, MISC };
109 enum Plot { DEF, PLOT, DATA, CONTOUR, VECTOR, MAP, PANEL };
110
111 static const int FORETIME = 0x1;
112 static const int LEVEL = 0x2;
113 static const int VAR =0x4;
114 static const int FORMAT =0x8;
115 static const int ALL =0xF;
116
117 static int update( VarSpec &v1, VarSpec &v2, int flag );
118
119 friend class VarList;
120 };
121}
122#endif
This class defines forecast time parameters.
Definition: ForeTime.h:9
int toCode()
Definition: ForeTime.cc:230
int getSeconds()
Definition: ForeTime.cc:504
int toString(String &str)
Definition: ForeTime.cc:368
int set(int t, float t1, float t2)
Definition: ForeTime.cc:300
bool isSet()
Definition: ForeTime.h:24
float getHours()
Definition: ForeTime.cc:483
int print()
Definition: ForeTime.cc:635
This class defines vertical level parameters.
Definition: Level.h:8
int getType1()
Definition: Level.h:38
bool isSet()
Definition: Level.h:26
int print()
Definition: Level.cc:1293
int toLevelCode()
Definition: Level.cc:705
int set(int t1, float l1, int t2, float l2)
Definition: Level.cc:89
int toTypeCode()
Definition: Level.cc:640
int toString(String &str)
Definition: Level.cc:917
This class processes variable information from variable.lup file.
Definition: VarName.h:9
This class specifies variable information.
Definition: VarSpec.h:13
int getPlot()
Definition: VarSpec.h:43
int set(const char *str)
Definition: VarSpec.cc:69
int setPlot(int t)
Definition: VarSpec.h:41
int setType(int t)
Definition: VarSpec.h:36
int toInfoLabel(String &str)
Definition: VarSpec.cc:352
int print()
Definition: VarSpec.cc:578
VarSpec()
Definition: VarSpec.cc:27
int printDetails()
Definition: VarSpec.cc:565
int getType()
Definition: VarSpec.h:38
int init()
Definition: VarSpec.cc:53
This class specifies variable information.
Definition: Variable.h:7
int getType()
Definition: Variable.h:29
int print()
Definition: Variable.cc:582
int setUnits(const char *str)
Definition: Variable.cc:119
int toIndCode()
Definition: Variable.cc:290
int toAbbrCode(String &str)
Definition: Variable.cc:403
const char * getUnits()
Definition: Variable.h:49
int toString(String &str)
Definition: Variable.cc:218
int getInd()
Definition: Variable.h:32
const char * getAbbr()
Definition: Variable.h:46
All WXP classes fall under the WXP namespace.
Definition: Angle.h:4