Skip to content

Commit

Permalink
put debug messages under debug #ifndef NDEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
pratheekshasn committed Sep 11, 2023
1 parent b2f5ba0 commit 3b17a6c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pointer_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ namespace grpc_labview
auto storedPtr = _registeredPointers.find(ptr);
if (storedPtr == _registeredPointers.end())
{
#ifndef NDEBUG
std::cerr << "ERROR: THIS POINTER IS NOT REGISTERED" << std::endl;
#endif // ! NDEBUG
if (status != nullptr)
{
*status = -1;
Expand All @@ -83,7 +85,9 @@ namespace grpc_labview
std::shared_ptr<TDerivedType> derivedPtr = std::dynamic_pointer_cast<TDerivedType>(storedPtr->second);
if (!derivedPtr)
{
#ifndef NDEBUG
std::cerr << "ERROR: CASTING POINTER TO MORE SPECIFIC TYPE FAILED" << std::endl;
#endif // ! NDEBUG
if (status != nullptr)
{
*status = -1;
Expand All @@ -100,7 +104,9 @@ namespace grpc_labview
std::lock_guard<std::mutex> lock(_mutex);
if (!ptr)
{
#ifndef NDEBUG
std::cerr << "ERROR: CANNOT REGISTER A NULL POINTER" << std::endl;
#endif // ! NDEBUG
return nullptr;
}

Expand All @@ -117,7 +123,9 @@ namespace grpc_labview
std::lock_guard<std::mutex> lock(_mutex);
if (!ptr)
{
#ifndef NDEBUG
std::cerr << "ERROR: CANNOT REGISTER A NULL POINTER" << std::endl;
#endif // ! NDEBUG
return nullptr;
}

Expand All @@ -134,4 +142,4 @@ namespace grpc_labview
std::lock_guard<std::mutex> lock(_mutex);
return _registeredPointers.erase(ptr) > 0;
}
}
}

0 comments on commit 3b17a6c

Please sign in to comment.