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