From: Leonardo Florez Valencia Date: Tue, 5 Apr 2016 22:04:54 +0000 (-0500) Subject: It should now compile on windows... X-Git-Tag: v0.1~207 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f6a1a464a66361a325a5835e22863f8d72a1fe73;p=cpPlugins.git It should now compile on windows... --- diff --git a/appli/bash/cpPlugins_CreateInstances.cxx b/appli/bash/cpPlugins_CreateInstances.cxx index 2340678..b83bdce 100644 --- a/appli/bash/cpPlugins_CreateInstances.cxx +++ b/appli/bash/cpPlugins_CreateInstances.cxx @@ -2,18 +2,24 @@ #include #include -#include #include #include #include #include +#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) +# define cpPlugins_STRTOK( A, B, N ) strtok_s( A, B, N ) +#else // defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) +# define cpPlugins_STRTOK( A, B, N ) std::strtok( A, B ) +#endif // defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) + // ------------------------------------------------------------------------- typedef std::vector< std::string > TLines; typedef std::map< char, TLines > TParsedLines; typedef std::map< std::string, TLines > TVariables; // ------------------------------------------------------------------------- +bool cpPlugins_ISBLANK( const char& value ); TLines Tokenize( const std::string& str, const std::string& delims ); std::string Replace( const std::string& str, const std::string& sub, const std::string& nsub @@ -146,20 +152,29 @@ int main( int argc, char* argv[] ) return( 0 ); } +// ------------------------------------------------------------------------- +bool cpPlugins_ISBLANK( const char& value ) +{ + return( value == ' ' || value == '\t' || value == '\n' || value == '\r' ); +} + // ------------------------------------------------------------------------- TLines Tokenize( const std::string& str, const std::string& delims ) { TLines tokens; if( str.size( ) > 0 ) { - char* buffer = new char[ str.size( ) + 1 ]; - std::strcpy( buffer, str.c_str( ) ); - buffer[ str.size( ) ] = '\0'; - char* it = std::strtok( buffer, delims.c_str( ) ); + auto ssize = str.size( ); + char* buffer = new char[ ssize + 1 ]; + for( unsigned long i = 0; i < ssize; ++i ) + buffer[ i ] = str[ i ]; + buffer[ ssize ] = '\0'; + char* next; + char* it = cpPlugins_STRTOK( buffer, delims.c_str( ), &next ); while( it != NULL ) { tokens.push_back( std::string( it ) ); - it = std::strtok( NULL, delims.c_str( ) ); + it = cpPlugins_STRTOK( NULL, delims.c_str( ), &next ); } // elihw delete buffer; @@ -189,7 +204,7 @@ bool ReadFile( TParsedLines& lines, const std::string& fname ) return( false ); std::string buffer; file_stream.seekg( 0, std::ios::end ); - buffer.reserve( file_stream.tellg( ) ); + buffer.reserve( ( unsigned int )( file_stream.tellg( ) ) ); file_stream.seekg( 0, std::ios::beg ); buffer.assign( ( std::istreambuf_iterator< char >( file_stream ) ), @@ -207,7 +222,7 @@ bool ReadFile( TParsedLines& lines, const std::string& fname ) auto lIt = line.begin( ); while( lIt != line.end( ) ) { - if( !std::isblank( *lIt ) ) + if( !cpPlugins_ISBLANK( *lIt ) ) { if( cmd_pos == line.end( ) ) { diff --git a/appli/bash/cpPlugins_HostCreator.cxx b/appli/bash/cpPlugins_HostCreator.cxx index 4fbaded..eb529bd 100644 --- a/appli/bash/cpPlugins_HostCreator.cxx +++ b/appli/bash/cpPlugins_HostCreator.cxx @@ -26,7 +26,7 @@ void process_header( TInfo& info, const std::string& file_name ) return; std::string buf; file_stream.seekg( 0, std::ios::end ); - buf.reserve( file_stream.tellg( ) ); + buf.reserve( ( unsigned int )( file_stream.tellg( ) ) ); file_stream.seekg( 0, std::ios::beg ); buf.assign( ( std::istreambuf_iterator< char >( file_stream ) ), diff --git a/lib/cpPlugins_Instances/Base_extra.cxx b/lib/cpPlugins_Instances/Base_extra.cxx index 77449ff..e0d8a83 100644 --- a/lib/cpPlugins_Instances/Base_extra.cxx +++ b/lib/cpPlugins_Instances/Base_extra.cxx @@ -4,11 +4,13 @@ #include #include #include +#include #include #include #include #include +#include #include // ------------------------------------------------------------------------- @@ -44,4 +46,15 @@ cpPlugins_Base_extra_Array_AllScalars_AllDims( itk::FixedArray ); cpPlugins_Base_extra_Array_AllScalars_AllDims( itk::Point ); cpPlugins_Base_extra_Array_AllScalars_AllDims( itk::Vector ); +#define cpPlugins_Base_extra_VariableLengthVector_SetSize( T, P ) \ + template cpPlugins_Base_EXPORT void itk::VariableLengthVector< T >:: \ + SetSize< itk::VariableLengthVector< T >::P, \ + itk::VariableLengthVector< T >::KeepOldValues >( \ + unsigned int, itk::VariableLengthVector< T >::P, \ + itk::VariableLengthVector< float >::KeepOldValues \ + ) + +cpPlugins_Base_extra_VariableLengthVector_SetSize( float, AlwaysReallocate ); +cpPlugins_Base_extra_VariableLengthVector_SetSize( float, ShrinkToFit ); + // eof - $RCSfile$ diff --git a/lib/cpPlugins_Instances/CMakeLists.txt b/lib/cpPlugins_Instances/CMakeLists.txt index 2be6bd8..bd6ff33 100644 --- a/lib/cpPlugins_Instances/CMakeLists.txt +++ b/lib/cpPlugins_Instances/CMakeLists.txt @@ -36,90 +36,20 @@ FOREACH(i ${libs_DEFS}) ENDFOREACH(i) ## Target links -TARGET_LINK_LIBRARIES(cpPlugins_Base ${ITK_LIBRARIES} ${VTK_LIBRARIES}) -TARGET_LINK_LIBRARIES(cpPlugins_Image cpPlugins_Base) -TARGET_LINK_LIBRARIES(cpPlugins_Mesh cpPlugins_Base) +TARGET_LINK_LIBRARIES(cpPlugins_Base ${ITK_LIBRARIES}) +TARGET_LINK_LIBRARIES(cpPlugins_Transforms ${ITK_LIBRARIES} cpPlugins_Base) TARGET_LINK_LIBRARIES(cpPlugins_Paths cpPlugins_Base) -TARGET_LINK_LIBRARIES(cpPlugins_Transforms cpPlugins_Base) -TARGET_LINK_LIBRARIES(cpPlugins_ImageIterators cpPlugins_Image) +TARGET_LINK_LIBRARIES(cpPlugins_Mesh cpPlugins_Base) +TARGET_LINK_LIBRARIES(cpPlugins_Image cpPlugins_Base) +TARGET_LINK_LIBRARIES(cpPlugins_ImageIterators ${ITK_LIBRARIES} cpPlugins_Image) TARGET_LINK_LIBRARIES(cpPlugins_ImageFiltersBase cpPlugins_Image) TARGET_LINK_LIBRARIES(cpPlugins_InPlaceImageFiltersBase cpPlugins_ImageFiltersBase) +TARGET_LINK_LIBRARIES(cpPlugins_ImageITK2VTK cpPlugins_ImageFiltersBase ${VTK_LIBRARIES}) TARGET_LINK_LIBRARIES(cpPlugins_ThresholdFilters cpPlugins_InPlaceImageFiltersBase cpPlugins_ImageIterators) TARGET_LINK_LIBRARIES(cpPlugins_DistanceMapFilters cpPlugins_ThresholdFilters) -TARGET_LINK_LIBRARIES(cpPlugins_ImageIO cpPlugins_ImageFiltersBase cpPlugins_ImageIterators) -TARGET_LINK_LIBRARIES(cpPlugins_ImageITK2VTK cpPlugins_ImageFiltersBase) TARGET_LINK_LIBRARIES(cpPlugins_ResamplingFilters cpPlugins_ImageFiltersBase cpPlugins_ImageIterators cpPlugins_Transforms) TARGET_LINK_LIBRARIES(cpPlugins_GaussianImageFilters cpPlugins_ImageFiltersBase cpPlugins_ImageIterators) - -#TARGET_LINK_LIBRARIES(cpPlugins_Transforms -# cpPlugins_Base -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_Image -# cpPlugins_Base -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_Mesh -# cpPlugins_Base -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_ImageFiltersBase -# cpPlugins_Image -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_ImageITK2VTK -# cpPlugins_ImageFiltersBase -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_ImageIterators -# cpPlugins_Image -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_ImageIO -# cpPlugins_ImageFiltersBase -# cpPlugins_ImageIterators -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_ThresholdFilters -# cpPlugins_ImageFiltersBase -# cpPlugins_ImageIterators -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_DistanceMapFilters -# cpPlugins_ThresholdFilters -# ) -# TARGET_LINK_LIBRARIES( -# cpPlugins_ResamplingFilters -# cpPlugins_Transforms -# cpPlugins_ImageFiltersBase -# cpPlugins_ImageIterators -# ) - -# # =================================== -# # = Integrate all source file names = -# # =================================== - -# SET( -# lib_HEADERS -# ${lib_HEADERS_H} -# ${lib_HEADERS_HPP} -# ${lib_HEADERS_HXX} -# ) - -# SET( -# lib_SOURCES -# ${lib_SOURCES_C} -# ${lib_SOURCES_CPP} -# ${lib_SOURCES_CXX} -# ) - -# ## ===================== -# ## = Compilation rules = -# ## ===================== - -# ## ======================== -# ## == Installation rules == -# ## ======================== +TARGET_LINK_LIBRARIES(cpPlugins_ImageIO cpPlugins_ImageFiltersBase cpPlugins_ImageIterators) # INSTALL( # TARGETS ${l_NAME} diff --git a/lib/cpPlugins_Instances/Image.i b/lib/cpPlugins_Instances/Image.i index 1387997..7e8c24d 100644 --- a/lib/cpPlugins_Instances/Image.i +++ b/lib/cpPlugins_Instances/Image.i @@ -17,6 +17,9 @@ d #pixels=#scalar;#color_pixels;#complex_pixels d #array_pixels=#lin_alg_vectors;itk::SymmetricSecondRankTensor d #double_array_pixels=itk::Matrix +c itk::ImageRegion< #dims > +c itk::ImageBase< #dims > + c itk::ImportImageContainer< unsigned long, #pixels > c itk::ImportImageContainer< unsigned long, #array_pixels< #float, #dims > > c itk::ImportImageContainer< unsigned long, #double_array_pixels< #float, #dims, #dims > > diff --git a/lib/cpPlugins_Instances/ImageITK2VTK.i b/lib/cpPlugins_Instances/ImageITK2VTK.i index 2c9315a..7529a31 100644 --- a/lib/cpPlugins_Instances/ImageITK2VTK.i +++ b/lib/cpPlugins_Instances/ImageITK2VTK.i @@ -12,9 +12,7 @@ d #color_pixels=itk::RGBPixel< #scalar >;itk::RGBAPixel< #scalar > d #lin_alg_vectors=itk::CovariantVector;itk::Point;itk::Vector d #pixels=#scalar;#color_pixels;#complex_pixels d #array_pixels=#lin_alg_vectors;itk::SymmetricSecondRankTensor -d #double_array_pixels=itk::Matrix d #filters=itk::ImageToVTKImageFilter;itk::VTKImageToImageFilter c #filters< itk::Image< #pixels, #dims > > c #filters< itk::Image< #array_pixels< #float, #dims >, #dims > > -c #filters< itk::Image< #double_array_pixels< #float, #dims, #dims >, #dims > > diff --git a/lib/cpPlugins_Instances/Mesh.i b/lib/cpPlugins_Instances/Mesh.i index e0d68a9..bd0b0c4 100644 --- a/lib/cpPlugins_Instances/Mesh.i +++ b/lib/cpPlugins_Instances/Mesh.i @@ -9,5 +9,6 @@ t itkBoundingBox.h t itkMapContainer.h t itkVectorContainer.h +c itk::VectorContainer< unsigned long, itk::CellInterface< #float, itk::CellTraitsInfo< #dims, float, float, unsigned long, unsigned long, unsigned long, itk::Point< float, #dims >, itk::VectorContainer< unsigned long, itk::Point< float, #dims > >, std::set< unsigned long > > >* > c @{itk::PointSet;itk::Mesh}< #float, #dims >