- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/RandomNumbersAction/SetRandomNumbersDistributionAction.cpp
ra483e4 rbe21fa 47 47 48 48 // set the new default 49 RandomNumberDistributionFactory::getInstance().setCurrentType(params.distribution_type .get());49 RandomNumberDistributionFactory::getInstance().setCurrentType(params.distribution_type); 50 50 LOG(0, "STATUS: Distribution of random number generator is now: " 51 51 << RandomNumberDistributionFactory::getInstance().getCurrentTypeName()); … … 55 55 RandomNumberDistributionFactory::getInstance().getPrototype().getParameterSet(); 56 56 // set each parameter (that is not -1); 57 { 58 std::stringstream input(params.parameters.get()); 57 if (!params.parameters.isDefault()) { 59 58 RandomNumberDistribution_Parameters *currentparameters = 60 59 RandomNumberDistributionFactory::getInstance().getPrototype().getParameterSet(); 61 input >> *currentparameters; // add new values on top 62 if (!currentparameters->isDefault()) { 63 LOG(1, "Changing prototype's parameters."); 64 RandomNumberDistributionFactory::getInstance().manipulatePrototype(*currentparameters); 65 } 60 currentparameters->update(params.parameters); 61 LOG(1, "INFO: Changing prototype's parameters to " << params.parameters << "."); 62 RandomNumberDistributionFactory::getInstance().manipulatePrototype(*currentparameters); 66 63 delete currentparameters; 67 64 } … … 74 71 } 75 72 76 std::stringstream output;77 output << *oldparameters;78 73 CommandSetRandomNumbersDistributionState *newstate = 79 new CommandSetRandomNumbersDistributionState(oldtype, output.str(),params);74 new CommandSetRandomNumbersDistributionState(oldtype,*oldparameters,params); 80 75 delete oldparameters; 81 76 return Action::state_ptr(newstate); … … 99 94 100 95 // set each parameter back (that is not -1); 101 { 102 std::stringstream input(state->old_parameters); 103 RandomNumberDistribution_Parameters *currentparameters = 104 RandomNumberDistributionFactory::getInstance().getPrototype().getParameterSet(); 105 input >> *currentparameters; 106 if (!currentparameters->isDefault()) { 107 LOG(1, "Changing prototype's parameters."); 108 RandomNumberDistributionFactory::getInstance().manipulatePrototype(*currentparameters); 109 } 110 delete currentparameters; 96 if (!state->old_parameters.isDefault()) { 97 LOG(1, "INFO: Changing back prototype's parameters to " << state->old_parameters << "."); 98 RandomNumberDistributionFactory::getInstance().manipulatePrototype(state->old_parameters); 111 99 } 112 100 … … 118 106 } 119 107 120 std::stringstream output;121 output << *newparameters;122 108 CommandSetRandomNumbersDistributionState *newstate = 123 new CommandSetRandomNumbersDistributionState(newtype, output.str(),params);109 new CommandSetRandomNumbersDistributionState(newtype,*newparameters,params); 124 110 delete newparameters; 125 111 return Action::state_ptr(newstate);
Note:
See TracChangeset
for help on using the changeset viewer.