Surface NMR forward modelling
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.

MerlinObject.cpp 3.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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:51:33 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. #include "MerlinObject.h"
  18. namespace Lemma {
  19. // ==================== FRIEND METHODS =====================
  20. std::ostream &operator << (std::ostream &stream, const MerlinObject &ob) {
  21. stream << ob.Serialize() << "\n"; // End of doc ---
  22. return stream;
  23. }
  24. // ==================== LIFECYCLE =======================
  25. //--------------------------------------------------------------------------------------
  26. // Class: MerlinObject
  27. // Method: MerlinObject
  28. // Description: constructor (locked)
  29. //--------------------------------------------------------------------------------------
  30. MerlinObject::MerlinObject ( const ctor_key& key ) : LemmaObject( key ) {
  31. } // ----- end of method MerlinObject::MerlinObject (constructor) -----
  32. //--------------------------------------------------------------------------------------
  33. // Class: MerlinObject
  34. // Method: MerlinObject
  35. // Description: DeSerializing constructor (locked)
  36. //--------------------------------------------------------------------------------------
  37. MerlinObject::MerlinObject (const YAML::Node& node, const ctor_key& key ) : LemmaObject(node, key) {
  38. } // ----- end of method MerlinObject::MerlinObject (constructor) -----
  39. //--------------------------------------------------------------------------------------
  40. // Class: MerlinObject
  41. // Method: NewSP()
  42. // Description: public constructor returing a shared_ptr
  43. //--------------------------------------------------------------------------------------
  44. std::shared_ptr< MerlinObject > MerlinObject::NewSP() {
  45. return std::make_shared< MerlinObject >( ctor_key() );
  46. }
  47. //--------------------------------------------------------------------------------------
  48. // Class: MerlinObject
  49. // Method: ~MerlinObject
  50. // Description: destructor (protected)
  51. //--------------------------------------------------------------------------------------
  52. MerlinObject::~MerlinObject () {
  53. } // ----- end of method MerlinObject::~MerlinObject (destructor) -----
  54. //--------------------------------------------------------------------------------------
  55. // Class: MerlinObject
  56. // Method: Serialize
  57. //--------------------------------------------------------------------------------------
  58. YAML::Node MerlinObject::Serialize ( ) const {
  59. YAML::Node node = LemmaObject::Serialize();
  60. node.SetTag( GetName() );
  61. // FILL IN CLASS SPECIFICS HERE
  62. node["Merlin_VERSION"] = MERLIN_VERSION;
  63. return node;
  64. } // ----- end of method MerlinObject::Serialize -----
  65. //--------------------------------------------------------------------------------------
  66. // Class: MerlinObject
  67. // Method: DeSerialize
  68. //--------------------------------------------------------------------------------------
  69. std::shared_ptr<MerlinObject> MerlinObject::DeSerialize ( const YAML::Node& node ) {
  70. if (node.Tag() != "MerlinObject" ) {
  71. throw DeSerializeTypeMismatch( "MerlinObject", node.Tag());
  72. }
  73. return std::make_shared< MerlinObject > ( node, ctor_key() );
  74. } // ----- end of method MerlinObject::DeSerialize -----
  75. } // ---- end of namespace Lemma ----
  76. /* vim: set tabstop=4 expandtab: */
  77. /* vim: set filetype=cpp: */