/*============================================================================= 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: 2008-06-21 09:20:09 +0200 (Sat, 21 Jun 2008) $ Revision: $Revision: 18 $ Portions of this code are covered under the ITK and VTK copyright. See http://www.itk.org/HTML/Copyright.htm for details. See http://www.kitware.com/VTKCopyright.htm for details. Copyright (c) 2008 Queensland University of Technology (QUT) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =============================================================================*/ #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 IntPtr NativePointer { virtual IntPtr get() override { return IntPtr(this->m_Instance->NativePointer); } virtual void set ( IntPtr 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; } } ///Get if the iterator is at the beginning of the region to iterate. property bool IsAtBegin { virtual bool get() override { return this->m_Instance->IsAtBegin; } } ///Get if the iterator is at the end of the region to iterate. property bool IsAtEnd { virtual bool get() override { return this->m_Instance->IsAtEnd; } } ///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 GoToEnd() override { this->m_Instance->GoToEnd(); } ///Increment the iterator. virtual itk::itkImageConstIterator^ 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::itkImageConstIterator^ 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::ImageIterator. 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