IOManipulate.tlh 870 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /***************************************************************************
  2. * E-Com Technology Ltd.
  3. *
  4. * ECOMPACS DICOM Network Transport Libraries * Version 0.1 Beta
  5. ***************************************************************************/
  6. #pragma once
  7. #ifndef __IOManipulate__
  8. #define __IOManipulate__
  9. template <class stype, class vtype>
  10. class fcn_obj
  11. {
  12. public:
  13. fcn_obj (stype & (*f) (stype &, vtype), vtype v):
  14. func (f), val (v)
  15. {
  16. }
  17. stype & operator () (stype & s) const
  18. {
  19. return (*func) (s, val);
  20. }
  21. private:
  22. stype & (*func) (stype &, vtype);
  23. vtype val;
  24. };
  25. template <class stype, class vtype>
  26. stype & operator << (stype & ofile, const fcn_obj <stype, vtype> (im))
  27. {
  28. return im (ofile);
  29. }
  30. template <class stype, class vtype>
  31. stype & operator >> (stype & ifile, const fcn_obj <stype, vtype> (im))
  32. {
  33. return im (ifile);
  34. }
  35. #endif