Closed JordanD2 closed 7 years ago
I just wanted to input that from our previous work on the SQL, each database file represents 1 file. I'm not sure if it's possible to create multiple files from one database, but it might be easiest to just create multiple databases with each representing it's own file.
First mission:
FlightPlan fp1 = new FlightPlan("mission1.dat");
fp1.addFlightPath(...);
. It will automatically save. Second mission:
FlightPlan fp2 = new FlightPlan("mission2.dat");
fp2.addFlightPath(...);
.In directory:
@logicxd Yes, multiple files each with one database sounds good. So your example is exactly how we would do it if there were two missions being loaded.
One design idea to keep in mind here though is that FlightPath and Mission objects are first and foremost data structures to be used internally by the ground station application. That's why I think it's best for them to have distinct save and load methods (or possibly a constructor for loading). That way we can create and manipulate the data structures independent of the database. For example: I could load a FlightPlan from "mission1.dat", make 20 changes to it in the Mission Planner, then save it back into "mission1.dat". To do this, I will only need to interact with the database once when I load from the file and once when I save the changes.
Update for you guys. I just merged my local branch where I added load constructors and save methods for FlightPlan and Mission objects. There are a bunch of todo labels that should make it much easier for you guys to interface with the existing code. Let me know if there are any questions.
@JordanDickson I made a mock-up of the diagram. Each line is a column. Annnd I might be not be getting database files that you want. Let me know. The diagram is not tested. Changes can be made. @Farbod909 @fa01
Yes, those tables look exactly like what I had in mind. I think the second option where the two files are merged will be better.
Closed by #154
The FlightPath and Mission classes need the ability to interact with database files by loading and saving.
Load: should take a file name and return a pointer to an object (possibly implement as a constructor or a static method)
FlightPlan fp = new FlightPlan("dataFile.dat");
ORFlightPlan fp = FlightPlan::load("dataFile.dat");
Save: should take a file name and output the content of the flight plan to a file with that name.
fp.save("dataFile.dat");