Main Lemma Repository
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

GridReader.h 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. /**
  7. @file
  8. @date 09/23/2013 11:25:11 AM
  9. @version $Id$
  10. @author Trevor Irons (ti)
  11. @email Trevor.Irons@xri-geo.com
  12. @copyright Copyright (c) 2013, XRI Geophysics, LLC
  13. @copyright Copyright (c) 2013, Trevor Irons
  14. **/
  15. #ifndef GRIDREADER_INC
  16. #define GRIDREADER_INC
  17. #include "LemmaObject.h"
  18. #include "Grid.h"
  19. namespace Lemma {
  20. /**
  21. \ingroup LemmaCore
  22. \brief Abstract class for grid readers.
  23. \details Provides a consistent interface for reading grid files in Lemma.
  24. */
  25. class GridReader : public LemmaObject {
  26. friend std::ostream &operator << (std::ostream &stream, const GridReader &ob) {
  27. stream << ob.Serialize() << "\n---\n"; // End of doc --- as a direct stream should encapulste thingy
  28. return stream;
  29. }
  30. public:
  31. // ==================== LIFECYCLE =======================
  32. // ==================== OPERATORS =======================
  33. // ==================== OPERATIONS =======================
  34. virtual void ReadASCIIGridFile( const std::string& name )=0;
  35. virtual std::shared_ptr< Grid > GetGrid( ) const =0;
  36. // ==================== ACCESS =======================
  37. // ==================== INQUIRY =======================
  38. /** Returns the name of the underlying class, similiar to Python's type */
  39. virtual std::string GetName() const = 0;
  40. protected:
  41. // ==================== LIFECYCLE =======================
  42. /** Default protected constructor, use New */
  43. GridReader ( const ctor_key& key ) : LemmaObject( key ) {
  44. }
  45. /** Default protected constructor, use New */
  46. GridReader ( const YAML::Node& node, const ctor_key& key ) : LemmaObject( node, key ) {
  47. }
  48. /** Default protected constructor, use Delete */
  49. ~GridReader () {
  50. }
  51. private:
  52. /** ASCII string representation of the class name */
  53. static constexpr auto CName = "GridReader";
  54. // ==================== DATA MEMBERS =========================
  55. }; // ----- end of class GridReader -----
  56. } // ----- end of Lemma name -----
  57. #endif // ----- #ifndef GRIDREADER_INC -----