Changeset 118 for osgVisual/src/dataIO
- Timestamp:
- Aug 23, 2010, 11:43:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/dataIO/visual_dataIO.cpp
r116 r118 191 191 { 192 192 // Check if this variable name&-type already exists 193 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == variableTyp_)193 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == variableTyp_) 194 194 { 195 195 //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotPointer() - Slot found at position " << i << std::endl; 196 196 // Return pointer to the value 197 if (variableTyp_ == osgVisual::dataIO_slot::STRING ) 198 return &(dataSlots[i].sValue); 199 else 200 return &(dataSlots[i].value); 197 return dataSlots[i]; 201 198 } 202 199 } … … 204 201 // Slot does not exist -> add it to slot list 205 202 //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotPointer() - Slot not found, will add as new slot " << std::endl; 206 dataIO_slot newSlot;207 newSlot .variableName = variableName_;208 newSlot .variableType = variableTyp_;209 newSlot .value = 0;210 newSlot .sValue = "";203 dataIO_slot* newSlot = new dataIO_slot(); 204 newSlot->variableName = variableName_; 205 newSlot->variableType = variableTyp_; 206 newSlot->value = 0; 207 newSlot->sValue = ""; 211 208 dataSlots.push_back( newSlot ); 212 if (variableTyp_ == osgVisual::dataIO_slot::STRING ) 213 return &(dataSlots.back().sValue); 214 else 215 { 216 return &(dataSlots.back().value); 217 } 209 return dataSlots.back(); 218 210 } 219 211 … … 224 216 { 225 217 // Check if this variable name&-type already exists 226 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == osgVisual::dataIO_slot::DOUBLE )218 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == osgVisual::dataIO_slot::DOUBLE ) 227 219 { 228 220 //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotDataAsDouble() - Slot found at position " << i << std::endl; 229 return dataSlots[i] .value;221 return dataSlots[i]->value; 230 222 } 231 223 } … … 239 231 { 240 232 // Check if this variable name&-type already exists 241 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == osgVisual::dataIO_slot::STRING )233 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == osgVisual::dataIO_slot::STRING ) 242 234 { 243 235 //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotDataAsDouble() - Slot found at position " << i << std::endl; 244 return dataSlots[i] .sValue;236 return dataSlots[i]->sValue; 245 237 } 246 238 } … … 255 247 { 256 248 // Check if this variable name&-type already exists 257 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == osgVisual::dataIO_slot::STRING)249 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == osgVisual::dataIO_slot::STRING) 258 250 { 259 251 // Update value 260 dataSlots[i] .sValue = sValue_;252 dataSlots[i]->sValue = sValue_; 261 253 slotFound = true; 262 return &(dataSlots[i]);254 return dataSlots[i]; 263 255 } 264 256 … … 268 260 { 269 261 // Slot does not exist -> add it to slot list 270 dataIO_slot newSlot;271 newSlot .variableName = variableName_;272 newSlot .direction = direction_;273 newSlot .variableType = osgVisual::dataIO_slot::STRING;274 newSlot .value = 0;275 newSlot .sValue = sValue_;262 dataIO_slot* newSlot = new dataIO_slot(); 263 newSlot->variableName = variableName_; 264 newSlot->direction = direction_; 265 newSlot->variableType = osgVisual::dataIO_slot::STRING; 266 newSlot->value = 0; 267 newSlot->sValue = sValue_; 276 268 dataSlots.push_back( newSlot ); 269 return dataSlots.back(); 277 270 } 278 271 … … 287 280 { 288 281 // Check if this variableName & -type already exists 289 if( dataSlots[i] .variableName == variableName_ && dataSlots[i].direction == direction_ && dataSlots[i].variableType == osgVisual::dataIO_slot::DOUBLE)282 if( dataSlots[i]->variableName == variableName_ && dataSlots[i]->direction == direction_ && dataSlots[i]->variableType == osgVisual::dataIO_slot::DOUBLE) 290 283 { 291 284 // Update value 292 285 //OSG_NOTIFY( osg::ALWAYS ) << "setSlotData: " << variableName_ << " - value: " << value_ << std::endl; 293 dataSlots[i] .value = value_;286 dataSlots[i]->value = value_; 294 287 slotFound = true; 295 return &(dataSlots[i]);288 return dataSlots[i]; 296 289 } 297 290 } … … 300 293 { 301 294 // Slot does not exist -> add it to slot list 302 dataIO_slot newSlot;303 newSlot .variableName = variableName_;304 newSlot .direction = direction_;305 newSlot .variableType = osgVisual::dataIO_slot::DOUBLE;306 newSlot .value = value_;307 newSlot .sValue = "";295 dataIO_slot* newSlot = new dataIO_slot(); 296 newSlot->variableName = variableName_; 297 newSlot->direction = direction_; 298 newSlot->variableType = osgVisual::dataIO_slot::DOUBLE; 299 newSlot->value = value_; 300 newSlot->sValue = ""; 308 301 dataSlots.push_back( newSlot ); 302 return dataSlots.back(); 309 303 } 310 304
Note: See TracChangeset
for help on using the changeset viewer.