H:/gfcppsancout/product/include/gfcpp/Struct.hpp

Go to the documentation of this file.
00001 #ifndef __GEMFIRE_STRUCT_H__
00002 #define __GEMFIRE_STRUCT_H__
00003 /*=========================================================================
00004  * (c) Copyright 2002-2006, GemStone Systems, Inc. All Rights Reserved.
00005  * 1260 NW Waterhouse Ave., Suite 200,  Beaverton, OR 97006
00006  *========================================================================
00007  */
00008 
00009 #include "gfcpp_globals.hpp"
00010 #include "gf_types.hpp"
00011 #include "CacheableBuiltins.hpp"
00012 #include "StructSet.hpp"
00013 #include "SelectResults.hpp"
00014 #include "Serializable.hpp"
00015 #include "VectorT.hpp"
00016 #include "HashMapT.hpp"
00017 
00022 namespace gemfire
00023 {
00024 
00025 class StructSet;
00026 
00036 class CPPCACHE_EXPORT Struct : public Serializable
00037 {
00038 
00039 public:
00040 
00047   Struct(StructSet * ssPtr, VectorT<SerializablePtr> & fieldValues);
00048 
00055   static Serializable* createDeserializable( );
00056 
00066   const SerializablePtr operator [] (size_t index) const;
00067   
00078   const SerializablePtr operator [] (const char * fieldName) const;
00079 
00088   const StructSetPtr getStructSet() const;
00089 
00098   bool hasNext() const;
00099 
00108   size_t length() const;
00109 
00118   const SerializablePtr next();
00119 
00126   virtual Serializable* fromData( DataInput& input );
00127 
00134   virtual void toData( DataOutput& output ) const;
00135 
00142   virtual int8_t classId( ) const;
00143 
00150   virtual int8_t typeId( ) const;
00151 
00158   virtual const char * getFieldName(size_t index);
00159 
00166   virtual uint32_t objectSize() const {
00167     return 0;  //does not get cached, so no need to account for it
00168   }
00169   
00170 
00171 private:
00172 
00173    void skipClassName( DataInput& input );
00174 
00175    Struct( );
00176 
00177    HashMapT< CacheableStringPtr, CacheableInt32Ptr > m_fieldNames;
00178    VectorT<SerializablePtr> m_fieldValues;
00179 
00180    StructSet * m_parent;
00181 
00182    size_t m_lastAccessIndex;
00183 };
00184 
00185 } //namespace gemfire
00186 
00187 #endif //ifndef __GEMFIRE_STRUCT_H__

GemFire C++ Cache API Documentation