ZeroBuf  0.1.0
ZeroBuf is a replacement for FlatBuffers
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ConstVector.h
1 
2 /* Copyright (c) 2015, Human Brain Project
3  * Stefan.Eilemann@epfl.ch
4  */
5 
6 #ifndef ZEROBUF_CONSTVECTOR_H
7 #define ZEROBUF_CONSTVECTOR_H
8 
9 #include <zerobuf/BaseVector.h> // base class
10 
11 namespace zerobuf
12 {
13 
19 template< class T >
20 class ConstVector : public BaseVector< const Allocator, T >
21 {
23 
24 public:
29  ConstVector( const Allocator* alloc, size_t index );
30  ~ConstVector() {}
31 
32 private:
33  ConstVector();
34  void _resize( size_t )
35  { throw std::runtime_error( "Cannot resize const vector" ); }
36  void copyBuffer( uint8_t*, size_t )
37  { throw std::runtime_error( "Cannot copy into const vector" ); }
38 };
39 
40 // Implementation
41 template< class T > inline
42 ConstVector< T >::ConstVector( const Allocator* alloc, const size_t index )
43  : BaseVector< const Allocator, T >( alloc, index )
44 {}
45 
46 }
47 
48 #endif
Const vector.
Definition: ConstVector.h:20
Allocator base class and interface.
Definition: Allocator.h:20