iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PixRGBDImpl.H
Go to the documentation of this file.
1 /*! @file
2  @author Shane Grant
3  @copyright GNU Public License (GPL v3)
4  @section License
5  @verbatim
6  // ////////////////////////////////////////////////////////////////////////
7  // The iLab Neuromorphic Robotics Toolkit (NRT) //
8  ma/ 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 
36 //// ######################################################################
37 template <class T_rgb, class T_d>
38 PixRGBD<T_rgb, T_d>::PixRGBD() :
39  PixRGB<T_rgb>(),
40  PixelWithDepth<T_d>()
41 { }
42 
43 // ######################################################################
44 template <class T_rgb, class T_d>
45 template <typename T1>
47  PixRGB<T_rgb>(value),
48  PixelWithDepth<T_d>(0)
49 { }
50 
51 // ######################################################################
52 template <class T_rgb, class T_d>
53 PixRGBD<T_rgb, T_d>::PixRGBD(PixRGB<T_rgb> const & rgb, T_d depth) :
54  PixRGB<T_rgb>(rgb),
55  PixelWithDepth<T_d>(depth)
56 { }
57 
58 // ######################################################################
59 template <class T_rgb, class T_d>
60 PixRGBD<T_rgb, T_d>::PixRGBD(T_rgb r, T_rgb g, T_rgb b, T_d d) :
61  PixRGB<T_rgb>(r,g,b),
62  PixelWithDepth<T_d>(d)
63 { }
64 
65 // ######################################################################
66 template <class T_rgb, class T_d>
67 template<class T_rgb2, class T_d2>
68 PixRGBD<T_rgb, T_d>::PixRGBD(PixRGBD<T_rgb2, T_d2> const& other) :
69  PixRGB<T_rgb>(other),
70  PixelWithDepth<T_d>(other.depth)
71 { }
72 
73 // ######################################################################
74 template <class T_rgb, class T_d>
75 template <class rType, class gType, class bType, class dType>
76 PixRGBD<T_rgb, T_d>::PixRGBD(rType r, gType g, bType b, dType d) :
77  PixRGB<T_rgb>(r, g, b),
78  PixelWithDepth<T_d>(d)
79 { }
80 
81 // ######################################################################
82 template <class T_rgb, class T_d>
84 {
85  return *static_cast<PixRGB<T_rgb>*>(this);
86  //return static_cast<PixRGB<T_rgb>>(*this);
87 }
88 
89 // ######################################################################
90 template <class T_rgb, class T_d>
92 {
93  return *static_cast<PixRGB<T_rgb> const *>(this);
94  //return static_cast<PixRGB<T_rgb>>(*this);
95  //return static_cast<PixRGB<T_rgb>>(*this);
96 }
97 
98 // ######################################################################
99 template <class T_rgb, class T_d>
101 {
102  return PixRGB<T_rgb>(this->channels[0], this->channels[1], this->channels[2]);
103 }
104 
105 // ######################################################################
106 template <class T_rgb, class T_d>
108 {
109  return PixRGBD<T_rgb, T_d>(rgb.channels[0], rgb.channels[1], rgb.channels[2], 0);
110 }
111 
112 // ######################################################################
113 template<class T_rgb, class T_d>
114 inline std::ostream& operator<< (std::ostream &out, PixRGBD<T_rgb, T_d> pix)
115 {
116  out << "PixRGBD(" << pix.r() << "," << pix.g() << "," << pix.b() << "," << pix.d() << ")";
117  return out;
118 }