OpendTect-6_4  6.4
datachar.h
Go to the documentation of this file.
1 #ifndef datachar_H
2 #define datachar_H
3 
4 /*
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H.Bril
9  Date: Nov 2000
10  Contents: Binary data interpretation
11  RCS: $Id$
12 ________________________________________________________________________
13 
14 */
15 
16 
17 #include "generalmod.h"
18 #include "bindatadesc.h"
19 #include "enums.h"
20 
21 #define mDeclConstr(T,ii,is) \
22 DataCharacteristics( const T* ) \
23 : BinDataDesc(ii,is,sizeof(T)), fmt_(Ieee), littleendian_(__islittle__) {} \
24 DataCharacteristics( const T& ) \
25 : BinDataDesc(ii,is,sizeof(T)), fmt_(Ieee), littleendian_(__islittle__) {}
26 
38 {
39 public:
40 
41  enum Format { Ieee, Ibm };
42 
45 
46  DataCharacteristics( bool ii=false, bool is=true,
47  ByteCount n=N4, Format f=Ieee,
48  bool l=__islittle__ )
49  : BinDataDesc(ii,is,n)
50  , fmt_(f), littleendian_(l) {}
51  DataCharacteristics( const BinDataDesc& bd )
52  : BinDataDesc(bd)
53  , fmt_(Ieee), littleendian_(__islittle__) {}
54 
55  inline bool isIeee() const { return fmt_ == Ieee; }
56 
57  DataCharacteristics( unsigned char c1,unsigned char c2 )
58  { set(c1,c2); }
59  DataCharacteristics( const char* s ) { set(s); }
60 
61  virtual int maxStringifiedSize() const { return 50; }
62  virtual void toString(BufferString&) const;
63  virtual void set(const char*);
64  virtual void dump(unsigned char&,unsigned char&) const;
65  virtual void set(unsigned char,unsigned char);
66 
67  mDeclConstr(signed char,true,true)
68  mDeclConstr(short,true,true)
69  mDeclConstr(int,true,true)
70  mDeclConstr(unsigned char,true,false)
71  mDeclConstr(unsigned short,true,false)
72  mDeclConstr(unsigned int,true,false)
73  mDeclConstr(float,false,true)
74  mDeclConstr(double,false,true)
75  mDeclConstr(od_int64,true,true)
76 
77  bool operator ==( const DataCharacteristics& dc ) const
78  { return isEqual(dc); }
79  bool operator !=( const DataCharacteristics& dc ) const
80  { return !isEqual(dc); }
81  DataCharacteristics& operator =( const BinDataDesc& bd )
82  { BinDataDesc::operator=(bd); return *this; }
83 
84  bool needSwap() const
85  { return (int)nrbytes_ > 1
86  && littleendian_ != __islittle__; }
87 
88  enum UserType { Auto=0, SI8, UI8, SI16, UI16, SI32, UI32, F32,
89  F64, SI64 };
92  UserType userType() const;
93  double getLimitValue(bool max) const;
94 
95 };
96 
97 #undef mDeclConstr
98 
99 #endif
#define mExpClass(module)
Definition: commondefs.h:160
ByteCount
Definition: bindatadesc.h:47
#define od_int64
Definition: plftypes.h:36
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:258
bool isIeee() const
Definition: datachar.h:55
#define __islittle__
Definition: plfdefs.h:136
DataCharacteristics(bool ii=false, bool is=true, ByteCount n=N4, Format f=Ieee, bool l=__islittle__)
Definition: datachar.h:46
bool littleendian_
Definition: datachar.h:44
byte-level data characteristics of stored data.
Definition: datachar.h:37
Format fmt_
Definition: datachar.h:43
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
bool needSwap() const
Definition: datachar.h:84
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Definition: datachar.h:41
DataCharacteristics(const BinDataDesc &bd)
Definition: datachar.h:51
virtual int maxStringifiedSize() const
Definition: datachar.h:61
UserType
Definition: datachar.h:88
DataCharacteristics(const char *s)
Definition: datachar.h:59
Format
Definition: datachar.h:41
Description of binary data.
Definition: bindatadesc.h:43
#define mDeclConstr(T, ii, is)
Definition: datachar.h:21
ManagedObjectSet< BufferString > & operator=(const ObjectSet< BufferString > &)
Export_Basic const char * toString(ViewStyle)
DataCharacteristics(unsigned char c1, unsigned char c2)
Definition: datachar.h:57

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