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  * $Revision$ *
45  * $Date$ *
46  * *
47 \*===========================================================================*/
48 
49 #include <OpenMesh/Core/Mesh/BaseKernel.hh>
50 #include <iostream>
51 
52 namespace OpenMesh
53 {
54 
55 void BaseKernel::property_stats() const
56 {
57  property_stats(std::clog);
58 }
59 void BaseKernel::property_stats(std::ostream& _ostr) const
60 {
61  const PropertyContainer::Properties& vps = vprops_.properties();
62  const PropertyContainer::Properties& hps = hprops_.properties();
63  const PropertyContainer::Properties& eps = eprops_.properties();
64  const PropertyContainer::Properties& fps = fprops_.properties();
65  const PropertyContainer::Properties& mps = mprops_.properties();
66 
67  PropertyContainer::Properties::const_iterator it;
68 
69  _ostr << vprops_.size() << " vprops:\n";
70  for (it=vps.begin(); it!=vps.end(); ++it)
71  {
72  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
73  }
74  _ostr << hprops_.size() << " hprops:\n";
75  for (it=hps.begin(); it!=hps.end(); ++it)
76  {
77  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
78  }
79  _ostr << eprops_.size() << " eprops:\n";
80  for (it=eps.begin(); it!=eps.end(); ++it)
81  {
82  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
83  }
84  _ostr << fprops_.size() << " fprops:\n";
85  for (it=fps.begin(); it!=fps.end(); ++it)
86  {
87  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
88  }
89  _ostr << mprops_.size() << " mprops:\n";
90  for (it=mps.begin(); it!=mps.end(); ++it)
91  {
92  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
93  }
94 }
95 
96 
97 
98 void BaseKernel::vprop_stats( std::string& _string ) const
99 {
100  _string.clear();
101 
102  PropertyContainer::Properties::const_iterator it;
103  const PropertyContainer::Properties& vps = vprops_.properties();
104  for (it=vps.begin(); it!=vps.end(); ++it)
105  if ( *it == NULL )
106  _string += "[deleted] \n";
107  else {
108  _string += (*it)->name();
109  _string += "\n";
110  }
111 
112 }
113 
114 void BaseKernel::hprop_stats( std::string& _string ) const
115 {
116  _string.clear();
117 
118  PropertyContainer::Properties::const_iterator it;
119  const PropertyContainer::Properties& hps = hprops_.properties();
120  for (it=hps.begin(); it!=hps.end(); ++it)
121  if ( *it == NULL )
122  _string += "[deleted] \n";
123  else {
124  _string += (*it)->name();
125  _string += "\n";
126  }
127 
128 }
129 
130 void BaseKernel::eprop_stats( std::string& _string ) const
131 {
132  _string.clear();
133 
134  PropertyContainer::Properties::const_iterator it;
135  const PropertyContainer::Properties& eps = eprops_.properties();
136  for (it=eps.begin(); it!=eps.end(); ++it)
137  if ( *it == NULL )
138  _string += "[deleted] \n";
139  else {
140  _string += (*it)->name();
141  _string += "\n";
142  }
143 
144 }
145 void BaseKernel::fprop_stats( std::string& _string ) const
146 {
147  _string.clear();
148 
149  PropertyContainer::Properties::const_iterator it;
150  const PropertyContainer::Properties& fps = fprops_.properties();
151  for (it=fps.begin(); it!=fps.end(); ++it)
152  if ( *it == NULL )
153  _string += "[deleted] \n";
154  else {
155  _string += (*it)->name();
156  _string += "\n";
157  }
158 
159 }
160 
161 void BaseKernel::mprop_stats( std::string& _string ) const
162 {
163  _string.clear();
164 
165  PropertyContainer::Properties::const_iterator it;
166  const PropertyContainer::Properties& mps = mprops_.properties();
167  for (it=mps.begin(); it!=mps.end(); ++it)
168  if ( *it == NULL )
169  _string += "[deleted] \n";
170  else {
171  _string += (*it)->name();
172  _string += "\n";
173  }
174 
175 }
176 
177 void BaseKernel::vprop_stats() const
178 {
179  vprop_stats(std::clog);
180 }
181 void BaseKernel::vprop_stats(std::ostream& _ostr ) const
182 {
183  PropertyContainer::Properties::const_iterator it;
184  const PropertyContainer::Properties& vps = vprops_.properties();
185  for (it=vps.begin(); it!=vps.end(); ++it)
186  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
187 
188 }
189 void BaseKernel::hprop_stats() const
190 {
191  hprop_stats(std::clog);
192 }
193 void BaseKernel::hprop_stats(std::ostream& _ostr ) const
194 {
195  PropertyContainer::Properties::const_iterator it;
196  const PropertyContainer::Properties& hps = hprops_.properties();
197  for (it=hps.begin(); it!=hps.end(); ++it)
198  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
199 
200 }
201 void BaseKernel::eprop_stats() const
202 {
203  eprop_stats(std::clog);
204 }
205 void BaseKernel::eprop_stats(std::ostream& _ostr ) const
206 {
207  PropertyContainer::Properties::const_iterator it;
208  const PropertyContainer::Properties& eps = eprops_.properties();
209  for (it=eps.begin(); it!=eps.end(); ++it)
210  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
211 
212 }
213 void BaseKernel::fprop_stats() const
214 {
215  fprop_stats(std::clog);
216 }
217 void BaseKernel::fprop_stats(std::ostream& _ostr ) const
218 {
219  PropertyContainer::Properties::const_iterator it;
220  const PropertyContainer::Properties& fps = fprops_.properties();
221  for (it=fps.begin(); it!=fps.end(); ++it)
222  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
223 
224 }
225 void BaseKernel::mprop_stats() const
226 {
227  mprop_stats(std::clog);
228 }
229 void BaseKernel::mprop_stats(std::ostream& _ostr ) const
230 {
231  PropertyContainer::Properties::const_iterator it;
232  const PropertyContainer::Properties& mps = mprops_.properties();
233  for (it=mps.begin(); it!=mps.end(); ++it)
234  *it == NULL ? (void)(_ostr << "[deleted]" << "\n") : (*it)->stats(_ostr);
235 
236 }
237 
238 
239 }