Example #1
0
bool TPPlus_Matrix::Read_Header (bool stat)
{
	int i;
	char *header;
	double size;
	String label;

	//---- extract the table names ----

	stat = false;
	Clear_Fields ();

	header = (char *) fh->Mnames;

	for (i=0; i < Tables (); i++) {
		label = header;
		if (label.empty ()) {
			header++;
			label ("%d") % (i + 1);
		} else {
			header += label.size () + 1;
		}
		size = sizeof (double);
		if (fh->Mspecs [i] != 'D' && fh->Mspecs [i] != 'S') {
			size += fh->Mspecs [i] / 10.0;
		}
		Add_Field (label, DB_DOUBLE, size, NO_UNITS, true);
	}
	Add_Field ("ORG", DB_INTEGER, 4, NO_UNITS, true);
	Add_Field ("DES", DB_INTEGER, 4, NO_UNITS, true);

	return (Set_Field_Numbers ());
}
Example #2
0
bool Boundary_File::Create_Fields (void) 
{
	Add_Field ("PARKING", INTEGER, 10);
	Add_Field ("START", STRING, TIME_BUFFER);
	Add_Field ("END", STRING, TIME_BUFFER);
	Add_Field ("SPEED", DOUBLE, 10, 2);

	return (Set_Field_Numbers ());
}
Example #3
0
bool Count_File::Create_Fields (void) 
{
	Add_Field ("ANODE", INTEGER, 10);
	Add_Field ("BNODE", INTEGER, 10);
	Add_Field ("START", STRING, 20);
	Add_Field ("END", STRING, 20);
	Add_Field ("COUNT", INTEGER, 10);

	return (Set_Field_Numbers ());
}
Example #4
0
bool Factor_File::Create_Fields (void) 
{
	Add_Field ("ORG", INTEGER, 5);
	Add_Field ("DES", INTEGER, 5);

	if (Period_Flag ()) {
		Add_Field ("PERIOD", INTEGER, 3);
	}
	Add_Field ("FACTOR", DOUBLE, 16, 6);

	return (Set_Field_Numbers ());
}
Example #5
0
bool Sign_File::Create_Fields (void) 
{
	Add_Field ("LINK", DB_INTEGER, 10);
	Add_LinkDir_Field ();
	if (Code_Flag ()) {
		Add_Field ("SIGN", DB_UNSIGNED, 1, CONTROL_CODE, true);
	} else {
		Add_Field ("SIGN", DB_STRING, 10, CONTROL_CODE);
	}
	if (exe->Notes_Name_Flag ()) {
		Add_Field ("NOTES", DB_STRING, STRING_FIELD_SIZE);
	}
	return (Set_Field_Numbers ());
}
Example #6
0
bool Event_File::Create_Fields (void) 
{
	Add_Field ("HOUSEHOLD", INTEGER, 10);
	Add_Field ("PERSON", INTEGER, 2);
	Add_Field ("TRIP", INTEGER, 4);
	Add_Field ("LEG", INTEGER, 2);
	Add_Field ("MODE", INTEGER, 2);
	Add_Field ("EVENT", INTEGER, 2);
	Add_Field ("SCHEDULE", STRING, TIME_BUFFER);
	Add_Field ("ACTUAL", STRING, TIME_BUFFER);
	Add_Field ("LINK", INTEGER, 10);
	Add_Field ("OFFSET", INTEGER, 10);

	return (Set_Field_Numbers ());
}
Example #7
0
bool Ridership_File::Create_Fields (void) 
{
	Add_Field ("MODE", STRING, 16);
	Add_Field ("ROUTE", INTEGER, 10);
	Add_Field ("RUN", INTEGER, 5);
	Add_Field ("STOP", INTEGER, 10);
	Add_Field ("SCHEDULE", STRING, TIME_BUFFER);
	Add_Field ("TIME", STRING, TIME_BUFFER);
	Add_Field ("BOARD", INTEGER, 5);
	Add_Field ("ALIGHT", INTEGER, 5);
	Add_Field ("LOAD", INTEGER, 5);
	Add_Field ("FACTOR", DOUBLE, 5, 2);
	
	return (Set_Field_Numbers ());
}
Example #8
0
bool Db_Base::Replicate_Fields (Db_Base *file, bool notes_flag, bool nest_flag, bool drop_flag) 
{
	int i, offset, nfield;
	bool convert, binary;
	Nest_Type nest;
	Field_Ptr fld;

	if (file == 0) return (false);
	if (Dbase_Format () == DEFAULT_FORMAT) {
		Dbase_Format (DEFAULT_FORMAT);
	}
	convert = (file->Dbase_Format () != Dbase_Format () || Num_Fields () > 0);
	binary = (file->Record_Format () == BINARY);

	offset = END_OF_RECORD;
	nfield = file->Num_Fields ();

	for (i=0; i < nfield; i++) {
		fld = file->Field (i);
		if (fld == 0) continue;

		if (!convert) {
			offset = fld->Offset ();
		}
		if (notes_flag == false) {
			if (fld->Name ().Equals ("NOTES")) continue;
		}
		if (drop_flag && fld->Nested ()) continue;

		nest = (nest_flag) ? fld->Nest () : NO_NEST;

		Add_Field (fld->Name (), fld->Type (), fld->Size (), fld->Units (), binary, nest, offset);
	}
	return (Write_Fields ());
}
Example #9
0
bool Route_Nodes_File::Create_Fields (void) 
{
	Add_Field ("ROUTE", INTEGER, 10);
	Add_Field ("NODE", INTEGER, 10);

	if (dwell_flag) {
		Add_Field ("DWELL", INTEGER, 10);
	}
	if (time_flag) {
		Add_Field ("TIME", INTEGER, 10);
	}
	if (speed_flag) {
		Add_Field ("SPEED", DOUBLE, 10, 2);
	}
	return (Set_Field_Numbers ());
}
bool CSG_PointCloud::Create(void)
{
    Destroy();

    Add_Field(SG_T(""), SG_DATATYPE_Undefined);	// add x, y, z fields

    return( true );
}
Example #11
0
bool TransCAD_Matrix::Read_Header (bool stat)
{
	int i;
	char label [_MAX_FLABEL];
	double size;
	Field_Type type;
	String text;

	//---- extract the table names ----

	Clear_Fields ();
	stat = false;

	type = Type ();

	if (type == DB_DOUBLE) {
		size = sizeof (double);
	} else if (type == DB_FLOAT) {
		type = DB_DOUBLE;
		size = sizeof (float);
	} else if (type == DB_SHORT) {
		type = DB_INTEGER;
		size = sizeof (short);
	} else {
		size = sizeof (int);
	}

	for (i=0; i < Tables (); i++) {
		MATRIX_GetLabel (fh, (short) i, label);
		text = label;
		Add_Field (text, type, size, NO_UNITS, true);
	}
	Add_Field ("ORG", DB_INTEGER, 4, NO_UNITS, true);
	Add_Field ("DES", DB_INTEGER, 4, NO_UNITS, true);

	return (Set_Field_Numbers ());
}
Example #12
0
bool Link_Delay_File::Create_Fields (void) 
{
	Add_Field ("LINK", DB_INTEGER, 10);
	Add_LinkDir_Field ();
	if (type_flag) {
		Add_Field ("TYPE", DB_INTEGER, 1);
	}
	Add_Field ("START", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("END", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("FLOW", DB_DOUBLE, 9.2, flow_units);
	Add_Field ("TIME", DB_TIME, 8.1, SECONDS);
	if (turn_flag) {
		Nest (NESTED);
		Header_Lines (2);
		Add_Field ("NCONNECT", DB_INTEGER, 2);
		Add_Field ("OUT_LINK", DB_INTEGER, 10, NO_UNITS, false, NESTED);
		Add_Field ("OUT_FLOW", DB_DOUBLE, 9.2, flow_units, false, NESTED);
		Add_Field ("OUT_TIME", DB_TIME, 8.1, SECONDS, false, NESTED);
	} else {
		Nest (NO_NEST);
		Header_Lines (1);
	}
	return (Set_Field_Numbers ());
}
Example #13
0
bool Node_File::Create_Fields (void) 
{
	Add_Field ("NODE", DB_INTEGER, 10);
	Add_Field ("X_COORD", DB_DOUBLE, 14.1, METERS);
	Add_Field ("Y_COORD", DB_DOUBLE, 14.1, METERS);
	Add_Field ("Z_COORD", DB_DOUBLE, 14.1, METERS);
	if (Subarea_Flag ()) {
		Add_Field ("SUBAREA", DB_INTEGER, 4);
		Add_Field ("PARTITION", DB_INTEGER, 4);
	}
	if (exe->Notes_Name_Flag ()) {
		Add_Field ("NOTES", DB_STRING, STRING_FIELD_SIZE);
	}
	return (Set_Field_Numbers ());
}
Example #14
0
bool Location_File::Create_Fields (void) 
{
	Add_Field ("LOCATION", DB_INTEGER, 10);
	Add_Field ("LINK", DB_INTEGER, 10);
	Add_LinkDir_Field ();
	Add_Field ("OFFSET", DB_DOUBLE, 8.1, METERS);
	Add_Field ("SETBACK", DB_DOUBLE, 8.1, METERS);
	Add_Field ("ZONE", DB_INTEGER, 10);
	if (exe->Notes_Name_Flag ()) {
		Add_Field ("NOTES", DB_STRING, STRING_FIELD_SIZE);
	}
	return (Set_Field_Numbers ());
}
Example #15
0
bool Coordinator_File::Create_Fields (void) 
{
	if (Dbase_Format () == VERSION3) {
		Add_Field ("ID", INTEGER, 10);
		Add_Field ("TYPE", STRING, 10);
		Add_Field ("ALGORITHM", STRING, 10);
		Add_Field ("NOTES", STRING, FIELD_BUFFER);
	} else {
		Add_Field ("ID", INTEGER, 10);
		if (Notes_Flag ()) {
			Add_Field ("NOTES", STRING, FIELD_BUFFER);
		}
	}
	return (Set_Field_Numbers ());
}
Example #16
0
void Location_File::Add_User_Fields (Location_File *file)
{
	int i, offset, nfield;
	bool convert, binary;
	Field_Ptr fld;

	if (file == 0) return;

	if (Dbase_Format () == DEFAULT_FORMAT) {
		Dbase_Format (DEFAULT_FORMAT);
	}
	convert = (file->Dbase_Format () != Dbase_Format () || Num_Fields () > 0);
	binary = (file->Record_Format () == BINARY);

	offset = END_OF_RECORD;
	nfield = file->Num_Fields ();

	for (i=0; i < nfield; i++) {
		fld = file->Field (i);
		if (fld == 0) continue;

		//---- skip standard fields ----

		if (fld->Name ().Equals ("LOCATION") || fld->Name ().Equals ("ID") || fld->Name ().Equals ("LINK") ||
			fld->Name ().Equals ("OFFSET") || fld->Name ().Equals ("SETBACK") || fld->Name ().Equals ("ZONE") ||
			fld->Name ().Equals ("TAZ") || fld->Name ().Equals ("DIR") || fld->Name ().Equals ("NODE") ||
			fld->Name ().Equals ("X_COORD") || fld->Name ().Equals ("EASTING") || fld->Name ().Equals ("X") ||
			fld->Name ().Equals ("Y_COORD") || fld->Name ().Equals ("NORTHING") || fld->Name ().Equals ("Y") ||
			fld->Name ().Equals ("NOTES")) continue;

		if (!convert) {
			offset = fld->Offset ();
		}
		Add_Field (fld->Name (), fld->Type (), fld->Size (), fld->Units (), binary, NO_NEST, offset);
	}
	Write_Fields ();
	Write_Header ();
}
Example #17
0
bool Parking_File::Create_Fields (void) 
{
	if (Dbase_Format () == VERSION3) {
		Add_Field ("ID", INTEGER, 10);
		Add_Field ("NODE", INTEGER, 10);
		Add_Field ("LINK", INTEGER, 10);
		Add_Field ("OFFSET", DOUBLE, 10, 2);
		Add_Field ("STYLE", STRING, 16);
		Add_Field ("CAPACITY", INTEGER, 6);
		Add_Field ("GENERIC", CHAR, 1);
		Add_Field ("VEHICLE", STRING, FIELD_BUFFER);
		Add_Field ("STARTTIME", STRING, TIME_BUFFER);
		Add_Field ("ENDTIME", STRING, TIME_BUFFER);
		Add_Field ("NOTES", STRING, FIELD_BUFFER);
	} else {
		Add_Field ("PARKING", INTEGER, 10);
		Add_Field ("LINK", INTEGER, 10);
		Add_Field ("NODE", INTEGER, 10);
		Add_Field ("OFFSET", DOUBLE, 10, 2);
		Add_Field ("TYPE", STRING, 16);
		Add_Field ("USE", STRING, FIELD_BUFFER);
		Add_Field ("SPACE", INTEGER, 6);
		Add_Field ("START", STRING, TIME_BUFFER);
		Add_Field ("END", STRING, TIME_BUFFER);
		Add_Field ("HOURLY", INTEGER, 8);
		Add_Field ("DAILY", INTEGER, 8);
		if (Notes_Flag ()) {
			Add_Field ("NOTES", STRING, FIELD_BUFFER);
		}
	}
	return (Set_Field_Numbers ());
}
Example #18
0
//---------------------------------------------------------
bool CSG_Table::Serialize(CSG_File &Stream, bool bSave)
{
	SG_Char				Separator	= SG_T('\t');
	int					iField, nFields, iRecord, nRecords, FieldType;
	CSG_Table_Record	*pRecord;
	CSG_String			s, sLine;

	//-----------------------------------------------------
	if( bSave )
	{
		Stream.Printf(SG_T("%d %d\n"), m_nFields, m_nRecords);

		for(iField=0; iField<m_nFields; iField++)
		{
			Stream.Printf(SG_T("%d \"%s\"\n"), Get_Field_Type(iField), Get_Field_Name(iField));
		}

		for(iRecord=0; iRecord<m_nRecords; iRecord++)
		{
			for(iField=0; iField<m_nFields; iField++)
			{
				Stream.Printf(SG_T("%s%c"), Get_Record(iRecord)->asString(iField), iField < m_nFields - 1 ? Separator : '\n');
			}
		}

		return( true );
	}

	//-----------------------------------------------------
	else if( Stream.Read_Line(sLine) && SG_SSCANF(sLine, SG_T("%d %d"), &nFields, &nRecords) == 2 && nFields > 0 )
	{
		_Destroy();

		for(iField=0; iField<nFields; iField++)
		{
			if( Stream.Read_Line(sLine) && SG_SSCANF(sLine, SG_T("%d"), &FieldType) == 1 )
			{
				Add_Field(sLine.AfterFirst(SG_T('\"')).BeforeFirst(SG_T('\"')), (TSG_Data_Type)FieldType);
			}
		}

		for(iRecord=0; iRecord<nRecords; iRecord++)
		{
			if( Stream.Read_Line(sLine) )
			{
				pRecord	= _Add_Record();

				for(iField=0; iField<m_nFields; iField++)
				{
					pRecord->Set_Value(iField, sLine.BeforeFirst(Separator));

					sLine	= sLine.AfterFirst(Separator);
				}
			}
		}

		return( true );
	}

	//-----------------------------------------------------
	return( false );
}
Example #19
0
bool Travel_Time_File::Create_Fields (void) 
{
	Add_Field ("HHOLD", DB_INTEGER, 4, NO_UNITS, true);
	Add_Field ("PERSON", DB_INTEGER, 2, NO_UNITS, true);
	Add_Field ("TOUR", DB_INTEGER, 1, NO_UNITS, true);
	Add_Field ("TRIP", DB_INTEGER, 1, NO_UNITS, true);
	if (Code_Flag ()) {
		Add_Field ("MODE", DB_INTEGER, 1, MODE_CODE, true);
		Add_Field ("PURPOSE", DB_INTEGER, 1, NO_UNITS, true);
		Add_Field ("CONSTRAINT", DB_INTEGER, 1, CONSTRAINT_CODE, true);
	} else {
		Add_Field ("MODE", DB_STRING, 12, MODE_CODE);
		Add_Field ("PURPOSE", DB_INTEGER, 2);
		Add_Field ("CONSTRAINT", DB_STRING, 14, CONSTRAINT_CODE);
	}
	Add_Field ("START_LINK", DB_INTEGER, 10);
	Add_Field ("END_LINK", DB_INTEGER, 10);

	Add_Field ("TRIP_START", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("BASE_START", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("STARTED", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("START_DIFF", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("TRIP_END", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("BASE_END", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("ENDED", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("END_DIFF", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("MID_TRIP", DB_TIME, TIME_FIELD_SIZE, Time_Format ());
	Add_Field ("TTIME", DB_TIME, TIME_FIELD_SIZE, Time_Format ());

	return (Set_Field_Numbers ());
}
Example #20
0
bool Location_File::Create_Fields (void) 
{
	if (Dbase_Format () == VERSION3) {
		Add_Field ("ID", INTEGER, 10);
		Add_Field ("NODE", INTEGER, 10);
		Add_Field ("LINK", INTEGER, 10);
		Add_Field ("OFFSET", DOUBLE, 10, 2);
		Add_Field ("LAYER", STRING, 16);
		Add_Field ("EASTING", DOUBLE, 14, 2);
		Add_Field ("NORTHING", DOUBLE, 14, 2);
		Add_Field ("ELEVATION", DOUBLE, 14, 2);
		Add_Field ("TAZ", INTEGER, 10);
		Add_Field ("NOTES", STRING, FIELD_BUFFER);
	} else {
		Add_Field ("LOCATION", INTEGER, 10);
		Add_Field ("LINK", INTEGER, 10);
		Add_Field ("NODE", INTEGER, 10);
		Add_Field ("OFFSET", DOUBLE, 10, 1);
		Add_Field ("X_COORD", DOUBLE, 14, 1);
		Add_Field ("Y_COORD", DOUBLE, 14, 1);
		Add_Field ("ZONE", INTEGER, 10);
		if (Notes_Flag ()) {
			Add_Field ("NOTES", STRING, FIELD_BUFFER);
		}
	}
	return (Set_Field_Numbers ());
}
Example #21
0
bool System_Event_File::Create_Fields (void) 
{
	if (Dbase_Format () == VERSION3) {
		Add_Field ("TIME", STRING, TIME_BUFFER);
		Add_Field ("EVENT", INTEGER, 5);
		Add_Field ("NODE", INTEGER, 10);
		Add_Field ("PLAN", INTEGER, 10);
		Add_Field ("PHASE", INTEGER, 10);
		Add_Field ("RING", INTEGER, 2);
		Add_Field ("GROUP", INTEGER, 2);
		Add_Field ("STATUS", STRING, 16);
	} else {
		Add_Field ("TIME", STRING, TIME_BUFFER);
		Add_Field ("EVENT", INTEGER, 5);
		Add_Field ("NODE", INTEGER, 10);
		Add_Field ("PLAN", INTEGER, 10);
		Add_Field ("PHASE", INTEGER, 5);
		Add_Field ("RING", INTEGER, 2);
		Add_Field ("GROUP", INTEGER, 2);
		Add_Field ("STATUS", STRING, 16);
	}
	return (Set_Field_Numbers ());
}
Example #22
0
bool Veh_Type_File::Create_Fields (void) 
{
	if (Dbase_Format () == VERSION3) {
		Add_Field ("VEHTYPE", INTEGER, 2);
		Add_Field ("VSUBTYPE", INTEGER, 2);
		Add_Field ("MAXVEL", DOUBLE, 6, 2);
		Add_Field ("MAXACCEL", DOUBLE, 6, 2);
		Add_Field ("LENGTH", DOUBLE, 6, 1);
		Add_Field ("CAPACITY", INTEGER, 4);
	} else {
		Add_Field ("TYPE", INTEGER, 2);
		Add_Field ("SUBTYPE", INTEGER, 2);
		Add_Field ("LENGTH", DOUBLE, 6, 1);
		Add_Field ("MAX_SPEED", DOUBLE, 6, 1);
		Add_Field ("MAX_ACCEL", DOUBLE, 6, 2);
		Add_Field ("MAX_DECEL", DOUBLE, 6, 2);
		Add_Field ("USE", STRING, 20);
		Add_Field ("CAPACITY", INTEGER, 4);
		Add_Field ("LOADING", DOUBLE, 6, 2);
		Add_Field ("UNLOADING", DOUBLE, 6, 2);
		Add_Field ("METHOD", STRING, 20);
		Add_Field ("MIN_DWELL", INTEGER, 4);
		Add_Field ("MAX_DWELL", INTEGER, 4);
	}
	return (Set_Field_Numbers ());
}
Example #23
0
bool Connect_File::Create_Fields (void) 
{
	Add_Field ("LINK", DB_INTEGER, 10);
	Add_LinkDir_Field ();
	Add_Field ("TO_LINK", DB_INTEGER, 10);
	if (Code_Flag ()) {
		Add_Field ("LANES", DB_UNSIGNED, 2, LANE_RANGE_CODE, true);
		Add_Field ("TO_LANES", DB_UNSIGNED, 2, LANE_RANGE_CODE, true);
		Add_Field ("TYPE", DB_UNSIGNED, 1, CONNECT_CODE, true);
	} else {
		Add_Field ("LANES", DB_STRING, 8, LANE_RANGE_CODE);
		Add_Field ("TO_LANES", DB_STRING, 8, LANE_RANGE_CODE);
		Add_Field ("TYPE", DB_STRING, 8, CONNECT_CODE);
	}
	Add_Field ("PENALTY", DB_UNSIGNED, 2, IMPEDANCE, true);
	Add_Field ("SPEED", DB_DOUBLE, 5.1, MPH);
	Add_Field ("CAPACITY", DB_UNSIGNED, 8, VPH);
	if (exe->Notes_Name_Flag ()) {
		Add_Field ("NOTES", DB_STRING, STRING_FIELD_SIZE);
	}
	return (Set_Field_Numbers ());
}
Example #24
0
bool Travel_Time_File::Create_Fields (void) 
{
	Add_Field ("HOUSEHOLD", INTEGER, 10);
	Add_Field ("PERSON", INTEGER, 5);
	Add_Field ("TRIP", INTEGER, 5);
	Add_Field ("LEG", INTEGER, 2);
	Add_Field ("MODE", INTEGER, 2);
	Add_Field ("PURPOSE", INTEGER, 2);
	Add_Field ("CONSTRAINT", INTEGER, 2);
	Add_Field ("START_LINK", INTEGER, 10);
	Add_Field ("END_LINK", INTEGER, 10);
	Add_Field ("TRIP_START", STRING, 16);
	Add_Field ("BASE_START", STRING, 16);
	Add_Field ("STARTED", STRING, 16);
	Add_Field ("START_DIFF", STRING, 16);
	Add_Field ("TRIP_END", STRING, 16);
	Add_Field ("BASE_END", STRING, 16);
	Add_Field ("ENDED", STRING, 16);
	Add_Field ("END_DIFF", STRING, 16);
	Add_Field ("MID_TRIP", STRING, 16);
	Add_Field ("DURATION", STRING, 16);

	return (Set_Field_Numbers ());
}
Example #25
0
bool Veh_Type_File::Create_Fields (void) 
{
	Add_Field ("TYPE", DB_INTEGER, 4, VEH_TYPE);
	Add_Field ("LENGTH", DB_DOUBLE, 5.1, FEET);
	Add_Field ("MAX_SPEED", DB_DOUBLE, 5.1, MPH);
	Add_Field ("MAX_ACCEL", DB_DOUBLE, 5.1, FPS2);
	Add_Field ("MAX_DECEL", DB_DOUBLE, 5.1, FPS2);
	Add_Field ("OP_COST", DB_DOUBLE, 5.1, CENT_MI);

	if (Code_Flag ()) {
		Add_Field ("USE", DB_UNSIGNED, 2, VEH_USE_CODE, true);
	} else {
		Add_Field ("USE", DB_STRING, 20, VEH_USE_CODE);
	}
	Add_Field ("CAPACITY", DB_UNSIGNED, 4, PPV);
	Add_Field ("MAX_LOAD", DB_UNSIGNED, 4, PPV);
	Add_Field ("OCCUPANCY", DB_DOUBLE, 8.2, PPV);
	Add_Field ("LOADING", DB_DOUBLE, 6.2, SPP);
	Add_Field ("UNLOADING", DB_DOUBLE, 6.2, SPP);
	if (Code_Flag ()) {
		Add_Field ("METHOD", DB_UNSIGNED, 1, LOADING_CODE, true);
	} else {
		Add_Field ("METHOD", DB_STRING, 20, LOADING_CODE);
	}
	Add_Field ("MIN_DWELL", DB_TIME, 6.1, SECONDS);
	Add_Field ("MAX_DWELL", DB_TIME, 6.1, SECONDS);
	Add_Field ("GRADE_FUNC", DB_INTEGER, 3);
	Add_Field ("FUEL_FUNC", DB_INTEGER, 3);
	Add_Field ("FUEL_CAP", DB_INTEGER, 5.1, GALLONS);

	if (exe->Notes_Name_Flag ()) {
		Add_Field ("NOTES", DB_STRING, STRING_FIELD_SIZE);
	}
	return (Set_Field_Numbers ());
}
Example #26
0
bool Fare_File::Create_Fields (void) 
{
	if (Dbase_Format () == VERSION3) {
		Add_Field ("FROMZONE", STRING, 8);
		Add_Field ("TOZONE", STRING, 8);
		Add_Field ("MODE", STRING, 20);
		Add_Field ("COST", INTEGER, 6);
	} else {
		Add_Field ("FROM_ZONE", STRING, FIELD_BUFFER);
		Add_Field ("TO_ZONE", STRING, FIELD_BUFFER);
		Add_Field ("FROM_MODE", STRING, FIELD_BUFFER);
		Add_Field ("TO_MODE", STRING, FIELD_BUFFER);
		Add_Field ("PERIOD", STRING, FIELD_BUFFER);
		Add_Field ("CLASS", STRING, FIELD_BUFFER);
		Add_Field ("FARE", INTEGER, 6);
		if (Notes_Flag ()) {
			Add_Field ("NOTES", STRING, FIELD_BUFFER);
		}
	}
	return (Set_Field_Numbers ());
}
Example #27
0
bool Skim_File::Create_Fields (void) 
{
	Clear_Fields ();

	Matrix_File::Create_Fields ();

	if (time_flag) {
		Add_Field ("TIME", DB_TIME, 4, Time_Format (), true);
	} else {
		if (mode == WAIT_MODE) {
			Add_Field ("WAIT", DB_TIME, 2, Time_Format (), true);
		} else if (mode == BIKE_MODE || mode == OTHER_MODE) {
			Add_Field ("OTHER", DB_TIME, 2, Time_Format (), true);
		} else {
			Add_Field ("WALK", DB_TIME, 2, Time_Format (), true);

			if (mode != WALK_MODE) {
				if (mode != RIDE_MODE && mode != TRANSIT_MODE && mode != TAXI_MODE) {
					Add_Field ("DRIVE", DB_TIME, 4, Time_Format (), true);
				}
				if (mode != DRIVE_MODE) {
					if (mode != RIDE_MODE && mode != TAXI_MODE) {
						Add_Field ("TRANSIT", DB_TIME, 4, Time_Format (), true);
					}
					Add_Field ("WAIT", DB_TIME, 2, Time_Format (), true);
				}
				Add_Field ("OTHER", DB_TIME, 2, Time_Format (), true);
			}
		}
	}
	if (Length_Format () == MILES || Length_Format () == KILOMETERS) {
		Add_Field ("LENGTH", DB_DOUBLE, 4.2, Length_Format (), true);
	} else {
		Add_Field ("LENGTH", DB_INTEGER, 4, Length_Format (), true);
	}
	if (len_flag) {
		Db_Field *fld = Field ("LENGTH");

		if (fld->Units () != Length_Format ()) {
			fld->Units (Length_Format ());
		}
	}
	Add_Field ("COST", DB_INTEGER, 2, CENTS, true);
	Add_Field ("IMPEDANCE", DB_INTEGER, 4, IMPEDANCE, true);

	return (Set_Field_Numbers ());
}
Example #28
0
bool Tour_File::Create_Fields (void) 
{
	Add_Field ("HHOLD", INTEGER, 10);
	Add_Field ("PERSON", INTEGER, 3);
	Add_Field ("TOUR", INTEGER, 5);
	Add_Field ("PURPOSE", INTEGER, 2);
	Add_Field ("MODE", INTEGER, 2);
	Add_Field ("ORIGIN", INTEGER, 5);
	Add_Field ("DESTINATION", INTEGER, 5);
	Add_Field ("STOP_OUT", INTEGER, 5);
	Add_Field ("STOP_IN", INTEGER, 5);
	Add_Field ("START", INTEGER, 5);
	Add_Field ("RETURN", INTEGER, 5);
	Add_Field ("GROUP", INTEGER, 2);
	return (Set_Field_Numbers ());
}
Example #29
0
bool Skim_File::Create_Fields (void) 
{
	if (Dbase_Format () == VERSION3) {
		Header_Lines (0);
		Add_Field ("ORG", INTEGER, 5);
		Add_Field ("DES", INTEGER, 5);
		Add_Field ("MODE", INTEGER, 2);
		Add_Field ("INTERVAL", INTEGER, 3);
		Add_Field ("TIME", DOUBLE, 16, 6);
		Add_Field ("COUNT", INTEGER, 10);
		Add_Field ("VARIANCE", DOUBLE, 16, 6);
	} else {
		Add_Field ("ORG", INTEGER, 5);
		Add_Field ("DES", INTEGER, 5);
		Add_Field ("PERIOD", INTEGER, 3);

		if (total_flag) {
			Add_Field ("TIME", INTEGER, 6);
			if (length_flag) {
				Add_Field ("LENGTH", INTEGER, 8);
			}
		} else {
			Add_Field ("COUNT", INTEGER, 5);
			Add_Field ("WALK", INTEGER, 5);

			if (transit_flag) {
				Add_Field ("WAIT", INTEGER, 5);
				Add_Field ("TRANSIT", INTEGER, 5);
			}
			if (drive_flag) {
				Add_Field ("DRIVE", INTEGER, 5);
			}
			if (other_flag) {
				Add_Field ("OTHER", INTEGER, 5);
			}
			if (length_flag) {
				Add_Field ("LENGTH", INTEGER, 8);
			}
			if (transit_flag || drive_flag) {
				Add_Field ("COST", INTEGER, 5);
			}
		}
	}
	return (Set_Field_Numbers ());
}
Example #30
0
bool Fare_File::Create_Fields (void) 
{
	if (Code_Flag ()) {
		Add_Field ("FROM_ZONE", DB_UNSIGNED, 2, FARE_ZONE, true);
		Add_Field ("TO_ZONE", DB_UNSIGNED, 2, FARE_ZONE, true);
		Add_Field ("FROM_MODE", DB_UNSIGNED, 1, TRANSIT_CODE, true);
		Add_Field ("TO_MODE", DB_UNSIGNED, 1, TRANSIT_CODE, true);
		Add_Field ("PERIOD", DB_UNSIGNED, 1, TIME_PERIOD, true);
		Add_Field ("CLASS", DB_UNSIGNED, 1, CLASS_CODE, true);
		Add_Field ("FARE", DB_INTEGER, 2, CENTS, true);
	} else {
		Add_Field ("FROM_ZONE", DB_STRING, STRING_FIELD_SIZE, FARE_ZONE_RANGE);
		Add_Field ("TO_ZONE", DB_STRING, STRING_FIELD_SIZE, FARE_ZONE_RANGE);
		Add_Field ("FROM_MODE", DB_STRING, STRING_FIELD_SIZE, TRANSIT_CODE_RANGE);
		Add_Field ("TO_MODE", DB_STRING, STRING_FIELD_SIZE, TRANSIT_CODE_RANGE);
		Add_Field ("PERIOD", DB_STRING, STRING_FIELD_SIZE, TIME_PERIOD_RANGE);
		Add_Field ("CLASS", DB_STRING, STRING_FIELD_SIZE, CLASS_CODE_RANGE);
		Add_Field ("FARE", DB_INTEGER, 2, CENTS, true);
		if (exe->Notes_Name_Flag ()) {
			Add_Field ("NOTES", DB_STRING, STRING_FIELD_SIZE);
		}
	}
	return (Set_Field_Numbers ());
}