SourceForge.net Logo
ATDoubleOrDerived.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2008
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004-2008
5  * Oracle. All rights reserved.
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  * $Id$
20  */
21 
22 #ifndef _ATDOUBLEORDERIVED_HPP
23 #define _ATDOUBLEORDERIVED_HPP
24 
25 #include <xercesc/util/XercesDefs.hpp>
26 #include <xqilla/framework/XQillaExport.hpp>
27 #include <xqilla/items/Numeric.hpp>
28 
29 class XQILLA_API ATDoubleOrDerived : public Numeric
30 {
31 public:
33 
34  /* Get the name of the primitive type (basic type) of this type
35  * (ie "decimal" for xs:decimal) */
36  virtual const XMLCh* getPrimitiveTypeName() const = 0;
37 
38  /* Get the namespace URI for this type */
39  virtual const XMLCh* getTypeURI() const = 0;
40 
41  /* Get the name of this type (ie "integer" for xs:integer) */
42  virtual const XMLCh* getTypeName() const = 0;
43 
44  /* returns the XMLCh* (canonical) representation of this type */
45  virtual const XMLCh* asString(const DynamicContext* context) const = 0;
46 
47  /* Promote this to the given type, if possible */
49  const DynamicContext* context) const = 0;
50 
52  virtual Numeric::Ptr add(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
53 
56  virtual Numeric::Ptr subtract(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
57 
59  virtual Numeric::Ptr multiply(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
60 
62  virtual Numeric::Ptr divide(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
63 
65  virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
66 
68  virtual Numeric::Ptr floor(const DynamicContext* context) const = 0;
69 
71  virtual Numeric::Ptr ceiling(const DynamicContext* context) const = 0;
72 
74  virtual Numeric::Ptr round(const DynamicContext* context) const = 0;
75 
77  virtual Numeric::Ptr roundHalfToEven(const Numeric::Ptr &precision, const DynamicContext* context) const = 0;
78 
80  virtual Numeric::Ptr invert(const DynamicContext* context) const = 0;
81 
83  virtual Numeric::Ptr abs(const DynamicContext* context) const = 0;
84 
85  /* Is this xs:double not a number */
86  virtual bool isNaN() const = 0;
87 
88  /* Is this xs:double infinite? */
89  virtual bool isInfinite() const = 0;
90 
92  virtual bool isZero() const = 0;
93 
95  virtual bool isPositive() const = 0;
96 
98 
99  virtual const MAPM &asMAPM() const = 0;
100 
101  virtual State getState() const = 0;
102 };
103 
104 #endif // _ATDOUBLEORDERIVED_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 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:58
virtual bool isPositive() const =0
Is this Numeric positive?
Definition: Numeric.hpp:33
virtual Numeric::Ptr round(const DynamicContext *context) const =0
Rounds this Numeric.
AtomicObjectType
Definition: AnyAtomicType.hpp:36
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 AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const =0
virtual bool isZero() const =0
Does this Numeric have value 0?
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
The execution time dynamic context interface.
Definition: DynamicContext.hpp:39
virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns the arithmetic product of its operands as a 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 floor(const DynamicContext *context) const =0
Returns the floor of this Numeric.
RefCountPointer< const ATDoubleOrDerived > Ptr
Definition: ATDoubleOrDerived.hpp:32
virtual Numeric::Ptr promoteTypeIfApplicable(AnyAtomicType::AtomicObjectType typeIndex, const DynamicContext *context) const =0
State
Definition: Numeric.hpp:124
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.
Definition: ATDoubleOrDerived.hpp:29
virtual const MAPM & asMAPM() const =0