Ignore:
Timestamp:
Aug 23, 2010, 11:43:12 PM (14 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/src/dataIO/visual_dataIO.cpp

    r116 r118  
    191191        {
    192192                // 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_)
    194194                {
    195195                        //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotPointer() - Slot found at position " << i << std::endl;
    196196                        // 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];
    201198                }
    202199        }
     
    204201        // Slot does not exist -> add it to slot list
    205202        //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 = "";
    211208        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();
    218210}
    219211
     
    224216        {
    225217                // 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 )
    227219                {
    228220                        //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotDataAsDouble() - Slot found at position " << i << std::endl;
    229                         return dataSlots[i].value;
     221                        return dataSlots[i]->value;
    230222                }
    231223        }
     
    239231        {
    240232                // 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 )
    242234                {
    243235                        //OSG_NOTIFY( osg::INFO ) << "visual_dataIO::getSlotDataAsDouble() - Slot found at position " << i << std::endl;
    244                         return dataSlots[i].sValue;
     236                        return dataSlots[i]->sValue;
    245237                }
    246238        }
     
    255247        {
    256248                // 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)
    258250                {
    259251                        // Update value
    260                         dataSlots[i].sValue = sValue_;
     252                        dataSlots[i]->sValue = sValue_;
    261253                        slotFound = true;
    262                         return &(dataSlots[i]);
     254                        return dataSlots[i];
    263255                }
    264256               
     
    268260        {
    269261                // 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_;
    276268                dataSlots.push_back( newSlot );
     269                return dataSlots.back();
    277270        }
    278271
     
    287280        {
    288281                // 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)
    290283                {
    291284                        // Update value
    292285                        //OSG_NOTIFY( osg::ALWAYS ) << "setSlotData: " << variableName_ << " - value: " << value_ << std::endl;
    293                         dataSlots[i].value = value_;
     286                        dataSlots[i]->value = value_;
    294287                        slotFound = true;
    295                         return &(dataSlots[i]);
     288                        return dataSlots[i];
    296289                }       
    297290        }
     
    300293        {
    301294                // 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 = "";
    308301                dataSlots.push_back( newSlot );
     302                return dataSlots.back();
    309303        }
    310304
Note: See TracChangeset for help on using the changeset viewer.