UMPIRE
Umpire: resource management and provision
Macros.hpp File Reference
#include <cassert>
#include <iostream>
#include <mutex>
#include <sstream>
#include "umpire/config.hpp"
#include "umpire/util/backtrace.hpp"
#include "umpire/util/io.hpp"
#include <stdlib.h>
#include <strings.h>
#include <string>
#include "slic/GenericOutputStream.hpp"
#include "slic/Logger.hpp"

Macros

#define UMPIRE_ASSERT(condition)   assert(condition)
 
#define UMPIRE_LOG(lvl, msg)
 
#define UMPIRE_UNUSED_ARG(x)
 
#define UMPIRE_USE_VAR(x)   static_cast<void>(x)
 
#define UMPIRE_RECORD_BACKTRACE(record)    umpire::util::backtracer<umpire::util::trace_optional>::get_backtrace(record.allocation_backtrace)
 
#define UMPIRE_DEPRECATE(Msg)   __attribute__((deprecated(Msg)))
 
#define UMPIRE_DEPRECATE_ALIAS(Msg)
 
#define UMPIRE_INTERNAL_TRACK(p, s)
 
#define UMPIRE_INTERNAL_UNTRACK(p)   umpire::util::AllocationRecord{};
 

Macro Definition Documentation

◆ UMPIRE_ASSERT

#define UMPIRE_ASSERT (   condition)    assert(condition)

◆ UMPIRE_LOG

#define UMPIRE_LOG (   lvl,
  msg 
)
Value:
{ \
axom::slic::Logger* plog = axom::slic::Logger::getActiveLogger(); \
if (plog == nullptr) { \
static const std::string env_name = "UMPIRE_LOG_LEVEL"; \
plog = axom::slic::Logger::getActiveLogger(); \
char* enval = std::getenv(env_name.c_str()); \
if (enval != NULL) { \
for (int i = 0; i < axom::slic::message::Level::Num_Levels; ++i) { \
if (strcasecmp(enval, axom::slic::message::MessageLevelName[i].c_str()) == 0) { \
break; \
} \
} \
} \
plog->setLoggingMsgLevel(level); \
\
std::string console_format = std::string("[<LEVEL>][<FILE>:<LINE>]: <MESSAGE>\n"); \
axom::slic::LogStream* console = new axom::slic::GenericOutputStream(&std::cerr, console_format); \
plog->addStreamToAllMsgLevels(console); \
} \
std::ostringstream local_msg; \
local_msg << " " << __func__ << " " << msg; \
plog->logMessage(axom::slic::message::lvl, local_msg.str(), std::string(__FILE__), __LINE__); \
}
Level
Definition: Logger.hpp:16
@ Error
Definition: Logger.hpp:17
@ Num_Levels
Definition: Logger.hpp:22
static const char * MessageLevelName[message::Num_Levels]
Definition: Logger.cpp:22
static const char * env_name
Definition: Logger.cpp:19
void initialize()
Definition: Umpire.hpp:24

◆ UMPIRE_UNUSED_ARG

#define UMPIRE_UNUSED_ARG (   x)

◆ UMPIRE_USE_VAR

#define UMPIRE_USE_VAR (   x)    static_cast<void>(x)

◆ UMPIRE_RECORD_BACKTRACE

#define UMPIRE_RECORD_BACKTRACE (   record)     umpire::util::backtracer<umpire::util::trace_optional>::get_backtrace(record.allocation_backtrace)

◆ UMPIRE_DEPRECATE

#define UMPIRE_DEPRECATE (   Msg)    __attribute__((deprecated(Msg)))

◆ UMPIRE_DEPRECATE_ALIAS

#define UMPIRE_DEPRECATE_ALIAS (   Msg)

◆ UMPIRE_INTERNAL_TRACK

#define UMPIRE_INTERNAL_TRACK (   p,
 
)

◆ UMPIRE_INTERNAL_UNTRACK

#define UMPIRE_INTERNAL_UNTRACK (   p)    umpire::util::AllocationRecord{};