Fixed link and load errors in example, added exception (rather than segfault) if file not found.
							parent
							
								
									f7349704f8
								
							
						
					
					
						commit
						33cdd30173
					
				|  | @ -24,8 +24,8 @@ gtsam_add_subdir_tests(discrete_unstable "${discrete_local_libs}" "${discrete_fu | ||||||
| # add examples | # add examples | ||||||
| foreach(example schedulingExample schedulingQuals12) | foreach(example schedulingExample schedulingQuals12) | ||||||
| 	add_executable(${example} "examples/${example}.cpp") | 	add_executable(${example} "examples/${example}.cpp") | ||||||
| 	add_dependencies(${example} gtsam-static) | 	add_dependencies(${example} gtsam-static gtsam_unstable-static) | ||||||
| 	target_link_libraries(${example} gtsam-static) | 	target_link_libraries(${example} gtsam-static gtsam_unstable-static) | ||||||
| 	add_custom_target(${example}.run ${EXECUTABLE_OUTPUT_PATH}${example} ${ARGN}) | 	add_custom_target(${example}.run ${EXECUTABLE_OUTPUT_PATH}${example} ${ARGN}) | ||||||
| endforeach(example) | endforeach(example) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -29,6 +29,10 @@ namespace gtsam { | ||||||
| 
 | 
 | ||||||
| 		// open file
 | 		// open file
 | ||||||
| 		ifstream is(filename.c_str()); | 		ifstream is(filename.c_str()); | ||||||
|  | 		if (!is) { | ||||||
|  | 			cerr << "Scheduler: could not open file " << filename << endl; | ||||||
|  | 			throw runtime_error("Scheduler: could not open file " + filename); | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		string line; // buffer
 | 		string line; // buffer
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -53,7 +53,7 @@ void addStudent(Scheduler& s, size_t i) { | ||||||
| } | } | ||||||
| /* ************************************************************************* */ | /* ************************************************************************* */ | ||||||
| Scheduler largeExample(size_t nrStudents = 7) { | Scheduler largeExample(size_t nrStudents = 7) { | ||||||
| 	string path("/Users/dellaert/borg/gtsam/gtsam/discrete/examples/"); | 	string path("../../../gtsam_unstable/discrete/examples/"); | ||||||
| 	Scheduler s(nrStudents, path + "Doodle.csv"); | 	Scheduler s(nrStudents, path + "Doodle.csv"); | ||||||
| 
 | 
 | ||||||
| 	s.addArea("Harvey Lipkin", "Mechanics"); | 	s.addArea("Harvey Lipkin", "Mechanics"); | ||||||
|  |  | ||||||
|  | @ -65,7 +65,7 @@ void addStudent(Scheduler& s, size_t i) { | ||||||
| 
 | 
 | ||||||
| /* ************************************************************************* */ | /* ************************************************************************* */ | ||||||
| Scheduler largeExample(size_t nrStudents = NRSTUDENTS) { | Scheduler largeExample(size_t nrStudents = NRSTUDENTS) { | ||||||
| 	string path("/Users/dellaert/borg/gtsam/gtsam/discrete/examples/"); | 	string path("../../../gtsam_unstable/discrete/examples/"); | ||||||
| 	Scheduler s(nrStudents, path + "Doodle2012.csv"); | 	Scheduler s(nrStudents, path + "Doodle2012.csv"); | ||||||
| 
 | 
 | ||||||
| 	s.addArea("Harvey Lipkin", "Mechanics"); | 	s.addArea("Harvey Lipkin", "Mechanics"); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue