00001 // FileHandler.h: interface for the FileHandler class. 00002 // 00004 00005 #if !defined(AFX_FILEHANDLER_H__1D4DB653_00A1_4904_803E_A9AFD95DA75D__INCLUDED_) 00006 #define AFX_FILEHANDLER_H__1D4DB653_00A1_4904_803E_A9AFD95DA75D__INCLUDED_ 00007 00008 #if _MSC_VER > 1000 00009 #pragma once 00010 #endif // _MSC_VER > 1000 00011 00012 #include "stdafx.h" 00013 #include <string> 00014 #include <fstream> 00015 #include <algorithm> 00016 #include "Truck.h" 00017 #include "Car.h" 00018 00021 class FileHandler 00022 { 00023 public: 00024 int getPercentComplete(); 00025 std::vector<Vehicle*> loadTruckGroup(int no); 00026 virtual void writeLine(Vehicle *pVeh) = 0; 00027 virtual Vehicle* readLine() = 0; 00028 FileHandler(); 00029 virtual ~FileHandler(); 00030 00031 protected: 00032 void setInFileSize(); 00033 std::ifstream m_InFile; 00034 std::ofstream m_OutFile; 00035 std::vector<Vehicle*> m_Vehicles; 00036 char* m_pCharVeh; 00037 char m_VehCharArry[78]; 00038 00039 int m_CurLine; 00040 int m_InFileSize; 00041 00042 int TRUCK_WEIGHT_THRESHOLD; 00043 00044 }; 00045 00046 #endif // !defined(AFX_FILEHANDLER_H__1D4DB653_00A1_4904_803E_A9AFD95DA75D__INCLUDED_)