1 #ifndef GCP_UTIL_IERSCOMMUNICATOR_H
2 #define GCP_UTIL_IERSCOMMUNICATOR_H
15 #include "gcp/util/common/Communicator.h"
16 #include "gcp/util/common/FdSet.h"
17 #include "gcp/util/common/GenericTask.h"
18 #include "gcp/util/common/GenericTaskMsg.h"
19 #include "gcp/util/common/SpawnableTask.h"
20 #include "gcp/util/common/String.h"
21 #include "gcp/util/common/TcpClient.h"
22 #include "gcp/util/common/TimeOut.h"
24 #define IERS_HANDLER(fn) void (fn)(void* args, std::string fileName)
25 #define IERS_FILENAME_MAX 100
48 char fileName[IERS_FILENAME_MAX+1];
104 unsigned timeOutIntervalInSeconds=0);
107 std::string outputFileName,
108 unsigned timeOutIntervalInSeconds=0);
129 void addHandler(IERS_HANDLER(*handler),
void* args=0);
133 void removeHandler(IERS_HANDLER(*handler));
159 std::vector<Handler> handlers_;
164 double expiryThresholdInDays_;
169 double updateThresholdInDays_;
173 std::ostringstream ftpOs_;
177 std::string outputFileName_;
192 struct timeval* timeOutPtr_;
201 void initialize(std::string fullPathToOutputFile);
202 void initialize(std::string outputDir, std::string outputFileName);
206 void setupTimeOuts(
unsigned timeOutIntervalInSeconds);
210 void stepState(CommState state);
216 void executeAddHandler(IERS_HANDLER(*handler),
void* args=0);
217 void executeRemoveHandler(IERS_HANDLER(*handler));
228 void registerTimeOut();
247 void compileGetIersBulletinStateMachine();
252 void initiateGetIersBulletinCommSequence();
256 void concatenateString(std::ostringstream& os);
260 void processIersBulletin();
264 static COMM_PARSER_FN(parsePortNumber);
265 void parsePortNumber();
269 static COMM_PARSER_FN(quitFromServer);
270 void quitFromServer(
bool error);
274 void terminateFtpConnection(
bool error);
279 void registerCommTimeOut();
286 void printHeader(std::ofstream& fout);
287 void printEphem(std::ofstream& fout);
295 bool ephemerisNeedsUpdating();
308 bool ephemIsAboutToRunOut();
312 double getLastEphemMjd();
317 bool ephemFileIsOutOfDate();
328 #endif // End #ifndef GCP_UTIL_IERSCOMMUNICATOR_H
Definition: GenericTaskMsg.h:31
void loadFile(std::string name)
Definition: IersCommunicator.cc:606
void getIersBulletin()
Definition: IersCommunicator.cc:466
virtual ~IersCommunicator()
Definition: IersCommunicator.cc:113
Definition: SpawnableTask.h:31
Definition: HorizonsCommunicator.h:80
Definition: Communicator.h:26
Definition: IersCommunicator.h:80
Definition: TcpClient.h:18
void updateEphemerisFileName(std::string fileName)
Definition: IersCommunicator.cc:501
IersCommunicator(std::string fullPathToOutputFile, unsigned timeOutIntervalInSeconds=0)
Definition: IersCommunicator.cc:40
std::string ephemFileName()
Definition: IersCommunicator.cc:700
Definition: IersCommunicator.h:34
void addHandler(IERS_HANDLER(*handler), void *args=0)
Definition: IersCommunicator.cc:478