#include <OSGGraphOp.h>
Public Member Functions | |
| ParamSet (const std::string ¶ms) | |
| bool | operator() (const char *name, std::string &val) |
| bool | operator() (const char *name, Real32 &val) |
| bool | operator() (const char *name, UInt16 &val) |
| bool | operator() (const char *name, UInt32 &val) |
| bool | operator() (const char *name, bool &val) |
| void | markUsed (const char *name) |
| std::string | getUnusedParams (void) |
Private Types | |
| typedef std::map< std::string, std::string > | valuesT |
| typedef std::map< std::string, bool > | usedT |
Private Attributes | |
| valuesT | _values |
| usedT | _used |
Definition at line 128 of file OSGGraphOp.h.
typedef std::map<std::string, std::string> osg::GraphOp::ParamSet::valuesT [private] |
Definition at line 148 of file OSGGraphOp.h.
typedef std::map<std::string, bool> osg::GraphOp::ParamSet::usedT [private] |
Definition at line 149 of file OSGGraphOp.h.
| GraphOp::ParamSet::ParamSet | ( | const std::string & | params | ) |
Definition at line 184 of file OSGGraphOp.cpp.
References _values, and FDEBUG.
00184 : 00185 _values(), 00186 _used() 00187 { 00188 std::string::const_iterator it = params.begin(), end = params.end(); 00189 00190 std::string key, value; 00191 00192 while(it != end) 00193 { 00194 char c = 0; 00195 00196 key = ""; 00197 value = ""; 00198 00199 // Read key 00200 while(it != end) 00201 { 00202 c = *it++; 00203 00204 if(c == ' ' || c == '=') 00205 break; 00206 00207 key += tolower(c); 00208 } 00209 00210 // Do we have a value? Read it 00211 if (it != end && c == '=') 00212 { 00213 while(it != end) 00214 { 00215 c = *it++; 00216 00217 if(c == ' ') 00218 break; 00219 00220 value += c; 00221 } 00222 } 00223 00224 // Add key, value pair 00225 00226 FDEBUG(("GraphOp::ParamSet: key='%s', value='%s'\n", key.c_str(), 00227 value.c_str())); 00228 00229 _values.insert(valuesT::value_type(key, value)); 00230 00231 // Skip to next param 00232 00233 while(it != end && (*it == ' ')); 00234 } 00235 }
| bool GraphOp::ParamSet::operator() | ( | const char * | name, | |
| std::string & | val | |||
| ) |
| bool GraphOp::ParamSet::operator() | ( | const char * | name, | |
| Real32 & | val | |||
| ) |
Definition at line 252 of file OSGGraphOp.cpp.
References _used, and _values.
00253 { 00254 valuesT::iterator it = _values.find(name); 00255 00256 if(it != _values.end()) 00257 { 00258 const Char8* c = (*it).second.c_str(); 00259 FieldDataTraits<Real32>::getFromString(val, c); 00260 00261 _used[name] = true; 00262 return true; 00263 } 00264 return false; 00265 }
| bool GraphOp::ParamSet::operator() | ( | const char * | name, | |
| UInt16 & | val | |||
| ) |
Definition at line 267 of file OSGGraphOp.cpp.
References _used, and _values.
00268 { 00269 valuesT::iterator it = _values.find(name); 00270 00271 if(it != _values.end()) 00272 { 00273 const Char8* c = (*it).second.c_str(); 00274 FieldDataTraits<UInt16>::getFromString(val, c); 00275 00276 _used[name] = true; 00277 return true; 00278 } 00279 return false; 00280 }
| bool GraphOp::ParamSet::operator() | ( | const char * | name, | |
| UInt32 & | val | |||
| ) |
Definition at line 282 of file OSGGraphOp.cpp.
References _used, and _values.
00283 { 00284 valuesT::iterator it = _values.find(name); 00285 00286 if(it != _values.end()) 00287 { 00288 const Char8* c = (*it).second.c_str(); 00289 FieldDataTraits<UInt32>::getFromString(val, c); 00290 00291 _used[name] = true; 00292 return true; 00293 } 00294 return false; 00295 }
| bool GraphOp::ParamSet::operator() | ( | const char * | name, | |
| bool & | val | |||
| ) |
Definition at line 297 of file OSGGraphOp.cpp.
References _used, and _values.
00298 { 00299 valuesT::iterator it = _values.find(name); 00300 00301 if(it != _values.end()) 00302 { 00303 if((*it).second.length() == 0) 00304 { 00305 val = true; 00306 } 00307 else 00308 { 00309 const Char8* c = (*it).second.c_str(); 00310 FieldDataTraits2<bool>::getFromString(val, c); 00311 } 00312 00313 _used[name] = true; 00314 return true; 00315 } 00316 return false; 00317 }
| void GraphOp::ParamSet::markUsed | ( | const char * | name | ) |
| std::string GraphOp::ParamSet::getUnusedParams | ( | void | ) |
Definition at line 324 of file OSGGraphOp.cpp.
References _used, and _values.
Referenced by osg::VerifyGraphOp::setParams(), osg::VerifyGeoGraphOp::setParams(), osg::StripeGraphOp::setParams(), osg::SplitGraphOp::setParams(), osg::SharePtrGraphOp::setParams(), osg::PruneGraphOp::setParams(), osg::MergeGraphOp::setParams(), osg::MaterialMergeGraphOp::setParams(), osg::MakeTransparentGraphOp::setParams(), and osg::GeoTypeGraphOp::setParams().
00325 { 00326 std::string out; 00327 00328 for (valuesT::iterator it = _values.begin(); it != _values.end(); ++it) 00329 { 00330 usedT::iterator uit = _used.find((*it).first); 00331 00332 if(uit == _used.end()) 00333 { 00334 if(out.length()) 00335 out += " "; 00336 00337 out += (*it).first; 00338 } 00339 } 00340 00341 return out; 00342 }
valuesT osg::GraphOp::ParamSet::_values [private] |
Definition at line 151 of file OSGGraphOp.h.
Referenced by getUnusedParams(), operator()(), and ParamSet().
usedT osg::GraphOp::ParamSet::_used [private] |
Definition at line 152 of file OSGGraphOp.h.
Referenced by getUnusedParams(), markUsed(), and operator()().
1.5.5