Oracle Coherence for C++ API
Release 3.7.1.0
E22845-01
00001 /* 00002 * NumberIncrementor.hpp 00003 * 00004 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_NUMBER_INCREMENTOR_HPP 00017 #define COH_NUMBER_INCREMENTOR_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/pof/PofReader.hpp" 00022 #include "coherence/io/pof/PofWriter.hpp" 00023 #include "coherence/util/InvocableMap.hpp" 00024 #include "coherence/util/processor/PropertyProcessor.hpp" 00025 #include "coherence/util/ValueManipulator.hpp" 00026 00027 COH_OPEN_NAMESPACE3(coherence,util, processor) 00028 00029 using coherence::io::pof::PofReader; 00030 using coherence::io::pof::PofWriter; 00031 using coherence::util::InvocableMap; 00032 using coherence::util::ValueManipulator; 00033 00034 00035 /** 00036 * The NumberIncrementor entry processor is used to increment a property value 00037 * of a Number type. 00038 * 00039 * @author tb 2008.04.28 00040 */ 00041 class COH_EXPORT NumberIncrementor 00042 : public class_spec<NumberIncrementor, 00043 extends<PropertyProcessor> > 00044 { 00045 friend class factory<NumberIncrementor>; 00046 00047 // ----- constructors --------------------------------------------------- 00048 00049 protected: 00050 /** 00051 * Construct an NumberIncrementor processor. 00052 */ 00053 NumberIncrementor(); 00054 00055 /** 00056 * Construct an NumberIncrementor processor that will increment a 00057 * property value by a specified amount, returning either the old or 00058 * the new value as specified. The type of the numInc parameter will 00059 * dictate the type of the original and the new value. 00060 * 00061 * @param vManipulator the ValueManipulator; could be NULL 00062 * @param vNumInc the Number representing the magnitude and 00063 * sign of the increment 00064 * @param fPostIncrement pass true to return the value as it was 00065 * before it was incremented, or pass false to 00066 * return the value as it is after it is 00067 * incremented 00068 */ 00069 NumberIncrementor(ValueManipulator::View vManipulator, 00070 Number::View vNumInc, bool fPostIncrement); 00071 00072 00073 // ----- InvocableMap::EntryProcessor interface ------------------------- 00074 00075 public: 00076 /** 00077 * {@inheritDoc} 00078 */ 00079 virtual Object::Holder process(InvocableMap::Entry::Handle hEntry) const; 00080 00081 00082 // ----- PortableObject interface --------------------------------------- 00083 00084 public: 00085 /** 00086 * {@inheritDoc} 00087 */ 00088 virtual void readExternal(PofReader::Handle hIn); 00089 00090 /** 00091 * {@inheritDoc} 00092 */ 00093 virtual void writeExternal(PofWriter::Handle hOut) const; 00094 00095 00096 // ----- Describable interface ------------------------------------------ 00097 00098 public: 00099 /** 00100 * {@inheritDoc} 00101 */ 00102 virtual void outputDescription(std::ostream& out) const; 00103 00104 00105 // ----- constants ------------------------------------------------------ 00106 00107 public: 00108 /** 00109 * The Integer16 value of 0. 00110 */ 00111 static Number::View getInteger16Zero(); 00112 00113 /** 00114 * The Integer32 value of 0. 00115 */ 00116 static Number::View getInteger32Zero(); 00117 00118 /** 00119 * The Integer64 value of 0. 00120 */ 00121 static Number::View getInteger64Zero(); 00122 00123 /** 00124 * The Float32 value of 0. 00125 */ 00126 static Number::View getFloat32Zero(); 00127 00128 /** 00129 * The Float64 value of 0. 00130 */ 00131 static Number::View getFloat64Zero(); 00132 00133 00134 // ----- data members --------------------------------------------------- 00135 00136 protected: 00137 /** 00138 * The number to increment by. 00139 */ 00140 MemberView<Number> m_vNumInc; 00141 00142 /** 00143 * Whether to return the value before it was incremented 00144 * ("post-increment") or after it is incremented ("pre-increment"). 00145 */ 00146 bool m_fPostInc; 00147 }; 00148 00149 COH_CLOSE_NAMESPACE3 00150 00151 #endif // COH_NUMBER_INCREMENTOR_HPP