Field3D
WritableField< Data_T > Class Template Reference

#include <Field.h>

Inheritance diagram for WritableField< Data_T >:
Field< Data_T > FieldRes FieldBase RefBase ResizableField< Data_T > DenseField< Data_T > EmptyField< Data_T > MACField< Data_T > SparseField< Data_T >

List of all members.

Classes

class  iterator

Public Types

typedef WritableField< Data_T > class_type
typedef boost::intrusive_ptr
< WritableField
Ptr

Public Member Functions

iterator begin ()
 Iterator to first element.
iterator begin (const Box3i &subset)
 Iterator to first element of specific subset.
virtual void clear (const Data_T &value)
 Clears all the voxels in the storage. Should be re-implemented by subclasses that can provide a more efficient version.
iterator end (const Box3i &subset)
 Iterator pointing one element past the last valid one (for a subset)
iterator end ()
 Iterator pointing one element past the last valid one.
virtual Data_T & lvalue (int i, int j, int k)=0
 Write access to a voxel. The coordinates are global coordinates.

Static Public Member Functions

static const char * classType ()
static const char * staticClassName ()

Public Attributes

 DEFINE_FIELD_RTTI_ABSTRACT_CLASS

Private Types

typedef Field< Data_T > base
 Convenience typedef for referring to base class.

Static Private Attributes

static TemplatedFieldType
< WritableField< Data_T > > 
ms_classType

Detailed Description

template<class Data_T>
class WritableField< Data_T >

This class brings together both read- and write-access to voxels. The buffer can not be resized. Resizing is added by ResizableField.

Definition at line 596 of file Field.h.


Member Typedef Documentation

template<class Data_T>
typedef boost::intrusive_ptr<WritableField> WritableField< Data_T >::Ptr
template<class Data_T>
typedef WritableField<Data_T> WritableField< Data_T >::class_type
template<class Data_T>
typedef Field<Data_T> WritableField< Data_T >::base [private]

Convenience typedef for referring to base class.

Reimplemented from Field< Data_T >.

Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, ResizableField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

Definition at line 663 of file Field.h.


Member Function Documentation

template<class Data_T>
static const char* WritableField< Data_T >::staticClassName ( ) [inline, static]

Reimplemented from Field< Data_T >.

Reimplemented in DenseField< Data_T >, ResizableField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

Definition at line 610 of file Field.h.

  {
    return "WritableField";
  }
template<class Data_T>
static const char* WritableField< Data_T >::classType ( ) [inline, static]
template<class Data_T >
WritableField< Data_T >::iterator WritableField< Data_T >::begin ( ) [inline]

Iterator to first element.

Reimplemented in DenseField< Data_T >, and SparseField< Data_T >.

Definition at line 675 of file Field.h.

References FieldRes::dataResolution().

Referenced by WritableField< Data_T >::clear().

{
  if (FieldRes::dataResolution() == V3i(0))
    return end();
  return iterator(*this, Field<Data_T>::m_dataWindow, 
                  Field<Data_T>::m_dataWindow.min);
}
template<class Data_T >
WritableField< Data_T >::iterator WritableField< Data_T >::begin ( const Box3i subset) [inline]

Iterator to first element of specific subset.

Reimplemented in DenseField< Data_T >, and SparseField< Data_T >.

Definition at line 687 of file Field.h.

{
  if (subset.isEmpty())
    return end(subset);
  return iterator(*this, subset, subset.min);
}
template<class Data_T >
WritableField< Data_T >::iterator WritableField< Data_T >::end ( ) [inline]

Iterator pointing one element past the last valid one.

Reimplemented in DenseField< Data_T >, and SparseField< Data_T >.

Definition at line 698 of file Field.h.

Referenced by WritableField< Data_T >::clear().

template<class Data_T >
WritableField< Data_T >::iterator WritableField< Data_T >::end ( const Box3i subset) [inline]

Iterator pointing one element past the last valid one (for a subset)

Reimplemented in DenseField< Data_T >, and SparseField< Data_T >.

Definition at line 709 of file Field.h.

{ return iterator(*this, subset, 
                  V3i(subset.min.x, subset.min.y, subset.max.z + 1));
}
template<class Data_T>
virtual Data_T& WritableField< Data_T >::lvalue ( int  i,
int  j,
int  k 
) [pure virtual]

Write access to a voxel. The coordinates are global coordinates.

Note:
Before the internal storage is accessed, the subclass must compute the crop window coordinates by looking at Field::m_dataWindow.
This is named differently from the const value so that non-const objects still have a clear way of accessing data in a const way.
Virtual functions are known not to play nice with threading. Therefor, concrete classes can implement (by convention) fastLValue() as a non-virtual function.

Implemented in DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

template<class Data_T>
virtual void WritableField< Data_T >::clear ( const Data_T &  value) [inline, virtual]

Clears all the voxels in the storage. Should be re-implemented by subclasses that can provide a more efficient version.

Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

Definition at line 652 of file Field.h.

References WritableField< Data_T >::begin(), and WritableField< Data_T >::end().

  { std::fill(begin(), end(), value); }

Member Data Documentation

template<class Data_T>
WritableField< Data_T >::DEFINE_FIELD_RTTI_ABSTRACT_CLASS

Reimplemented from Field< Data_T >.

Reimplemented in ResizableField< Data_T >.

Definition at line 608 of file Field.h.

template<class Data_T>
TemplatedFieldType<WritableField<Data_T> > WritableField< Data_T >::ms_classType [static, private]

Reimplemented from Field< Data_T >.

Reimplemented in DenseField< Data_T >, ResizableField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

Definition at line 659 of file Field.h.


The documentation for this class was generated from the following file: