Skip to content

Commit 7641dba

Browse files
committed
Fixed constructor issue in RegexMatch on PPC64. Added blob handling in
RegexMatch. Updated descriptions. Update to v1.4.3.
1 parent 99fb30c commit 7641dba

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

com.ibm.streamsx.regex/com.ibm.streamsx.regex.re2/RegexMatch/RegexMatch_cpp.cgt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,71 +10,71 @@
1010
my $maxMemory = ($_ = $model->getParameterByName('maxMemory')) ? $_->getValueAt(0)->getCppExpression() : 1000000;
1111
%>
1212

13-
bool MY_OPERATOR::RegexFullMatch(const string & str) {
13+
bool MY_OPERATOR::RegexFullMatch(const rstring & str) {
1414
return RE2::FullMatch(str, _regex) == 1;
1515
}
1616

1717
bool MY_OPERATOR::RegexFullMatch(const blob & blb) {
1818
return RE2::FullMatch(re2::StringPiece(reinterpret_cast<const char*>(blb.getData()), blb.getSize()), _regex) == 1;
1919
}
2020

21-
bool MY_OPERATOR::RegexFullMatch(const string & str, const string & pattern) {
21+
bool MY_OPERATOR::RegexFullMatch(const rstring & str, const rstring & pattern) {
2222

2323
AutoPortMutex am(_mutex, *this);
2424
if(_regexMap.count(pattern) == 0) {
25-
string pat = pattern;
25+
rstring pat = pattern;
2626
_regexMap.insert(pat, new RE2(pattern, _options));
2727
}
2828

2929
return RE2::FullMatch(str, _regexMap.at(pattern)) == 1;
3030
}
3131

32-
bool MY_OPERATOR::RegexFullMatch(const blob & blb, const string & pattern) {
32+
bool MY_OPERATOR::RegexFullMatch(const blob & blb, const rstring & pattern) {
3333

3434
AutoPortMutex am(_mutex, *this);
3535
if(_regexMap.count(pattern) == 0) {
36-
string pat = pattern;
36+
rstring pat = pattern;
3737
_regexMap.insert(pat, new RE2(pattern, _options));
3838
}
3939

4040
return RE2::FullMatch(re2::StringPiece(reinterpret_cast<const char*>(blb.getData()), blb.getSize()), _regexMap.at(pattern)) == 1;
4141
}
4242

43-
bool MY_OPERATOR::RegexPartialMatch(const string & str) {
43+
bool MY_OPERATOR::RegexPartialMatch(const rstring & str) {
4444
return RE2::PartialMatch(str, _regex) == 1;
4545
}
4646

4747
bool MY_OPERATOR::RegexPartialMatch(const blob & blb) {
4848
return RE2::PartialMatch(re2::StringPiece(reinterpret_cast<const char*>(blb.getData()), blb.getSize()), _regex) == 1;
4949
}
5050

51-
bool MY_OPERATOR::RegexPartialMatch(const string & str, const string & pattern) {
51+
bool MY_OPERATOR::RegexPartialMatch(const rstring & str, const rstring & pattern) {
5252

5353
AutoPortMutex am(_mutex, *this);
5454
if(_regexMap.count(pattern) == 0) {
55-
string pat = pattern;
55+
rstring pat = pattern;
5656
_regexMap.insert(pat, new RE2(pattern, _options));
5757
}
5858

5959
return RE2::PartialMatch(str, _regexMap.at(pattern)) == 1;
6060
}
6161

62-
bool MY_OPERATOR::RegexPartialMatch(const blob & blb, const string & pattern) {
62+
bool MY_OPERATOR::RegexPartialMatch(const blob & blb, const rstring & pattern) {
6363

6464
AutoPortMutex am(_mutex, *this);
6565
if(_regexMap.count(pattern) == 0) {
66-
string pat = pattern;
66+
rstring pat = pattern;
6767
_regexMap.insert(pat, new RE2(pattern, _options));
6868
}
6969

7070
return RE2::PartialMatch(re2::StringPiece(reinterpret_cast<const char*>(blb.getData()), blb.getSize()), _regexMap.at(pattern)) == 1;
7171
}
7272

73-
bool MY_OPERATOR::RegexSimpleMatch(const string & str, const string & pattern) {
73+
bool MY_OPERATOR::RegexSimpleMatch(const rstring & str, const rstring & pattern) {
7474
return RE2::PartialMatch(str, pattern) == 1;
7575
}
7676

77-
bool MY_OPERATOR::RegexSimpleMatch(const blob & blb, const string & pattern) {
77+
bool MY_OPERATOR::RegexSimpleMatch(const blob & blb, const rstring & pattern) {
7878
return RE2::PartialMatch(re2::StringPiece(reinterpret_cast<const char*>(blb.getData()), blb.getSize()), pattern) == 1;
7979
}
8080

com.ibm.streamsx.regex/com.ibm.streamsx.regex.re2/RegexMatch/RegexMatch_h.cgt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <string>
21
#include <streams_boost/ptr_container/ptr_unordered_map.hpp>
32
#include <streams_boost/thread/tss.hpp>
43
#include "re2/re2.h"
@@ -23,19 +22,21 @@ private:
2322
RE2 _regex;
2423

2524
Mutex _mutex;
26-
ptr_unordered_map<string,RE2> _regexMap;
25+
ptr_unordered_map<rstring,RE2> _regexMap;
2726
static thread_specific_ptr<OPort0Type> otuplePtr_;
2827

2928
OPort0Type * getOutputTuple();
3029

31-
bool RegexFullMatch(const string & str);
30+
bool RegexFullMatch(const rstring & str);
3231
bool RegexFullMatch(const blob & blb);
33-
bool RegexFullMatch(const string & str, const string & pattern);
34-
bool RegexFullMatch(const blob & blb, const string & pattern);
35-
bool RegexPartialMatch(const string & str);
32+
bool RegexFullMatch(const rstring & str, const rstring & pattern);
33+
bool RegexFullMatch(const blob & blb, const rstring & pattern);
34+
bool RegexPartialMatch(const rstring & str);
3635
bool RegexPartialMatch(const blob & blb);
37-
bool RegexPartialMatch(const string & str, const string & pattern);
38-
bool RegexPartialMatch(const blob & blb, const string & pattern);
36+
bool RegexPartialMatch(const rstring & str, const rstring & pattern);
37+
bool RegexPartialMatch(const blob & blb, const rstring & pattern);
38+
bool RegexSimpleMatch(const rstring & str, const rstring & pattern);
39+
bool RegexSimpleMatch(const blob & blb, const rstring & pattern);
3940
};
4041

4142
<%SPL::CodeGen::headerEpilogue($model);%>

samples/RegexMatchSample/sample/RegexMatchSample.spl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,15 @@ composite RegexMatchSample {
3333
}
3434

3535
// Matching string with precompiled regex pattern (from parameter)
36-
(stream<rstring str, boolean result> RegexMatch_2_out0)as
37-
RegexMatch_2 = RegexMatch(Beacon_1_out0){
36+
(stream<rstring str, boolean result> RegexMatch_2_out0) as RegexMatch_2 = RegexMatch(Beacon_1_out0){
3837
param
3938
pattern : "^Hello" ;
4039
output
4140
RegexMatch_2_out0 : result = RegexPartialMatch(str);
4241
}
4342

4443
// Matching string with updated precompiled regex pattern (from input attribute)
45-
(stream<rstring str, boolean result> RegexMatch_3_out0)as
46-
RegexMatch_3 = RegexMatch(Beacon_2_out0){
44+
(stream<rstring str, boolean result> RegexMatch_3_out0) as RegexMatch_3 = RegexMatch(Beacon_2_out0){
4745
output
4846
RegexMatch_3_out0 : result = RegexPartialMatch(str, pattern);
4947
}

0 commit comments

Comments
 (0)