Output.cpp 1001 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "Output.h"
  2. namespace mdd {
  3. Output::Output( const std::string& type, int appendix, const json& initial) :
  4. _changed(false)
  5. {
  6. _appendix = appendix;
  7. _prefix = "";
  8. _type = type;
  9. _value = initial;
  10. }
  11. const json& Output::getValue() { return _value; }
  12. json& Output::getValueInternal() {
  13. _changed = true;
  14. return _value;
  15. }
  16. std::string Output::getType() { return _type; }
  17. bool Output::hasChanged() { return _changed; }
  18. void Output::resetChange() { _changed = false; }
  19. std::string Output::setType(std::string type){
  20. _type = type;
  21. return getID();
  22. }
  23. std::string Output::getID(){
  24. return _prefix + "/" + _type + std::to_string(_appendix);
  25. }
  26. std::string Output::setPrefix(std::string prefix){
  27. _prefix = prefix;
  28. return getID();
  29. }
  30. std::string Output::setAppendix(int appendix){
  31. _appendix = appendix;
  32. return getID();
  33. }
  34. }