Surface NMR forward modelling
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

MerlinObject.h 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 08/28/2017 11:40:40 AM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2017, University of Utah
  15. * @copyright Copyright (c) 2017, Lemma Software, LLC
  16. */
  17. #ifndef MERLINOBJECT_INC
  18. #define MERLINOBJECT_INC
  19. #pragma once
  20. #include "LemmaObject.h"
  21. #include "LemmaObject.h"
  22. #include "MerlinConfig.h"
  23. namespace Lemma {
  24. /**
  25. * \ingroup Merlin
  26. * \brief Abstract base class for all of Merlin
  27. * \details
  28. */
  29. class MerlinObject : public LemmaObject {
  30. friend std::ostream &operator<<(std::ostream &stream, const MerlinObject &ob);
  31. protected:
  32. /*
  33. * This key is used to lock the constructor. It is protected so that inhereted
  34. * classes also have the key to contruct their base class.
  35. */
  36. public:
  37. // ==================== LIFECYCLE =======================
  38. /**
  39. * Default constructor.
  40. * @note This method is locked, and cannot be called directly.
  41. * The reason that the method is public is to enable the use
  42. * of make_shared whilst enforcing the use of shared_ptr,
  43. * in c++-17, this curiosity may be resolved.
  44. * @see MerlinObject::NewSP
  45. */
  46. explicit MerlinObject ( );
  47. /**
  48. * DeSerializing constructor.
  49. * @note This method is locked, and cannot be called directly.
  50. * The reason that the method is public is to enable the use
  51. * of make_shared whilst enforcing the use of shared_ptr,
  52. * in c++-17, this curiosity may be resolved.
  53. * @see MerlinObject::DeSerialize
  54. */
  55. MerlinObject ( const YAML::Node& node );
  56. /**
  57. * Default destructor.
  58. * @note This method should never be called due to the mandated
  59. * use of smart pointers. It is necessary to keep the method
  60. * public in order to allow for the use of the more efficient
  61. * make_shared constructor.
  62. */
  63. virtual ~MerlinObject ();
  64. /**
  65. * Uses YAML to serialize this object.
  66. * @return a YAML::Node
  67. * @see MerlinObject::DeSerialize
  68. */
  69. virtual YAML::Node Serialize() const ;
  70. /*
  71. * Factory method for generating concrete class.
  72. * @return a std::shared_ptr of type MerlinObject
  73. */
  74. static std::shared_ptr< MerlinObject > NewSP();
  75. /**
  76. * Constructs an MerlinObject object from a YAML::Node.
  77. * @see MerlinObject::Serialize
  78. */
  79. static std::shared_ptr<MerlinObject> DeSerialize(const YAML::Node& node);
  80. // ==================== OPERATORS =======================
  81. // ==================== OPERATIONS =======================
  82. // ==================== ACCESS =======================
  83. // ==================== INQUIRY =======================
  84. /**
  85. * Returns the name of the underlying class, similiar to Python's type
  86. * @return string of class name
  87. */
  88. virtual inline std::string GetName() const {
  89. return CName;
  90. }
  91. protected:
  92. // ==================== LIFECYCLE =======================
  93. /** Copy is disabled */
  94. MerlinObject( const MerlinObject& ) = delete;
  95. // ==================== DATA MEMBERS =========================
  96. private:
  97. /** ASCII string representation of the class name */
  98. static constexpr auto CName = "MerlinObject";
  99. }; // ----- end of class MerlinObject -----
  100. } // ----- end of namespace Lemma ----
  101. /* vim: set tabstop=4 expandtab: */
  102. /* vim: set filetype=cpp: */
  103. #endif // ----- #ifndef MERLINOBJECT_INC -----