OpendTect-6_4  6.4
odplatform.h
Go to the documentation of this file.
1 #ifndef odplatform_h
2 #define odplatform_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: May 2010
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "enums.h"
17 
18 namespace OD
19 {
20 
26 {
27 public:
28 
29  static const Platform& local();
30 
31  enum Type { Lin32, Lin64, Win32, Win64, Mac };
33 
34  Platform();
35  Platform( Type t )
36  : type_(t) {}
37  Platform( const char* s, bool isshortnm )
38  { set(s,isshortnm); }
39  Platform( bool iswin, bool is32, bool ismac=false )
40  { set(iswin,is32,ismac); }
41  bool operator ==( const Platform& p ) const
42  { return type_ == p.type_; }
43  bool operator ==( const Platform::Type& t ) const
44  { return type_ == t; }
45 
46  const char* longName() const { return getTypeString(type_); }
47  const char* shortName() const;
48 
49  static bool isValidName(const char*,bool isshortnm);
50  void set(const char*,bool isshortnm);
51  inline void set( bool iswin, bool is32, bool ismac=false )
52  { type_ = ismac ? Mac : (iswin ? (is32 ? Win32 : Win64)
53  : (is32 ? Lin32 : Lin64) ); }
54 
55  inline bool isWindows() const
56  { return type_ == Win32 || type_ == Win64; }
57  inline bool isLinux() const
58  { return type_ == Lin32 || type_ == Lin64; }
59  inline bool isMac() const
60  { return type_ == Mac; }
61 
62  inline bool is32Bits() const
63  { return type_ != Win64 && type_ != Lin64; }
64 
65  inline Type type() const { return type_; }
66  inline Type& type() { return type_; }
67  inline void setType( Type t ) { type_ = t; }
68 
69 protected:
70 
72 
73 };
74 
75 } // namespace
76 
77 
78 #define mPlf(ptyp) OD::Platform(OD::Platform::ptyp)
79 #define mPlfShortName(ptyp) mPlf(ptyp).shortName()
80 
81 
82 #endif
#define mExpClass(module)
Definition: commondefs.h:160
bool is32Bits() const
Definition: odplatform.h:62
Type type_
Definition: odplatform.h:71
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
Type
Definition: odplatform.h:31
Type type() const
Definition: odplatform.h:65
bool isMac() const
Definition: odplatform.h:59
Platform(const char *s, bool isshortnm)
Definition: odplatform.h:37
bool isLinux() const
Definition: odplatform.h:57
Type & type()
Definition: odplatform.h:66
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:258
Definition: odplatform.h:31
void setType(Type t)
Definition: odplatform.h:67
const char * longName() const
Definition: odplatform.h:46
Platform or Operating System.
Definition: odplatform.h:25
OpendTect.
Definition: commontypes.h:29
bool isWindows() const
Definition: odplatform.h:55
Platform(bool iswin, bool is32, bool ismac=false)
Definition: odplatform.h:39

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