mach-info.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_mach_info_h)
00024 #define octave_mach_info_h 1
00025 
00026 #include <string>
00027 
00028 class
00029 OCTAVE_API
00030 oct_mach_info
00031 {
00032 protected:
00033 
00034   oct_mach_info (void);
00035 
00036 public:
00037 
00038   enum float_format
00039     {
00040       flt_fmt_unknown,
00041       flt_fmt_ieee_little_endian,
00042       flt_fmt_ieee_big_endian,
00043       flt_fmt_vax_d,
00044       flt_fmt_vax_g,
00045       flt_fmt_cray
00046     };
00047 
00048   static bool instance_ok (void);
00049 
00050   static float_format native_float_format (void);
00051 
00052   static bool words_big_endian (void);
00053 
00054   static bool words_little_endian (void);
00055 
00056   static float_format string_to_float_format (const std::string&);
00057 
00058   static std::string float_format_as_string (float_format);
00059 
00060 private:
00061 
00062   static oct_mach_info *instance;
00063 
00064   static void cleanup_instance (void) { delete instance; instance = 0; }
00065 
00066   // The floating point format for the current machine.
00067   mutable float_format native_float_fmt;
00068 
00069   // TRUE if the byte order on this system is big endian.
00070   mutable bool big_chief;
00071 
00072   // No copying!
00073 
00074   oct_mach_info (const oct_mach_info&);
00075 
00076   oct_mach_info& operator = (const oct_mach_info&);
00077 };
00078 
00079 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines