Commit e4260bb6 authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Updating the interface of Softs to handle shared pointers on data.

parent 937d3f49
...@@ -58,7 +58,7 @@ int main(int argc, char** argv) ...@@ -58,7 +58,7 @@ int main(int argc, char** argv)
} }
// Get the associated data object and load the file is any // Get the associated data object and load the file is any
data* d = NULL ; ptr<data> d = NULL ;
d = plugins_manager::get_data(args["data"]) ; d = plugins_manager::get_data(args["data"]) ;
if(args.is_defined("data-file")) if(args.is_defined("data-file"))
{ {
...@@ -67,14 +67,14 @@ int main(int argc, char** argv) ...@@ -67,14 +67,14 @@ int main(int argc, char** argv)
// Get the output object. In the case where it is not a VS file, we use // Get the output object. In the case where it is not a VS file, we use
// the load object. // the load object.
data* d_out = NULL; ptr<data> d_out = NULL;
if(dynamic_cast<vertical_segment*>(d) == NULL) if(!dynamic_pointer_cast<vertical_segment>(d))
{ {
d_out = d; d_out = d;
} }
else else
{ {
d_out = new vertical_segment(); d_out = ptr<data>(new vertical_segment());
d_out->setDimX(d->dimX()); d_out->setDimX(d->dimX());
d_out->setDimY(d->dimY()); d_out->setDimY(d->dimY());
d_out->setParametrization(d->input_parametrization()); d_out->setParametrization(d->input_parametrization());
...@@ -89,7 +89,7 @@ int main(int argc, char** argv) ...@@ -89,7 +89,7 @@ int main(int argc, char** argv)
return 1; return 1;
} }
if(d != NULL && f != NULL) if(d && f != NULL)
{ {
vec temp(f->dimX()); vec temp(f->dimX());
for(int i=0; i<d->size(); ++i) for(int i=0; i<d->size(); ++i)
......
...@@ -67,11 +67,11 @@ int main(int argc, char** argv) ...@@ -67,11 +67,11 @@ int main(int argc, char** argv)
// Load a data file // Load a data file
data* d = NULL ; ptr<data> d = NULL ;
if(args.is_defined("data") || args.is_defined("in-data")) if(args.is_defined("data") || args.is_defined("in-data"))
{ {
d = plugins_manager::get_data(args["data"]); d = plugins_manager::get_data(args["data"]);
if(dynamic_cast<vertical_segment*>(d) != NULL) if(dynamic_pointer_cast<vertical_segment>(d))
{ {
d->load(args["in-data"]); d->load(args["in-data"]);
} }
...@@ -97,7 +97,7 @@ int main(int argc, char** argv) ...@@ -97,7 +97,7 @@ int main(int argc, char** argv)
linear_plot = true; linear_plot = true;
} }
if(d != NULL) if(d)
{ {
for(int i=0; i<d->size(); ++i) for(int i=0; i<d->size(); ++i)
{ {
......
...@@ -99,20 +99,20 @@ int main(int argc, char** argv) ...@@ -99,20 +99,20 @@ int main(int argc, char** argv)
// Import data // Import data
data* d_in = NULL ; ptr<data> d_in = NULL ;
d_in = plugins_manager::get_data(args["in-data"]) ; d_in = plugins_manager::get_data(args["in-data"]) ;
d_in->load(args["input"], args); d_in->load(args["input"], args);
data* d_out = NULL; ptr<data> d_out = NULL;
d_out = plugins_manager::get_data(args["out-data"]) ; d_out = plugins_manager::get_data(args["out-data"]) ;
if(d_in == NULL && d_out == NULL) if(!d_in && !d_out)
{ {
std::cerr << "<<ERROR>> cannot import or export data" << std::endl ; std::cerr << "<<ERROR>> cannot import or export data" << std::endl ;
return 1; return 1;
} }
if(dynamic_cast<vertical_segment*>(d_out) != NULL) if(dynamic_pointer_cast<vertical_segment>(d_out))
{ {
params::input param = params::parse_input(args["param"]); params::input param = params::parse_input(args["param"]);
if(param == params::UNKNOWN_INPUT && d_in->input_parametrization() != params::UNKNOWN_INPUT) if(param == params::UNKNOWN_INPUT && d_in->input_parametrization() != params::UNKNOWN_INPUT)
......
...@@ -43,7 +43,7 @@ int main(int argc, char** argv) ...@@ -43,7 +43,7 @@ int main(int argc, char** argv)
} }
// Import data // Import data
data* d = NULL ; ptr<data> d = NULL ;
d = plugins_manager::get_data(args["data"]) ; d = plugins_manager::get_data(args["data"]) ;
d->load(args["input"]); d->load(args["input"]);
...@@ -62,7 +62,7 @@ int main(int argc, char** argv) ...@@ -62,7 +62,7 @@ int main(int argc, char** argv)
} }
// Get the output data object // Get the output data object
data* out_d = plugins_manager::get_data(args["data"]); ptr<data> out_d = plugins_manager::get_data(args["data"]);
if(d != NULL) if(d != NULL)
{ {
......
...@@ -33,7 +33,7 @@ int main(int argc, char** argv) ...@@ -33,7 +33,7 @@ int main(int argc, char** argv)
return 1 ; return 1 ;
} }
data* d = plugins_manager::get_data(args["data"]) ; ptr<data> d = plugins_manager::get_data(args["data"]) ;
d->load(args["input"], args); d->load(args["input"], args);
// Create output file // Create output file
......
...@@ -68,10 +68,10 @@ int main(int argc, char** argv) ...@@ -68,10 +68,10 @@ int main(int argc, char** argv)
} }
// Import data // Import data
data* d = NULL ; ptr<data> d = NULL ;
d = plugins_manager::get_data(args["data"]) ; d = plugins_manager::get_data(args["data"]) ;
if(dynamic_cast<const vertical_segment*>(d) != NULL) { if(dynamic_pointer_cast<vertical_segment>(d)) {
std::cerr << "<<ERROR>> this data object is not interpolant." << std::endl; std::cerr << "<<ERROR>> this data object is not interpolant." << std::endl;
return 1; return 1;
} }
...@@ -80,7 +80,7 @@ int main(int argc, char** argv) ...@@ -80,7 +80,7 @@ int main(int argc, char** argv)
// Create output file // Create output file
std::ofstream file(args["output"].c_str(), std::ios_base::trunc); std::ofstream file(args["output"].c_str(), std::ios_base::trunc);
if(d != NULL) if(d)
{ {
// Data parametrization // Data parametrization
params::input data_param = d->parametrization(); params::input data_param = d->parametrization();
......
...@@ -39,7 +39,7 @@ int main(int argc, char** argv) ...@@ -39,7 +39,7 @@ int main(int argc, char** argv)
return 1 ; return 1 ;
} }
data* d = NULL ; ptr<data> d = NULL ;
d = manager.get_data(args["loader"]) ; d = manager.get_data(args["loader"]) ;
d->load(args["input"]); d->load(args["input"]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment