DGtal  1.0.beta
Public Member Functions | Private Member Functions | Private Attributes
DGtal::Trace Class Reference

#include <DGtal/base/Trace.h>

Collaboration diagram for DGtal::Trace:
[legend]

Public Member Functions

 Trace (TraceWriter &writer)
 
 ~Trace ()
 
void reset ()
 
void beginBlock (const std::string &keyword="")
 
double endBlock ()
 
std::ostream & info ()
 
std::ostream & warning ()
 
std::ostream & error ()
 
std::ostream & emphase ()
 
void progressBar (const double currentValue, const double maximalValue)
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Private Member Functions

 Trace (const Trace &other)
 
Traceoperator= (const Trace &other)
 

Private Attributes

unsigned int myCurrentLevel
 
std::string myCurrentPrefix
 
std::stack< std::string > myKeywordStack
 
TraceWritermyWriter
 
std::stack< Clock * > myClockStack
 
int myProgressBarCurrent
 
unsigned int myProgressBarRotation
 
bool myStyle
 

Detailed Description

implementation of basic methods to trace out messages with indentation levels.

Description of class 'Trace'

Aim:Trace objects use a TraceWriter to switch between terminal and file outputs. Methods postfixed with "Debug" contain no code if the compilation flag DEBUG is not set.

For usage examples, see the testtrace.cpp file.

See also
testTrace.cpp
Todo:
Create a default constructor on TraceWriterTerm(std::cerr)

Definition at line 73 of file Trace.h.

Constructor & Destructor Documentation

DGtal::Trace::Trace ( TraceWriter writer)

Constructor.

Parameters
writerthe output writer that will receive the traces.
DGtal::Trace::~Trace ( )

Destructor.

DGtal::Trace::Trace ( const Trace other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

void DGtal::Trace::beginBlock ( const std::string &  keyword = "")

Enter a new block and increase the indentation level

Parameters
keywordcontains a label to the new block
Examples:
dec/exampleDECSurface.cpp, dec/exampleDiscreteExteriorCalculusChladni.cpp, dec/exampleDiscreteExteriorCalculusSolve.cpp, dec/exampleDiscreteExteriorCalculusUsage.cpp, dec/exampleHeatLaplace.cpp, dec/examplePropagation.cpp, doc-examples/kernelDomain.cpp, doc-examples/range.cpp, examples/tutorial-examples/polyhedralizer.cpp, geometry/curves/convex-and-concave-parts.cpp, geometry/curves/estimation/exampleCurvature.cpp, geometry/curves/exampleAlphaThickSegment.cpp, geometry/curves/exampleAlphaThickSegmentNoisy.cpp, geometry/curves/exampleAlphaThickSegmentTgtCover.cpp, geometry/curves/exampleArithmeticalDSL.cpp, geometry/curves/exampleArithmeticalDSS.cpp, geometry/curves/exampleDSLSubsegment.cpp, geometry/curves/exampleFrechetShortcut.cpp, geometry/curves/exampleGridCurve2d.cpp, geometry/curves/exampleGridCurve3d-2.cpp, geometry/curves/greedy-dss-decomposition.cpp, geometry/curves/greedyAlphaThickDecomposition.cpp, geometry/surfaces/dvcm-3d.cpp, geometry/surfaces/greedy-plane-segmentation-ex2.cpp, geometry/surfaces/greedy-plane-segmentation.cpp, geometry/tools/determinant/exampleInHalfPlane.cpp, geometry/tools/exampleAlphaShape.cpp, geometry/tools/exampleConvexHull2D.cpp, geometry/tools/examplePreimage.cpp, geometry/volumes/distance/distancetransform2D.cpp, geometry/volumes/distance/exampleFMM2D.cpp, geometry/volumes/distance/exampleFMM3D.cpp, geometry/volumes/distance/toricdomainvolumetric.cpp, geometry/volumes/distance/voronoimap2D.cpp, graph/volDistanceTraversal.cpp, images/exampleConstImageAdapter.cpp, images/exampleImageFactoryFromHDF5.cpp, images/exampleRigidtransformation2d.cpp, images/exampleRigidtransformation3d.cpp, images/exampleTiledImage.cpp, images/extract2DImagesFrom3D.cpp, images/extract2DImagesFrom3DandVisu.cpp, images/extract2DSlicesImagesFrom3D.cpp, images/imageBasicSubsampling.cpp, images/raw2HDF5.cpp, io/boards/dgtalBoard2D-1-points.cpp, io/boards/dgtalBoard2D-2-sets.cpp, io/boards/dgtalBoard2D-3-custom-classes.cpp, io/boards/dgtalBoard2D-3-custom-points.cpp, io/boards/dgtalBoard2D-4-colormaps.cpp, io/boards/dgtalBoard3D-1-points.cpp, io/boards/exampleBezierCurve.cpp, io/boards/logoDGtal.cpp, io/viewers/viewer3D-7-planes.cpp, io/viewers/viewer3D-7-stdplane.cpp, io/viewers/viewer3D-7bis-planes.cpp, io/viewers/viewer3D-7bis-stdplane.cpp, shapes/exampleEuclideanShapesDecorator.cpp, shapes/exampleMeshVoxelizer.cpp, shapes/viewMarchingCubes.cpp, shapes/viewPolygonalMarchingCubes.cpp, topology/area-estimation-with-digital-surface.cpp, topology/area-estimation-with-indexed-digital-surface.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-fillContours.cpp, topology/cubical-complex-collapse.cpp, topology/cubical-complex-illustrations.cpp, topology/digitalSetToCubicalComplexes2D.cpp, topology/digitalSurfaceSlice.cpp, topology/frontierAndBoundary.cpp, topology/generateSimplicityTables2D.cpp, topology/generateSimplicityTables3D.cpp, topology/homotopicThinning3D.cpp, topology/khalimskySpaceScanner.cpp, topology/trackImplicitPolynomialSurfaceToOFF.cpp, topology/volBreadthFirstTraversal.cpp, topology/volMarchingCubes.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, tutorial-examples/2DSliceImageFromVol.cpp, tutorial-examples/AreaSurfaceEstimation-final.cpp, tutorial-examples/FMMErosion.cpp, and tutorial-examples/polyhedralizer.cpp.

Referenced by DGtal::VoxelComplex< KSpace, FixtureObject >::criticalCliques(), DGtal::testImplicitDigitalSurface(), and DGtal::testLightImplicitDigitalSurface().

std::ostream& DGtal::Trace::emphase ( )
double DGtal::Trace::endBlock ( )

Leave a current block, decrease the indentation level and display the associate keyword

Returns
the ellapsed time in the block in milliseconds (Class Clock).
Examples:
dec/exampleDECSurface.cpp, dec/exampleDiscreteExteriorCalculusChladni.cpp, dec/exampleDiscreteExteriorCalculusSolve.cpp, dec/exampleDiscreteExteriorCalculusUsage.cpp, dec/exampleHeatLaplace.cpp, dec/examplePropagation.cpp, doc-examples/kernelDomain.cpp, doc-examples/range.cpp, examples/tutorial-examples/polyhedralizer.cpp, geometry/curves/convex-and-concave-parts.cpp, geometry/curves/estimation/exampleCurvature.cpp, geometry/curves/exampleAlphaThickSegment.cpp, geometry/curves/exampleAlphaThickSegmentNoisy.cpp, geometry/curves/exampleAlphaThickSegmentTgtCover.cpp, geometry/curves/exampleArithmeticalDSL.cpp, geometry/curves/exampleArithmeticalDSS.cpp, geometry/curves/exampleDSLSubsegment.cpp, geometry/curves/exampleFrechetShortcut.cpp, geometry/curves/exampleGridCurve2d.cpp, geometry/curves/exampleGridCurve3d-2.cpp, geometry/curves/greedy-dss-decomposition.cpp, geometry/curves/greedyAlphaThickDecomposition.cpp, geometry/surfaces/dvcm-3d.cpp, geometry/surfaces/greedy-plane-segmentation-ex2.cpp, geometry/surfaces/greedy-plane-segmentation.cpp, geometry/tools/determinant/exampleInHalfPlane.cpp, geometry/tools/exampleAlphaShape.cpp, geometry/tools/exampleConvexHull2D.cpp, geometry/tools/examplePreimage.cpp, geometry/volumes/distance/distancetransform2D.cpp, geometry/volumes/distance/exampleFMM2D.cpp, geometry/volumes/distance/exampleFMM3D.cpp, geometry/volumes/distance/toricdomainvolumetric.cpp, geometry/volumes/distance/voronoimap2D.cpp, graph/volDistanceTraversal.cpp, images/exampleConstImageAdapter.cpp, images/exampleImageFactoryFromHDF5.cpp, images/exampleRigidtransformation2d.cpp, images/exampleRigidtransformation3d.cpp, images/exampleTiledImage.cpp, images/imageBasicSubsampling.cpp, images/raw2HDF5.cpp, io/boards/dgtalBoard2D-1-points.cpp, io/boards/dgtalBoard2D-2-sets.cpp, io/boards/dgtalBoard2D-3-custom-classes.cpp, io/boards/dgtalBoard2D-3-custom-points.cpp, io/boards/dgtalBoard2D-4-colormaps.cpp, io/boards/dgtalBoard3D-1-points.cpp, io/boards/exampleBezierCurve.cpp, io/boards/logoDGtal.cpp, io/viewers/viewer3D-7-planes.cpp, io/viewers/viewer3D-7-stdplane.cpp, io/viewers/viewer3D-7bis-planes.cpp, io/viewers/viewer3D-7bis-stdplane.cpp, shapes/exampleEuclideanShapesDecorator.cpp, shapes/exampleMeshVoxelizer.cpp, shapes/viewMarchingCubes.cpp, shapes/viewPolygonalMarchingCubes.cpp, topology/area-estimation-with-digital-surface.cpp, topology/area-estimation-with-indexed-digital-surface.cpp, topology/ctopo-fillContours.cpp, topology/cubical-complex-collapse.cpp, topology/cubical-complex-illustrations.cpp, topology/digitalSetToCubicalComplexes2D.cpp, topology/digitalSurfaceSlice.cpp, topology/frontierAndBoundary.cpp, topology/generateSimplicityTables2D.cpp, topology/generateSimplicityTables3D.cpp, topology/homotopicThinning3D.cpp, topology/trackImplicitPolynomialSurfaceToOFF.cpp, topology/volBreadthFirstTraversal.cpp, topology/volMarchingCubes.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, tutorial-examples/2DSliceImageFromVol.cpp, tutorial-examples/AreaSurfaceEstimation-final.cpp, tutorial-examples/FMMErosion.cpp, and tutorial-examples/polyhedralizer.cpp.

Referenced by DGtal::VoxelComplex< KSpace, FixtureObject >::criticalCliques(), DGtal::testImplicitDigitalSurface(), and DGtal::testLightImplicitDigitalSurface().

std::ostream& DGtal::Trace::error ( )

Create a string with an indentation prefix for an error trace. the string is postfixed by the keyword "[ERR]"

Returns
the cerr output stream with the prefix
Examples:
examples/tutorial-examples/polyhedralizer.cpp, graph/volDistanceTraversal.cpp, images/exampleImageFactoryFromHDF5.cpp, images/raw2HDF5.cpp, shapes/viewMarchingCubes.cpp, shapes/viewPolygonalMarchingCubes.cpp, topology/ctopo-2-3d.cpp, topology/digitalSurfaceSlice.cpp, topology/frontierAndBoundary.cpp, topology/trackImplicitPolynomialSurfaceToOFF.cpp, topology/volBreadthFirstTraversal.cpp, topology/volMarchingCubes.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, tutorial-examples/2DSliceImageFromVol.cpp, and tutorial-examples/polyhedralizer.cpp.

Referenced by DGtal::ImageFactoryFromHDF5< TImageContainer >::flushImage(), DGtal::Shortcuts< TKSpace >::getKSpace(), DGtal::GenericReader< TContainer, Tdim, TValue >::importWithColorFunctor(), DGtal::GenericReader< TContainer, 2, TValue >::importWithColorFunctor(), DGtal::GenericReader< TContainer, 2, DGtal::uint32_t >::importWithColorFunctor(), DGtal::GenericReader< TContainer, Tdim, TValue >::importWithValueFunctor(), DGtal::GenericReader< TContainer, 3, TValue >::importWithValueFunctor(), DGtal::GenericReader< TContainer, 3, DGtal::uint32_t >::importWithValueFunctor(), DGtal::GenericReader< TContainer, 2, TValue >::importWithValueFunctor(), DGtal::GenericReader< TContainer, 2, DGtal::uint32_t >::importWithValueFunctor(), DGtal::Shortcuts< TKSpace >::makeImplicitShape3D(), DGtal::Shortcuts< TKSpace >::makeLightDigitalSurface(), DGtal::functors::BasicDomainSubSampler< TDomain, TInteger, TValue >::operator()(), and DGtal::ImageFactoryFromHDF5< TImageContainer >::requestImage().

std::ostream& DGtal::Trace::info ( )

Create a string with an indentation prefix for a normal trace.

Returns
the cerr output stream with the prefix
Examples:
dec/exampleDECSurface.cpp, dec/exampleDiscreteExteriorCalculusChladni.cpp, dec/exampleDiscreteExteriorCalculusSolve.cpp, dec/exampleDiscreteExteriorCalculusUsage.cpp, dec/exampleHeatLaplace.cpp, dec/examplePropagation.cpp, doc-examples/kernelDomain.cpp, doc-examples/range.cpp, examples/tutorial-examples/polyhedralizer.cpp, geometry/curves/convex-and-concave-parts.cpp, geometry/curves/estimation/exampleCurvature.cpp, geometry/curves/exampleArithmeticalDSL.cpp, geometry/curves/exampleArithmeticalDSS.cpp, geometry/curves/exampleFrechetShortcut.cpp, geometry/curves/exampleGridCurve2d.cpp, geometry/curves/exampleGridCurve3d-2.cpp, geometry/curves/exampleGridCurve3d.cpp, geometry/surfaces/dvcm-2d-curvature.cpp, geometry/surfaces/dvcm-3d.cpp, geometry/surfaces/greedy-plane-segmentation-ex2.cpp, geometry/surfaces/greedy-plane-segmentation.cpp, geometry/tools/determinant/exampleInHalfPlane.cpp, geometry/tools/exampleAlphaShape.cpp, geometry/tools/exampleConvexHull2D.cpp, geometry/tools/examplePreimage.cpp, geometry/volumes/distance/exampleFMM2D.cpp, geometry/volumes/distance/exampleFMM3D.cpp, geometry/volumes/dvcm-2d.cpp, graph/graphTraversal.cpp, graph/volDistanceTraversal.cpp, images/exampleImageFactoryFromHDF5.cpp, images/exampleTiledImage.cpp, images/imageBasicSubsampling.cpp, images/raw2HDF5.cpp, io/boards/dgtalBoard3D-1-points.cpp, io/boards/exampleBezierCurve.cpp, io/meshFromOFF.cpp, io/viewers/viewer3D-10-interaction.cpp, io/viewers/viewer3D-11-extension.cpp, io/viewers/viewer3D-7-planes.cpp, io/viewers/viewer3D-7-stdplane.cpp, io/viewers/viewer3D-7bis-planes.cpp, io/viewers/viewer3D-7bis-stdplane.cpp, shapes/exampleEuclideanShapesDecorator.cpp, shapes/exampleMeshVoxelizer.cpp, shapes/viewMarchingCubes.cpp, shapes/viewPolygonalMarchingCubes.cpp, topology/area-estimation-with-digital-surface.cpp, topology/area-estimation-with-indexed-digital-surface.cpp, topology/ctopo-2-3d.cpp, topology/cubical-complex-collapse.cpp, topology/digitalSurfaceSlice.cpp, topology/frontierAndBoundary.cpp, topology/khalimskySpaceScanner.cpp, topology/trackImplicitPolynomialSurfaceToOFF.cpp, topology/volBreadthFirstTraversal.cpp, topology/volMarchingCubes.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, tutorial-examples/AreaSurfaceEstimation-final.cpp, tutorial-examples/FMMErosion.cpp, tutorial-examples/polyhedralizer.cpp, and tutorial-examples/volDTGranulo.cpp.

Referenced by DGtal::VoxelComplex< KSpace, FixtureObject >::criticalCliques(), DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::eval(), DGtal::ShortcutsGeometry< TKSpace >::getCTrivialNormalVectors(), DGtal::ShortcutsGeometry< TKSpace >::getIIGaussianCurvatures(), DGtal::ShortcutsGeometry< TKSpace >::getIIMeanCurvatures(), DGtal::ShortcutsGeometry< TKSpace >::getIINormalVectors(), DGtal::ShortcutsGeometry< TKSpace >::getVCMNormalVectors(), DGtal::TiledImage< TImageContainer, TImageFactory, TImageCacheReadPolicy, TImageCacheWritePolicy >::operator()(), DGtal::functors::SphereFittingEstimator< TSurfel, TEmbedder, TNormalVectorEstimatorCache >::pushSurfel(), HodgeTester< Calculus, order >::test(), DerivativeTester< Calculus, order >::test(), DGtal::testImplicitDigitalSurface(), and DGtal::testLightImplicitDigitalSurface().

bool DGtal::Trace::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
Trace& DGtal::Trace::operator= ( const Trace other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.
void DGtal::Trace::progressBar ( const double  currentValue,
const double  maximalValue 
)
void DGtal::Trace::reset ( )

Reset all the variables of the Trace object (indentation level and keyword stack)

void DGtal::Trace::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
std::ostream& DGtal::Trace::warning ( )

Field Documentation

std::stack<Clock*> DGtal::Trace::myClockStack
private

A stack to store the block clocks.

Definition at line 189 of file Trace.h.

unsigned int DGtal::Trace::myCurrentLevel
private

The indentation level.

Definition at line 178 of file Trace.h.

std::string DGtal::Trace::myCurrentPrefix
private

The indentation prefix string.

Definition at line 180 of file Trace.h.

std::stack<std::string> DGtal::Trace::myKeywordStack
private

A stack to store the block keywords.

Definition at line 183 of file Trace.h.

int DGtal::Trace::myProgressBarCurrent
private

Progress bar current position.

Definition at line 192 of file Trace.h.

unsigned int DGtal::Trace::myProgressBarRotation
private

Progress bar rotation position.

Definition at line 195 of file Trace.h.

bool DGtal::Trace::myStyle
private

True if the style has changed.

Definition at line 198 of file Trace.h.

TraceWriter& DGtal::Trace::myWriter
private

A reference to the output writer.

Definition at line 186 of file Trace.h.


The documentation for this class was generated from the following file: