OpendTect  6.3
odplatform.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: Bert
8  Date: May 2010
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "basicmod.h"
14 #include "enums.h"
15 
16 namespace OD
17 {
18 
24 {
25 public:
26 
27  static const Platform& local();
28 
29  enum Type { Lin32, Lin64, Win32, Win64, Mac };
31 
32  Platform();
33  Platform( Type t )
34  : type_(t) {}
35  Platform( const char* s, bool isshortnm )
36  { set(s,isshortnm); }
37  Platform( bool iswin, bool is32, bool ismac=false )
38  { set(iswin,is32,ismac); }
39  bool operator ==( const Platform& p ) const
40  { return type_ == p.type_; }
41  bool operator ==( const Platform::Type& t ) const
42  { return type_ == t; }
43 
44  const char* longName() const { return TypeDef().getKey(type_); }
45  const char* shortName() const;
46 
47  static bool isValidName(const char*,bool isshortnm);
48  void set(const char*,bool isshortnm);
49  inline void set( bool iswin, bool is32, bool ismac=false )
50  { type_ = ismac ? Mac : (iswin ? (is32 ? Win32 : Win64)
51  : (is32 ? Lin32 : Lin64) ); }
52 
53  inline bool isWindows() const
54  { return type_ == Win32 || type_ == Win64; }
55  inline bool isLinux() const
56  { return type_ == Lin32 || type_ == Lin64; }
57  inline bool isMac() const
58  { return type_ == Mac; }
59 
60  inline bool is32Bits() const
61  { return type_ != Win64 && type_ != Lin64; }
62 
63  inline Type type() const { return type_; }
64  inline Type& type() { return type_; }
65  inline void setType( Type t ) { type_ = t; }
66 
67 protected:
68 
70 
71 };
72 
73 } // namespace
74 
75 
76 #define mPlf(ptyp) OD::Platform(OD::Platform::ptyp)
77 #define mPlfShortName(ptyp) mPlf(ptyp).shortName()
#define mExpClass(module)
Definition: commondefs.h:157
bool is32Bits() const
Definition: odplatform.h:60
Type type_
Definition: odplatform.h:69
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
Type
Definition: odplatform.h:29
Type type() const
Definition: odplatform.h:63
bool isMac() const
Definition: odplatform.h:57
Platform(const char *s, bool isshortnm)
Definition: odplatform.h:35
bool isLinux() const
Definition: odplatform.h:55
Type & type()
Definition: odplatform.h:64
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:188
Definition: odplatform.h:29
void setType(Type t)
Definition: odplatform.h:65
const char * longName() const
Definition: odplatform.h:44
Platform or Operating System.
Definition: odplatform.h:23
OpendTect.
Definition: commontypes.h:25
bool isWindows() const
Definition: odplatform.h:53
Platform(bool iswin, bool is32, bool ismac=false)
Definition: odplatform.h:37

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