void Data_Service::Initialize_Lane_Uses (Lane_Use_File &file) { Required_File_Check (file, LINK); Required_File_Check (file, VEHICLE_TYPE); if (file.Version () <= 40) { Required_File_Check (file, POCKET); } int percent = System_Data_Reserve (LANE_USE); if (lane_use_array.capacity () == 0 && percent > 0) { int num = file.Num_Records (); if (percent != 100) { num = (int) ((double) num * percent / 100.0); } else if (file.Version () <= 40) { num = (int) (num / 1.5); } if (num > 1) { lane_use_array.reserve (num); if (num > (int) lane_use_array.capacity ()) Mem_Error (file.File_ID ()); } } else { Dir_Itr dir_itr; Lane_Use_Itr use_itr; for (dir_itr = dir_array.begin (); dir_itr != dir_array.end (); dir_itr++) { dir_itr->First_Lane_Use (-1); } for (use_itr = lane_use_array.begin (); use_itr != lane_use_array.end (); use_itr++) { use_itr->Next_Index (-1); } } }
void LinkSum::Initialize_Locations (Location_File &file) { Required_File_Check (file, LINK); //---- initialize the link activity data ---- if (activity_flag) { int i; Int_Itr itr; Int_Map_Itr map_itr; //---- initialize the fields ---- for (i=1, itr = field_list.begin (); itr != field_list.end (); itr++, i++) { link_db.Put_Field (i, 0); } //---- set the record key in sorted order ---- for (map_itr = link_map.begin (); map_itr != link_map.end (); map_itr++) { link_db.Put_Field (0, map_itr->first); if (!link_db.Write_Record (map_itr->first)) { Error ("Adding Link Database"); } } } }
void Data_Service::Initialize_Trips (Trip_File &file) { Required_File_Check (file, LOCATION); Required_File_Check (file, VEHICLE_TYPE); int percent = System_Data_Reserve (TRIP); if (trip_array.capacity () == 0 && percent > 0) { int num = file.Estimate_Records (); if (percent != 100) { num = (int) ((double) num * percent / 100.0); } if (num > 1) { trip_array.reserve (num); if (num > (int) trip_array.capacity ()) Mem_Error (file.File_ID ()); } } }
void Data_Service::Initialize_Lines (Line_File &file) { Required_File_Check (file, TRANSIT_STOP); if (file.Version () > 40) { Required_File_Check (file, VEHICLE_TYPE); } int percent = System_Data_Reserve (TRANSIT_ROUTE); if (line_array.capacity () == 0 && percent > 0) { int num = file.Num_Records () / 25; if (percent != 100) { num = (int) ((double) num * percent / 100.0); } if (num > 1) { line_array.reserve (num); if (num > (int) line_array.capacity ()) Mem_Error (file.File_ID ()); } } }
void Data_Service::Initialize_Connects (Connect_File &file) { Required_File_Check (file, LINK); if (file.Version () <= 40) { Required_File_Check (file, POCKET); } int percent = System_Data_Reserve (CONNECTION); if (connect_array.capacity () == 0 && percent > 0) { int num = file.Num_Records (); if (percent != 100) { num = (int) ((double) num * percent / 100.0); } else if (file.Version () <= 40) { num = (int) (num / 2.25); } if (num > 1) { connect_array.reserve (num); if (num > (int) connect_array.capacity ()) Mem_Error (file.File_ID ()); } } }
void Data_Service::Initialize_Locations (Location_File &file) { Required_File_Check (file, LINK); int percent = System_Data_Reserve (LOCATION); if (location_array.capacity () == 0 && percent > 0) { int num = file.Num_Records (); if (percent != 100) { num = (int) ((double) num * percent / 100.0); } if (num > 1) { location_array.reserve (num); if (num > (int) location_array.capacity ()) Mem_Error (file.File_ID ()); } } }
void Data_Service::Initialize_Timing_Plans (Timing_File &file) { Required_File_Check (file, SIGNAL); }
void Data_Service::Initialize_Drivers (Driver_File &file) { Required_File_Check (file, TRANSIT_ROUTE); Required_File_Check (file, LINK); Required_File_Check (file, VEHICLE_TYPE); }