Hazelcast C++ Client
Ringbuffer.h
1 /*
2  * Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 //
17 // Created by ihsan demir on 16/20/13.
18 #ifndef HZELCAST_CLIENT_RINGBUFFER_H_
19 #define HZELCAST_CLIENT_RINGBUFFER_H_
20 
21 #include <memory>
22 #include <stdint.h>
23 
24 #include "hazelcast/client/DistributedObject.h"
25 
26 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
27 #pragma warning(push)
28 #pragma warning(disable: 4251) //for dll export
29 #endif
30 
31 namespace hazelcast {
32  namespace client {
66  template<typename E>
67  class Ringbuffer : public DistributedObject {
68  public:
69  virtual ~Ringbuffer() {
70  }
71 
77  virtual int64_t capacity() = 0;
78 
87  virtual int64_t size() = 0;
88 
96  virtual int64_t tailSequence() = 0;
97 
108  virtual int64_t headSequence() = 0;
109 
119  virtual int64_t remainingCapacity() = 0;
120 
138  virtual int64_t add(const E &item) = 0;
139 
173  virtual std::auto_ptr<E> readOne(int64_t sequence) = 0;
174  };
175  }
176 }
177 
178 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
179 #pragma warning(pop)
180 #endif
181 
182 #endif //HZELCAST_CLIENT_RINGBUFFER_H_
183 
virtual int64_t capacity()=0
Returns the capacity of this Ringbuffer.
virtual int64_t tailSequence()=0
Returns the sequence of the tail.
virtual std::auto_ptr< E > readOne(int64_t sequence)=0
Reads one item from the Ringbuffer.
Base class for all distributed objects.
Definition: DistributedObject.h:58
A Ringbuffer is a data-structure where the content is stored in a ring like structure.
Definition: Ringbuffer.h:67
virtual int64_t headSequence()=0
Returns the sequence of the head.
virtual int64_t size()=0
Returns number of items in the ringbuffer.
virtual int64_t add(const E &item)=0
Adds an item to the tail of the Ringbuffer.
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
virtual int64_t remainingCapacity()=0
Returns the remaining capacity of the ringbuffer.