EMAN2
|
CustomVector has some trivial optimizations of the STL vector. More...
#include <marchingcubes.h>
Public Member Functions | |
CustomVector (unsigned int starting_size=1024) | |
Constructor. More... | |
~CustomVector () | |
void | clear (unsigned int starting_size=1024) |
Clear clears all data and resizes. More... | |
void | resize (const unsigned int n) |
Resize Resize the data pointer using realloc In general you want to resize to a larger size... More... | |
void | push_back (const type &t) |
Push back a value Potentially resizes. More... | |
void | push_back_3 (const type *const p) |
Push back 3 values Potentially resizes. More... | |
void | mult3 (const type &v1, const type &v2, const type &v3) |
Multiply contiguous groups of 3 by different values. More... | |
unsigned int | elem () |
The number of elements, is the same as STL::vector size() Should be called size() but oh well... This is the actual number of stored floating point numbers not the number of 'groups of 3'. More... | |
type & | operator[] (const unsigned int idx) |
Operator[] - provide convenient set functionality (note NOT get) More... | |
type * | get_data () |
get the underlying data as a pointer objects More... | |
Private Attributes | |
type * | data |
The data pointer. More... | |
unsigned int | size |
The size of the associated memory block. More... | |
unsigned int | elements |
The number of stored elements. More... | |
CustomVector has some trivial optimizations of the STL vector.
It has get_data() functionality, which gives direct access to the underlying data, which is necessary for handing OpenGL vertex and normal arrays - the native STL vector does not give straightforward access to the data pointers. This class also has a push_back_3 function which does a memcpy of 3 elements - this can be used instead of 3 push_back function calls. Although it wasn't rigorously tested it should save some time by virtue of less function calls. Although the savings may be trivial, I just haven't tested it.
This class was not written for general use because- it is designed specifically for use in conjunction with the MarchingCubes class only.
Definition at line 74 of file marchingcubes.h.
|
inlineexplicit |
Constructor.
starting_size | the starting size of the underlying data |
Definition at line 80 of file marchingcubes.h.
References EMAN::CustomVector< type >::resize().
|
inline |
Definition at line 85 of file marchingcubes.h.
References EMAN::CustomVector< type >::data.
|
inline |
Clear clears all data and resizes.
starting_size | the starting size of the underlying data |
Definition at line 94 of file marchingcubes.h.
References EMAN::CustomVector< type >::data, EMAN::CustomVector< type >::elements, EMAN::CustomVector< type >::resize(), and EMAN::CustomVector< type >::size.
|
inline |
The number of elements, is the same as STL::vector size() Should be called size() but oh well... This is the actual number of stored floating point numbers not the number of 'groups of 3'.
Definition at line 155 of file marchingcubes.h.
References EMAN::CustomVector< type >::elements.
|
inline |
get the underlying data as a pointer objects
Definition at line 174 of file marchingcubes.h.
References EMAN::CustomVector< type >::data.
|
inline |
Multiply contiguous groups of 3 by different values.
Definition at line 140 of file marchingcubes.h.
References EMAN::CustomVector< type >::data, and EMAN::CustomVector< type >::elements.
|
inline |
Operator[] - provide convenient set functionality (note NOT get)
idx | the index to access for setting purposes potentially resizes |
Definition at line 161 of file marchingcubes.h.
References EMAN::CustomVector< type >::data, EMAN::CustomVector< type >::resize(), and EMAN::CustomVector< type >::size.
|
inline |
Push back a value Potentially resizes.
t | the value to push back |
Definition at line 120 of file marchingcubes.h.
References EMAN::CustomVector< type >::data, EMAN::CustomVector< type >::elements, EMAN::CustomVector< type >::resize(), and EMAN::CustomVector< type >::size.
|
inline |
Push back 3 values Potentially resizes.
p | a pointer to 3 contiguous values |
Definition at line 131 of file marchingcubes.h.
References EMAN::CustomVector< type >::data, EMAN::CustomVector< type >::elements, EMAN::CustomVector< type >::resize(), and EMAN::CustomVector< type >::size.
|
inline |
Resize Resize the data pointer using realloc In general you want to resize to a larger size...
n | the new size of the underlying data |
Definition at line 108 of file marchingcubes.h.
References EMAN::CustomVector< type >::data, and EMAN::CustomVector< type >::size.
Referenced by EMAN::CustomVector< type >::clear(), EMAN::CustomVector< type >::CustomVector(), EMAN::CustomVector< type >::operator[](), EMAN::CustomVector< type >::push_back(), and EMAN::CustomVector< type >::push_back_3().
|
private |
The data pointer.
Definition at line 178 of file marchingcubes.h.
Referenced by EMAN::CustomVector< type >::clear(), EMAN::CustomVector< type >::get_data(), EMAN::CustomVector< type >::mult3(), EMAN::CustomVector< type >::operator[](), EMAN::CustomVector< type >::push_back(), EMAN::CustomVector< type >::push_back_3(), EMAN::CustomVector< type >::resize(), and EMAN::CustomVector< type >::~CustomVector().
|
private |
The number of stored elements.
Definition at line 182 of file marchingcubes.h.
Referenced by EMAN::CustomVector< type >::clear(), EMAN::CustomVector< type >::elem(), EMAN::CustomVector< type >::mult3(), EMAN::CustomVector< type >::push_back(), and EMAN::CustomVector< type >::push_back_3().
|
private |
The size of the associated memory block.
Definition at line 180 of file marchingcubes.h.
Referenced by EMAN::CustomVector< type >::clear(), EMAN::CustomVector< type >::operator[](), EMAN::CustomVector< type >::push_back(), EMAN::CustomVector< type >::push_back_3(), and EMAN::CustomVector< type >::resize().