VMware VMware GemFire Native C++ Reference 10.4.3
Loading...
Searching...
No Matches
Struct.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#ifndef GEODE_STRUCT_H_
21#define GEODE_STRUCT_H_
22
23#include <unordered_map>
24#include <vector>
25
26#include "CacheableBuiltins.hpp"
27#include "SelectResults.hpp"
28#include "Serializable.hpp"
29#include "StructSet.hpp"
30#include "internal/DataSerializableFixedId.hpp"
31#include "internal/geode_globals.hpp"
32
37namespace apache {
38namespace geode {
39namespace client {
40
41class StructSet;
42
49class APACHE_GEODE_EXPORT Struct
50 : public internal::DataSerializableFixedId_t<internal::DSFid::Struct> {
51 public:
52 typedef std::vector<std::shared_ptr<Serializable>>::iterator iterator;
53
58 std::vector<std::shared_ptr<Serializable>>& fieldValues);
59
60 Struct() = default;
61
62 ~Struct() noexcept override = default;
63
67 static std::shared_ptr<Serializable> createDeserializable();
68
76 const std::shared_ptr<Serializable> operator[](int32_t index) const;
77
85 const std::shared_ptr<Serializable> operator[](
86 const std::string& fieldName) const;
87
93 const std::shared_ptr<StructSet> getStructSet() const;
94
95 iterator begin();
96
97 iterator end();
98
104 int32_t size() const;
105
106 void fromData(DataInput& input) override;
107
108 void toData(DataOutput& output) const override;
109
115 virtual const std::string& getFieldName(const int32_t index) const;
116
120 size_t objectSize() const override {
121 return 0; // does not get cached, so no need to account for it
122 }
123
124 private:
125 void skipClassName(DataInput& input);
126
127 typedef std::unordered_map<std::string, int32_t> FieldNameToIndexMap;
128
129 StructSet* m_parent = nullptr;
130 std::vector<std::shared_ptr<Serializable>> m_fieldValues;
131 FieldNameToIndexMap m_fieldNameToIndex;
132};
133} // namespace client
134} // namespace geode
135} // namespace apache
136
137#endif // GEODE_STRUCT_H_
Contains generic template definitions for Cacheable types and instantiations for built-in types.
Provide operations for reading primitive data values, byte arrays, strings, Serializable objects from...
Definition DataInput.hpp:59
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition DataOutput.hpp:48
This base class is the superclass of all user objects in the cache that can be serialized.
Definition Serializable.hpp:53
A Struct has a StructSet as its parent.
Definition Struct.hpp:50
Struct(StructSet *ssPtr, std::vector< std::shared_ptr< Serializable > > &fieldValues)
Constructor - meant only for internal use.
A StructSet may be obtained after executing a Query which is obtained from a QueryService which in tu...
Definition StructSet.hpp:42

Apache Geode C++ Cache API Documentation