Embedded Template Library 1.0
Loading...
Searching...
No Matches
vector_base.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4The MIT License(MIT)
5
6Embedded Template Library.
7https://github.com/ETLCPP/etl
8https://www.etlcpp.com
9
10Copyright(c) 2014 John Wellbelove
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files(the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions :
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29******************************************************************************/
30
31#if !defined(ETL_IN_VECTOR_H) && !defined(ETL_IN_PVOIDVECTOR)
32#error This header is a private element of etl::vector & etl::pvoidvector
33#endif
34
35#ifndef ETL_VECTOR_BASE_INCLUDED
36#define ETL_VECTOR_BASE_INCLUDED
37
38#include "../platform.h"
39#include "../exception.h"
40#include "../error_handler.h"
41#include "../debug_count.h"
42
43#include <stddef.h>
44
45namespace etl
46{
47 //***************************************************************************
50 //***************************************************************************
60
61 //***************************************************************************
64 //***************************************************************************
66 {
67 public:
68
70 : vector_exception(ETL_ERROR_TEXT("vector:full", ETL_VECTOR_FILE_ID"A"), file_name_, line_number_)
71 {
72 }
73 };
74
75 //***************************************************************************
78 //***************************************************************************
80 {
81 public:
82
84 : vector_exception(ETL_ERROR_TEXT("vector:empty", ETL_VECTOR_FILE_ID"B"), file_name_, line_number_)
85 {
86 }
87 };
88
89 //***************************************************************************
92 //***************************************************************************
94 {
95 public:
96
98 : vector_exception(ETL_ERROR_TEXT("vector:bounds", ETL_VECTOR_FILE_ID"C"), file_name_, line_number_)
99 {
100 }
101 };
102
103 //***************************************************************************
106 //***************************************************************************
108 {
109 public:
110
112 : vector_exception(ETL_ERROR_TEXT("vector:type", ETL_VECTOR_FILE_ID"D"), file_name_, line_number_)
113 {
114 }
115 };
116
117 //***************************************************************************
120 //***************************************************************************
122 {
123 public:
124
125 typedef size_t size_type;
126
127 //*************************************************************************
130 //*************************************************************************
131 size_type capacity() const
132 {
133 return CAPACITY;
134 }
135
136 //*************************************************************************
139 //*************************************************************************
140 size_type max_size() const
141 {
142 return CAPACITY;
143 }
144
145 protected:
146
147 //*************************************************************************
149 //*************************************************************************
152 {
153 }
154
155 //*************************************************************************
157 //*************************************************************************
158#if defined(ETL_POLYMORPHIC_VECTOR) || defined(ETL_POLYMORPHIC_CONTAINERS) || defined(ETL_IVECTOR_REPAIR_ENABLE)
159 public:
160 virtual ~vector_base()
161 {
162 }
163#else
164 protected:
166 {
167 }
168#endif
169
170 const size_type CAPACITY;
172 };
173}
174
175#endif
Definition exception.h:47
size_type max_size() const
Definition vector_base.h:140
size_type capacity() const
Definition vector_base.h:131
vector_base(size_t max_size_)
Constructor.
Definition vector_base.h:150
const size_type CAPACITY
The maximum number of elements in the vector.
Definition vector_base.h:170
ETL_DECLARE_DEBUG_COUNT
Internal debugging.
Definition vector_base.h:171
~vector_base()
Destructor.
Definition vector_base.h:165
Definition vector_base.h:122
Definition vector_base.h:80
Definition vector_base.h:52
Definition vector_base.h:66
Definition vector_base.h:108
Definition vector_base.h:94
bitset_ext
Definition absolute.h:38
pair holds two objects of arbitrary type
Definition utility.h:164