SourceForge.net Logo
ATFloatOrDerived.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001, 2008,
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004, 2018 Oracle and/or its affiliates. All rights reserved.
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef _ATFLOATORDERIVED_HPP
21 #define _ATFLOATORDERIVED_HPP
22 
23 #include <xercesc/util/XercesDefs.hpp>
24 #include <xqilla/framework/XQillaExport.hpp>
25 #include <xqilla/items/Numeric.hpp>
26 
27 class XQILLA_API ATFloatOrDerived : public Numeric
28 {
29 public:
31 
32  /* Get the name of the primitive type (basic type) of this type
33  * (ie "decimal" for xs:decimal) */
34  virtual const XMLCh* getPrimitiveTypeName() const = 0;
35 
36  /* Get the namespace URI for this type */
37  virtual const XMLCh* getTypeURI() const = 0;
38 
39  /* Get the name of this type (ie "integer" for xs:integer) */
40  virtual const XMLCh* getTypeName() const = 0;
41 
42  /* returns the XMLCh* (canonical) representation of this type */
43  virtual const XMLCh* asString(const DynamicContext* context) const = 0;
44 
45  /* Promote this to the given type, if possible */
47  const DynamicContext* context) const = 0;
48 
50  virtual Numeric::Ptr add(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
51 
54  virtual Numeric::Ptr subtract(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
55 
57  virtual Numeric::Ptr multiply(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
58 
60  virtual Numeric::Ptr divide(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
61 
63  virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
64 
66  virtual Numeric::Ptr floor(const DynamicContext* context) const = 0;
67 
69  virtual Numeric::Ptr ceiling(const DynamicContext* context) const = 0;
70 
72  virtual Numeric::Ptr round(const DynamicContext* context) const = 0;
73 
75  virtual Numeric::Ptr roundHalfToEven(const Numeric::Ptr &precision, const DynamicContext* context) const = 0;
76 
78  virtual Numeric::Ptr invert(const DynamicContext* context) const = 0;
79 
81  virtual Numeric::Ptr abs(const DynamicContext* context) const = 0;
82 
84  virtual Numeric::Ptr sqrt(const DynamicContext* context) const = 0;
85 
87  virtual Numeric::Ptr sin(const DynamicContext* context) const = 0;
88 
90  virtual Numeric::Ptr cos(const DynamicContext* context) const = 0;
91 
93  virtual Numeric::Ptr tan(const DynamicContext* context) const = 0;
94 
96  virtual Numeric::Ptr asin(const DynamicContext* context) const = 0;
97 
99  virtual Numeric::Ptr acos(const DynamicContext* context) const = 0;
100 
102  virtual Numeric::Ptr atan(const DynamicContext* context) const = 0;
103 
105  virtual Numeric::Ptr log(const DynamicContext* context) const = 0;
106 
108  virtual Numeric::Ptr exp(const DynamicContext* context) const = 0;
109 
110  /* Is this xs:double not a number */
111  virtual bool isNaN() const = 0;
112 
113  /* Is this xs:double infinite? */
114  virtual bool isInfinite() const = 0;
115 
117  virtual bool isZero() const = 0;
118 
120  virtual bool isPositive() const = 0;
121 
123  virtual bool isNegative() const = 0;
124 
126 
127  virtual const MAPM &asMAPM() const = 0;
128 
129  virtual State getState() const = 0;
130 };
131 
132 #endif // _ATFLOATORDERIVED_HPP
virtual bool isInfinite() const =0
virtual Numeric::Ptr invert(const DynamicContext *context) const =0
Returns the Additive inverse of this Numeric.
virtual const XMLCh * getTypeName() const =0
virtual Numeric::Ptr cos(const DynamicContext *context) const =0
Returns the cos root of this Numeric.
virtual State getState() const =0
virtual Numeric::Ptr ceiling(const DynamicContext *context) const =0
Returns the ceiling of this Numeric.
virtual Numeric::Ptr add(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns a Numeric object which is the sum of this and other.
virtual bool isNaN() const =0
Super class of all the reference counted wrappers for Items.
Definition: ReferenceCounted.hpp:61
virtual bool isPositive() const =0
Is this Numeric positive?
Definition: Numeric.hpp:31
virtual Numeric::Ptr round(const DynamicContext *context) const =0
Rounds this Numeric.
virtual Numeric::Ptr tan(const DynamicContext *context) const =0
Returns the tan of this Numeric.
AtomicObjectType
Definition: AnyAtomicType.hpp:34
virtual Numeric::Ptr divide(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns a Numeric object which is the quotient of this and other.
virtual Numeric::Ptr log(const DynamicContext *context) const =0
Returns the ln of this Numeric.
virtual Numeric::Ptr atan(const DynamicContext *context) const =0
Returns the atan of this Numeric.
virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const =0
virtual bool isZero() const =0
Does this Numeric have value 0?
Definition: ATFloatOrDerived.hpp:27
virtual Numeric::Ptr subtract(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns a Numeric object which is the difference of this and other.
virtual const XMLCh * asString(const DynamicContext *context) const =0
virtual const XMLCh * getPrimitiveTypeName() const =0
virtual const XMLCh * getTypeURI() const =0
RefCountPointer< const ATFloatOrDerived > Ptr
Definition: ATFloatOrDerived.hpp:30
The execution time dynamic context interface.
Definition: DynamicContext.hpp:38
virtual Numeric::Ptr exp(const DynamicContext *context) const =0
Returns the exp of this Numeric.
virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns the arithmetic product of its operands as a Numeric.
virtual bool isNegative() const =0
Is this Numeric negative?
virtual Numeric::Ptr sqrt(const DynamicContext *context) const =0
Returns the squart root of this Numeric.
virtual Numeric::Ptr acos(const DynamicContext *context) const =0
Returns the acos of this Numeric.
virtual Numeric::Ptr roundHalfToEven(const Numeric::Ptr &precision, const DynamicContext *context) const =0
Rounds this Numeric to the given precision, and rounds a half to even.
virtual Numeric::Ptr sin(const DynamicContext *context) const =0
Returns the sin of this Numeric.
virtual Numeric::Ptr floor(const DynamicContext *context) const =0
Returns the floor of this Numeric.
virtual Numeric::Ptr asin(const DynamicContext *context) const =0
Returns the asin of this Numeric.
virtual Numeric::Ptr promoteTypeIfApplicable(AnyAtomicType::AtomicObjectType typeIndex, const DynamicContext *context) const =0
State
Definition: Numeric.hpp:159
virtual Numeric::Ptr multiply(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns a Numeric object which is the product of this and other.
virtual Numeric::Ptr abs(const DynamicContext *context) const =0
Returns the absolute value of this Numeric.
virtual const MAPM & asMAPM() const =0