diff --git a/alib2algo/src/stringology/compression/LZ77Compression.cpp b/alib2algo/src/stringology/compression/LZ77Compression.cpp index 46e8c670520df3cad105c56a7ab2399036a9b492..5849ee0743a0797ac63288f97afff4e5918fe1c8 100644 --- a/alib2algo/src/stringology/compression/LZ77Compression.cpp +++ b/alib2algo/src/stringology/compression/LZ77Compression.cpp @@ -3,6 +3,6 @@ namespace { -auto LZ77CompressionLinearString = registration::AbstractRegister < stringology::compression::LZ77Compression, std::vector < std::tuple < unsigned, unsigned, DefaultSymbolType > >, const string::LinearString < > &, unsigned, unsigned > ( stringology::compression::LZ77Compression::compress ); +auto LZ77CompressionLinearString = registration::AbstractRegister < stringology::compression::LZ77Compression, ext::vector < ext::tuple < unsigned, unsigned, DefaultSymbolType > >, const string::LinearString < > &, unsigned, unsigned > ( stringology::compression::LZ77Compression::compress ); } /* namespace */ diff --git a/alib2algo/src/stringology/compression/LZ77Compression.h b/alib2algo/src/stringology/compression/LZ77Compression.h index 2dedb9286db5f19c68b767e321c3dde643a6bb4a..387a4483247026f613dc5ea478780efe9532fc46 100644 --- a/alib2algo/src/stringology/compression/LZ77Compression.h +++ b/alib2algo/src/stringology/compression/LZ77Compression.h @@ -1,7 +1,7 @@ #pragma once -#include <tuple> -#include <vector> +#include <alib/tuple> +#include <alib/vector> #include <string/LinearString.h> @@ -14,7 +14,7 @@ namespace compression { class LZ77Compression { public: template < class SymbolType > - static std::vector < std::tuple < unsigned, unsigned, SymbolType > > compress ( const string::LinearString < SymbolType > & string, unsigned searchBufferSize, unsigned lookaheadBufferSize ); + static ext::vector < ext::tuple < unsigned, unsigned, SymbolType > > compress ( const string::LinearString < SymbolType > & string, unsigned searchBufferSize, unsigned lookaheadBufferSize ); private: template < class SymbolType > @@ -23,7 +23,7 @@ private: // Main method that handle compress template < class SymbolType > -std::vector < std::tuple < unsigned, unsigned, SymbolType > > LZ77Compression::compress ( const string::LinearString < SymbolType > & string, unsigned searchBufferSize, unsigned lookaheadBufferSize ) { +ext::vector < ext::tuple < unsigned, unsigned, SymbolType > > LZ77Compression::compress ( const string::LinearString < SymbolType > & string, unsigned searchBufferSize, unsigned lookaheadBufferSize ) { if(searchBufferSize == 0) throw exception::CommonException("LZ77: search buffer size must be greater than 0"); @@ -33,7 +33,7 @@ std::vector < std::tuple < unsigned, unsigned, SymbolType > > LZ77Compression::c size_t pointer = 0; - std::vector < std::tuple < unsigned, unsigned, SymbolType > > output; + ext::vector < ext::tuple < unsigned, unsigned, SymbolType > > output; while ( pointer < string.getContent ( ).size ( ) ) { unsigned lookaheadBufferRealSize = lookaheadBufferSize; @@ -55,7 +55,7 @@ std::vector < std::tuple < unsigned, unsigned, SymbolType > > LZ77Compression::c } } - output.push_back ( std::tuple < unsigned, unsigned, SymbolType > ( pointer - sbPointer, maxMatch, string.getContent ( ) [ pointer + maxMatch ] ) ); + output.push_back ( ext::tuple < unsigned, unsigned, SymbolType > ( pointer - sbPointer, maxMatch, string.getContent ( ) [ pointer + maxMatch ] ) ); pointer = pointer + maxMatch + 1; } diff --git a/alib2algo/src/stringology/compression/LZ77Decompression.cpp b/alib2algo/src/stringology/compression/LZ77Decompression.cpp index cadbacae0307df542b2d26620ff40997661c389d..4d19b96c57e7f3d923226244c07e644a22cbe4bd 100644 --- a/alib2algo/src/stringology/compression/LZ77Decompression.cpp +++ b/alib2algo/src/stringology/compression/LZ77Decompression.cpp @@ -3,6 +3,6 @@ namespace { -auto LZ77Decompression = registration::AbstractRegister < stringology::compression::LZ77Decompression, string::LinearString < >, const std::vector < std::tuple < unsigned, unsigned, DefaultSymbolType > > & > ( stringology::compression::LZ77Decompression::decompress ); +auto LZ77Decompression = registration::AbstractRegister < stringology::compression::LZ77Decompression, string::LinearString < >, const ext::vector < ext::tuple < unsigned, unsigned, DefaultSymbolType > > & > ( stringology::compression::LZ77Decompression::decompress ); } /* namespace */ diff --git a/alib2algo/src/stringology/compression/LZ77Decompression.h b/alib2algo/src/stringology/compression/LZ77Decompression.h index c84339ad95f17e4ba7e1a9a68d9cac8cb8a60420..d54534f0324a32efc56e31c84b30c0ef5f5530f2 100644 --- a/alib2algo/src/stringology/compression/LZ77Decompression.h +++ b/alib2algo/src/stringology/compression/LZ77Decompression.h @@ -1,7 +1,7 @@ #pragma once -#include <tuple> -#include <vector> +#include <alib/tuple> +#include <alib/vector> #include <alib/set> #include <string/LinearString.h> @@ -13,12 +13,12 @@ namespace compression { class LZ77Decompression { public: template < class SymbolType > - static string::LinearString < SymbolType > decompress ( const std::vector < std::tuple < unsigned, unsigned, SymbolType > > & input ); + static string::LinearString < SymbolType > decompress ( const ext::vector < ext::tuple < unsigned, unsigned, SymbolType > > & input ); }; // Main method that handle decompress template < class SymbolType > -string::LinearString < SymbolType > LZ77Decompression::decompress ( const std::vector < std::tuple < unsigned, unsigned, SymbolType > > & input ) { +string::LinearString < SymbolType > LZ77Decompression::decompress ( const ext::vector < ext::tuple < unsigned, unsigned, SymbolType > > & input ) { string::LinearString < SymbolType > output; diff --git a/alib2algo/test-src/stringology/compression/LZ77Test.cpp b/alib2algo/test-src/stringology/compression/LZ77Test.cpp index 10fa4b9e4312c78ac1439beab05f371ffaace952..a9dfe24b99a074604ec57abb7d8eedb3f18de982 100644 --- a/alib2algo/test-src/stringology/compression/LZ77Test.cpp +++ b/alib2algo/test-src/stringology/compression/LZ77Test.cpp @@ -11,15 +11,15 @@ TEST_CASE ( "LZ77 Compression", "[unit][algo][stringology][compression]" ) { SECTION ( "Compress and Decompress" ) { auto testcase = GENERATE ( - std::make_pair ( "aabaacaaaaaababab", std::vector < std::tuple < unsigned, unsigned, char > > { std::make_tuple(0, 0, 'a' ), std::make_tuple(1, 1, 'b' ), std::make_tuple(3, 2, 'c' ), std::make_tuple(3, 2, 'a' ), std::make_tuple(1, 3, 'b' ), std::make_tuple(2, 3, 'b' ) } ), - std::make_pair ( "aacaacabcabaaac", std::vector < std::tuple < unsigned, unsigned, char > > { std::make_tuple(0, 0, 'a' ), std::make_tuple(1, 1, 'c' ), std::make_tuple(3, 4, 'b' ), std::make_tuple(3, 3, 'a' ), std::make_tuple(1, 2, 'c' ) } ) ); + ext::make_pair ( "aabaacaaaaaababab", ext::vector < ext::tuple < unsigned, unsigned, char > > { ext::make_tuple(0, 0, 'a' ), ext::make_tuple(1, 1, 'b' ), ext::make_tuple(3, 2, 'c' ), ext::make_tuple(3, 2, 'a' ), ext::make_tuple(1, 3, 'b' ), ext::make_tuple(2, 3, 'b' ) } ), + ext::make_pair ( "aacaacabcabaaac", ext::vector < ext::tuple < unsigned, unsigned, char > > { ext::make_tuple(0, 0, 'a' ), ext::make_tuple(1, 1, 'c' ), ext::make_tuple(3, 4, 'b' ), ext::make_tuple(3, 3, 'a' ), ext::make_tuple(1, 2, 'c' ) } ) ); string::LinearString < char > string = string::stringFrom ( testcase.first ); - std::vector < std::tuple < unsigned, unsigned, char > > res = stringology::compression::LZ77Compression::compress ( string, 6, 4 ); - const std::vector < std::tuple < unsigned, unsigned, char > > & expectedOutput = testcase.second; + ext::vector < ext::tuple < unsigned, unsigned, char > > res = stringology::compression::LZ77Compression::compress ( string, 6, 4 ); + const ext::vector < ext::tuple < unsigned, unsigned, char > > & expectedOutput = testcase.second; /* compress */ - for ( const std::tuple < unsigned, unsigned, char > & resItem : res ) + for ( const ext::tuple < unsigned, unsigned, char > & resItem : res ) INFO ( std::get < 0 > ( resItem ) << " " << std::get < 1 > ( resItem ) << " " << std::get < 2 > ( resItem ) ); CHECK ( res == expectedOutput ); @@ -33,7 +33,7 @@ TEST_CASE ( "LZ77 Compression", "[unit][algo][stringology][compression]" ) { std::string string = ""; string::LinearString < char > input = string::stringFrom ( string ); - std::vector < std::tuple < unsigned, unsigned, char > > out = stringology::compression::LZ77Compression::compress ( input, 6, 4 ); + ext::vector < ext::tuple < unsigned, unsigned, char > > out = stringology::compression::LZ77Compression::compress ( input, 6, 4 ); string::LinearString < char > res = stringology::compression::LZ77Decompression::decompress ( out ); CHECK ( input == res );