vectorio.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * NICE-Core - efficient algebra and computer vision methods
  3. * - libfbasics - library of some basic tools
  4. * See file License for license information.
  5. */
  6. #ifndef _VECTORIO_H_
  7. #define _VECTORIO_H_
  8. #include <iostream>
  9. #include <vector>
  10. namespace NICE {
  11. /**
  12. * Output function.
  13. */
  14. template<class T>
  15. std::ostream& operator << ( std::ostream& output, const std::vector<T>& v );
  16. /**
  17. * Output function.
  18. */
  19. template<class T>
  20. void writeVectorHumanReadable ( std::ostream& output, const std::vector<T>& v );
  21. /**
  22. * Output function.
  23. */
  24. template<class T>
  25. void writeVectorOfPointers ( std::ostream& output, const std::vector<T*>& v );
  26. /**
  27. * Output function.
  28. */
  29. template<class T>
  30. void writeVectorOfPointersHumanReadable ( std::ostream& output,
  31. const std::vector<T*>& v );
  32. /**
  33. * Input function.
  34. * Format has to be as produced by
  35. * \c operator << (std::ostream& output, const std::vector<T>& v),
  36. * \c writeVectorHumanReadable(), \c writeVectorOfPointers()
  37. * or \c writeVectorOfPointersHumanReadable().
  38. * Note that no data element must begin with '>'.
  39. */
  40. template<class T>
  41. std::istream& operator >> ( std::istream& input, std::vector<T>& v );
  42. /**
  43. * Input function. A new heap object will be created for each vector element
  44. * (Ownership given away.)
  45. * Format has to be as produced by
  46. * \c operator << (std::ostream& output, const std::vector<T>& v),
  47. * \c writeVectorHumanReadable(), \c writeVectorOfPointers()
  48. * or \c writeVectorOfPointersHumanReadable().
  49. */
  50. template<class T>
  51. void readVectorOfPointers ( std::istream& input, std::vector<T*>& v );
  52. } // namespace
  53. //#ifdef __GNUC__
  54. #include "core/basics/vectorio.tcc"
  55. //#endif
  56. #endif //_VECTORIO_H_