Boolean IsOSSMTimeFile(char *path, short *selectedUnitsOut)
{
	vector<string> linesInFile;

	if (ReadLinesInFile(path, linesInFile))
		return IsOSSMTimeFile(linesInFile, selectedUnitsOut);
	else
		return false;
}
Example #2
0
TOSSMTimeValue* CreateTOSSMTimeValue(TMover *theOwner,char* path, char* shortFileName, short unitsIfKnownInAdvance)
{
	char tempStr[256];
	OSErr err = 0;
	
	if(IsShioFile(path))
	{
		TShioTimeValue *timeValObj = new TShioTimeValue(theOwner);
		if (!timeValObj)
		{ TechError("LoadTOSSMTimeValue()", "new TShioTimeValue()", 0); return nil; }
		
		err = timeValObj->InitTimeFunc();
		if(err) {delete timeValObj; timeValObj = nil; return nil;}  
		err = timeValObj->ReadTimeValues (path, M19REALREAL, unitsIfKnownInAdvance);
		if(err) { delete timeValObj; timeValObj = nil; return nil;}
		return timeValObj;
	}
	else if (IsTimeFile(path) || IsHydrologyFile(path) || IsOSSMTimeFile(path, &unitsIfKnownInAdvance))
	{
		TOSSMTimeValue *timeValObj = new TOSSMTimeValue(theOwner);
		
		if (!timeValObj)
		{ TechError("LoadTOSSMTimeValue()", "new TOSSMTimeValue()", 0); return nil; }
		
		err = timeValObj->InitTimeFunc();
		if(err) {delete timeValObj; timeValObj = nil; return nil;}  
		
		err = timeValObj->ReadTimeValues (path, M19REALREAL, unitsIfKnownInAdvance);
		if(err) { delete timeValObj; timeValObj = nil; return nil;}
		return timeValObj;
	}	
	// code goes here, add code for OSSMHeightFiles, need scale factor to calculate derivative
	else
	{
		sprintf(tempStr,"File %s is not a recognizable time file.",shortFileName);
		printError(tempStr);
	}
		
	return nil;
}