Commit 9be6b08d authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[STYLE] - if ( and for ( fixed. (removed the space)

parent 29610b34
......@@ -40,7 +40,7 @@ WConditionSet::~WConditionSet()
// clean conditions list
// NOTE: we need to disconnect here.
for ( ConditionConnectionMap::iterator it = m_conditionSet.begin(); it != m_conditionSet.end(); ++it )
for( ConditionConnectionMap::iterator it = m_conditionSet.begin(); it != m_conditionSet.end(); ++it )
{
( *it ).second.disconnect();
}
......@@ -54,7 +54,7 @@ void WConditionSet::add( boost::shared_ptr< WCondition > condition )
// get write lock
boost::unique_lock<boost::shared_mutex> lock = boost::unique_lock<boost::shared_mutex>( m_conditionSetLock );
if ( !m_conditionSet.count( condition ) )
if( !m_conditionSet.count( condition ) )
{
// create a new pair, the condition and its connection object.
// this is needed since remove needs the connection to disconnect the notifier again
......@@ -71,7 +71,7 @@ void WConditionSet::remove( boost::shared_ptr< WCondition > condition )
// get the element
ConditionConnectionMap::iterator it = m_conditionSet.find( condition );
if ( it != m_conditionSet.end() )
if( it != m_conditionSet.end() )
{
( *it ).second.disconnect();
m_conditionSet.erase( it );
......@@ -88,12 +88,12 @@ void WConditionSet::conditionFired()
void WConditionSet::wait() const
{
if ( !m_resetable || !m_fired )
if( !m_resetable || !m_fired )
{
WCondition::wait();
}
if ( m_autoReset )
if( m_autoReset )
{
reset();
}
......
......@@ -55,7 +55,7 @@ WException::WException( const std::string& msg ):
// print stacktrace and message
// no backtrace?
if ( !noBacktrace )
if( !noBacktrace )
{
std::cerr << m_headlineColor( std::string( "Exception thrown! Callstack's backtrace:" ) ) << std::endl << getBacktrace() << std::endl;
}
......@@ -72,7 +72,7 @@ WException::WException( const std::exception& e ):
// print stacktrace and message
// no backtrace?
if ( !noBacktrace )
if( !noBacktrace )
{
std::cerr << m_headlineColor( std::string( "Exception thrown! Callstack's backtrace:" ) ) << std::endl << getBacktrace() << std::endl;
}
......@@ -119,7 +119,7 @@ std::string WException::getBacktrace() const
stackSymbols = backtrace_symbols( stackAddrs, stackDepth );
// for each stack element -> demangle and print
for ( size_t i = 1; i < stackDepth; ++i )
for( size_t i = 1; i < stackDepth; ++i )
{
// need some space for function name
// just a guess, especially template names might be even longer
......@@ -131,20 +131,20 @@ std::string WException::getBacktrace() const
char* end = 0;
// find the parentheses and address offset surrounding the mangled name
for ( char* j = stackSymbols[i]; *j; ++j )
for( char* j = stackSymbols[i]; *j; ++j )
{
if ( *j == '(' )
if( *j == '(' )
{
begin = j;
}
else if ( *j == '+' )
else if( *j == '+' )
{
end = j;
}
}
// found?
if ( begin && end )
if( begin && end )
{
*begin++ = '(';
*end = '\0'; // temporarily end string there (since \0 is string delimiter)
......@@ -153,7 +153,7 @@ std::string WException::getBacktrace() const
int status;
char* ret = abi::__cxa_demangle( begin, function, &functionLength, &status );
if ( ret )
if( ret )
{
// return value may be a realloc() of the input
function = ret;
......
......@@ -256,7 +256,7 @@ const T WFlag< T >::operator()() const
template < typename T >
const T WFlag< T >::get( bool resetChangeState )
{
if ( resetChangeState )
if( resetChangeState )
{
m_changed = false;
}
......@@ -291,13 +291,13 @@ template < typename T >
bool WFlag< T >::set( T value, bool suppressNotification )
{
// if the value is the same as the current one -> do not notify but let the caller know "all ok"
if ( m_flag == value )
if( m_flag == value )
{
return true;
}
// let the caller know whether the value was acceptable.
if ( !accept( value ) )
if( !accept( value ) )
{
return false;
}
......@@ -306,7 +306,7 @@ bool WFlag< T >::set( T value, bool suppressNotification )
m_changed = true;
// is the notification suppressed ?
if ( !suppressNotification )
if( !suppressNotification )
{
m_condition->notify();
}
......@@ -344,7 +344,7 @@ template < typename T >
bool WFlag< T >::changed( bool reset )
{
bool tmp = m_changed;
if ( reset )
if( reset )
{
m_changed = false;
}
......
......@@ -40,7 +40,7 @@ std::vector< size_t > WHierarchicalTree::findXBiggestClusters( size_t cluster, s
{
//std::cout << number << " largest clusters for cluster: " << cluster << std::endl;
if ( number > m_containsLeafes[cluster].size() )
if( number > m_containsLeafes[cluster].size() )
{
number = m_containsLeafes[cluster].size();
}
......@@ -53,7 +53,7 @@ std::vector< size_t > WHierarchicalTree::findXBiggestClusters( size_t cluster, s
{
size_t current = worklist.front();
worklist.pop_front();
if ( m_containsLeafes[current].size() > 1 )
if( m_containsLeafes[current].size() > 1 )
{
size_t left = m_children[current].first;
size_t right = m_children[current].second;
......@@ -75,13 +75,13 @@ std::vector< size_t > WHierarchicalTree::findXBiggestClusters( size_t cluster, s
newSplit = false;
size_t current = worklist.front();
if ( m_containsLeafes[current].size() > 1 )
if( m_containsLeafes[current].size() > 1 )
{
size_t left = m_children[current].first;
size_t right = m_children[current].second;
size_t last = worklist.back();
if ( m_containsLeafes[left].size() > m_containsLeafes[last].size() )
if( m_containsLeafes[left].size() > m_containsLeafes[last].size() )
{
worklist.pop_front();
worklist.push_back( left );
......@@ -90,13 +90,13 @@ std::vector< size_t > WHierarchicalTree::findXBiggestClusters( size_t cluster, s
}
last = worklist.back();
if ( m_containsLeafes[right].size() > m_containsLeafes[last].size() )
if( m_containsLeafes[right].size() > m_containsLeafes[last].size() )
{
if ( !newSplit )
if( !newSplit )
{
worklist.pop_front();
}
if ( worklist.size() == number )
if( worklist.size() == number )
{
worklist.pop_back();
}
......@@ -109,7 +109,7 @@ std::vector< size_t > WHierarchicalTree::findXBiggestClusters( size_t cluster, s
std::vector<size_t>returnVector;
std::list<size_t>::iterator it;
for ( it = worklist.begin(); it != worklist.end(); ++it )
for( it = worklist.begin(); it != worklist.end(); ++it )
{
size_t current = *it;
//std::cout << "cluster:" << current << " size:" << m_containsLeafes[current].size() << std::endl;
......@@ -121,7 +121,7 @@ std::vector< size_t > WHierarchicalTree::findXBiggestClusters( size_t cluster, s
std::vector< size_t > WHierarchicalTree::downXLevelsFromTop( size_t level, bool hideOutliers )
{
if ( level > m_maxLevel )
if( level > m_maxLevel )
{
level = m_maxLevel -1;
}
......@@ -131,25 +131,25 @@ std::vector< size_t > WHierarchicalTree::downXLevelsFromTop( size_t level, bool
std::list<size_t>worklist;
worklist.push_back( m_clusterCount - 1 );
for ( size_t i = 0; i < level; ++i )
for( size_t i = 0; i < level; ++i )
{
std::list<size_t>newChildList;
while ( !worklist.empty() )
{
size_t current = worklist.front();
worklist.pop_front();
if ( m_containsLeafes[current].size() > 1 )
if( m_containsLeafes[current].size() > 1 )
{
size_t left = m_children[current].first;
size_t right = m_children[current].second;
if ( hideOutliers )
if( hideOutliers )
{
if ( m_containsLeafes[left].size() > 1 )
if( m_containsLeafes[left].size() > 1 )
{
newChildList.push_back( left );
}
if ( m_containsLeafes[right].size() > 1 )
if( m_containsLeafes[right].size() > 1 )
{
newChildList.push_back( right );
}
......@@ -167,7 +167,7 @@ std::vector< size_t > WHierarchicalTree::downXLevelsFromTop( size_t level, bool
worklist.sort( compSize( this ) );
std::list<size_t>::iterator it;
for ( it = worklist.begin(); it != worklist.end(); ++it )
for( it = worklist.begin(); it != worklist.end(); ++it )
{
size_t current = *it;
returnVector.push_back( current );
......@@ -179,7 +179,7 @@ std::vector< size_t > WHierarchicalTree::downXLevelsFromTop( size_t level, bool
void WHierarchicalTree::colorCluster( size_t cluster, WColor color )
{
m_colors[cluster] = color;
if ( m_containsLeafes[cluster].size() > 1 )
if( m_containsLeafes[cluster].size() > 1 )
{
colorCluster( m_children[cluster].first, color );
colorCluster( m_children[cluster].second, color );
......
......@@ -240,7 +240,7 @@ inline size_t WHierarchicalTree::getLevel( size_t cluster )
inline size_t WHierarchicalTree::getParent( size_t cluster )
{
if ( m_level[cluster] < m_maxLevel )
if( m_level[cluster] < m_maxLevel )
{
return m_parents[cluster];
}
......@@ -253,7 +253,7 @@ inline size_t WHierarchicalTree::getParent( size_t cluster )
inline std::pair<size_t, size_t>WHierarchicalTree::getChildren( size_t cluster )
{
if ( m_level[cluster] > 0 )
if( m_level[cluster] > 0 )
{
return m_children[cluster];
}
......
......@@ -43,7 +43,7 @@ WHierarchicalTreeFibers::~WHierarchicalTreeFibers()
void WHierarchicalTreeFibers::addLeaf()
{
// after a cluster was added no more leafes may be inserted
if ( m_leafesLocked )
if( m_leafesLocked )
{
return;
}
......@@ -86,14 +86,14 @@ boost::shared_ptr< std::vector<bool> > WHierarchicalTreeFibers::getOutputBitfiel
{
boost::shared_ptr< std::vector< bool > > bf;
// only a single fiber selected
if ( cluster < m_leafCount )
if( cluster < m_leafCount )
{
bf = boost::shared_ptr< std::vector< bool > >( new std::vector< bool >( m_leafCount, false ) );
( *bf )[cluster] = true;
}
else
{
if ( cluster >= m_clusterCount )
if( cluster >= m_clusterCount )
{
return bf;
}
......@@ -101,7 +101,7 @@ boost::shared_ptr< std::vector<bool> > WHierarchicalTreeFibers::getOutputBitfiel
bf = boost::shared_ptr< std::vector< bool > >( new std::vector< bool >( m_leafCount, false ) );
std::vector<size_t> fibers = m_containsLeafes[cluster];
for ( size_t i = 0; i < fibers.size(); ++i )
for( size_t i = 0; i < fibers.size(); ++i )
{
( *bf )[fibers[i]] = true;
}
......@@ -118,11 +118,11 @@ boost::shared_ptr< std::vector<bool> >WHierarchicalTreeFibers::getOutputBitfield
bf = boost::shared_ptr< std::vector< bool > >( new std::vector< bool >( m_leafCount, false ) );
for ( size_t k = 0; k < clusters.size(); ++k )
for( size_t k = 0; k < clusters.size(); ++k )
{
size_t cluster = clusters[k];
std::vector<size_t> fibers = m_containsLeafes[cluster];
for ( size_t i = 0; i < fibers.size(); ++i )
for( size_t i = 0; i < fibers.size(); ++i )
{
( *bf )[fibers[i]] = true;
}
......@@ -132,7 +132,7 @@ boost::shared_ptr< std::vector<bool> >WHierarchicalTreeFibers::getOutputBitfield
std::vector<size_t> WHierarchicalTreeFibers::getBestClustersFittingRoi( float ratio, size_t number )
{
if ( number == 0 )
if( number == 0 )
{
number = 1;
}
......@@ -146,20 +146,20 @@ std::vector<size_t> WHierarchicalTreeFibers::getBestClustersFittingRoi( float ra
size_t current = worklist.front();
worklist.pop();
if ( getRatio( current ) >= ratio )
if( getRatio( current ) >= ratio )
{
candidateList.push_back( current );
}
else
{
if ( getLevel( current ) > 1 )
if( getLevel( current ) > 1 )
{
std::pair<size_t, size_t> children = getChildren( current );
if ( getLevel( children.first ) > 0 )
if( getLevel( children.first ) > 0 )
{
worklist.push( children.first );
}
if ( getLevel( children.second ) > 0 )
if( getLevel( children.second ) > 0 )
{
worklist.push( children.second );
}
......@@ -171,12 +171,12 @@ std::vector<size_t> WHierarchicalTreeFibers::getBestClustersFittingRoi( float ra
std::vector<size_t>returnList;
std::list<size_t>::iterator it;
for ( it = candidateList.begin(); it != candidateList.end(); ++it )
for( it = candidateList.begin(); it != candidateList.end(); ++it )
{
size_t current = *it;
returnList.push_back( current );
--number;
if ( number == 0 )
if( number == 0 )
{
break;
}
......@@ -193,9 +193,9 @@ float WHierarchicalTreeFibers::getRatio( size_t cluster )
size_t countFibersInCluster = fibersInCluster.size();
size_t fibersFromClusterActive = 0;
for ( size_t i = 0; i < countFibersInCluster; ++i )
for( size_t i = 0; i < countFibersInCluster; ++i )
{
if ( ( *m_roiSelection )[fibersInCluster[i]] )
if( ( *m_roiSelection )[fibersInCluster[i]] )
{
++fibersFromClusterActive;
}
......
......@@ -47,7 +47,7 @@ void WHierarchicalTreeVoxels::addLeaf()
void WHierarchicalTreeVoxels::addLeaf( size_t voxelnum )
{
// after a cluster was added no more leafes may be inserted
if ( m_leafesLocked )
if( m_leafesLocked )
{
return;
}
......@@ -97,7 +97,7 @@ std::vector<size_t> WHierarchicalTreeVoxels::getVoxelsForCluster( size_t cluster
{
std::vector<size_t>returnVec = getLeafesForCluster( cluster );
for ( size_t i = 0; i < returnVec.size(); ++i )
for( size_t i = 0; i < returnVec.size(); ++i )
{
returnVec[i] = m_voxelnums[returnVec[i]];
}
......@@ -110,7 +110,7 @@ std::vector< size_t > WHierarchicalTreeVoxels::findClustersForValue( float value
std::list<size_t>worklist;
std::vector<size_t>returnVector;
if ( value < getCustomData( m_clusterCount - 1 ) )
if( value < getCustomData( m_clusterCount - 1 ) )
{
worklist.push_back( m_clusterCount - 1 );
}
......@@ -119,12 +119,12 @@ std::vector< size_t > WHierarchicalTreeVoxels::findClustersForValue( float value
{
size_t current = worklist.front();
worklist.pop_front();
if ( m_containsLeafes[current].size() > 1 )
if( m_containsLeafes[current].size() > 1 )
{
size_t left = m_children[current].first;
size_t right = m_children[current].second;
if ( value < getCustomData( left ) )
if( value < getCustomData( left ) )
{
worklist.push_back( left );
}
......@@ -132,7 +132,7 @@ std::vector< size_t > WHierarchicalTreeVoxels::findClustersForValue( float value
{
returnVector.push_back( left );
}
if ( value < getCustomData( right ) )
if( value < getCustomData( right ) )
{
worklist.push_back( right );
}
......@@ -153,13 +153,13 @@ std::vector< size_t >WHierarchicalTreeVoxels::findClustersForBranchLength( float
std::vector<int>distanceCheckVector( m_clusterCount, 0 );
for ( size_t i = m_leafCount; i < m_clusterCount; ++i )
for( size_t i = m_leafCount; i < m_clusterCount; ++i )
{
if ( ( distanceCheckVector[m_children[i].first] > 0 ) || ( distanceCheckVector[m_children[i].second] > 0 ) )
if( ( distanceCheckVector[m_children[i].first] > 0 ) || ( distanceCheckVector[m_children[i].second] > 0 ) )
{
distanceCheckVector[i] = 2;
}
else if ( ( ( m_containsLeafes[i].size() >= minSize ) && ( ( m_customData[m_parents[i]] - m_customData[i] ) > value ) ) )
else if( ( ( m_containsLeafes[i].size() >= minSize ) && ( ( m_customData[m_parents[i]] - m_customData[i] ) > value ) ) )
{
distanceCheckVector[i] = 1;
returnVector.push_back( i );
......@@ -191,7 +191,7 @@ std::vector< size_t >WHierarchicalTreeVoxels::findXClusters( size_t root, size_t
std::cout << number << " clusters at " << m_customData[worklist.front()] << " energy" << std::endl;
std::list<size_t>::iterator it;
for ( it = worklist.begin(); it != worklist.end(); ++it )
for( it = worklist.begin(); it != worklist.end(); ++it )
{
size_t current = *it;
returnVector.push_back( current );
......
......@@ -49,7 +49,7 @@ WItemSelector WItemSelection::getSelectorAll()
WItemSelector::IndexList l;
ReadTicket r = getReadTicket();
for ( size_t i = 0; i < r->get().size(); ++i )
for( size_t i = 0; i < r->get().size(); ++i )
{
l.push_back( i );
}
......@@ -68,7 +68,7 @@ WItemSelector WItemSelection::getSelectorFirst()
WItemSelector::IndexList l;
ReadTicket r = getReadTicket();
if ( r->get().size() >= 1 )
if( r->get().size() >= 1 )
{
l.push_back( 0 );
}
......@@ -80,7 +80,7 @@ WItemSelector WItemSelection::getSelectorLast()
WItemSelector::IndexList l;
ReadTicket r = getReadTicket();
if ( r->get().size() >= 1 )
if( r->get().size() >= 1 )
{
l.push_back( r->get().size() - 1 );
}
......@@ -92,7 +92,7 @@ WItemSelector WItemSelection::getSelector( size_t item )
WItemSelector::IndexList l;
ReadTicket r = getReadTicket();
if ( r->get().size() <= item )
if( r->get().size() <= item )
{
throw WOutOfBounds( std::string( "The specified item does not exist." ) );
}
......
......@@ -52,7 +52,7 @@ WItemSelector::WItemSelector( const WItemSelector& other ):
WItemSelector& WItemSelector::operator=( const WItemSelector & other )
{
if ( this != &other ) // protect against invalid self-assignment
if( this != &other ) // protect against invalid self-assignment
{
m_selection = other.m_selection;
m_selected = other.m_selected;
......@@ -89,7 +89,7 @@ WItemSelector WItemSelector::newSelector( const std::string asString ) const
tokens = string_utils::tokenize( asString, ";" );
IndexList l;
for ( size_t i = 0; i < tokens.size(); ++i )
for( size_t i = 0; i < tokens.size(); ++i )
{
l.push_back( boost::lexical_cast< size_t >( tokens[i] ) );
}
......@@ -102,9 +102,9 @@ WItemSelector WItemSelector::newSelector() const
WItemSelector s( *this );
s.m_valid = true;
// iterate selected items to remove items with invalid index
for ( IndexList::iterator i = s.m_selected.begin(); i != s.m_selected.end(); ++i )
for( IndexList::iterator i = s.m_selected.begin(); i != s.m_selected.end(); ++i )
{
if ( ( *i ) >= m_selection->size() )
if( ( *i ) >= m_selection->size() )
{
s.m_selected.erase( i );
}
......@@ -114,10 +114,10 @@ WItemSelector WItemSelector::newSelector() const
std::ostream& WItemSelector::operator<<( std::ostream& out ) const
{
for ( WItemSelector::IndexList::const_iterator iter = m_selected.begin(); iter != m_selected.end(); ++iter )
for( WItemSelector::IndexList::const_iterator iter = m_selected.begin(); iter != m_selected.end(); ++iter )
{
out << ( *iter );
if ( ( iter + 1 ) != m_selected.end() )
if( ( iter + 1 ) != m_selected.end() )
{
out << ";";
}
......
......@@ -39,7 +39,7 @@ WLogStream::WLogStream( std::ostream& output, LogLevel logLevel, std::string for
void WLogStream::printEntry( const WLogEntry& entry )
{
// level test
if ( m_logLevel > entry.getLogLevel() )
if( m_logLevel > entry.getLogLevel() )
{
return;
}
......
......@@ -40,7 +40,7 @@ WLogger* logger = NULL;
void WLogger::startup( std::ostream& output, LogLevel level ) // NOLINT - we need this non-const ref here
{
if ( !logger )
if( !logger )
{
logger = new WLogger( output, level );
}
......@@ -63,7 +63,7 @@ WLogger::~WLogger()
WLogger* WLogger::getLogger()
{
if ( !logger )
if( !logger )
{
throw new WPreconditionNotMet( std::string( "Logger not yet initialized." ) );
}
......@@ -92,7 +92,7 @@ void WLogger::addLogMessage( std::string message, std::string source, LogLevel l
// output
Outputs::ReadTicket r = m_outputs.getReadTicket();
for ( Outputs::ConstIterator i = r->get().begin(); i != r->get().end(); ++i )
for( Outputs::ConstIterator i = r->get().begin(); i != r->get().end(); ++i )
{
( *i )->printEntry( entry );
}
......
......@@ -47,7 +47,7 @@ WPathHelper::~WPathHelper()
boost::shared_ptr< WPathHelper > WPathHelper::getPathHelper()
{
if ( !m_instance )
if( !m_instance )
{
m_instance = boost::shared_ptr< WPathHelper >( new WPathHelper() );
}
......@@ -144,7 +144,7 @@ std::vector< boost::filesystem::path > WPathHelper::getAllModulePaths()
paths.push_back( getModulePath() );
std::string additionalPaths = "";
if ( !WPreferences::getPreference< std::string >( "modules.path", &additionalPaths ) )
if( !WPreferences::getPreference< std::string >( "modules.path", &additionalPaths ) )
{
// no config option found.
return paths;
......@@ -154,7 +154,7 @@ std::vector< boost::filesystem::path > WPathHelper::getAllModulePaths()
typedef boost::tokenizer< boost::char_separator< char > > tokenizer;
boost::char_separator< char > sep( ";" );
tokenizer tok( additionalPaths, sep );
for ( tokenizer::iterator it = tok.begin(); it != tok.end(); ++it )
for( tokenizer::iterator it = tok.begin(); it != tok.end(); ++it )
{
paths.push_back( boost::filesystem::path( *it ) );
}
......
......@@ -37,7 +37,7 @@ WProgress::WProgress( std::string name, unsigned int count )
m_pending( true ),
m_determined( true )
{