cisst-saw
Loading...
Searching...
No Matches
vctDynamicConstVectorRef.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5 Author(s): Ofri Sadowsky, Anton Deguet
6 Created on: 2004-07-01
7
8 (C) Copyright 2004-2018 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17*/
18
19#pragma once
20#ifndef _vctDynamicConstVectorRef_h
21#define _vctDynamicConstVectorRef_h
22
27
30
76template <class _elementType>
78 public vctDynamicConstVectorBase<vctDynamicVectorRefOwner<_elementType>, _elementType>
79{
80public:
85 typedef typename BaseType::CopyType CopyType;
90
94
97 BaseType()
98 {
99 SetRef(other.size(), other.Pointer(), other.stride());
100 }
101
102 vctDynamicConstVectorRef(size_type size, pointer data, stride_type stride = 1) {
103 SetRef(size, data, stride);
104 }
105
106 vctDynamicConstVectorRef(size_type size, const_pointer data, stride_type stride = 1) {
107 SetRef(size, data, stride);
108 }
109
115 template <size_type __size, stride_type __stride, class __dataPtrType>
120
127 template <size_type __size, stride_type __stride, class __dataPtrType>
129 size_type startPosition, size_type length)
130 {
131 SetRef(otherVector, startPosition, length);
132 }
133
137 template <class __vectorOwnerType>
142
147 template <class __vectorOwnerType>
149 size_type startPosition, size_type length)
150 {
151 SetRef(otherVector, startPosition, length);
152 }
153
154 void SetRef(size_type size, const_pointer p, stride_type stride = 1) {
155 this->Vector.SetRef(size, const_cast<pointer>(p), stride);
156 }
157
162 template <size_type __size, stride_type __stride, class __dataPtrType>
164 {
165 SetRef(otherVector.size(), otherVector.Pointer(), otherVector.stride());
166 }
167
174 template <size_type __size, stride_type __stride, class __dataPtrType>
176 size_type startPosition, size_type length) CISST_THROW(std::out_of_range)
177 {
178 if (startPosition + length > otherVector.size()) {
179 cmnThrow(std::out_of_range("vctDynamicConstVectorRef SetRef out of range"));
180 }
181 SetRef(length, otherVector.Pointer(startPosition), otherVector.stride());
182 }
183
188 template <class __vectorOwnerType>
190 {
191 SetRef(otherVector.size(), otherVector.Pointer(), otherVector.stride());
192 }
193
200 template <class __vectorOwnerType>
202 size_type startPosition, size_type length) CISST_THROW(std::out_of_range)
203 {
204 if (startPosition + length > otherVector.size()) {
205 cmnThrow(std::out_of_range("vctDynamicConstVectorRef SetRef out of range"));
206 }
207 SetRef(length, otherVector.Pointer(startPosition), otherVector.stride());
208 }
209
210};
211
212
213#endif // _vctDynamicConstVectorRef_h
214
Definition vctForwardDeclarations.h:119
VectorOwnerType::reverse_iterator reverse_iterator
Definition vctDynamicConstVectorRef.h:88
vctDynamicConstVectorRef(size_type size, pointer data, stride_type stride=1)
Definition vctDynamicConstVectorRef.h:102
vctDynamicConstVectorRef(const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector, size_type startPosition, size_type length)
Definition vctDynamicConstVectorRef.h:148
vctDynamicConstVectorRef(const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &otherVector)
Definition vctDynamicConstVectorRef.h:116
void SetRef(size_type size, const_pointer p, stride_type stride=1)
Definition vctDynamicConstVectorRef.h:154
BaseType::CopyType CopyType
Definition vctDynamicConstVectorRef.h:85
vctDynamicVectorRefOwner< value_type > VectorOwnerType
Definition vctDynamicConstVectorRef.h:83
void SetRef(const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
Definition vctDynamicConstVectorRef.h:189
vctDynamicConstVectorRef()
Definition vctDynamicConstVectorRef.h:92
vctDynamicConstVectorRef(const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &otherVector, size_type startPosition, size_type length)
Definition vctDynamicConstVectorRef.h:128
VectorOwnerType::const_iterator const_iterator
Definition vctDynamicConstVectorRef.h:87
vctDynamicConstVectorRef(const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector)
Definition vctDynamicConstVectorRef.h:138
vctDynamicConstVectorRef< value_type > ThisType
Definition vctDynamicConstVectorRef.h:82
vctDynamicConstVectorRef(const ThisType &other)
Definition vctDynamicConstVectorRef.h:96
vctDynamicConstVectorRef(size_type size, const_pointer data, stride_type stride=1)
Definition vctDynamicConstVectorRef.h:106
vctDynamicConstVectorBase< vctDynamicVectorRefOwner< value_type >, value_type > BaseType
Definition vctDynamicConstVectorRef.h:84
VectorOwnerType::iterator iterator
Definition vctDynamicConstVectorRef.h:86
void SetRef(const vctDynamicConstVectorBase< __vectorOwnerType, _elementType > &otherVector, size_type startPosition, size_type length) CISST_THROW(std
Definition vctDynamicConstVectorRef.h:201
void SetRef(const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &otherVector)
Definition vctDynamicConstVectorRef.h:163
VectorOwnerType::const_reverse_iterator const_reverse_iterator
Definition vctDynamicConstVectorRef.h:89
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
void SetRef(const vctFixedSizeConstVectorBase< __size, __stride, _elementType, __dataPtrType > &otherVector, size_type startPosition, size_type length) CISST_THROW(std
Definition vctDynamicConstVectorRef.h:175
Definition vctDynamicVectorRefOwner.h:40
vctVarStrideVectorIterator< value_type > reverse_iterator
Definition vctDynamicVectorRefOwner.h:52
vctVarStrideVectorConstIterator< value_type > const_iterator
Definition vctDynamicVectorRefOwner.h:49
vctVarStrideVectorConstIterator< value_type > const_reverse_iterator
Definition vctDynamicVectorRefOwner.h:51
vctVarStrideVectorIterator< value_type > iterator
Definition vctDynamicVectorRefOwner.h:50
A template for a fixed length vector with fixed spacing in memory.
Definition vctFixedSizeConstVectorBase.h:108
difference_type stride(void) const
Definition vctFixedSizeConstVectorBase.h:218
size_type size(void) const
Definition vctFixedSizeConstVectorBase.h:205
const_pointer Pointer(size_type index=0) const
Definition vctFixedSizeConstVectorBase.h:268
#define CISST_THROW(exceptionParameter)
Somewhat portable compilation warning message. This works with very recent versions of gcc (4....
Definition cmnPortability.h:559
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
size_type size(void) const
Definition vctDynamicConstMatrixBase.h:228
difference_type stride(dimension_type dimension) const
Definition vctDynamicConstNArrayBase.h:325
Declaration of vctDynamicConstVectorBase.
OwnerType Vector
Definition vctDynamicConstVectorBase.h:126
Declaration of vctDynamicVectorRefOwner.