/usr/include/omniORB4/CORBA_Fixed.h is in libomniorb4-dev 4.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | // -*- Mode: C++; -*-
// Package : omniORB
// CORBA_Fixed.h Created on: 2001/08/17
// Author : Duncan Grisby (dpg1)
//
// Copyright (C) 2001 AT&T Laboratories Cambridge
//
// This file is part of the omniORB library
//
// The omniORB library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// Description:
// CORBA::Fixed
//
/*
$Log$
Revision 1.1.2.4 2002/11/25 21:06:59 dgrisby
Add new to_string() function to Fixed.
Revision 1.1.2.3 2002/10/15 23:24:14 dgrisby
Avoid clash with Solaris defining truncate to truncate64.
Revision 1.1.2.2 2001/10/17 16:44:00 dpg1
Update DynAny to CORBA 2.5 spec, const Any exception extraction.
Revision 1.1.2.1 2001/08/17 13:39:46 dpg1
Split CORBA.h into separate bits.
*/
#ifndef INSIDE_OMNIORB_CORBA_MODULE
# error "Must only be #included by CORBA.h"
#endif
// Some Solaris versions helpfully #define truncate to truncate64...
#ifdef truncate
# undef truncate
#endif
//////////////////////////////////////////////////////////////////////
/////////////////////////////// Fixed ////////////////////////////////
//////////////////////////////////////////////////////////////////////
class Fixed {
#define OMNI_FIXED_DIGITS 31
public:
// Constructors
Fixed(int val = 0);
Fixed(unsigned val);
#ifndef OMNI_LONG_IS_INT
Fixed(Long val);
Fixed(ULong val);
#endif
#ifdef HAS_LongLong
Fixed(LongLong val);
Fixed(ULongLong val);
#endif
#ifndef NO_FLOAT
Fixed(Double val);
#endif
#ifdef HAS_LongDouble
Fixed(LongDouble val);
#endif
Fixed(const Fixed& val);
Fixed(const char* val);
Fixed(const Octet* val, UShort digits, UShort scale, Boolean negative);
// omniORB specific constructor
~Fixed();
// Conversions
#ifdef HAS_LongLong
operator LongLong() const;
#else
operator Long() const;
#endif
#ifndef NO_FLOAT
# ifdef HAS_LongDouble
operator LongDouble() const;
# else
operator Double() const;
# endif
#endif
Fixed round (UShort scale) const;
Fixed truncate(UShort scale) const;
// Operators
Fixed& operator= (const Fixed& val);
Fixed& operator+=(const Fixed& val);
Fixed& operator-=(const Fixed& val);
Fixed& operator*=(const Fixed& val);
Fixed& operator/=(const Fixed& val);
Fixed& operator++();
Fixed operator++(int);
Fixed& operator--();
Fixed operator--(int);
Fixed operator+ () const;
Fixed operator- () const;
Boolean operator! () const;
// Other member functions
UShort fixed_digits() const { return pd_digits; }
UShort fixed_scale() const { return pd_scale; }
char* to_string() const;
// Return a string with trailing zeros to match the scale.
// omniORB specific functions
char* NP_asString() const;
// Return a string containing the fixed. Caller frees with
// CORBA::string_free(). Does not include trailing zeros.
CORBA::Boolean NP_fromString(const char* val, Boolean ignore_end = 0);
// Set the value from the given string.
// If ignore_end is true, do not complain about trailing garbage.
// Return true if the value fit without truncation; false if the
// value had to be truncated.
static int NP_cmp(const Fixed& a, const Fixed& b);
// Compare a and b. Returns -1 if a < b, 1 if a > b, 0 if a == b.
// "Private" functions only to be called by omniORB internals.
// Application code which uses these is asking for trouble.
const Octet* PR_val() const { return pd_val; }
// Return the internal value buffer. Used by arithmetic functions.
Boolean PR_negative() const { return pd_negative; }
// True if the value is negative, false if positive or zero.
CORBA::Boolean PR_checkLimits();
// Function to check that this fixed point value fits in the
// digits/scale limits declared in the IDL. Truncates the value,
// or throws DATA_CONVERSION if the value is too big. Does nothing
// for base CORBA::Fixed, where there are no limits.
// Returns true if the value fit without truncation; false if the
// value had to be truncated.
void PR_setLimits(UShort idl_digits, UShort idl_scale);
// Set and check the digits/scale limits.
void PR_changeScale(UShort new_scale);
// Modify the scale. Updates the number of digits if necessary.
// Marshalling operators
void operator>>= (cdrStream& s) const;
void operator<<= (cdrStream& s);
private:
Octet pd_val[OMNI_FIXED_DIGITS]; // Value stored least sig. digit first
UShort pd_digits; // Digits and scale the number has
UShort pd_scale;
Boolean pd_negative; // True if value is negative
UShort pd_idl_digits; // Digits and scale the IDL says it should have
UShort pd_idl_scale; // (zero for base CORBA::Fixed).
};
|