# gdcmTrace.h File Reference

Go to the source code of this file.

## Classes
class | gdcm::Trace
| Trace. More...
## Namespaces
namespace | gdcm
## Defines
#define | GDCM_FUNCTION "<unknow>"
#define | gdcmAssertMacro(arg)
| Assert.
#define | gdcmDebugMacro(msg)
| Debug.
#define | gdcmErrorMacro(msg)
| Error this is pretty bad, more than just warning It could mean lost of data, something not handle...
#define | gdcmWarningMacro(msg)
| Warning.

## Define Documentation

#define GDCM_FUNCTION "<unknow>"

#define gdcmAssertMacro | ( | arg |  | ) |

Value:

    {                                                           \
       if( !(arg) )                                             \
       {                                                        \
       std::ostringstream osmacro;                              \
       osmacro << "Assert: In " __FILE__ ", line " << __LINE__  \
               << ", function " << GDCM_FUNCTION                \
               << "\n\n";                                       \
       if( Trace::GetDebugToFile() )                            \
          Trace::GetDebugFile() << osmacro.str() << std::endl;  \
       else                                                     \
          std::cerr << osmacro.str() << std::endl;              \
       assert ( arg );                                          \
       }                                                        \
    }

Assert.

Parameters:

  | arg | argument to test An easy solution to pass also a message is to do: gdcmAssertMacro( "my message" && 2 < 3 )

#define gdcmDebugMacro | ( | msg |  | ) |

Value:

    {                                                           \
       if( Trace::GetDebugFlag() )                              \
       {                                                        \
       std::ostringstream osmacro;                              \
       osmacro << "Debug: In " __FILE__ ", line " << __LINE__   \
               << ", function " << GDCM_FUNCTION << '\n'        \
               << "Last system error was: " << strerror(errno)  \
               << '\n' << msg << "\n\n";                        \
       if( Trace::GetDebugToFile() )                            \
          Trace::GetDebugFile() << osmacro.str() << std::endl;  \
       else                                                     \
          std::cerr << osmacro.str() << std::endl;              \
       }                                                        \
    }

Debug.

Parameters:

  | msg | message part

Referenced by gdcm::ByteValue::ByteValue(), gdcm::ByteValue::GetBuffer(), gdcm::VR::Read(), gdcm::SequenceOfFragments::Read(), gdcm::Item::Read(), and gdcm::ByteValue::SetLength().

#define gdcmErrorMacro | ( | msg |  | ) |

Value:

    {                                                           \
       if( Trace::GetErrorFlag() )                              \
       {                                                        \
       std::ostringstream osmacro;                              \
       osmacro << "Error: In " __FILE__ ", line " << __LINE__   \
               << ", function " << GDCM_FUNCTION << '\n'        \
               << msg << "\n\n";                                \
       if( Trace::GetDebugToFile() )                            \
          Trace::GetDebugFile() << osmacro.str() << std::endl;  \
       else                                                     \
          std::cerr << osmacro.str() << std::endl;              \
       }                                                        \
    }

Error this is pretty bad, more than just warning It could mean lost of data, something not handle...

Parameters:

  | msg | second message part

Referenced by gdcm::FileMetaInformation::Insert(), gdcm::DataSet::Insert(), and gdcm::Item::Read().

#define gdcmWarningMacro | ( | msg |  | ) |

Value:

    {                                                           \
       if( Trace::GetWarningFlag() )                            \
       {                                                        \
       std::ostringstream osmacro;                              \
       osmacro << "Warning: In " __FILE__ ", line " << __LINE__ \
               << ", function " << GDCM_FUNCTION << "\n"        \
               << msg << "\n\n";                                \
       if( Trace::GetDebugToFile() )                            \
          Trace::GetDebugFile() << osmacro.str() << std::endl;  \
       else                                                     \
          std::cerr << osmacro.str() << std::endl;              \
       }                                                        \
    }

Warning.

Parameters:

  | msg | message part

Referenced by gdcm::DataSet::InsertDataElement(), gdcm::SequenceOfItems::Read(), gdcm::SequenceOfFragments::Read(), gdcm::Item::Read(), gdcm::Fragment::Read(), and gdcm::Item::Write().