VMware GemFire Native C++ Reference  9.1
SharedBase.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef GEODE_SHAREDBASE_H_
4 #define GEODE_SHAREDBASE_H_
5 
6 // SharedBase.hpp -*- mode: c++ -*-
7 
8 /*
9  * Licensed to the Apache Software Foundation (ASF) under one or more
10  * contributor license agreements. See the NOTICE file distributed with
11  * this work for additional information regarding copyright ownership.
12  * The ASF licenses this file to You under the Apache License, Version 2.0
13  * (the "License"); you may not use this file except in compliance with
14  * the License. You may obtain a copy of the License at
15  *
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */
24 
25 #include "geode_globals.hpp"
26 
30 namespace apache {
31 namespace geode {
32 namespace client {
33 
41  public:
43  inline SharedBase() : m_refCount(0) {}
44 
46  void preserveSB() const;
47 
52  void releaseSB() const;
53 
55  inline int32_t refCount() { return m_refCount; }
56 
57  protected:
58  inline SharedBase(bool noInit) {}
59 
60  virtual ~SharedBase() {}
61 
62  private:
63  mutable volatile int32_t m_refCount;
64 
65  void operator=(const SharedBase& rhs);
66 };
67 
74  public:
75  static const NullSharedBase* const s_instancePtr;
76 
77  private:
78  NullSharedBase() {}
79  // never defined
81  NullSharedBase& operator=(const NullSharedBase&);
82 
83  friend class SharedBase; // just to get rid of warning with gcc3.x
84 };
85 } // namespace client
86 } // namespace geode
87 } // namespace apache
88 
89 #define NULLPTR ::apache::geode::client::NullSharedBase::s_instancePtr
90 
91 #endif // GEODE_SHAREDBASE_H_
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
int32_t refCount()
Definition: SharedBase.hpp:55
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
Class encapsulating a NULL SharedBase smart pointer.
Definition: SharedBase.hpp:73
This abstract base class is the base class of all user objects that have the shared capability of ref...
Definition: SharedBase.hpp:40
SharedBase()
Constructor.
Definition: SharedBase.hpp:43
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation