blob: ee2a812c079e0859bb87bb87d4d03229fd2e6c01 [file] [log] [blame]
#pragma once
#ifndef GEODE_PDXREADERWITHTYPECOLLECTOR_H_
#define GEODE_PDXREADERWITHTYPECOLLECTOR_H_
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "PdxLocalReader.hpp"
namespace apache {
namespace geode {
namespace client {
class PdxReaderWithTypeCollector : public PdxLocalReader {
private:
PdxTypePtr m_newPdxType;
void checkType(const char* fieldName, int8_t typeId, const char* fieldType);
public:
PdxReaderWithTypeCollector();
PdxReaderWithTypeCollector(DataInput& dataInput, PdxTypePtr pdxType,
int pdxlen);
virtual ~PdxReaderWithTypeCollector();
PdxTypePtr getLocalType() const { return m_newPdxType; }
virtual char readChar(const char* fieldName);
virtual wchar_t readWideChar(const char* fieldName);
/**
* Read a boolean value from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns bool value
*/
virtual bool readBoolean(const char* fieldName);
/**
* Read a byte value from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Byte value
*/
virtual int8_t readByte(const char* fieldName);
/**
* Read a 16-bit integer value from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Short value
*/
virtual int16_t readShort(const char* fieldName);
/**
* Read a 32-bit integer value from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Int value
*/
virtual int32_t readInt(const char* fieldName);
/**
* Read a 64-bit long value from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Long value
*/
virtual int64_t readLong(const char* fieldName);
/**
* Read a float value from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Float value
*/
virtual float readFloat(const char* fieldName);
/**
* Read a double value from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Double value
*/
virtual double readDouble(const char* fieldName);
virtual char* readString(const char* fieldName);
virtual wchar_t* readWideString(const char* fieldName);
/**
* Read a object from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns String value
*/
virtual SerializablePtr readObject(const char* fieldName);
virtual char* readCharArray(const char* fieldName, int32_t& length);
virtual wchar_t* readWideCharArray(const char* fieldName, int32_t& length);
virtual bool* readBooleanArray(const char* fieldName, int32_t& length);
/**
* Read a 8bit-Integer Array from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Byte array
*/
virtual int8_t* readByteArray(const char* fieldName, int32_t& length);
/**
* Read a 16bit-Integer Array from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Short array
*/
virtual int16_t* readShortArray(const char* fieldName, int32_t& length);
/**
* Read a 32bit-Integer Array from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Int array
*/
virtual int32_t* readIntArray(const char* fieldName, int32_t& length);
/**
* Read a Long integer Array from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Long array
*/
virtual int64_t* readLongArray(const char* fieldName, int32_t& length);
/**
* Read a Float Array from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Float array
*/
virtual float* readFloatArray(const char* fieldName, int32_t& length);
/**
* Read a Double Array from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns Double array
*/
virtual double* readDoubleArray(const char* fieldName, int32_t& length);
/**
* Read a String Array from the <code>PdxReader</code>.
* @param fieldName name of the field which needs to serialize
* Returns String array
*/
virtual char** readStringArray(const char* fieldName, int32_t& length);
virtual wchar_t** readWideStringArray(const char* fieldName, int32_t& length);
virtual CacheableObjectArrayPtr readObjectArray(const char* fieldName);
virtual int8_t** readArrayOfByteArrays(const char* fieldName,
int32_t& arrayLength,
int32_t** elementLength);
virtual CacheableDatePtr readDate(const char* fieldName);
virtual void readCollection(const char* fieldName,
CacheableArrayListPtr& collection);
};
typedef SharedPtr<PdxReaderWithTypeCollector> PdxReaderWithTypeCollectorPtr;
} // namespace client
} // namespace geode
} // namespace apache
#endif // GEODE_PDXREADERWITHTYPECOLLECTOR_H_