Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Classes | Defines | Functions | Variables

SgSystem.h File Reference

System specific definitions for SmartGo. More...

#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

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.


Define Documentation

#define OTHER_BYTE_ORDER   0

Definition at line 61 of file SgSystem.h.

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

Definition at line 88 of file SgSystem.h.

Referenced by SgStatisticsVltBase< VALUE, COUNT >::Add(), 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(), SgArrayAssign< T *, SIZE >::Assign(), SgArrayAssign< bool, SIZE >::Assign(), SgArrayAssign< int, SIZE >::Assign(), SgArrayAssign< T, SIZE >::Assign(), SgVector< void * >::Back(), SgVector< void * >::BackAndPop(), SgSortedMoves< MOVE, VALUE, SIZE >::BestValue(), SgBoardConst::BoardConstImpl::BoardConstImpl(), SgBWSet::Both(), 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< void * >::Front(), SgTime::Get(), SgPointSet::PrecompAllPoints::Get(), SgUctSearch::GetValueEstimateRave(), SgRect::Height(), SgVectorOf< std::string >::Include(), SgStatisticsVltBase< VALUE, COUNT >::Initialize(), SgStatisticsBase< VALUE, COUNT >::Initialize(), SgUctTree::InitializeRaveValue(), SgUctTree::InitializeValue(), SgSearchTracer::InitTracing(), SgVector< T >::Insert(), SgSortedMoves< MOVE, VALUE, SIZE >::Insert(), SgRandom::Int(), SgArrayList< T, SIZE >::Intersect(), SgPointUtil::InvRotation(), SgPointSet::IsSize(), SgSearch::IteratedSearch(), SgArrayList< T, SIZE >::Last(), SgNode::LinkTrees(), SgSearch::LookupHash(), SgStatisticsVltBase< VALUE, COUNT >::Mean(), 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*(), SgSetIterator::operator*(), SgNodeConstIterator::operator*(), SgNodeIterator::operator*(), SgSonNodeConstIterator::operator*(), SgSonNodeIterator::operator*(), SgConnComp8Iterator::operator*(), SgConnCompIterator::operator*(), SgArrayList< T, SIZE >::NonConstIterator::operator*(), SgArrayList< T, SIZE >::Iterator::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[](), SgArrayList< 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(), SgArrayList< T, SIZE >::PopBack(), SgVector< T >::PopFront(), SgGameReader::PrintWarnings(), SgProbCut::ProbCut(), SgStack< T, SIZE >::Push(), SgVectorOf< std::string >::PushBack(), SgVector< void * >::PushBack(), SgArrayList< 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(), SgArrayList< T, SIZE >::Resize(), SgPointUtil::Rotate(), SgPointUtil::PointToRow::Row(), SgSearch::SearchEngine(), SgUctSearch::SelectChild(), SgUctTree::SetChildren(), SgUctSearch::SetExpandThreshold(), SgUctTree::SetKnowledgeCount(), SgUctTree::SetMaxNodes(), SgSortedMoves< MOVE, VALUE, SIZE >::SetMaxNuMoves(), SgTimeRecord::SetMovesLeft(), SgUctNode::SetNuChildren(), SgUctSearch::SetNumberPlayouts(), SgUctSearch::SetNumberThreads(), SgUctTree::SetPosCount(), SgUctTree::SetProvenType(), 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(), SgRandom::SmallInt(), SgVector< T >::SortedRemoveDuplicates(), SgSearchTracer::StartOfDepth(), SgTimer::Stop(), SgSearch::StoreHash(), SgUctTree::Swap(), SgUctSearch::ThreadState(), SgPointSet::Toggle(), SgStack< T, SIZE >::Top(), SgVector< void * >::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)
#define SG_ATTR_ALWAYS_INLINE

Definition at line 47 of file SgSystem.h.

#define SG_ATTR_FLATTEN

Definition at line 54 of file SgSystem.h.

#define SG_ATTR_NOINLINE

Definition at line 46 of file SgSystem.h.

#define SG_DEBUG_ONLY (   x  ) 

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 31 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 &   ) 
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 57 of file SgSystem.cpp.

References cerr, 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 71 of file SgSystem.cpp.

void SgSynchronizeThreadMemory (  ) 
bool SgUserAbort (  ) 

Poll for user abort.

See also:
SgSetUserAbort.

Definition at line 76 of file SgSystem.cpp.

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


Variable Documentation

const bool SG_CHECK = true

Definition at line 103 of file SgSystem.h.

const bool SG_HEAVYCHECK = SG_CHECK && true

Definition at line 104 of file SgSystem.h.


Sun Mar 13 2011 Doxygen 1.7.1