OpendTect  6.6
tableascio.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H.Bril
8  Date: Nov 2006
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "generalmod.h"
15 #include "bufstringset.h"
16 #include "repos.h"
17 #include "od_iosfwd.h"
18 #include "uistring.h"
19 class UnitOfMeasure;
20 
21 namespace Table
22 {
23 
24 class FormatDesc;
25 class ImportHandler;
26 class ExportHandler;
27 class Converter;
28 class FileFormatRepository;
29 
31 
32 
41 mExpClass(General) AscIO
43 public:
44 
45  AscIO( const FormatDesc& fd )
46  : fd_(fd)
47  , imphndlr_(0)
48  , exphndlr_(0)
49  , cnvrtr_(0)
50  , needfullline_(false)
51  , hdrread_(false) { units_.allowNull(true);}
52  virtual ~AscIO();
53 
54  const FormatDesc& desc() const { return fd_; }
55  uiString errMsg() const { return errmsg_; }
56  uiString warnMsg() const { return warnmsg_; }
57 
58 protected:
59 
60  const FormatDesc& fd_;
61  mutable uiString errmsg_;
62  mutable uiString warnmsg_;
68  mutable bool hdrread_;
71 
72  friend class AscIOImp_ExportHandler;
73  friend class AscIOExp_ImportHandler;
74 
75  void emptyVals() const;
76  void addVal(const char*,const UnitOfMeasure*) const;
77  bool getHdrVals(od_istream&) const;
80  bool putHdrVals(od_ostream&) const;
82 
83  BufferString getText(int) const;
84  int getIntValue(int,int udf=mUdf(int)) const;
85  float getFValue(int,float udf=mUdf(float)) const;
86  double getDValue(int,double udf=mUdf(double)) const;
87  // For more, use Conv:: stuff
88 
89  Coord getPos(int xfld,int yfld,
90  double udf=mUdf(double)) const;
91  //Return CRS converted Coord
92  Coord3 getPos3D(int xfld,int yfld, int zfld,
93  double udf=mUdf(double)) const;
94  BinID getBinID(int xfld,int yfld,
95  double udf=mUdf(double)) const;
96 
97  int formOf(bool hdr,int iinf) const;
98  int columnOf(bool hdr,int iinf,int ielem) const;
99 
100 public:
101  mDeprecated ("Use getFValue")
102  float getfValue(int idx,float udf=mUdf(float)) const
103  { return getFValue( idx, udf ); }
104  mDeprecated ("Use getDValue")
105  double getdValue(int idx,double udf=mUdf(double)) const
106  { return getDValue( idx, udf ); }
107  mDeprecated ("Use getText")
108  const char* text(int ifld) const { return getText(ifld); }
109 };
110 
111 
116 {
117 public:
118 
120  void getFormats(const char* grp,BufferStringSet&) const;
121 
122  const IOPar* get(const char* grp,const char* nm) const;
123  void set(const char* grp,const char* nm,
126 
127  bool write(Repos::Source) const;
128 
129 protected:
130 
132  void addFromFile(const char*,Repos::Source);
133  const char* grpNm(int) const;
134  int gtIdx(const char*,const char*) const;
135 
136  struct Entry
137  {
138  Entry( Repos::Source src, IOPar* iop )
139  : iopar_(iop), src_(src) {}
141 
144  };
145 
147 
148  mGlobal(General) friend FileFormatRepository& FFR();
149 
150 };
151 
152 
153 }; // namespace Table
154 
155 
Repos::Source
Source
Definition: repos.h:24
Table::FileFormatRepository::set
void set(const char *grp, const char *nm, IOPar *, Repos::Source)
IOPar* will become mine; set to null to remove.
Coord3
A cartesian coordinate in 3D space.
Definition: coord.h:72
Table::AscIO::getText
BufferString getText(int) const
Table::AscIO::imphndlr_
ImportHandler * imphndlr_
Definition: tableascio.h:65
Table::AscIO::errMsg
uiString errMsg() const
Definition: tableascio.h:55
Table::FileFormatRepository::FileFormatRepository
FileFormatRepository()
uistring.h
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
ObjectSet< const UnitOfMeasure >
BufferStringSet
Set of BufferString objects.
Definition: bufstringset.h:26
Table::FileFormatRepository::grpNm
const char * grpNm(int) const
Table::AscIO::units_
ObjectSet< const UnitOfMeasure > units_
Definition: tableascio.h:64
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
od_istream
OD class for stream read common access to the std::cin.
Definition: od_istream.h:24
Table::FileFormatRepository::get
const IOPar * get(const char *grp, const char *nm) const
Table::FileFormatRepository::FFR
friend FileFormatRepository & FFR()
Table::AscIO::getBinID
BinID getBinID(int xfld, int yfld, double udf=mUdf(double)) const
Table::FileFormatRepository::gtIdx
int gtIdx(const char *, const char *) const
Table
Definition: geom2dascio.h:20
Table::AscIO::warnMsg
uiString warnMsg() const
Definition: tableascio.h:56
Table::AscIO::getDValue
double getDValue(int, double udf=mUdf(double)) const
Table::AscIO::putNextBodyVals
bool putNextBodyVals(od_ostream &) const
Table::AscIO::~AscIO
virtual ~AscIO()
Table::AscIO::cnvrtr_
Converter * cnvrtr_
Definition: tableascio.h:67
Table::AscIO::fd_
const FormatDesc & fd_
Definition: tableascio.h:60
Table::FileFormatRepository::Entry
Definition: tableascio.h:137
Table::AscIO::warnmsg_
uiString warnmsg_
Definition: tableascio.h:62
BinID
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:31
Coord
A cartesian coordinate in 2D space.
Definition: coord.h:25
Table::AscIO::errmsg_
uiString errmsg_
Definition: tableascio.h:61
Table::FileFormatRepository::Entry::Entry
Entry(Repos::Source src, IOPar *iop)
Definition: tableascio.h:138
Table::AscIO::getPos3D
Coord3 getPos3D(int xfld, int yfld, int zfld, double udf=mUdf(double)) const
mDeprecated
#define mDeprecated(msg)
Definition: plfdefs.h:215
Table::AscIO::hdrread_
bool hdrread_
Definition: tableascio.h:68
Table::AscIO::desc
const FormatDesc & desc() const
Definition: tableascio.h:54
Table::FFR
FileFormatRepository & FFR()
Table::FileFormatRepository::getFormats
void getFormats(const char *grp, BufferStringSet &) const
Table::ExportHandler
Definition: tableconv.h:55
Table::AscIO::columnOf
int columnOf(bool hdr, int iinf, int ielem) const
Table::AscIO::emptyVals
void emptyVals() const
Table::FileFormatRepository::Entry::~Entry
~Entry()
Table::AscIO::needfullline_
bool needfullline_
Definition: tableascio.h:69
Table::FileFormatRepository::getGroups
void getGroups(BufferStringSet &) const
Table::ImportHandler
Definition: tableconv.h:24
Table::FileFormatRepository::entries_
ObjectSet< Entry > entries_
Definition: tableascio.h:146
Table::FileFormatRepository::Entry::iopar_
IOPar * iopar_
Definition: tableascio.h:142
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
Table::FileFormatRepository
Holds system- and user-defined formats for different data types ('groups')
Definition: tableascio.h:116
UnitOfMeasure
Unit of Measure.
Definition: unitofmeasure.h:35
bufstringset.h
Table::Converter
Definition: tableconv.h:84
uiString
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
Table::AscIO::getIntValue
int getIntValue(int, int udf=mUdf(int)) const
od_iosfwd.h
Table::AscIO::vals_
BufferStringSet vals_
Definition: tableascio.h:63
Table::AscIO::putHdrVals
bool putHdrVals(od_ostream &) const
Table::AscIO::mODTextTranslationClass
mODTextTranslationClass(AscIO)
MPE::errmsg_
BufferString errmsg_
Definition: horizontracker.h:118
Table::AscIO::mDeprecated
mDeprecated("Use getFValue") float getfValue(int idx
Table::AscIO::fullline_
BufferStringSet fullline_
Definition: tableascio.h:70
Table::AscIO::getNextBodyVals
int getNextBodyVals(od_istream &) const
Executor convention.
Table::FileFormatRepository::Entry::src_
Repos::Source src_
Definition: tableascio.h:143
Table::AscIO::getHdrVals
bool getHdrVals(od_istream &) const
mUdf
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
repos.h
Table::AscIO::formOf
int formOf(bool hdr, int iinf) const
Table::FileFormatRepository::write
bool write(Repos::Source) const
Table::FormatDesc
description of input our output data content
Definition: tabledef.h:220
Table::AscIO::addVal
void addVal(const char *, const UnitOfMeasure *) const
Table::AscIO::getPos
Coord getPos(int xfld, int yfld, double udf=mUdf(double)) const
Table::AscIO::exphndlr_
ExportHandler * exphndlr_
Definition: tableascio.h:66
Table::AscIO::AscIO
AscIO(const FormatDesc &fd)
Definition: tableascio.h:45
od_ostream
OD class for stream write common access to the user log file, or std::cout in other than od_main.
Definition: od_ostream.h:26
Table::AscIO::getFValue
float getFValue(int, float udf=mUdf(float)) const
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
Table::AscIO
Ascii I/O using Format Description.
Definition: tableascio.h:42
Table::FileFormatRepository::addFromFile
void addFromFile(const char *, Repos::Source)

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021