Developer Documentation
BaseKernel.cc
1 /* ========================================================================= *
2  * *
3  * OpenMesh *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openmesh.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenMesh. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40  * ========================================================================= */
41 
42 
43 
44 #include <OpenMesh/Core/Mesh/BaseKernel.hh>
45 #include <iostream>
46 
47 namespace OpenMesh
48 {
49 
50 void BaseKernel::property_stats() const
51 {
52  property_stats(std::clog);
53 }
54 void BaseKernel::property_stats(std::ostream& _ostr) const
55 {
56  const PropertyContainer::Properties& vps = vprops_.properties();
57  const PropertyContainer::Properties& hps = hprops_.properties();
58  const PropertyContainer::Properties& eps = eprops_.properties();
59  const PropertyContainer::Properties& fps = fprops_.properties();
60  const PropertyContainer::Properties& mps = mprops_.properties();
61 
62  PropertyContainer::Properties::const_iterator it;
63 
64  _ostr << vprops_.size() << " vprops:\n";
65  for (it=vps.begin(); it!=vps.end(); ++it)
66  {
67  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
68  }
69  _ostr << hprops_.size() << " hprops:\n";
70  for (it=hps.begin(); it!=hps.end(); ++it)
71  {
72  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
73  }
74  _ostr << eprops_.size() << " eprops:\n";
75  for (it=eps.begin(); it!=eps.end(); ++it)
76  {
77  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
78  }
79  _ostr << fprops_.size() << " fprops:\n";
80  for (it=fps.begin(); it!=fps.end(); ++it)
81  {
82  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
83  }
84  _ostr << mprops_.size() << " mprops:\n";
85  for (it=mps.begin(); it!=mps.end(); ++it)
86  {
87  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
88  }
89 }
90 
91 
92 
93 void BaseKernel::vprop_stats( std::string& _string ) const
94 {
95  _string.clear();
96 
97  PropertyContainer::Properties::const_iterator it;
98  const PropertyContainer::Properties& vps = vprops_.properties();
99  for (it=vps.begin(); it!=vps.end(); ++it)
100  if ( *it == nullptr )
101  _string += "[deleted] \n";
102  else {
103  _string += (*it)->name();
104  _string += "\n";
105  }
106 
107 }
108 
109 void BaseKernel::hprop_stats( std::string& _string ) const
110 {
111  _string.clear();
112 
113  PropertyContainer::Properties::const_iterator it;
114  const PropertyContainer::Properties& hps = hprops_.properties();
115  for (it=hps.begin(); it!=hps.end(); ++it)
116  if ( *it == nullptr )
117  _string += "[deleted] \n";
118  else {
119  _string += (*it)->name();
120  _string += "\n";
121  }
122 
123 }
124 
125 void BaseKernel::eprop_stats( std::string& _string ) const
126 {
127  _string.clear();
128 
129  PropertyContainer::Properties::const_iterator it;
130  const PropertyContainer::Properties& eps = eprops_.properties();
131  for (it=eps.begin(); it!=eps.end(); ++it)
132  if ( *it == nullptr )
133  _string += "[deleted] \n";
134  else {
135  _string += (*it)->name();
136  _string += "\n";
137  }
138 
139 }
140 void BaseKernel::fprop_stats( std::string& _string ) const
141 {
142  _string.clear();
143 
144  PropertyContainer::Properties::const_iterator it;
145  const PropertyContainer::Properties& fps = fprops_.properties();
146  for (it=fps.begin(); it!=fps.end(); ++it)
147  if ( *it == nullptr )
148  _string += "[deleted] \n";
149  else {
150  _string += (*it)->name();
151  _string += "\n";
152  }
153 
154 }
155 
156 void BaseKernel::mprop_stats( std::string& _string ) const
157 {
158  _string.clear();
159 
160  PropertyContainer::Properties::const_iterator it;
161  const PropertyContainer::Properties& mps = mprops_.properties();
162  for (it=mps.begin(); it!=mps.end(); ++it)
163  if ( *it == nullptr )
164  _string += "[deleted] \n";
165  else {
166  _string += (*it)->name();
167  _string += "\n";
168  }
169 
170 }
171 
172 void BaseKernel::vprop_stats() const
173 {
174  vprop_stats(std::clog);
175 }
176 void BaseKernel::vprop_stats(std::ostream& _ostr ) const
177 {
178  PropertyContainer::Properties::const_iterator it;
179  const PropertyContainer::Properties& vps = vprops_.properties();
180  for (it=vps.begin(); it!=vps.end(); ++it)
181  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
182 
183 }
184 void BaseKernel::hprop_stats() const
185 {
186  hprop_stats(std::clog);
187 }
188 void BaseKernel::hprop_stats(std::ostream& _ostr ) const
189 {
190  PropertyContainer::Properties::const_iterator it;
191  const PropertyContainer::Properties& hps = hprops_.properties();
192  for (it=hps.begin(); it!=hps.end(); ++it)
193  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
194 
195 }
196 void BaseKernel::eprop_stats() const
197 {
198  eprop_stats(std::clog);
199 }
200 void BaseKernel::eprop_stats(std::ostream& _ostr ) const
201 {
202  PropertyContainer::Properties::const_iterator it;
203  const PropertyContainer::Properties& eps = eprops_.properties();
204  for (it=eps.begin(); it!=eps.end(); ++it)
205  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
206 
207 }
208 void BaseKernel::fprop_stats() const
209 {
210  fprop_stats(std::clog);
211 }
212 void BaseKernel::fprop_stats(std::ostream& _ostr ) const
213 {
214  PropertyContainer::Properties::const_iterator it;
215  const PropertyContainer::Properties& fps = fprops_.properties();
216  for (it=fps.begin(); it!=fps.end(); ++it)
217  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
218 
219 }
220 void BaseKernel::mprop_stats() const
221 {
222  mprop_stats(std::clog);
223 }
224 void BaseKernel::mprop_stats(std::ostream& _ostr ) const
225 {
226  PropertyContainer::Properties::const_iterator it;
227  const PropertyContainer::Properties& mps = mprops_.properties();
228  for (it=mps.begin(); it!=mps.end(); ++it)
229  *it == nullptr ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
230 
231 }
232 
233 
234 }