00001 #ifndef __GEMFIRE_STRUCT_H__ 00002 #define __GEMFIRE_STRUCT_H__ 00003 /*========================================================================= 00004 * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved. 00005 * This product is protected by U.S. and international copyright 00006 * and intellectual property laws. Pivotal products are covered by 00007 * more patents listed at http://www.pivotal.io/patents. 00008 *======================================================================== 00009 */ 00010 00011 #include "gfcpp_globals.hpp" 00012 #include "gf_types.hpp" 00013 #include "CacheableBuiltins.hpp" 00014 #include "StructSet.hpp" 00015 #include "SelectResults.hpp" 00016 #include "Serializable.hpp" 00017 #include "VectorT.hpp" 00018 #include "HashMapT.hpp" 00019 00024 namespace gemfire 00025 { 00026 00027 class StructSet; 00028 00035 class CPPCACHE_EXPORT Struct : public Serializable 00036 { 00037 00038 public: 00039 00043 Struct(StructSet * ssPtr, VectorT<SerializablePtr> & fieldValues); 00044 00048 static Serializable* createDeserializable( ); 00049 00056 const SerializablePtr operator [] (int32_t index) const; 00057 00065 const SerializablePtr operator [] (const char * fieldName) const; 00066 00072 const StructSetPtr getStructSet() const; 00073 00079 bool hasNext() const; 00080 00086 int32_t length() const; 00087 00093 const SerializablePtr next(); 00094 00098 virtual Serializable* fromData( DataInput& input ); 00099 00103 virtual void toData( DataOutput& output ) const; 00104 00108 virtual int32_t classId( ) const; 00109 00113 virtual int8_t typeId( ) const; 00114 00119 virtual int8_t DSFID( ) const; 00120 00124 virtual const char * getFieldName(int32_t index); 00125 00129 virtual uint32_t objectSize() const { 00130 return 0; //does not get cached, so no need to account for it 00131 } 00132 00133 00134 private: 00135 00136 void skipClassName( DataInput& input ); 00137 00138 Struct( ); 00139 00140 HashMapT< CacheableStringPtr, CacheableInt32Ptr > m_fieldNames; 00141 VectorT<SerializablePtr> m_fieldValues; 00142 00143 StructSet * m_parent; 00144 00145 int32_t m_lastAccessIndex; 00146 }; 00147 00148 } //namespace gemfire 00149 00150 #endif //ifndef __GEMFIRE_STRUCT_H__