Commit 2af73a46 authored by schurade's avatar schurade
Browse files

[MERGE]

parents dd9148bd 3805fd78
......@@ -5,4 +5,4 @@ math Mathias_Goldau
math@informatik.uni-leipzig.de Mathias_Goldau
schurade Ralph_Schurade
ebaum Sebastian_Eichelbaum
eichelbaum@informatik.uni-leipzig.de Sebastian_Eichelbaum
\ No newline at end of file
eichelbaum@informatik.uni-leipzig.de Sebastian_Eichelbaum
......@@ -30,7 +30,7 @@ ENDIF( CMAKE_BUILD_TYPE STREQUAL "Static" )
# To see which boost libs we currently use, you may run the following command
# in the trunk/src directory on a linux box to make some investigations:
# grep -i include `find . -type f` | grep boost | awk '{print $2}' | sort | uniq
FIND_PACKAGE( Boost REQUIRED program_options thread )
FIND_PACKAGE( Boost REQUIRED program_options thread filesystem )
ASSERT_GE_VERSION( "Boost" "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" 1.36.0 )
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
......
......@@ -24,6 +24,7 @@
#include <iostream>
#include <string>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include "WLoaderManager.h"
#include "WDataSet.h"
......@@ -33,33 +34,37 @@
std::string getSuffix( std::string name )
{
size_t position = name.find_last_of( '.' );
if( position == std::string::npos )
return "";
else
return name.substr( position + 1 );
boost::filesystem::path p( name );
return p.extension();
}
void WLoaderManager::load( std::string fileName, boost::shared_ptr< WDataHandler > dataHandler )
{
std::string suffix = getSuffix( fileName );
if( suffix == "nii" || suffix == "gz" )
if( suffix == ".nii" || suffix == ".gz" )
{
if( suffix == ".gz" ) // it may be a NIfTI file too
{
boost::filesystem::path p( fileName );
p.replace_extension( "" );
suffix = getSuffix( p.string() );
assert( suffix == ".nii" && "currently only nii files may be gzipped" );
}
WLoaderNIfTI niiLoader( fileName, dataHandler );
boost::thread loaderThread( niiLoader );
}
else if( suffix == "edf" )
else if( suffix == ".edf" )
{
WLoaderBiosig biosigLoader( fileName, dataHandler );
boost::thread loaderThread( biosigLoader );
}
else if( suffix == "asc" )
else if( suffix == ".asc" )
{
WLoaderEEGASCII eegAsciiLoader( fileName, dataHandler );
boost::thread loaderThread( eegAsciiLoader );
}
else if( suffix == "vtk" )
else if( suffix == ".vtk" )
{
// This is a dummy implementation.
// You need to provide a real implementation here if you want to load vtk.
......
......@@ -50,12 +50,13 @@ public:
std::cout << "Test loading of " << fileName << "." << std::endl;
boost::shared_ptr< WDataHandler > dataHandler =
boost::shared_ptr< WDataHandler >( new WDataHandler() );
TS_ASSERT_EQUALS( dataHandler->getNumberOfSubjects(), 0 );
WLoaderManager testLoaderManager;
testLoaderManager.load( fileName, dataHandler );
sleep( 4 ); // we need this to allow the thread to terminate
// TODO(wiebel): we need to change this because loading, in the end,
// should not always increase the number of subjects.
TS_ASSERT( dataHandler->getNumberOfSubjects() );
TS_ASSERT_EQUALS( dataHandler->getNumberOfSubjects(), 1 );
}
};
......
......@@ -2334,9 +2334,10 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, include_state,
% (match.group(1), match.group(2)))
if Search(r'\busing namespace\b', line):
error(filename, linenum, 'build/namespaces', 5,
'Do not use namespace using-directives. '
'Use using-declarations instead.')
if( not file_extension == "cpp" ):
error(filename, linenum, 'build/namespaces', 5,
'Do not use namespace using-directives. '
'Use using-declarations instead.')
# Detect variable-length arrays.
match = Match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment