Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgSystem.h File Reference


Detailed Description

System specific definitions for SmartGo.

This file contains system specific defines and includes. It always needs to be the first header file included by any .cpp file.

Definition in file SgSystem.h.

#include <sys/types.h>

Go to the source code of this file.

Classes

class  SgAssertionHandler
 Additional code to run in debug mode after an assertion failed. More...

Defines

#define SG_DEBUG_ONLY(x)
 Avoid compiler warnings for variables used only if NDEBUG is not defined.
#define SG_ATTR_NOINLINE
#define SG_ATTR_ALWAYS_INLINE
#define SG_ATTR_FLATTEN
#define OTHER_BYTE_ORDER   0
#define SG_ASSERT(x)
#define SG_ASSERTRANGE(i, from, to)   SG_ASSERT(i >= from && i <= to)

Functions

template<class T>
void SG_UNUSED (const T &)
 Avoid compiler warnings for unused variables.
void SgHandleAssertion (const char *expr, const char *file, int line)
 System-specific action when an SG_ASSERT fails.
void SgSetUserAbort (bool aborted)
 Sets the global user abort flag.
bool SgUserAbort ()
 Poll for user abort.
void SgSynchronizeThreadMemory ()

Variables

const bool SG_CHECK = true
const bool SG_HEAVYCHECK = SG_CHECK && true


Define Documentation

#define OTHER_BYTE_ORDER   0

Definition at line 64 of file SgSystem.h.

#define SG_ASSERT (  ) 

Value:

do \
    { \
        if(! (x)) \
            ::SgHandleAssertion(#x, __FILE__, __LINE__); \
    } while (false)

Definition at line 93 of file SgSystem.h.

Referenced by SgStatisticsBase< VALUE, COUNT >::Add(), SgPropList::Add(), SgNode::Add(), SgUctTree::AddGameResult(), SgUctTree::AddGameResults(), SgSortedArray< T, K, size >::AddItem(), SgMiaiStrategy::AddPair(), SgUctTree::AddRaveValue(), SgSearch::AddSequenceToHash(), SgUctTree::Allocator(), SgNode::AppendTo(), SgUctTree::ApplyFilter(), SgBWSet::AssertDisjoint(), SgArrayAssign< T *, SIZE >::Assign(), SgArrayAssign< bool, SIZE >::Assign(), SgArrayAssign< int, SIZE >::Assign(), SgArrayAssign< T, SIZE >::Assign(), SgVector< std::pair< SgPoint, SgPoint > >::Back(), SgVector< std::pair< SgPoint, SgPoint > >::BackAndPop(), SgSortedMoves< MOVE, VALUE, SIZE >::BestValue(), SgBoardConst::BoardConstImpl::BoardConstImpl(), SgRect::Center(), SgBoardConst::ChangeSize(), SgUctSearch::CheckCountAbort(), SgSortedMoves< MOVE, VALUE, SIZE >::CheckMoves(), SgSortedMoves< MOVE, VALUE, SIZE >::Clear(), SgMiaiStrategy::Clear(), SgPointUtil::PointToCol::Col(), SgBookBuilder::ComputePriority(), SgPointSet::ConnComp8(), SgVectorOf< std::string >::Contains(), SgNode::ContainsText(), SgMiaiMap::ConvertFromSgMiaiStrategy(), SgMiaiMap::ConvertToSgMiaiStrategy(), SgUctTree::CopySubtree(), SgHistogram< VALUE, COUNT >::Count(), SgUctAllocator::Create(), SgBoardConst::Create(), SgUctTree::CreateChildren(), SgUctAllocator::CreateN(), SgUctAllocator::CreateOne(), SgProp::CreateProperty(), SgSortedMoves< MOVE, VALUE, SIZE >::DecNuMoves(), SgSortedMoves< MOVE, VALUE, SIZE >::Delete(), SgVector< T >::DeleteAt(), SgSortedMoves< MOVE, VALUE, SIZE >::DeleteEqual(), SgSearch::DepthFirstSearch(), SgSearch::DFS(), SgBookBuilder::DoExpansion(), SgMiaiMap::ExecuteMove(), SgUctTree::ExtractSubtree(), SgUctSearch::FindBestChild(), SgUctNode::FirstChild(), SgSearchValue::FromString(), SgVector< std::pair< SgPoint, SgPoint > >::Front(), SgTime::Get(), SgPointSet::PrecompAllPoints::Get(), SgUctSearch::GetValueEstimateRave(), SgRect::Height(), SgVectorOf< std::string >::Include(), SgStatisticsBase< VALUE, COUNT >::Initialize(), SgUctTree::InitializeRaveValue(), SgUctTree::InitializeValue(), SgSearchTracer::InitTracing(), SgVector< T >::Insert(), SgSortedMoves< MOVE, VALUE, SIZE >::Insert(), SgRandom::Int(), SgSList< T, SIZE >::Intersect(), SgPointUtil::InvRotation(), SgPointSet::IsSize(), SgSearch::IteratedSearch(), SgSList< T, SIZE >::Last(), SgNode::LinkTrees(), SgSearch::LookupHash(), SgStatisticsBase< VALUE, COUNT >::Mean(), SgNode::MemCheck(), SgVector< T >::Merge(), SgUctTree::MergeChildren(), SgUctNode::Move(), SgUctSearch::NeedToComputeKnowledge(), SgNodeConstIterator::Next(), SgNodeIterator::Next(), SgNode::NodeInDirection(), SgNode::NodePlayer(), SgMiaiStrategy::OpenThreatMove(), SgVectorIterator< void * >::operator *(), SgSList< T, SIZE >::NonConstIterator::operator *(), SgSList< T, SIZE >::Iterator::operator *(), SgSetIterator::operator *(), SgNodeConstIterator::operator *(), SgNodeIterator::operator *(), SgSonNodeConstIterator::operator *(), SgSonNodeIterator::operator *(), SgConnComp8Iterator::operator *(), SgConnCompIterator::operator *(), SgArray< T, SIZE >::NonConstIterator::operator *(), SgArray< T, SIZE >::Iterator::operator *(), SgUctTreeIterator::operator++(), SgRectIterator::operator++(), SgSetIterator::operator++(), SgNodeConstIterator::operator++(), SgNodeIterator::operator++(), SgNb8Iterator::operator++(), SgNb4DiagIterator::operator++(), operator<<(), SgArray< T, SIZE >::operator=(), SgStack< T, SIZE >::operator[](), SgSList< T, SIZE >::operator[](), SgArray< T, SIZE >::operator[](), SgProp::OpponentProp(), SgMiaiPairUtil::Other(), SgBalancer::Play(), SgProp::Player(), SgNode::Player(), SgProp::PlayerProp(), SgPropUtil::PointToSgfString(), SgStack< T, SIZE >::Pop(), SgVector< T >::PopBack(), SgSList< T, SIZE >::PopBack(), SgVector< T >::PopFront(), SgGameReader::PrintWarnings(), SgProbCut::ProbCut(), SgStack< T, SIZE >::Push(), SgVectorOf< std::string >::PushBack(), SgSList< T, SIZE >::PushBack(), SgVectorOf< std::string >::PushFront(), SgReadPoint::Read(), SgGameReader::ReadGames(), SgSortedArray< T, K, size >::ReduceSizeTo(), SgProp::Register(), SgStatisticsBase< VALUE, COUNT >::Remove(), SgVector< T >::RemoveDuplicates(), SgUctTree::RemoveGameResult(), SgUctTree::RemoveGameResults(), SgUctTree::RemoveRaveValue(), SgSList< T, SIZE >::Resize(), SgPointUtil::Rotate(), SgPointUtil::PointToRow::Row(), SgUctSearch::SelectChild(), SgUctSearch::SetExpandThreshold(), SgUctTree::SetMaxNodes(), SgSortedMoves< MOVE, VALUE, SIZE >::SetMaxNuMoves(), SgTimeRecord::SetMovesLeft(), SgUctNode::SetNuChildren(), SgUctSearch::SetNumberPlayouts(), SgUctSearch::SetNumberThreads(), SgUctTree::SetPosCount(), SgUctSearch::SetThreadStateFactory(), SgVector< T >::SetTo(), SgSearch::SetTracer(), SgArray< T, SIZE >::SgArray(), SgDebug(), SgPropUtil::SgfStringToPoint(), SgNb4DiagIterator::SgNb4DiagIterator(), SgNb4Iterator::SgNb4Iterator(), SgNb8Iterator::SgNb8Iterator(), SgReserveMarker::SgReserveMarker(), SgSearchHashData::SgSearchHashData(), SgSearchValue::SgSearchValue(), SgSideIterator::SgSideIterator(), SgSortedMoves< MOVE, VALUE, SIZE >::SgSortedMoves(), SgTimeRecord::SgTimeRecord(), SgUctChildIterator::SgUctChildIterator(), SgNode::ShortestPathTo(), SgSortedMoves< MOVE, VALUE, SIZE >::ShuffleInterval(), SgVector< T >::SortedRemoveDuplicates(), SgSearchTracer::StartOfDepth(), SgTimer::Stop(), SgSearch::StoreHash(), SgUctTree::Swap(), SgUctSearch::ThreadState(), TimeModeToString(), SgPointSet::Toggle(), SgStack< T, SIZE >::Top(), SgVector< std::pair< SgPoint, SgPoint > >::TopNth(), SgSearchTracer::TraceValue(), SgNode::TreeIndex(), SgSearch::TryMove(), SgMiaiStrategy::UndoMove(), SgUctSearch::UpdateRaveValues(), SgPropInt::Value(), SgRect::Width(), SgAssertRestored< T >::~SgAssertRestored(), and SgNode::~SgNode().

#define SG_ASSERTRANGE ( i,
from,
to   )     SG_ASSERT(i >= from && i <= to)

Definition at line 103 of file SgSystem.h.

Referenced by SgSortedMoves< MOVE, VALUE, SIZE >::AssertIndexRange(), SgPointSet::CheckedContains(), SgNb8Iterator::Direction(), SgRandom::Int(), SgConnComp8Iterator::SgConnComp8Iterator(), and SgConnCompIterator::SgConnCompIterator().

#define SG_ATTR_ALWAYS_INLINE

Definition at line 50 of file SgSystem.h.

#define SG_ATTR_FLATTEN

Definition at line 57 of file SgSystem.h.

#define SG_ATTR_NOINLINE

Definition at line 49 of file SgSystem.h.

#define SG_DEBUG_ONLY (  ) 

Avoid compiler warnings for variables used only if NDEBUG is not defined.

This macro is more portable than using a #pragma directive.

Definition at line 34 of file SgSystem.h.

Referenced by SgSortedMoves< MOVE, VALUE, SIZE >::AssertIndexRange(), SgTimeRecord::SgTimeRecord(), and SgUctChildIterator::SgUctChildIterator().


Function Documentation

template<class T>
void SG_UNUSED ( const T &   ) 

Avoid compiler warnings for unused variables.

This function is more portable than using a #pragma directive.

Definition at line 26 of file SgSystem.h.

Referenced by SgNodeSearchControl::Abort(), SgTimeSearchControl::Abort(), SgIncrementalStack::AddPoints(), SgEvaluatedMoves::BestMoves(), SgProp::ContainsText(), SgMiaiMap::ConvertToSgMiaiStrategy(), SgSearchValue::FromString(), SgPropPlayer::FromString(), SgPropText::FromString(), SgPropReal::FromString(), SgPropInt::FromString(), SgPropSimple::FromString(), SgPropUnknown::FromString(), SgMpiNullSynchronizer::OnEndSearch(), SgMpiNullSynchronizer::OnStartSearch(), SgMpiNullSynchronizer::OnThreadEndSearch(), SgMpiNullSynchronizer::OnThreadStartSearch(), operator<<(), SgUctTree::RemoveRaveValue(), SgBookBuilder::StartIteration(), SgSearchControl::StartNextIteration(), SgIncrementalStack::SubtractPoints(), SgMpiNullSynchronizer::SynchronizeEarlyPassPossible(), SgMpiNullSynchronizer::SynchronizeMove(), SgMpiNullSynchronizer::SynchronizePassWins(), SgMpiNullSynchronizer::SynchronizeUserAbort(), SgMpiNullSynchronizer::SynchronizeValue(), SgPropPlayer::ToString(), SgPropText::ToString(), SgPropReal::ToString(), SgPropInt::ToString(), SgPropSimple::ToString(), SgPropUnknown::ToString(), and SgMpiNullSynchronizer::WriteStatistics().

void SgHandleAssertion ( const char *  expr,
const char *  file,
int  line 
)

System-specific action when an SG_ASSERT fails.

Set a breakpoint on the next line to drop into the debugger

Definition at line 60 of file SgSystem.cpp.

References AssertionHandlers(), SgAssertionHandler::Run(), and s_assertContinue.

void SgSetUserAbort ( bool  aborted  ) 

Sets the global user abort flag.

This flag should be set to false at the beginning of each user event, e.g. each GUI event or GTP command. Lengthy functions should poll the user abort flag with SgUserAbort and abort, if necessary; they should not reset the flag themselves. It can also be called from a different thread (the abort flag is declared volatile).

Definition at line 74 of file SgSystem.cpp.

References s_userAbort.

void SgSynchronizeThreadMemory (  ) 

Definition at line 134 of file SgSystem.h.

Referenced by SgUctTree::ApplyFilter(), SgUctTree::CreateChildren(), SgUctSearch::CreateChildren(), SgUctSearch::ExpandNode(), SgUctTree::MergeChildren(), SgUctSearch::Search(), and SgUctSearch::SearchLoop().

bool SgUserAbort (  ) 

Poll for user abort.

See also:
SgSetUserAbort.

Definition at line 79 of file SgSystem.cpp.

References s_userAbort.

Referenced by SgSearch::AbortSearch(), SgUctSearch::CheckAbortSearch(), SgUctTree::CopySubtree(), and SgUctSearch::SearchOnePly().


Variable Documentation

const bool SG_CHECK = true

Definition at line 108 of file SgSystem.h.

const bool SG_HEAVYCHECK = SG_CHECK && true

Definition at line 109 of file SgSystem.h.


17 Jun 2010 Doxygen 1.4.7