Main Lemma Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LemmaObject.cpp 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* This file is part of Lemma, a geophysical modelling and inversion API */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /**
  6. @file
  7. @author Trevor Irons
  8. @date 06/25/2009
  9. @version $Id: LemmaObject.cpp 266 2015-04-01 03:24:00Z tirons $
  10. **/
  11. #include "LemmaObject.h"
  12. namespace Lemma {
  13. YAML::Emitter& operator << (YAML::Emitter& out, const LemmaObject& ob) {
  14. out << YAML::BeginMap;
  15. out << YAML::Key <<"Class Name" << YAML::Value << ob.GetName();
  16. return out;
  17. }
  18. // ==================== LIFECYCLE ==============================
  19. // Constructor
  20. LemmaObject::LemmaObject( ) {
  21. }
  22. LemmaObject::LemmaObject(const YAML::Node &node) {
  23. }
  24. // Destructor
  25. LemmaObject::~LemmaObject() {
  26. }
  27. // ==================== OPERATIONS ==============================
  28. // ==================== INQUIRY ==============================
  29. inline std::string LemmaObject::GetName() const {
  30. return CName;
  31. }
  32. // ==================== ACCESS ==============================
  33. // ==================== ACCESS ==============================
  34. // ==================== OPERATORS ==============================
  35. //////////////////////////////////////////////////////////////////////
  36. //////////////////////////////////////////////////////////////////////
  37. DeSerializeTypeMismatch::DeSerializeTypeMismatch(const std::string& expected, const std::string& got) :
  38. runtime_error("DESERIALIZE TYPE MISMATCH") {
  39. std::cerr << "Expected " << expected << " got " << got << std::endl;
  40. }
  41. RequestToReturnNullPointer::
  42. RequestToReturnNullPointer(LemmaObject *ptr) :
  43. runtime_error("REQUEST TO RETURN NULL POINTER"){
  44. std::cerr << "Thrown by instance of "
  45. << ptr->GetName() << std::endl;
  46. }
  47. MatFileCannotBeOpened::
  48. MatFileCannotBeOpened() :
  49. runtime_error("MATFILE CANNOT BE OPENED"){}
  50. AssignmentOutOfBounds::
  51. AssignmentOutOfBounds(LemmaObject *ptr) :
  52. runtime_error("ASSIGNMENT OUT OF BOUNDS"){
  53. std::cerr << "Thrown by instance of "
  54. << ptr->GetName() << std::endl;
  55. }
  56. GenericFileIOError::
  57. GenericFileIOError(LemmaObject *ptr, const std::string &filename) : runtime_error("FILE I/O ERROR"){
  58. std::cerr << std::endl;
  59. std::cerr << "FILE I/O ERROR" << std::endl;
  60. std::cerr << std::endl;
  61. std::cerr << "Thrown by instance of "
  62. << ptr->GetName() << std::endl;
  63. std::cerr << " while trying to access " << filename << std::endl;
  64. std::cerr << std::endl;
  65. }
  66. } // end of namespace Lemma