cisst-saw
Loading...
Searching...
No Matches
vctDynamicVectorRefOwner.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
6 Author(s): Ofri Sadowsky, Anton Deguet
7 Created on: 2004-07-01
8
9 (C) Copyright 2004-2007 Johns Hopkins University (JHU), All Rights
10 Reserved.
11
12--- begin cisst license - do not edit ---
13
14This software is provided "as is" under an open source license, with
15no warranty. The complete license can be found in license.txt and
16http://www.cisst.org/cisst/license.txt.
17
18--- end cisst license ---
19*/
20
21#pragma once
22#ifndef _vctDynamicVectorRefOwner_h
23#define _vctDynamicVectorRefOwner_h
24
29
31
38template<class _elementType>
40{
41public:
42 /* define most types from vctContainerTraits */
44
47
48 /* iterators are container specific */
53
54
56 : Size(0)
57 , Stride(1)
58 , Data(0)
59 {}
60
61 vctDynamicVectorRefOwner(size_type size, value_type * data, stride_type stride = 1)
62 : Size(size)
63 , Stride(stride)
64 , Data(data)
65 {}
66
67 void SetRef(size_type size, value_type * data, stride_type stride = 1)
68 {
69 Size = size;
70 Stride = stride;
71 Data = data;
72 }
73
74 size_type size(void) const {
75 return Size;
76 }
77
78 stride_type stride(void) const {
79 return Stride;
80 }
81
82 pointer Pointer(index_type index = 0) {
83 return Data + Stride * index;
84 }
85
86 const_pointer Pointer(index_type index = 0) const {
87 return Data + Stride * index;
88 }
89
90 const_iterator begin(void) const {
91 return const_iterator(Data, Stride);
92 }
93
94 const_iterator end(void) const {
96 }
97
99 return iterator(Data, Stride);
100 }
101
102 iterator end(void) {
103 return iterator(Data + Size * Stride, Stride);
104 }
105
107 return const_reverse_iterator(Data + (Size-1) * Stride, -Stride);
108 }
109
113
115 return reverse_iterator(Data + (Size-1) * Stride, -Stride);
116 }
117
120 }
121
122protected:
123 size_type Size;
124 stride_type Stride;
126
127private:
128 // copy constructor private to prevent any call
130
131};
132
133
134#endif // _vctDynamicVectorRefOwner_h
135
const_reverse_iterator rbegin(void) const
Definition vctDynamicVectorRefOwner.h:106
pointer Pointer(index_type index=0)
Definition vctDynamicVectorRefOwner.h:82
iterator end(void)
Definition vctDynamicVectorRefOwner.h:102
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
vctDynamicVectorRefOwner()
Definition vctDynamicVectorRefOwner.h:55
vctVarStrideVectorIterator< value_type > reverse_iterator
Definition vctDynamicVectorRefOwner.h:52
const_pointer Pointer(index_type index=0) const
Definition vctDynamicVectorRefOwner.h:86
vctVarStrideVectorConstIterator< value_type > const_iterator
Definition vctDynamicVectorRefOwner.h:49
value_type * Data
Definition vctDynamicVectorRefOwner.h:125
stride_type stride(void) const
Definition vctDynamicVectorRefOwner.h:78
const_reverse_iterator rend(void) const
Definition vctDynamicVectorRefOwner.h:110
const_iterator begin(void) const
Definition vctDynamicVectorRefOwner.h:90
vctVarStrideVectorConstIterator< value_type > const_reverse_iterator
Definition vctDynamicVectorRefOwner.h:51
vctDynamicVectorRefOwner< value_type > ThisType
Definition vctDynamicVectorRefOwner.h:46
vctVarStrideVectorIterator< value_type > iterator
Definition vctDynamicVectorRefOwner.h:50
vctDynamicVectorRefOwner(size_type size, value_type *data, stride_type stride=1)
Definition vctDynamicVectorRefOwner.h:61
size_type Size
Definition vctDynamicVectorRefOwner.h:123
reverse_iterator rbegin(void)
Definition vctDynamicVectorRefOwner.h:114
const_iterator end(void) const
Definition vctDynamicVectorRefOwner.h:94
iterator begin(void)
Definition vctDynamicVectorRefOwner.h:98
reverse_iterator rend(void)
Definition vctDynamicVectorRefOwner.h:118
size_type size(void) const
Definition vctDynamicVectorRefOwner.h:74
stride_type Stride
Definition vctDynamicVectorRefOwner.h:124
void SetRef(size_type size, value_type *data, stride_type stride=1)
Definition vctDynamicVectorRefOwner.h:67
Definition vctVarStrideVectorIterator.h:56
Definition vctVarStrideVectorIterator.h:218
#define CMN_UNUSED(argument)
Definition cmnPortability.h:497
Declaration of vctVarStrideVectorConstIterator and vctVarStrideVectorIterator.