Advertisement
Guest User

Untitled

a guest
Jun 14th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. //current way to setup the options
  2.  
  3. std::map<std::string, size_t> options; //public data member
  4.  
  5. options["num_images"] = 2;
  6. options["row_size"] = 321;
  7. options["col_size"] = 481;
  8. options["rgbd"] = 0;
  9. options["shrink"] = 2;
  10.  
  11. //if we change it to member function, we could
  12. //1 : set std::map<std::string, size_t> options as private data member or store each option as a data member, your choice.
  13. //I do not think these options will be the performance bottleneck.I prefer map in this case, because we can reduce the codes
  14. //the codes we need to change yet make the api easier to use
  15. //2 : let user read, set the options by member function
  16.  
  17. void NumImages(size_t value){ options["num_images"] = value; };
  18. void RowSize(size_t value){ options["row_size"] = value; };
  19. void ColSize(size_t value){ options["col_size"] = value; };
  20.  
  21. //or
  22. void NumImages(size_t value){ numImages = value; };
  23. void RowSize(size_t value){ rowSize = value; };
  24. void ColSize(size_t value){ colSize = value; };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement