Surface NMR forward modelling
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

MerlinObject.h 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. public:
  32. // ==================== LIFECYCLE =======================
  33. /**
  34. * Default constructor.
  35. * @note This method is locked, and cannot be called directly.
  36. * The reason that the method is public is to enable the use
  37. * of make_shared whilst enforcing the use of shared_ptr,
  38. * in c++-17, this curiosity may be resolved.
  39. * @see MerlinObject::NewSP
  40. */
  41. explicit MerlinObject ( const ctor_key& key );
  42. /**
  43. * DeSerializing constructor.
  44. * @note This method is locked, and cannot be called directly.
  45. * The reason that the method is public is to enable the use
  46. * of make_shared whilst enforcing the use of shared_ptr,
  47. * in c++-17, this curiosity may be resolved.
  48. * @see MerlinObject::DeSerialize
  49. */
  50. MerlinObject ( const YAML::Node& node, const ctor_key& key );
  51. /**
  52. * Default destructor.
  53. * @note This method should never be called due to the mandated
  54. * use of smart pointers. It is necessary to keep the method
  55. * public in order to allow for the use of the more efficient
  56. * make_shared constructor.
  57. */
  58. virtual ~MerlinObject ();
  59. /**
  60. * Uses YAML to serialize this object.
  61. * @return a YAML::Node
  62. * @see MerlinObject::DeSerialize
  63. */
  64. virtual YAML::Node Serialize() const ;
  65. /*
  66. * Factory method for generating concrete class.
  67. * @return a std::shared_ptr of type MerlinObject
  68. */
  69. static std::shared_ptr< MerlinObject > NewSP();
  70. /**
  71. * Constructs an MerlinObject object from a YAML::Node.
  72. * @see MerlinObject::Serialize
  73. */
  74. static std::shared_ptr<MerlinObject> DeSerialize(const YAML::Node& node);
  75. // ==================== OPERATORS =======================
  76. // ==================== OPERATIONS =======================
  77. // ==================== ACCESS =======================
  78. // ==================== INQUIRY =======================
  79. /**
  80. * Returns the name of the underlying class, similiar to Python's type
  81. * @return string of class name
  82. */
  83. virtual inline std::string GetName() const {
  84. return CName;
  85. }
  86. protected:
  87. // ==================== LIFECYCLE =======================
  88. /** Copy is disabled */
  89. MerlinObject( const MerlinObject& ) = delete;
  90. // ==================== DATA MEMBERS =========================
  91. private:
  92. /** ASCII string representation of the class name */
  93. static constexpr auto CName = "MerlinObject";
  94. }; // ----- end of class MerlinObject -----
  95. } // ----- end of namespace Lemma ----
  96. /* vim: set tabstop=4 expandtab: */
  97. /* vim: set filetype=cpp: */
  98. #endif // ----- #ifndef MERLINOBJECT_INC -----