Main Lemma Repository

Data.h 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 03/01/2010
  9. @version $Id: data.h 193 2014-11-10 23:51:41Z tirons $
  10. **/
  11. #ifndef _DATA_H_INC
  12. #define _DATA_H_INC
  13. #include "LemmaObject.h"
  14. namespace Lemma {
  15. // ===================================================================
  16. // Class: Data
  17. /** \brief Abstract class for data from an instrument
  18. * \details Currently provides no functionality, but this will likely
  19. * change in the near future.
  20. */
  21. // ===================================================================
  22. class Data : public LemmaObject {
  23. friend std::ostream &operator<<(std::ostream &stream,
  24. const Data &ob);
  25. public:
  26. // ==================== LIFECYCLE =======================
  27. /** Copies the *structure* of this class to a new object and
  28. * returns a pointer to this object. Memory management is
  29. * the responsibility of the receiver!. The data values are
  30. * not copied.
  31. */
  32. virtual Data* Clone()=0;
  33. // ==================== OPERATORS =======================
  34. // ==================== OPERATIONS =======================
  35. /** Clears all data arrays and containers
  36. */
  37. virtual void Zero()=0;
  38. /** Data2 needs to be compatible with the calling class. Data2 will
  39. * be cast into the calling class type. Most of the time this
  40. * cast will not perform anything, as Data2 *is* the same type
  41. * as the calling class.
  42. */
  43. virtual Real Norm(Data* Data2)=0;
  44. // ==================== ACCESS =======================
  45. // ==================== INQUIRY =======================
  46. /** Returns the name of the underlying class, similiar to Python's type */
  47. virtual inline std::string GetName() const {
  48. return CName;
  49. }
  50. protected:
  51. // ==================== LIFECYCLE =======================
  52. /** Default protected constructor. */
  53. Data ( );
  54. /** Default protected constructor. */
  55. ~Data ();
  56. // ==================== DATA MEMBERS =========================
  57. private:
  58. /** ASCII string representation of the class name */
  59. static constexpr auto CName = "Data";
  60. }; // ----- end of class Data -----
  61. } // ----- end of Lemma name -----
  62. #endif // ----- #ifndef _DATA_H_INC -----
  63. /* vim: set tabstop=4 expandtab: */
  64. /* vim: set filetype=cpp: */