![]() |
Orfeo Toolbox
3.16
|
Encapsulation of OGRField Instances of Field are expected to be built from an existing Feature with which they'll share their owning OGRFeature.
More...
#include <otbOGRFieldWrapper.h>
Collaboration diagram for otb::ogr::Field:Public Member Functions | |
| Field (Feature &feature, vcl_size_t index) | |
| void | Assign (Field const &f) |
| FieldDefn const & | GetDefinition () const |
| Field definition accessor. More... | |
| std::string | GetName () const |
| Field name accessor. More... | |
| OGRFieldType | GetType () const |
| Field type accessor. More... | |
| template<typename T > | |
| T | GetValue () const |
| bool | HasBeenSet () const |
| Tells whether the field value has been set. More... | |
| OGRField & | ogr () const |
| OGRField & | ogr () |
| More... | |
| std::ostream & | PrintSelf (std::ostream &os, itk::Indent indent) const |
| template<typename T > | |
| void | SetValue (T const &value) |
| void | Unset () const |
| Unsets the value of the field. More... | |
Private Member Functions | |
| void | CheckInvariants () const |
Unchecked definitions | |
All the definitions that follow do the real work. However, they are not the exposed public functions. The design of this class follows the principle behind the NVI (Non-Virtual Interface) pattern:
| |
| bool | UncheckedHasBeenSet () const |
| void | UncheckedUnset () const |
| std::ostream & | UncheckedPrintSelf (std::ostream &os, itk::Indent indent) const |
| void | UncheckedAssign (Field const &f) |
Private Attributes | |
| FieldDefn | m_Definition |
| Definition of the field. More... | |
| boost::shared_ptr< OGRFeature > & | m_Feature |
Link to the actual OGRFeature in charge of the fields. More... | |
| vcl_size_t | m_index |
Encapsulation of OGRField Instances of Field are expected to be built from an existing Feature with which they'll share their owning OGRFeature.
A Field instance works as a proxy. Copying a field will only have it share the actual OGRField between several instances. In order to copy a field value from another field, use Field::assign().
m_Feature shall be valid (i.e. not wrapping a null OGRFeature). m_index < m_Feature->GetFieldCount(). m_Feature->GetFieldDefnRef(m_index) != 0. Definition at line 91 of file otbOGRFieldWrapper.h.
| otb::ogr::Field::Field | ( | Feature & | feature, |
| vcl_size_t | index | ||
| ) |
Constructor.
| [in,out] | feature | Feature from which the field is. |
| [in] | index | Index of the field in the Feature. |
| None |
Definition at line 111 of file otbOGRFieldWrapper.cxx.
References CheckInvariants().
|
inline |
Copies a field. As Field is a proxy type, this function is the only possible way to copy a field.
First, the field must be defined with a definition, then it could be set from another field value.
Definition at line 434 of file otbOGRFieldWrapper.txx.
References CheckInvariants(), and GetType().
|
inlineprivate |
Internal function to check class invariants. If any invariant is broken, an assertion will be fired.
Definition at line 366 of file otbOGRFieldWrapper.txx.
|
inline |
Field definition accessor.
Definition at line 102 of file otbOGRFieldWrapper.h.
References m_Definition.
|
inline |
Field name accessor.
Definition at line 108 of file otbOGRFieldWrapper.h.
References otb::ogr::FieldDefn::GetName(), and m_Definition.
Referenced by printField().
|
inline |
Field type accessor.
Definition at line 105 of file otbOGRFieldWrapper.h.
References otb::ogr::FieldDefn::GetType(), and m_Definition.
Referenced by Assign().
|
inline |
Value getter.
| T | expected type for the stored value. |
| None |
T must match the field's type. Definition at line 396 of file otbOGRFieldWrapper.txx.
References otb::ogr::internal::BOOST_STATIC_ASSERT().
Referenced by PushVisitor::operator()(), otb::OGRLayerStreamStitchingFilter< TInputImage >::ProcessStreamingLine(), and otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile().
|
inline |
Tells whether the field value has been set.
Definition at line 420 of file otbOGRFieldWrapper.txx.
Referenced by UncheckedAssign().
|
inline |
Access to the raw underlying OGR data. This function provides an abstraction leak in case deeper control on the underlying OGRFeature is required.
OGRField obtained this way. Definition at line 448 of file otbOGRFieldWrapper.txx.
Referenced by UncheckedAssign().
|
inline |
Access to the raw underlying OGR data. This function provides an abstraction leak in case deeper control on the underlying OGRFeature is required.
OGRField obtained this way. Definition at line 454 of file otbOGRFieldWrapper.txx.
|
inline |
Prints self into stream.
Definition at line 412 of file otbOGRFieldWrapper.txx.
Referenced by otb::ogr::Feature::UncheckedPrintSelf().
|
inline |
Value setter.
| [in] | value | New value for the field. |
| None |
value's kind must match the field's type. Definition at line 375 of file otbOGRFieldWrapper.txx.
References otb::ogr::internal::BOOST_MPL_ASSERT_NOT().
Referenced by SetFieldVisitor::operator()(), and otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile().
|
private |
Definition at line 163 of file otbOGRFieldWrapper.cxx.
References HasBeenSet(), and ogr().
|
private |
Definition at line 153 of file otbOGRFieldWrapper.cxx.
|
private |
Definition at line 119 of file otbOGRFieldWrapper.cxx.
References itk::Indent::GetNextIndent(), and otb::Join().
|
private |
Definition at line 158 of file otbOGRFieldWrapper.cxx.
|
inline |
Unsets the value of the field.
Definition at line 427 of file otbOGRFieldWrapper.txx.
|
private |
Definition of the field.
Definition at line 192 of file otbOGRFieldWrapper.h.
Referenced by GetDefinition(), GetName(), and GetType().
|
private |
Link to the actual OGRFeature in charge of the fields.
Definition at line 194 of file otbOGRFieldWrapper.h.
|
private |
Index of the field according to the feature definition.
Definition at line 200 of file otbOGRFieldWrapper.h.