VMware GemFire Native C++ Reference  9.1
PdxSerializable.hpp
1 #pragma once
2 
3 #ifndef GEODE_PDXSERIALIZABLE_H_
4 #define GEODE_PDXSERIALIZABLE_H_
5 
6 /*
7  * Licensed to the Apache Software Foundation (ASF) under one or more
8  * contributor license agreements. See the NOTICE file distributed with
9  * this work for additional information regarding copyright ownership.
10  * The ASF licenses this file to You under the Apache License, Version 2.0
11  * (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include "CacheableKey.hpp"
24 
25 namespace apache {
26 namespace geode {
27 namespace client {
28 
29 typedef PdxSerializable* (*PdxTypeFactoryMethod)();
30 
31 class CPPCACHE_EXPORT PdxSerializable : public CacheableKey {
32  public:
33  PdxSerializable();
34  virtual ~PdxSerializable();
35 
36  // for virtual overloads bring base toData/fromData in scope otherwise
37  // child classes won't be able to override as desired
38  // Solaris compiler gives "hides the virtual function" warnings when
39  // compiling child classes while other compilers silently
40  // accept but will cause problems with overloaded calls (in this case
41  // no implicit conversion from PdxWriterPtr to DataOutput etc exists
42  // so no imminent danger)
43  // see
44  // http://www.oracle.com/technetwork/server-storage/solarisstudio/documentation/cplusplus-faq-355066.html#Coding1
45  // using Serializable::toData;
46  // using Serializable::fromData;
47 
52  virtual void toData(PdxWriterPtr output) /*const*/ = 0;
53 
58  virtual void fromData(PdxReaderPtr input) = 0;
59 
68  virtual int8_t typeId() const;
69 
71  virtual bool operator==(const CacheableKey& other) const;
72 
74  virtual int32_t hashcode() const;
75 
79  virtual void toData(DataOutput& output) const;
80 
85  virtual Serializable* fromData(DataInput& input);
86 
92  virtual int32_t classId() const { return 0x10; }
93 
103  virtual CacheableStringPtr toString() const;
104 
108  virtual const char* getClassName() const = 0;
109 };
110 } // namespace client
111 } // namespace geode
112 } // namespace apache
113 
114 #endif // GEODE_PDXSERIALIZABLE_H_
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation