24 #ifndef HAZELCAST_DATA_INPUT 
   25 #define HAZELCAST_DATA_INPUT 
   27 #include "hazelcast/client/exception/IOException.h" 
   28 #include "hazelcast/client/serialization/Serializer.h" 
   29 #include "hazelcast/client/serialization/pimpl/SerializerHolder.h" 
   30 #include "hazelcast/client/serialization/ClassDefinition.h" 
   31 #include "hazelcast/client/serialization/pimpl/PortableContext.h" 
   32 #include "hazelcast/client/exception/HazelcastSerializationException.h" 
   33 #include "hazelcast/client/serialization/pimpl/SerializationConstants.h" 
   34 #include "hazelcast/util/IOUtil.h" 
   35 #include "hazelcast/client/serialization/TypeIDS.h" 
   37 #include <boost/shared_ptr.hpp> 
   40 #if  defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 
   42 #pragma warning(disable: 4251) //for dll export 
   47         namespace serialization {
 
   50             class IdentifiedDataSerializable;
 
   53                 class PortableContext;
 
   75                 void readFully(std::vector<byte>& byteArray);
 
  135                 std::auto_ptr<std::string> readUTF();
 
  141                 std::auto_ptr<std::vector<byte> > readByteArray();
 
  147                 std::auto_ptr<std::vector<bool> > readBooleanArray();
 
  153                 std::auto_ptr<std::vector<char> > readCharArray();
 
  159                 std::auto_ptr<std::vector<int> > readIntArray();
 
  165                 std::auto_ptr<std::vector<long> > readLongArray();
 
  171                 std::auto_ptr<std::vector<double> > readDoubleArray();
 
  177                 std::auto_ptr<std::vector<float> > readFloatArray();
 
  183                 std::auto_ptr<std::vector<short> > readShortArray();
 
  189                 std::auto_ptr<std::vector<std::string> > readUTFArray();
 
  199                     int typeId = readInt();
 
  200                     const pimpl::SerializationConstants& constants = portableContext.getConstants();
 
  201                     if (constants.CONSTANT_TYPE_NULL == typeId) {
 
  202                         return boost::shared_ptr<T>(
static_cast<T *
>(NULL));
 
  204                         std::auto_ptr<T> result(
new T);
 
  205                         constants.checkClassType(getHazelcastTypeId(result.get()) , typeId);
 
  206                         if (constants.CONSTANT_TYPE_DATA == typeId) {
 
  207                             readDataSerializable(reinterpret_cast<IdentifiedDataSerializable *>(result.get()));
 
  208                         } 
else if (constants.CONSTANT_TYPE_PORTABLE == typeId) {
 
  209                             readPortable(reinterpret_cast<Portable *>(result.get()));
 
  211                             readInternal<T>(typeId, result.get());
 
  213                         return boost::shared_ptr<T>(result.release());
 
  221                 pimpl::Data readData();
 
  232                 void position(
int newPos);
 
  236                 template <
typename T>
 
  237                 void readInternal(
int typeId, T * 
object) {
 
  238                     boost::shared_ptr<SerializerBase> serializer = serializerHolder.serializerFor(typeId);
 
  239                     if (NULL == serializer.get()) {
 
  240                         const std::string message = 
"No serializer found for serializerId :"+
 
  241                                                      util::IOUtil::to_string(typeId) + 
", typename :" +
 
  246                     Serializer<T> *s = 
static_cast<Serializer<T> * 
>(serializer.get());
 
  247                     ObjectDataInput objectDataInput(dataInput, portableContext);
 
  248                     s->read(objectDataInput, *
object);
 
  251                 void readPortable(Portable *
object);
 
  253                 void readDataSerializable(IdentifiedDataSerializable * 
object);
 
  255                 pimpl::DataInput& dataInput;
 
  256                 pimpl::PortableContext& portableContext;
 
  257                 pimpl::SerializerHolder& serializerHolder;
 
  259                 ObjectDataInput(
const ObjectDataInput&);
 
  261                 void operator=(
const ObjectDataInput&);
 
  268 #if  defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 
Raised when an error occur during serialization or deserialization in Hazelcast. 
Definition: HazelcastSerializationException.h:33