WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
WmoParse.h
1#ifndef _WINC_WMOPARSE
2#define _WINC_WMOPARSE
3
4#include <WXP/File.h>
5#include <WXP/Filename.h>
6#include <WXP/String.h>
7#include <WXP/WmoProduct.h>
8
9namespace WXP {
10 class WmoParse {
11 Filename filename;
12 int ind;
13 File file;
14 File hfile;
15 bool opened;
16
17 bool use_hfile;
18 bool use_awips;
19
20 char sheader[80];
21 char sawip[80];
22 char sid[80];
23
24 char header[80];
25 char awip[80];
26 char data[500]; // Temporary data needed for processing
27 int data_len;
28
29 int pline_status;
30 int line_status;
31 bool next_hdr; // Need to go to next header
32 bool new_prod; // Is this the beginning of a new product
33
34 int loc; // Location of beginning of current line
35 int hloc; // Location of current header in file
36
37 int found; // Is product found
38 int ifound; // Is requested Id found
39
40 int end_dollar;
41 int end_blank;
42
43 int peeked;
44
45 int lnum;
46
47 bool compare( const char *pattern );
48 int newFile();
49
50 public:
51 static const int START = 0x1;
52 static const int SEQ = 0x2;
53 static const int HEADER = 0x3;
54 static const int AWIP = 0x4;
55 static const int SDATA = 0x5;
56 static const int DATA = 0x10;
57 static const int BLANK = 0x11;
58 static const int DOLLAR = 0x12;
59 static const int LOCATE = 0x13;
60 static const int VTEC = 0x14;
61 static const int LATLON = 0x15;
62 static const int DESC = 0x16;
63
64 WmoParse();
65 WmoParse( const char *str );
66 int init();
67 int setParam( const char *str );
68 int open( Filename &filename );
69 int open( const char *filename );
70 bool isOpen();
71 int rewind();
72 int close();
76 inline int useHdrFile( bool val ){ use_hfile = val; return 1; };
77 inline int useAwipsHdr( bool val ){ use_awips = val; return 1; };
78 bool isNewProd();
79 int setHeader( const char *string );
80 int setId( const char *id );
81 const char *getHeader();
82 const char *getAwip();
83 inline int getLineStatus(){ return line_status; };
84 int tell();
85 int seek( int loc );
86 int getLoc();
87 int getHeaderLoc();
88 int getFileInd();
89 int setLoc( int byte );
90 int setLoc( int rind, int byte );
91 int peek( WmoProduct &prod );
92 int read( WmoProduct &prod );
93 int getLine( char *string, int len );
94 int getLine( String &line );
95 bool isData();
96
97 static bool isStart( const char *line );
98 static bool compare( const char *header, const char *awip, const char *pattern );
99 static bool checkZone( const char *line, const char *str );
100 enum Type { RAW, WXP };
101 };
102}
103#endif
This class accesses files.
Definition: File.h:15
This class creates filenames.
Definition: Filename.h:11
This class parses text files.
Definition: WmoParse.h:10
int getLine(char *string, int len)
Definition: WmoParse.cc:333
WmoParse()
Definition: WmoParse.cc:26
int setId(const char *id)
Definition: WmoParse.cc:174
int setLoc(int byte)
Definition: WmoParse.cc:227
int rewind()
Definition: WmoParse.cc:132
int getLoc()
Definition: WmoParse.cc:211
bool isNewProd()
Definition: WmoParse.cc:157
const char * getHeader()
Definition: WmoParse.cc:183
bool isOpen()
Definition: WmoParse.cc:125
bool isData()
Definition: WmoParse.cc:688
int useHdrFile(bool val)
Definition: WmoParse.h:76
int setHeader(const char *string)
Definition: WmoParse.cc:165
int init()
Definition: WmoParse.cc:42
const char * getAwip()
Definition: WmoParse.cc:191
int getHeaderLoc()
Definition: WmoParse.cc:219
int open(Filename &filename)
Definition: WmoParse.cc:83
int close()
Definition: WmoParse.cc:144
All WXP classes fall under the WXP namespace.
Definition: Angle.h:4