Beispiel #1
0
FileLogger::FileLogger(const std::string& file) : _file(file){
    if(!_file){
        throw LoadingFailed(file);
    }
    _file << "Log started : " << getCurrentDate() << " " << getCurrentTime() << std::endl;
    _file << "================================" << std::endl;
}
Beispiel #2
0
//-------------------------------------------------------------
// Grille GRIB
void GribPlot::draw_GridPoints (const DataCode &dtc, QPainter &pnt, const Projection *proj)
{
    if (gribReader == NULL) {
        return;
    }
//     GribRecord *rec = gribReader->getFirstGribRecord ();
	DataCode dd;
	if (dtc.dataType == GRB_PRV_WIND_XY2D)
		dd = DataCode (GRB_WIND_VX, dtc.levelType, dtc.levelValue);
	else if (dtc.dataType == GRB_PRV_CUR_XY2D)
		dd = DataCode (GRB_CUR_VX, dtc.levelType, dtc.levelValue);
	else
		dd = dtc;
		
    GribRecord *rec = gribReader->getRecord (dd, getCurrentDate());
	if (! rec)
			return;
    int px,py, i,j, dl=2;
    for (i=0; i<rec->getNi(); i++)
        for (j=0; j<rec->getNj(); j++)
        {
            //if (rec->hasValue(i,j))
            {
                proj->map2screen(rec->getX(i), rec->getY(j), &px,&py);
                pnt.drawLine(px-dl,py, px+dl,py);
                pnt.drawLine(px,py-dl, px,py+dl);
                proj->map2screen(rec->getX(i)-360.0, rec->getY(j), &px,&py);
                pnt.drawLine(px-dl,py, px+dl,py);
                pnt.drawLine(px,py-dl, px,py+dl);
            }
        }
}
Beispiel #3
0
	/**@brief A function to start a runLog in the named directory
	 * @param dirName The name of the directory to start the runLog, runLog name
	 *will be runLog_[NAME_OF_PROGRAM]
	 *
	 */
	void startARunLog(const std::string &dirName) {
		rLog_.setFilenameAndOpen(
				files::make_path(dirName,"runLog_"
						+ replaceString(replaceString(commands_.getProgramName(), "./", ""),
								" ", "-")+ "_" + getCurrentDate() + ".txt").string(), timer_.start_);
		rLog_.startRunLog(commands_);
	}
Beispiel #4
0
CheckSheet ioHandler::getCheckSheet(PatientList& p_list, StaffList& s_list, CheckSheetList& cs_list)
{
	CheckSheet cs;

	string today = getCurrentDate();
	cout << endl << endl << "검사 기록에 대한 자료 입력";
	cs.check_sheet_no = cs_list.findMaxCheckSheetNo(today.substr(0, 4));
	cout << endl << "기록지 번호: " << cs.check_sheet_no;
	cs.patient_id = getPatientId(p_list, "환자번호: ");
	cs.check_date = getCurrentDate();
	cout << endl << "검사일: " << cs.check_date << endl;
	cs.nurse_id = getStaffId(s_list, "검사한 간호사의 직원번호: ");
	cout << endl << "혈압: ";
	cin >> cs.blood_pressure;
	cout << endl << "체온: ";
	cin >> cs.temperature;
	cout << endl << "혈당: ";
	cin >> cs.blood_sugar;
	return cs;
}
Beispiel #5
0
Patient ioHandler::getPatient(PatientList& p_list)
{
	Patient p;
	string today = getCurrentDate();
	cout << "신규 환자에 대한 자료 입력" << endl;
	p.patient_id = p_list.findMaxPatientId(today.substr(0, 4));
	cout << endl << "환자번호: " << p.patient_id;
	putNewLine();
	cout << endl << "성명: ";
	cin >> p.name;
	cout << endl << "성별(M: 남성 / F: 여성) : ";
	cin >> p.sex;
	cout << endl << "생년월일(yyyymmdd) : ";
	cin >> p.birth_date;
	cout << endl << "휴대전화번호: ";
	cin >> p.phone_no;
	p.entering_date = getCurrentDate();
	putNewLine();
	cout << endl << "입원일(yyyymmdd) : " << p.entering_date;
	//cout << endl << "입원일(yyyymmdd) : ";
	//cin >> p.entering_date;
	p.entering_time = getCurrentTime();
	putNewLine();
	cout << endl << "입원시간(hhmm) : " << p.entering_time;
	//cout << endl << "입원시간(hhmm) : ";
	//cin >> p.entering_time;
	putNewLine();
	cout << endl << "병명: ";
	cin >> p.disease;
	cout << endl << "병실: ";
	cin >> p.room_no;
	cout << endl << "주치의: ";
	cin >> p.doctor_assigned;
	cout << endl << "담당 간호사 : ";
	cin >> p.nurse_assigned;
	p.leaving_date = "xxxx0101";
	p.leaving_time = "xxxx";
	return p;
}
Beispiel #6
0
Staff ioHandler::getStaff(StaffList& s_list)
{
	Staff s;
	string today = getCurrentDate();
	cout << "신규 직원에 대한 자료 입력" << endl;
	s.staff_id = s_list.findMaxStaffId(today.substr(0, 4));
	cout << endl << "직원번호: " << s.staff_id;
	putNewLine();
	cout << endl << "직원구분: ";
	cin >> s.staff_sep;
	cout << endl << "성명 : ";
	cin >> s.name;
	cout << endl << "생년월일(yyyymmdd) : ";
	cin >> s.birth_date;
	cout << endl << "휴대전화번호: ";
	cin >> s.phone_no;
	s.join_date = getCurrentDate();
	putNewLine();
	cout << endl << "입사일(yyyymmdd) : " << s.join_date;
	s.resign_date = "xxxx0101";
	return s;
}
Beispiel #7
0
StaffAssign ioHandler::getNurseAssign(PatientList& p_list, StaffList& s_list)
{
	StaffAssign sa;
	sa.patient_id = getPatientId(p_list, "직원을 변경할 환자의 번호 : ");
	Patient p = p_list.searchPatient(sa.patient_id);

	sa.change_date = getCurrentDate();
	cout << endl << "변경일(yyyymmdd) : " << sa.change_date;

	sa.before_staff = p.nurse_assigned;
	cout << "변경전 담당 간호사 : " << sa.before_staff;
	sa.after_staff = getStaffId(s_list, "");
	return sa;
}
Beispiel #8
0
RoomChange ioHandler::getRoomChange(PatientList& p_list, RoomList& r_list)
{
	RoomChange rc;
	rc.patient_id = getPatientId(p_list, "병실을 변경할 환자의 번호 : ");
	Patient p = p_list.searchPatient(rc.patient_id);

	rc.change_date = getCurrentDate();
	cout << endl << "변경일(yyyymmdd) : " << rc.change_date;
	//cin >> rc.change_date;

	rc.before_room = p.room_no;
	cout << "변경전 병실 번호 : " << rc.before_room;
	rc.after_room = getRoomNo(r_list);
	return rc;
}
Beispiel #9
0
int main(int argc, char **argv)
{
  nonportFail = testingFail;

  char s[4];
  s[0] = '-';
  s[1] = 'l';
  s[2] = 's';
  s[3] = 0;
  if (0!=strcmp(s, "-ls")) {
    printf("strcmp failed!\n");
    return 4;
  }

  // process arguments
  bool interactive = false;
  for (int i=1; i<argc; i++) {
    if (0==strcmp("-ls", argv[i])) {
      // do an ls, and bail
      applyToCwdContents(printIt);
      return 0;
    }
    else if (0==strcmp("-noninteractive", argv[i])) {
      // don't do the interactive stuff
      interactive = false;
    }
    else {
      printf("unknown option: %s\n", argv[i]);
      return 2;
    }
  }

  // trying to figure out why backspace sometimes gives ^? crap
  // (turns out Konsole sometimes sends ^? in response to BS,
  // even when the option looks unchecked)
  //char buf[80];
  //printf("type stuff and try backspace: ");
  //gets(buf);
  //printf("%s (%d chars)\n", buf, strlen(buf));
  //return 0;

  long startTime = getMilliseconds();

  if (interactive) {
    printf("Type some characters; you should see each\n"
	   "character echoed once as you type it (q to stop):\n");
    setRawMode(true);
    char ch;
    do {
      ch = getConsoleChar();
      printf("%c", ch);
    } while (ch != 'q');

    setRawMode(false);

    printf("\n\nYou typed for %ld milliseconds\n",
	   getMilliseconds() - startTime);
  }

  limitFileAccess("chmod.test");

  printf("if the current dir contains a file called "
         "chmod.test, I just attempted to limit\n"
         "its access to just the owner\n");

  createDirectory("test.dir");

  // test chdir, which also implicitly tests mkdir
  bool didFirst=false;
  if (!changeDirectory("test.dir") || (didFirst=true, false) ||
      !changeDirectory("..")) {
    printf("failed while trying to chdir to %s\n",
           (didFirst? ".." : "test.dir"));
  }

  // more straightforward
  if (!fileOrDirectoryExists("test.dir")) {
    printf("test.dir didn't get created?\n");
  }

  printf("what's more, I just tried to mkdir & chdir test.dir\n");

  // test ensurePath
  if (!ensurePath("test.dir/a/b/c/d", false /*isDirectory*/)) {
    printf("ensurePath test.dir/a/b/c/d failed\n");
  }

  // try to list partial directory contents
  printf("listing of first 10 files in this directory:\n");
  {
    int count = 0;
    applyToCwdContents(printFirst10, &count);
  }

  // test date function
  {
    int m, d, y;
    getCurrentDate(m, d, y);

    printf("I think the date is (m/d/yyyy): %d/%d/%d\n",
           m, d, y);
  }

  // test sleep (mostly just to make sure it doesn't segfault)
  printf("sleeping for 1 second...\n");
  portableSleep(1);

  // test user name
  char buf[80];
  getCurrentUsername(buf, 80);
  printf("current user name is: %s\n", buf);

  if (interactive) {
    // test nonecho reading
    printf("Type something and press Enter; it won't be echoed (yet):\n");
    readNonechoString(buf, 80, "  > ");
    printf("You typed: %s\n", buf);
  }

  // test random stuff
  printf("hasSystemCryptoRandom: ");
  if (!hasSystemCryptoRandom()) {
    printf("no\n");
  }
  else {
    printf("yes\n");

    printf("three random numbers: %u %u %u\n",
           getSystemCryptoRandom(),
           getSystemCryptoRandom(),
           getSystemCryptoRandom());
  }

  printf("testing nprintf...\n");
  nprintfVector("simple");
  nprintfVector("a %s more", "little");
  nprintfVector("some %4d more %s complicated %c stuff",
                33, "yikes", 'f');
  nprintfVector("%f", 3.4);

  printf("nonport works\n");
  return 0;
}
Beispiel #10
0
int getData(void)
{

	if( fopen(Download_FILE,"r")!= NULL)
	{
		infoOutput("Download: 文件已存在,执行删除操作。\n");
		unlink(Download_FILE);
	}
	else
	{
		infoOutput("Download: 开始获取服务器数据,STARTING:\n");
	}

	int states = 0;
	char address[200] = "wget -O mixcMember.dat http://crlandcd.com/soap/mixc_lianmingka.php?token=";
	char passwd[30] = "";
	FILE *passwdFile;

	//printf("%s\n",cwd);

	if((passwdFile = fopen("passwd","r"))!=NULL)
	{

		fgets(passwd,30,passwdFile);
		strcat(address,passwd);
	}
	else
	{
		infoOutput("Download: 密码文件缺失,请自行在当前目录创建密码文件passwd,并填写秘钥。\n");
	}
	states = system(address);
	if(states < 0)
	{
		infoOutput("Download: 系统调用下载过程失败,文件未成功下载,请联系系统管理员。\n");
		return -1;
	}

	//char template[] = "store_XXXXXX";

	infoOutput("Download: 完成!\n");

	if(rename(Download_FILE,"store.dat")==0)
	{
		infoOutput("Download: 临时文件生成成功,文件名:store.dat\n");
		infoOutput("Download: 开始解析\n");
		FILE *fp;
		fp = fopen("store.dat","r");
		char buff[100];
		fgets(buff,100,fp);

		if(buff[0] == '0')
			infoOutput("Download: 服务器数据为空,请确定BI是否已成功执行数据操作。buff[0] = %c \n",buff[0]);

		if(buff[0] == '-' && buff[1] == '1')
		{
			infoOutput("Download: 服务器密码错误,请检查密码文件是否正确。\n");
			return -2;
		}

		rewind(fp);
		char next;
		int reValue = 0;
		reValue = fscanf(fp,"%d%c",&Record,&next);

		if(next != '\n' && reValue != 2)
		{
			infoOutput("Download: 文件格式错误,请联系系统管理员。\n");
			return -1;
		}
		if ( Record <= 0 )
		{
			infoOutput("Download: 数据量为0,请确认系统是否正常。\n");
			return 0;
		}
		char tmp[100] = "Download: 获取数据成功。\n";
		//sprintf(tmp,tmp,Record);
		//	printf("%d\n%s\n",Record,tmp);
		infoOutput(tmp);

		char dataString[8];
		strcpy(dataString,getCurrentDate(dataString));
		strcpy(saveFileName,"store_wanxiang_");

		strcat(saveFileName,dataString);
		char Records[Record][200];
		int i = 0;

		FILE *saveFile;
		saveFile = fopen(saveFileName,"w");

		for (i;i < Record ; i++)
		{
			fgets(Records[i],200,fp);	
			fprintf(saveFile,"%s",Records[i]);
		}



		//char *Records[200];
		//Records = (char *Records)malloc(Record * 200);

		MyStatus = GETDATA;

	}
	else
	{
		infoOutput("Download: 文件生成失败。请确定目录权限是否设置正确。\n");
		return -1;
	}
}