/*============================================================================= NOTE: THIS FILE WAS AUTOMATICALLY GENERATED BY THE ManagedITK PROJECT. Project: ManagedITK Program: Insight Segmentation & Registration Toolkit Module: @NAMESPACE@Managed@MANAGED_BASE_NAME@.cxx Language: C++/CLI Author: Dan Mueller Date: $Date: 2007-09-01 06:17:25 +1000 (Sat, 01 Sep 2007) $ Revision: $Revision: 2 $ Copyright (c) Queensland University of Technology (QUT) 2007. All rights reserved. Portions of this code are covered under the ITK and VTK copyright. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =============================================================================*/ #pragma once #pragma warning( disable : 4635 ) // Disable warnings about XML doc comments #ifndef __@NAMESPACE@Managed@MANAGED_BASE_NAME@_cxx #define __@NAMESPACE@Managed@MANAGED_BASE_NAME@_cxx // Use some managed namespaces #using #using #using using namespace System; using namespace System::IO; using namespace System::Reflection; using namespace System::ComponentModel; using namespace System::Diagnostics; namespace @NAMESPACE@ { /// ///This class is a managed interface for itk::@MANAGED_BASE_NAME@. /// /// ///Both the wrapper and type classes derive from this interface. /// public interface class I@MANAGED_BASE_NAME@ { @MANAGED_PROPERTIES_INTERFACE@ @MANAGED_METHODS_INTERFACE@ }; /// ///This class is a managed wrapper for @NAMESPACE@::@MANAGED_BASE_NAME@. /// /// ///The actual type instance can be specified by calling the New() ///method with the desired output image type. /// public ref class @NAMESPACE@@MANAGED_BASE_NAME@ : @MANAGED_SUBCLASS@, I@MANAGED_BASE_NAME@ { private: @MANAGED_SUBCLASS@^ m_Instance; public: @MANAGED_CONSTRUCTORS_WRAPPER@ ///Dispose of the managed object. ~@NAMESPACE@@MANAGED_BASE_NAME@ ( ) { if (!this->m_IsDisposed) { this->m_IsDisposed = true; delete m_Instance; } } ///Finalize the managed object. !@NAMESPACE@@MANAGED_BASE_NAME@ ( ) { if (!this->m_IsDisposed) delete this; } /// ///Get/set the pointer to the native ITK object associated with ///this wrapper instance. /// ///The pointer to the native ITK object. property void* NativePointer { virtual void* get() override { return this->m_Instance->NativePointer; } virtual void set ( void* value ) override { this->m_Instance->NativePointer = value; } } /// ///Get/set the index at the current iterator location. ///Iterators NOT in the "WithIndex" family calculate the index on demand (expensive call). ///Iterators in the "WithIndex" family maintain the index during operation (inexpensive call). /// property itk::itkIndex^ Index { virtual itk::itkIndex^ get() override { return this->m_Instance->Index; } virtual void set(itk::itkIndex^ value) override { this->m_Instance->Index = value; } } ///Get the image region this iterator walks. property itk::itkImageRegion^ Region { virtual itk::itkImageRegion^ get() override { return this->m_Instance->Region; } } ///Get the image this iterator walks. property itk::itkImageBase^ Image { virtual itk::itkImageBase^ get() override { return this->m_Instance->Image; } } ///Return itk::LightObject::Print( ostream ) as a string. virtual String^ ToString ( ) override { return m_Instance->ToString( ); } ///Get the pixel value at the current iterator location. virtual itk::itkPixel^ Get() override { return this->m_Instance->Get(); } ///Move the iterator to the beginning location. virtual void GoToBegin() override { this->m_Instance->GoToBegin(); } ///Move the iterator to the ending location. virtual void GoToReverseBegin() override { this->m_Instance->GoToReverseBegin(); } ///Returns if the iterator is at the beginning of the region to iterate. virtual bool IsAtReverseEnd() override { return this->m_Instance->IsAtReverseEnd(); } ///Returns if the iterator is at the end of the region to iterate. virtual bool IsAtEnd() override { return this->m_Instance->IsAtEnd(); } ///Increment the iterator. virtual itk::itkImageConstIteratorWithIndex^ operator++() override { this->m_Instance->operator++(); return this; } ///Increment the iterator. static @NAMESPACE@@MANAGED_BASE_NAME@^ operator++(@NAMESPACE@@MANAGED_BASE_NAME@^ lhs) { lhs->m_Instance->operator++(); return lhs; } ///Decrement the iterator. virtual itk::itkImageConstIteratorWithIndex^ operator--() override { this->m_Instance->operator--(); return this; } ///Decrement the iterator. static @NAMESPACE@@MANAGED_BASE_NAME@^ operator--(@NAMESPACE@@MANAGED_BASE_NAME@^ lhs) { lhs->m_Instance->operator++(); return lhs; } ///Implement the IEnumerable interface. virtual System::Collections::IEnumerator^ GetEnumerator() override { return this->m_Instance->GetEnumerator(); } @MANAGED_PROPERTIES_WRAPPER@ @MANAGED_METHODS_WRAPPER@ private: ///Creates the correct type instance of the underlying native itk::ImageIteratorWithIndex. void CreateInstance( array^ args ) { this->m_IsDisposed = false; String^ nameInstanceType = "@NAMESPACE@.@NAMESPACE@@MANAGED_BASE_NAME@_" + this->MangledTypeString; try { Type^ typeInstance = Assembly::GetExecutingAssembly()->GetType(nameInstanceType); if (typeInstance == nullptr) throw gcnew NullReferenceException("The type '" + nameInstanceType + "' could not be found in " + Assembly::GetExecutingAssembly()->GetName() ); Object^ objInstance = Activator::CreateInstance(typeInstance, args); if (objInstance == nullptr) throw gcnew NullReferenceException("Could not invoke constructor for '" + nameInstanceType + "'."); this->m_Instance = safe_cast<@MANAGED_SUBCLASS@^>(objInstance); } catch (Exception^ ex) { throw gcnew itk::itkInvalidWrappedTypeException("Could not create an instance of '" + nameInstanceType + "'. The given type may not be supported or may be invalid.", ex); } } }; // end ref class } // end namespace @MANAGED_BASE_NAME@ #endif