Hazelcast C++ Client
 All Classes Functions Variables Enumerations Enumerator Pages
Ringbuffer.h
1 /*
2  * Copyright (c) 2008-2017, 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/IDistributedObject.h"
25 
26 namespace hazelcast {
27  namespace client {
61  template<typename E>
62  class Ringbuffer : public IDistributedObject {
63  public:
64  virtual ~Ringbuffer() {
65  }
66 
72  virtual int64_t capacity() = 0;
73 
82  virtual int64_t size() = 0;
83 
91  virtual int64_t tailSequence() = 0;
92 
103  virtual int64_t headSequence() = 0;
104 
114  virtual int64_t remainingCapacity() = 0;
115 
133  virtual int64_t add(const E &item) = 0;
134 
168  virtual std::auto_ptr<E> readOne(int64_t sequence) = 0;
169  };
170  }
171 }
172 
173 #endif //HZELCAST_CLIENT_RINGBUFFER_H_
174 
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.
A Ringbuffer is a data-structure where the content is stored in a ring like structure.
Definition: Ringbuffer.h:62
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.
Definition: IDistributedObject.h:33
virtual int64_t remainingCapacity()=0
Returns the remaining capacity of the ringbuffer.