bool SpikeReportSimpleStreamer::handles( const SpikeReportInitData& initData )
{
    const lunchbox::URI& uri = initData.getURI();

    if( uri.getScheme() != "spikes" )
        return false;

    const boost::filesystem::path ext =
            boost::filesystem::path( uri.getPath() ).extension();
    return ext == NEST_REPORT_FILE_EXT;
}
Beispiel #2
0
bool SpikeReportNEST::handles( const SpikeReportInitData& initData )
{
    const URI& uri = initData.getURI();

    if( !uri.getScheme().empty() && uri.getScheme() != "file" )
        return false;

    const boost::filesystem::path ext =
            boost::filesystem::path( uri.getPath() ).extension();
    return ext == NEST_REPORT_FILE_EXT;
}
SpikeReportSimpleStreamer::SpikeReportSimpleStreamer(
                                        const SpikeReportInitData& initData )
    : _filename( initData.getURI().getPath( ) )
    , _lastTimeStamp( -1 ) // This means that nothing has been received yet
    , _lastEndTime( 0 )
{
    if( initData.getAccessMode() & MODE_WRITE )
        LBTHROW( std::runtime_error( "Writing of spike reports is not "
                                     "implemented" ));

    _readThread = boost::thread(
        boost::bind( &SpikeReportSimpleStreamer::_readLoop, this ));
}
Beispiel #4
0
SpikeReportNEST::SpikeReportNEST( const SpikeReportInitData& initData )
    : _uri( initData.getURI( ))
    , _spikeReportFile( _uri.getPath(), NEST_SPIKE_REPORT,
                        initData.getAccessMode( ))
{
    const int accessMode = initData.getAccessMode();

    if( accessMode == MODE_READ )
    {
        const Strings& reportFiles = expandShellWildcard( _uri.getPath( ));
        if( reportFiles.empty( ))
            LBTHROW( std::runtime_error( "No file(s) to read found in " +
                                         _uri.getPath( )));

        for( const std::string& reportFile : reportFiles )
        {
            SpikeReportFile reader( reportFile, NEST_SPIKE_REPORT, MODE_READ );
            reader.fillReportMap( _spikes );
        }
        return;
    }
}