ErrorControlAssert.h 1.69 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
//============================================================================
//  Copyright (c) Kitware, Inc.
//  All rights reserved.
//  See LICENSE.txt for details.
//  This software is distributed WITHOUT ANY WARRANTY; without even
//  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
//  PURPOSE.  See the above copyright notice for more information.
//
//  Copyright 2014 Sandia Corporation.
//  Copyright 2014 UT-Battelle, LLC.
11
//  Copyright 2014 Los Alamos National Security.
12 13 14 15 16 17 18 19
//
//  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
//  the U.S. Government retains certain rights in this software.
//
//  Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
//  Laboratory (LANL), the U.S. Government retains certain rights in
//  this software.
//============================================================================
20 21
#ifndef vtk_m_cont_ErrorControlAssert_h
#define vtk_m_cont_ErrorControlAssert_h
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

#include <vtkm/Types.h>
#include <vtkm/cont/ErrorControl.h>

#include <sstream>

namespace vtkm {
namespace cont {

/// This error is thrown whenever VTKM_ASSERT_CONT fails.
///
class ErrorControlAssert : public vtkm::cont::ErrorControl
{
public:
  ErrorControlAssert(const std::string &file,
                     vtkm::Id line,
                     const std::string &condition)
    : ErrorControl(), File(file), Line(line), Condition(condition)
  {
    std::stringstream message;
    message << this->File << ":" << this->Line
            << ": Assert Failed (" << this->Condition << ")";
    this->SetMessage(message.str());
  }

private:
  std::string File;
  vtkm::Id Line;
  std::string Condition;
};

}
}

56
#endif //vtk_m_cont_ErrorControlAssert_h