Logo Search packages:      
Sourcecode: libgdf version File versions  Download package

Channel * gdf::RecordBuffer::getValidChannel ( const size_t  channel_idx )

Returns reference to channel specified by channel_idx.

If channel does not exist gdf::nonexistent_channel_access::nonexistent_channel_access is thrown. A new record is created if the channelhead points to the end of the record list.

Definition at line 210 of file RecordBuffer.cpp.

References createNewRecord().

Referenced by addSamplePhys(), addSampleRaw(), blitSamplesPhys(), blitSamplesRaw(), and getNumFreeAlloc().

    {
        if( channel_idx >= m_channelhead.size( ) )
            throw exception::nonexistent_channel_access( "channel "+boost::lexical_cast<std::string>(channel_idx) +"does not exist" );

        if( m_channelhead[channel_idx] == m_records.end() )
        {
            if( m_records.size() > 0 )
            {
                if( m_records.back()->getChannel(channel_idx)->getFree( ) == 0 )
                    m_channelhead[channel_idx] = createNewRecord( );
                else
                    throw exception::corrupt_recordbuffer( "DOOM is upon us!" );
            }
            else
            {
                // list was empty: set all channel heads to the new record.
                std::list< Record* >::iterator r = createNewRecord( );
                for( size_t i=0; i<m_channelhead.size(); i++ )
                    m_channelhead[i] = r;
            }
        }

        return (*m_channelhead[channel_idx])->getChannel( channel_idx );
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index