blengerich / GenAMap

Visual Machine Learning of Genome-Phenome Associations
http://genamap.org
MIT License
22 stars 7 forks source link

change all raw pointers to smart pointers #183

Closed weifang1 closed 7 years ago

weifang1 commented 7 years ago

This commit tries to change Algorithm and Model in Job_t to shared_ptr\<Algorithm> and shared_ptr\<Model>. https://github.com/blengerich/GenAMap/blob/shared_ptr/src/Scheduler/Job.hpp#L30

To apply this modification, all run(Model*) interfaces in the Model folder are changed to run(shared_ptr\<Model>).

One more thing, in BrentSearch.hpp and GridSearch.hpp, the function run(shared_ptr) doesn't exist. So when call run(shared_ptr\<SparseLMM>) in Scheduler.cpp: https://github.com/blengerich/GenAMap/blob/shared_ptr/src/Scheduler/Scheduler.cpp#L316 It is ambiguous for the compiler to indicate which function should be called, run(shared_ptr\<LinearMixtureModel>) or run(shared_ptr\<Model>). In this case, to avoid the ambiguty, I change all run() that take derived classes as the parameter to sub_run(). https://github.com/blengerich/GenAMap/blob/shared_ptr/src/Algorithms/BrentSearch.hpp#L73

blengerich commented 7 years ago

are SchedulerTests supposed to be deleted?

weifang1 commented 7 years ago

No. The Scheduler_Test.cpp that I'm going to delete locates in the Graph folder. That is created by mistake. The original one is still in the Scheduler folder.

https://github.com/blengerich/GenAMap/tree/shared_ptr/src/Scheduler

blengerich commented 7 years ago

Ok, LGTM.