00001
00002
00003
00004
00005
00006
00007
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 # include "ifstreamer.hpp"
00041 # include "processor/xmlflowcontext.hpp"
00042
00043 BEGIN_XDFLENGINE_NS
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 IFStreamer::IFStreamer( const XMLStreamerFactory* p_pParent, StreamerParams* p_pParameters, XMLFlowContext* p_pContext, XMLStreamConsumer* p_pOutput)
00055 :XMLStreamer( p_pParent, p_pParameters, p_pContext, p_pOutput){}
00056
00057
00058
00059
00060 IFStreamer::~IFStreamer()
00061 {
00062 }
00063
00064
00065
00066
00067
00068
00069 bool IFStreamer::initStream()
00070 {
00071 return evaluateCondition(m_pParameters);
00072 }
00073
00074
00075
00076
00077 bool IFStreamer::evaluateCondition( StreamerParams* p_pParameters)
00078 {
00079
00080 const char* l_pszVal1;
00081 const char* l_pszVal2;
00082 const char* l_pszOp;
00083
00084 int l_iVal1;
00085 int l_iVal2;
00086
00087
00088 DEBUG_FUNC(IFStreamer::evaluateCondition)
00089
00090 l_pszVal1 = XMLStreamer::getParamValue( p_pParameters, IFSTREAMER_VAL1 );
00091 l_pszVal2 = XMLStreamer::getParamValue( p_pParameters, IFSTREAMER_VAL2 , IFSTREAMER_VAL2_DEF);
00092 l_pszOp = XMLStreamer::getParamValue( p_pParameters, IFSTREAMER_OP , IFSTREAMER_OP_DEF);
00093
00094 if( strcmp( l_pszOp, IFSTREAMER_OPSTREQ) == 0 ) if( strcmp( l_pszVal1, l_pszVal2) ==0 ) return true ; else return false;
00095 if( strcmp( l_pszOp, IFSTREAMER_OPSTRNE) == 0) if( strcmp( l_pszVal1, l_pszVal2) !=0 ) return true ; else return false;
00096 if( strcmp( l_pszOp, IFSTREAMER_OPIN) == 0) if( strstr( l_pszVal2, l_pszVal1 )>0 ) return true ; else return false;
00097
00098 l_iVal1 = atoi( l_pszVal1);
00099 l_iVal2 = atoi( l_pszVal2);
00100
00101 if( strcmp( l_pszOp, IFSTREAMER_OPEQ ) == 0) if( l_iVal1 == l_iVal2 ) return true ; else return false;
00102 if( strcmp( l_pszOp, IFSTREAMER_OPNE) == 0 ) if( l_iVal1 != l_iVal2 ) return true ; else return false;
00103 if( strcmp( l_pszOp, IFSTREAMER_OPGT) == 0 ) if( l_iVal1 > l_iVal2 ) return true ; else return false;
00104 if( strcmp( l_pszOp, IFSTREAMER_OPLT) == 0 ) if( l_iVal1 < l_iVal2 ) return true ; else return false;
00105 if( strcmp( l_pszOp, IFSTREAMER_OPGTE) == 0 ) if( l_iVal1 >= l_iVal2 ) return true ; else return false;
00106 if( strcmp( l_pszOp, IFSTREAMER_OPLTE) == 0 ) if( l_iVal1 <= l_iVal2 ) return true ; else return false;
00107
00108 return false;
00109 }
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 XMLStreamer* IFStreamerFactory::getStreamer(
00122 StreamerParams* p_pParameters,
00123 XMLFlowContext* p_pStreamContext,
00124 XMLStreamConsumer* p_pStreamConsumer) const
00125 {
00126 return (XMLStreamer*) new IFStreamer( this, p_pParameters, p_pStreamContext, p_pStreamConsumer);
00127 }
00128
00129
00130
00131
00132
00133 END_XDFLENGINE_NS
00134
00135
00136