00001 /* 00002 * SimplePofPath.hpp 00003 * 00004 * Copyright (c) 2000, 2017, 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_SIMPLE_POF_PATH_HPP 00017 #define COH_SIMPLE_POF_PATH_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/pof/reflect/AbstractPofPath.hpp" 00022 00023 COH_OPEN_NAMESPACE4(coherence,io,pof,reflect) 00024 00025 00026 /** 00027 * A static PofNavigator implementation which uses an array of integer indices 00028 * to navigate the PofValue hierarchy. 00029 * 00030 * @author as/gm 2009.04.01 00031 * @since Coherence 3.5 00032 */ 00033 class COH_EXPORT SimplePofPath 00034 : public class_spec<SimplePofPath, 00035 extends<AbstractPofPath> > 00036 { 00037 friend class factory<SimplePofPath>; 00038 00039 // ----- constructors --------------------------------------------------- 00040 00041 protected: 00042 /** 00043 * Default constructor (necessary for the PortableObject interface). 00044 */ 00045 SimplePofPath(); 00046 00047 /** 00048 * Construct a SimplePofPath using a single index as a path. 00049 * 00050 * @param nIndex an index 00051 */ 00052 SimplePofPath(int32_t nIndex); 00053 00054 /** 00055 * Construct a SimplePofPath using an array of indices as a path. 00056 * 00057 * @param vanIndices an array of indices 00058 */ 00059 SimplePofPath(Array<int32_t>::View vanIndices); 00060 00061 00062 // ----- internal ------------------------------------------------------- 00063 00064 protected: 00065 /** 00066 * {@inheritDoc} 00067 */ 00068 virtual Array<int32_t>::View getPathElements() const; 00069 00070 00071 // ----- PortableObject interface --------------------------------------- 00072 00073 public: 00074 /** 00075 * {@inheritDoc} 00076 */ 00077 virtual void readExternal(PofReader::Handle hIn); 00078 00079 /** 00080 * {@inheritDoc} 00081 */ 00082 virtual void writeExternal(PofWriter::Handle hOut) const; 00083 00084 00085 // ----- Object interface ----------------------------------------------- 00086 00087 public: 00088 /** 00089 * Compare the SimplePofPath with another object to determine 00090 * equality. Two SimplePofPath objects are considered equal iff their 00091 * indices are equal. 00092 * 00093 * @param v the object to compare against 00094 * 00095 * @return true iff this SimplePofPath and the passed object are 00096 * equivalent. 00097 */ 00098 virtual bool equals(Object::View v) const; 00099 00100 /** 00101 * Determine a hash value for the SimplePofPath object according to 00102 * the general {@link Object#hashCode()} contract. 00103 * 00104 * @return an integer hash value for this SimplePofPath object 00105 */ 00106 virtual size32_t hashCode() const; 00107 00108 /** 00109 * Return a human-readable description for this SimplePofPath. 00110 * 00111 * @param out the stream to write to 00112 * 00113 * @return a String description of the SimplePofPath 00114 */ 00115 virtual TypedHandle<const String> toString() const; 00116 00117 00118 // ----- data members --------------------------------------------- 00119 00120 private: 00121 /** 00122 * Path elements. 00123 */ 00124 FinalView<Array<int32_t> > f_vaiElements; 00125 }; 00126 00127 COH_CLOSE_NAMESPACE4 00128 00129 #endif // COH_SIMPLE_POF_PATH_HPP