iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VectorUtils.H
Go to the documentation of this file.
1 /*! @file
2  @author Dan Parks
3  @copyright GNU Public License (GPL v3)
4  @section License
5  @verbatim
6  // ////////////////////////////////////////////////////////////////////////
7  // The iLab Neuromorphic Robotics Toolkit (NRT) //
8  // Copyright 2010-2012 by the University of Southern California (USC) //
9  // and the iLab at USC. //
10  // //
11  // iLab - University of Southern California //
12  // Hedco Neurociences Building, Room HNB-10 //
13  // Los Angeles, Ca 90089-2520 - USA //
14  // //
15  // See http://ilab.usc.edu for information about this project. //
16  // ////////////////////////////////////////////////////////////////////////
17  // This file is part of The iLab Neuromorphic Robotics Toolkit. //
18  // //
19  // The iLab Neuromorphic Robotics Toolkit is free software: you can //
20  // redistribute it and/or modify it under the terms of the GNU General //
21  // Public License as published by the Free Software Foundation, either //
22  // version 3 of the License, or (at your option) any later version. //
23  // //
24  // The iLab Neuromorphic Robotics Toolkit is distributed in the hope //
25  // that it will be useful, but WITHOUT ANY WARRANTY; without even the //
26  // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
27  // PURPOSE. See the GNU General Public License for more details. //
28  // //
29  // You should have received a copy of the GNU General Public License //
30  // along with The iLab Neuromorphic Robotics Toolkit. If not, see //
31  // <http://www.gnu.org/licenses/>. //
32  // ////////////////////////////////////////////////////////////////////////
33  @endverbatim */
34 
35 #ifndef INCLUDE_NRT_CORE_UTIL_VECTORUTILS_H
36 #define INCLUDE_NRT_CORE_UTIL_VECTORUTILS_H
37 
38 #include <vector>
39 #include <map>
40 #include <istream>
41 #include <ostream>
42 
43 namespace std
44 {
45  /*! \defgroup vecutil Vector-related utility functions
46  \ingroup util */
47 
48  /*! @{ */ // **********************************************************************
49 
50  //! NRT Implementation of std::vector<T> operator<<
51  /*! Format is [element1,element2,...] where the [] are optional but must be used if vectors or containers are nested.
52  Other container classes such as Dims, Points, Rectangle, etc must use one of the following [],{},(),<> groupings
53  in order to work properly */
54  template <class Ch, class Tr, class T>
55  std::basic_ostream<Ch,Tr> & operator<<(std::basic_ostream<Ch,Tr> & out, std::vector<T> const & v);
56 
57  //! NRT Implementation of std::vector<T> operator>>
58  /*! Format is [element1,element2,...] where the [] are optional but must be used if vectors or containers are nested.
59  Other container classes such as Dims, Points, Rectangle, etc must use one of the following [],{},(),<> groupings
60  in order to work properly */
61  template <class Ch, class Tr, class T>
62  std::basic_istream<Ch,Tr> & operator>>(std::basic_istream<Ch,Tr>& in, std::vector<T> & result);
63 
64  //! NRT Implementation of std::map<T1,T2> operator<<
65  /*! Format is [key1:value1,key2:value2,...] where the [] are optional but must be used if vectors or containers are
66  nested. Other container classes such as Dims, Points, Rectangle, etc must use one of the following [],{},(),<>
67  groupings in order to work properly */
68  template <class Ch, class Tr, class T1, class T2>
69  std::basic_ostream<Ch,Tr> & operator<<(std::basic_ostream<Ch,Tr> & out, std::map<T1, T2> const & v);
70 
71  //! NRT Implementation of std::map<T1,T2> operator>>
72  /*! Format is [key1:value1,key2:value2,...] where the [] are optional but must be used if vectors or containers are
73  nested. Other container classes such as Dims, Points, Rectangle, etc must use one of the following [],{},(),<>
74  groupings in order to work properly */
75  template <class Ch, class Tr, class T1, class T2>
76  std::basic_istream<Ch,Tr> & operator>>(std::basic_istream<Ch,Tr>& in, std::map<T1, T2> & result);
77 
78  /*! @} */ // **********************************************************************
79 }
80 
82 
83 #endif // INCLUDE_NRT_CORE_UTIL_VECTORUTILS_H