JPTextFileReader.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include "Datum.h"
00007 #include "FileHeader.h"
00008 #include "FileObjectReader.h"
00009 #include <iostream>
00010 #include <sstream>
00011 #include "JPTextFileReader.h"
00012
00013 using namespace std;
00014
00015 class Object;
00016
00017 JPTextFileReader::JPTextFileReader()
00018 : FileObjectReader()
00019 {
00020 }
00021
00022 Object* JPTextFileReader::read(FILE* aFilePtr)
00023 {
00024 Object* theObjectPtr = 0;
00025 unsigned long long id;
00026 char id1[7];
00027 char id2[6];
00028 char dummy[1];
00029 double b, l;
00030 double ra;
00031 double dec;
00032 double orthoSD = 0.0;
00033 double decSD = 0.0;
00034 const int cNumFields = 7;
00035
00036 if (cNumFields == fscanf(aFilePtr, " %lf%lf%lf%lf%7s%1s%6s\n",
00037 &ra, &dec, &b, &l, id1, dummy, id2))
00038 {
00039 stringstream idStr;
00040 idStr << id1;
00041 idStr >> id;
00042 theObjectPtr = new Datum(id, ra, orthoSD, dec, decSD);
00043 cout << "match" << endl;
00044 }
00045 cout << id1 << " " << id << " " << ra << " " << dec << " " << b << " " << l << endl;
00046
00047 return theObjectPtr;
00048 }
00049