Class that provides code generation helper utilities.
More...
Classes |
|
class | Type |
Class that provides code generation helper functions dealing with SPL type inspection. This is the SPL Operator Code Generation Type API. This API is used to extract information about SPL types. These types are representations of the SPL types, and are often extracted using SPL::Operator::Instance::Expression::getSPLType() from expressions and parameters. The SPL type is the same as written in SPL, with whitespace removed, except between an attribute's type and associated name. For example, the SPL type for the output port of this operator: stream<rstring a, int32 b> A = Beacon() {} is the string: "tuple<rstring a,int32 b>" The functions in this class can be used to test the kind of the type, and pull apart types into their component parts. For the above example, SPL::CodeGen::Type::isTuple($type) will return 1 .SPL::CodeGen::Type::getAttributeTypes($type) will return ["rstring", "int32"] SPL::CodeGen::Type::getAttributeNames($type) will return ["a", "b"] More... |
|
Public Member Functions |
|
public method | validateTimeIntervalAttribute () |
public method | emitInputPortGetEventTime () |
public method | emitOutputPortGetEventTime () |
public method | emitGetEventTime () |
public method | emitAllGetEventTime () |
public method | emitEventTimeClass () |
public method | hasEventTimeContext () |
Static Public Member Functions |
|
static public void | headerPrologue (scalar model, scalar includes) |
static public void | headerEpilogue (scalar model) |
static public void | implementationPrologue (scalar model) |
static public void | implementationEpilogue (scalar model) |
static public bool | hasSideEffectInAssignments (scalar port) |
static public bool | hasStreamAttributeInAssignments (scalar port) |
static public string | getOutputTupleCppInitializer (scalar port) |
static public string | getOutputTupleCppAssignments (scalar tupleName, scalar port) |
static public string | getOutputTupleCppAssignmentsWithSideEffects (scalar tupleName, scalar port, scalar sideEffects) |
static public list | getParameterCppTypes (scalar param) |
static public string | getParameterCppInitializer (scalar param) |
static public string | adaptCppExpression (scalar cppExpr, array tuples) |
static public string | prefixLiteralsAndStatesInCppExpressions (scalar cppExpr, scalar prefix) |
static public string | extractPerlValue (scalar cppExpr, scalar splType) |
static public void | emitSubmitOutputTuple (scalar outputPort, scalar inputPort) |
static public void | emitSubmitCachedOutputTuple (scalar cachedTupleName, scalar outputPort, scalar inputPort) |
static public string | emitClass (scalar model, scalar name, array types) |
static public string | getWindowCppType (scalar window, scalar tupleType, scalar partitionType, scalar dataType, scalar storageType) |
static public string | getWindowCppInitializer (scalar window, scalar tupleType, scalar attrbGetterE, scalar attrbGetterT) |
static public string | getPartitionedWindowCppInitializer (scalar window, scalar tupleType, scalar selectionType, scalar attrbGetterE, scalar attrbGetterT) |
static public string | getWindowPolicyCppObject (scalar window, scalar eviction, scalar tupleType, scalar attrbGetter) |
static public string | getWindowPartitionEvictionPolicyInitializer (scalar window, scalar selectionType) |
static public string | getWindowEventCppType (scalar window, scalar tupleType, scalar partitionType, scalar dataType, scalar storageType) |
static public list | createWindowConfigurations (array confs) |
static public void | validateWindowConfiguration (scalar iport, scalar confs) |
static public bool | checkWindowConfiguration (scalar iport, scalar confs) |
static public bool | isInputTupleForwarded (scalar outputPort, scalar inputPort, scalar checkMutation) |
static public void | checkMinimalSchema (scalar port, array schema) |
static public void | checkMaximalSchema (scalar port, array schema) |
static public void | checkAnySchema (scalar port, array schema) |
static public void | print (scalar msg, array params) |
static public void | println (scalar msg, array params) |
static public void | printVerbose (scalar msg, array params) |
static public void | printlnVerbose (scalar msg, array params) |
static public void | warn (scalar msg, array params, scalar sloc) |
static public void | warnln (scalar msg, array params, scalar sloc) |
static public void | warnVerbose (scalar msg, array params, scalar sloc) |
static public void | warnlnVerbose (scalar msg, array params, scalar sloc) |
static public void | error (scalar msg, array params, scalar sloc) |
static public void | errorln (scalar msg, array params, scalar sloc) |
static public void | exit (scalar msg, array params, scalar sloc) |
static public void | exitln (scalar msg, array params, scalar sloc) |
static public void | runtimePath (scalar model, scalar path, scalar varName) |
static public void | compileTimeExpression (scalar model, scalar paramValue) |
Class that provides code generation helper utilities.
model | the operator instance model |
inputPort | the input port |
model | the operator instance model |
|
static |
Given an operator instance model, produces the prolog code for the
operator's header code generator template
model | the operator instance model |
includes | optional lines (passed in as a list reference) to be generated after the inclusion guards, but before any includes |
|
static |
Given an operator instance model, produces the epilog code for the operator's
header code generator template
model | the operator instance model |
|
static |
Given an operator instnce model, produces the prolog code for the operator's
implementation code generator template
model | the operator instance model |
|
static |
Given an operator instance model, produces the epilog code for the operator's
implementation code generator template
model | the operator instance model |
|
static |
Given an output port object, return true if any output assignment expression has
side effects, otherwise false. This can be used to pull output tuple initialization
out of a loop.
port | the output port object |
tuple<int8 a, int8 b>
, andoutput S : a = x, b = y;
output S : a = x++, b = statefulFunction(y);
|
static |
Given an output port object, return true if any output assignment expression contains an input
attribute within the expression. This can be used to pull output tuple initialization out of a loop
port | the output port object |
tuple<int8 a, int8 b>
, andoutput S : a = x, b = y;
|
static |
Given an output port object, return the C++ expression which can be used to
initialize a tuple for the port with the output assignments.
port | the output port object |
tuple<int8 a, int8 b>
, andoutput S : a = x, b = y;
$iport0.get_x(), $iport0.get_y()
|
static |
Given a tuple name and an output port object, return a C++ code segment which
can be used to assign an already initialized tuple for the port with the
output attribute assignments captured in the output port object.
tupleName | the name of the variable holding an initialized tuple |
port | the output port object |
tuple<int8 a, int8 b>
, andoutput S : a = x, b = y;
getOutputTupleCppAssignments('fred', $port)
will produce thefred.set_a($iport0.get_x()); fred.set_b($iport0.get_y());
|
static |
Given a tuple name and an output port object, return a C++ code segment which
can be used to assign an already initialized tuple for the port with the
output attribute assignments captured in the output port object.
This is the same as getOutputTupleCppAssignments except for the additional
sideEffects parameter which is used to specify whether we want assignments
which contain side effects on the RHS (or not).
tupleName | the name of the variable holding an initialized tuple |
port | the output port object |
sideEffects | If true then we only want assignments with side effects otherwise we only want assignments which have no side effects |
tuple<int8 a, int8 b>
, andoutput S : a = x, b = y++;
getOutputTupleCppAssignmentsWithSideEffects('fred', $port, 1)
will produce thefred.set_b($iport0.get_y());
|
static |
Given a parameter object, return a list of C++ types corresponding to the
expressions contained within the parameter. The resulting list can be used as
the types parameter in an emitClass call.
param | parameter object |
|
static |
Given a parameter object, return a C++ expresion that can be used as the
constructor initializer for an object of type returned by an br>SPL::CodeGen::emitClassemitClass@endlinkcall.<br>@paramparamparameterobject<br>@returnstringtobeusedasaconstructorinitializeror\aundefifparam<br>isnotdefined<br><br>Example:For<br>-%SPLparameterassignmentfragment<tt>paramkey:a,sqrt(b);</tt><br><br>thisfunctionwillproducethefollowing:<br>-<tt>$iport0.get_a(),SPL:Functions::Math::sqrt($iport0.get_b())</tt><br>@htmlonly[block]<divid='codesection-getParameterCppInitializer'class='dynheaderclosed'style='cursor:pointer;'onclick='returntoggleVisibility(this)'><imgid='codesection-getParameterCppInitializer-trigger'src='closed.png'alt='open/closeicon'style='display:inline'/><b>Code:</b></div><divid='codesection-getParameterCppInitializer-summary'class='dyncontent'style='display:block;font-size:small;'>clicktoview</div><divid='codesection-getParameterCppInitializer-content'class='dyncontent'style='display:none;'>@endhtmlonly@code#NumberoflinesofcodeingetParameterCppInitializer:14subgetParameterCppInitializer($)my($param)=@_;returnundefifnotdefined($param);my$res="";for(my$i=0;$i<$param->getNumberOfValues();$i++)my$value=$param->getValueAt($i);if($value)$res.=$value->getCppExpression();$res.=","if$i<$param->getNumberOfValues()-1;return$res;@endcode@htmlonly[block]</div>@endhtmlonly
|
static |
Obtain the C++ expression adapted for the given tuple context, where the
references to input tuples are replaced with the names given by the tuples
parameter.
cppExpr | C++ expression to adapt to the tuple context |
tuples | list of tuple variable names for the input ports |
Filter
operator with a filter
parameter that defines
|
static |
Obtain the C++ expression with all references to lit$[0-9]*, state$
and iport$[0-9]+History prefixed by the prefix parameter.
cppExpr | C++ expression to prefix literals and state references in |
prefix | prefix to be prepended to the 'lit$x' and 'state$' term |
|
static |
Obtain the Perl value from a C++ expression of a given SPL type.
cppExpr | C++ expression to convert to a Perl value |
splType | SPL type of the C++ expression |
Filter
operator with a filter
parameter that defines
|
static |
Generate code to submit a tuple to a given output port. If the output
attribute assignments indicate that the tuple is simply forwarded from the
given input port, then the generated code will not create a separate tuple
and will just forward the input one, as long as the port mutability settings
allow it.
outputPort | The output port that we want to submit the tuple to |
inputPort | The input port from which a tuple is potentially forwarded Example: emitSubmitOutputTuple($iport, $oport) will produce thefollowing code submit($iport0, 0); if the output port index is 0, theoutput assignments indicate a simple forwarding, and the port mutability settings allow submitting the input tuple directly to the output port. Otherwise, it will generate code like: OPort0Type otuple($iport0.get_x()+5); submit(otuple, 0); . |
|
static |
Generate code to submit a cached tuple to a given output port. If the output
attribute assignments indicate that the tuple is simply forwarded from the
given input port, then the generated code will not populate the cached tuple
and will just forward the input one, as long as the port mutability settings
allow it.
cachedTupleName | Name for the output tuple |
outputPort | The output port that we want to submit the tuple to |
inputPort | The input port from which a tuple is potentially forwarded Example: emitSubmitCachedOutputTuple('fred', $iport, $oport) willproduce the following code submit($iport0, 0); if the output portindex is 0, the output assignments indicate a simple forwarding, and the port mutability settings allow submitting the input tuple directly to the output port. Otherwise, it will generate code like: fred.set_x($iport0.get_x()+5); . |
|
static |
Given a name and a list of types, generates a C++ class that is hashable and
contains member fields with the specified types. The class will have public
members with the names 'field<index>_', one for each element in the $types
list. The class will also have empty, copy, and member initializer
constructors, assignment operator, as well as equality and non-equality
comparison operators.
model | the operator instance model |
name | local name for the class (must uniqiely identify the class within the operator) |
types | a list reference that holds the C++ types of the members |
|
static |
Given a window object from the operator instance model, returns the C++ type
for the window.
window | window object from the operator instance model |
tupleType | C++ type of the tuple to be stored in the window |
partitionType | optional C++ type of the partitions within the window; when subsequent parameter ($dataType or $storageType) need to be specified, set $partitionType to '' for unpartitioned window |
$dataType | optional parameter for the C++ data type for the window, can be either'std::deque' (default) or 'SPL::IncrDeque' |
$storageType | optional parameter for the C++ storage type for the window, can be either 'std::unordered_map' (default) or 'SPL::IncrUnorderedMap' Example 1: For a partitioned sliding window with a count-based eviction policy and a delta-based trigger policy, - getWindowCppType($window, "MyTupleT", "MyPartitionT") will produce the following: - SPL::SlidingWindow<MyTupleT, MyPartitionT> Example 2: For an un-partitioned tumbling window with a count-based eviction and a count-based trigger policy, - getWindowCppType($window, "MyTupleT") will produce the following: - SPL::TumblingWindow<MyTupleT> Example 3: For an un-partitioned sliding window with a count-based eviction and a count-based trigger policy and incremental checkpointing, - getWindowCppType($window, "MyTupleT", '', 'SPL::IncrDeque', 'SPL::IncrUnorderedMap') will produce the following: - SPL::SlidingWindow<MyTupleT, int32_t, SPL::IncrDeque<MyTupleT>, SPL::IncrUnorderedMap<int32_t, SPL::IncrDeque<MyTupleT> > > |
|
static |
Given a window object from the operator instance model, returns the C++ type
initializer for the window.
window | window object from the operator instance model |
tupleType | C++ type of the tuple to be stored in the window |
attrbGetterE | optional name of the member function within the $tupleType, which is used to access the delta-based eviction policy attribute. This parameter is not used for window policies other than delta-based ones. If not specified, get_<delta-attribute-name> will be used |
attrbGetterT | optional name of the member function within the $tupleType, which is used to access the delta-based trigger policy attribute. This parameter is not used for window policies other than delta-based ones. If not specified, get_<delta-attribute-name> will be used |
int32
attribute with a delta of 15, the callgetWindowCppInitializer($window, "MyTupleT", "", "get_age")
*this, 0, SPL::CountWindowPolicy(10), SPL::DeltaWindowPolicy<MyTupleT,uint32,&MyTupleT::get_age>(15)
|
static |
Given a window object for a partitioned window from the operator instance model,
returns the C++ type initializer for the window.
window | window object from the operator instance model |
tupleType | C++ type of the tuple to be stored in the window |
selectionType | Algorithm to use for partion selection. Supported algorithms are "LRU" and "OperatorDefined". |
attrbGetterE | optional name of the member function within the $tupleType, which is used to access the delta-based eviction policy attribute. This parameter is not used for window policies other than delta-based ones. If not specified, get_<delta-attribute-name> will be used |
attrbGetterT | optional name of the member function within the $tupleType, which is used to access the delta-based trigger policy attribute. This parameter is not used for window policies other than delta-based ones. If not specified, get_<delta-attribute-name> will be used Example: For a sliding window with a count-based eviction policy of size 10 and a delta-based trigger policy on an int32 attribute with a delta of 15, andpartitioned(tupleCount(100)), the call - getPartitionedWindowCppInitializer($window, "MyTupleT", "LRU", "", "get_age") will produce the following: - *this, 0, SPL::CountWindowPolicy(10), SPL::DeltaWindowPolicy<MyTupleT,uint32,&MyTupleT::get_age>(15), ::SPL::TupleCountPartitionEvictionPolicy(100, ::SPL::PartitionEvictionPolicy::LRU) |
|
static |
Given a window object from the operator instance model and a window policy,
returns the code that creates a C++ object for the policy
window | window object from the operator instance model |
eviction | 1 if eviction policy, 0 if trigger policy |
tupleType | C++ type of the tuple to be stored in the window |
attrbGetter | optional name of the member function within the $tupleType, which is used to access the delta-based window policy attribute. This parameter is not used for window policies other than delta-based ones. If not specified, get_<delta-attribute-name> will be used Example 1: For a sliding window with a count-based eviction policy of size 10, the call - getWindowPolicyCppObject($window, 1, "MyTupleT") will produce the following: - SPL::CountWindowPolicy(10) Example 2: For a sliding window with a delta-based trigger policy on an int32 attribute with a delta of 15, the call - getWindowPolicyCppObject($window, 0, "MyTupleT", "get_age") will produce the following: - SPL::DeltaWindowPolicy<MyTupleT,uint32,&MyTupleT::get_age>(15) Example 3: For a sliding window with a delta-based trigger policy on an int32 attribute with a delta of 15, where the window stores pointers, the call - getWindowPolicyCppObject($window, 0, "MyTupleT*", "get_age") will produce the following: - SPL::DeltaWindowPolicy<MyTupleT*,uint32,&MyTupleT::get_age>(15) |
|
static |
Given a window object from the operator instance model, returns the C++ initializer
that can be appended to the window initializer to set the partition evicition policy.
If there is no partition eviction policy, return an empty string
window | window object from the operator instance model |
selectionType | Algorithm to use for partion selection. Supported algorithms are "LRU" and "OperatorDefined". Example: For a partition eviction policy of partitionAge(value), return - , ::SPL::PartitionEvictionPolicy::PartitionAge(value) |
|
static |
Given a window object from the operator instance model, returns the C++ type
for the WindowEvent class that is used to handle events from the window.
window | window object from the operator instance model |
tupleType | C++ type of the tuple to be stored in the window |
partitionType | optional C++ type of the partitions within the window; when subsequent parameter ($dataType or $storageType) need to be specified, set $partitionType to '' for unpartitioned window |
$dataType | optional parameter for the C++ data type for the window, can be either'std::deque' (default) or 'SPL::IncrDeque' |
$storageType | optional parameter for the C++ storage type for the window, can be either 'std::unordered_map' (default) or 'SPL::IncrUnorderedMap' Example 1: For a partitioned sliding window with a count-based eviction policy and a delta-based trigger policy, - getWindowEventCppType($window, "MyTupleT", "MyPartitionT") will produce the following: - SPL::WindowEvent<MyTupleT, MyPartitionT> Example 2: For an un-partitioned sliding window with a count-based eviction and a count-based trigger policy, - getWindowEventCppType($window, "MyTupleT") will produce the following: - SPL::WindowEvent<MyTupleT> Example 3: For an un-partitioned sliding window with a count-based eviction and a count-based trigger policy and incremental checkpointing, - getWindowEventCppType($window, "MyTupleT", '', 'SPL::IncrDeque', 'SPL::IncrUnorderedMap') will produce the following: - SPL::WindowEvent<MyTupleT, int32_t, SPL::IncrDeque<MyTupleT>, SPL::IncrUnorderedMap<int32_t, SPL::IncrDeque<MyTupleT> > > |
|
static |
Given a list of window configurations, verify that the configurations are
valid and return a reference to a list of configurations that can be used as
input to SPL::CodeGen::validateWindowConfiguration validateWindowConfiguration and br>SPL::CodeGen::checkWindowConfigurationcheckWindowConfiguration@endlink<br>functions.Theinputlistcontainsonehashreferenceforeach<br>configuration.Ahashthatrepresentsawindowconfigurationcontainsoneor<br>moreofthefollowingmappings:<br>-type=>\<window-type\>,wherethewindowtypeisoneof<br>$SPL::Operator::Instance::Window::TUMBLINGandSLIDING.<br>-eviction=>\<eviction-policy\>,wheretheevictionpolicyisoneof<br>$SPL::Operator::Instance::Window::COUNT,DELTA,TIME,andPUNCT.<br>-trigger=>\<trigger-policy\>,wherethetriggerpolicyisoneof<br>$SPL::Operator::Instance::Window::COUNT,DELTA,andTIME.<br>-partitioned=>\<partition-status\>,wherethepartitionstatusis0or1.<br>Thesemappingsaretreatedasconjunctions.<br>@paramconfslistofvalidwindowconfigurations<br>@paramconfsreferencetothelistofvalidwindowconfigurations<br>@returnareferencetothelistofconfigurations<br><br>HereisanexampleusefromtheSortoperator,whichcreatestwo<br>configurations,onethatacceptsanytumblingwindow,anotheronethat<br>acceptsslidingwindowswithcountbasedtriggerandevictionpolicies:<br>@code<br>my$confs=SPL::CodeGen::createWindowConfigurations(<br>type=>$SPL::Operator::Instance::Window::TUMBLING,<br>type=>$SPL::Operator::Instance::Window::SLIDING,<br>eviction=>$SPL::Operator::Instance::Window::COUNT,<br>trigger=>$SPL::Operator::Instance::Window::COUNT);<br>\endcode<br>@htmlonly[block]<divid='codesection-createWindowConfigurations'class='dynheaderclosed'style='cursor:pointer;'onclick='returntoggleVisibility(this)'><imgid='codesection-createWindowConfigurations-trigger'src='closed.png'alt='open/closeicon'style='display:inline'/><b>Code:</b></div><divid='codesection-createWindowConfigurations-summary'class='dyncontent'style='display:block;font-size:small;'>clicktoview</div><divid='codesection-createWindowConfigurations-content'class='dyncontent'style='display:none;'>@endhtmlonly@code#NumberoflinesofcodeincreateWindowConfigurations:40subcreateWindowConfigurationsmy(@confs)=@_;foreachmy$conf(@confs)my$type=$conf->type;my$partitioned=$conf->partitioned;my$eviction=$conf->eviction;my$trigger=$conf->trigger;if(defined($type))SPL::CodeGen::exitln(SPL::Msg::UNKNOWN_WINDOW_PROPERTY_VALUE($type, "type"))if($typene"$SPL::Operator::Instance::Window::TUMBLING"&&$typene"$SPL::Operator::Instance::Window::SLIDING"&&$typene"$SPL::Operator::Instance::Window::TIME_INTERVAL");if(defined($partitioned))SPL::CodeGen::exitln(SPL::Msg::UNKNOWN_WINDOW_PROPERTY_VALUE($partitioned, "partitioned"))if($partitioned ne "0" && $partitioned ne "1");if(defined($eviction))SPL::CodeGen::exitln(SPL::Msg::UNKNOWN_WINDOW_PROPERTY_VALUE($eviction, "eviction"))if($evictionne"$SPL::Operator::Instance::Window::COUNT"&&$evictionne"$SPL::Operator::Instance::Window::DELTA"&&$evictionne"$SPL::Operator::Instance::Window::TIME"&&$evictionne"$SPL::Operator::Instance::Window::PUNCT");if(defined($trigger))SPL::CodeGen::exitln(SPL::Msg::UNKNOWN_WINDOW_PROPERTY_VALUE($trigger, "trigger"))if($triggerne"$SPL::Operator::Instance::Window::COUNT"&&$triggerne"$SPL::Operator::Instance::Window::DELTA"&&$triggerne"$SPL::Operator::Instance::Window::TIME"&&$triggerne"$SPL::Operator::Instance::Window::PUNCT");my%validKeys=("type"=>1,"partitioned"=>1,"eviction"=>1,"trigger"=>1);foreachmy$key(keys%$conf)SPL::CodeGen::exitln(SPL::Msg::UNKNOWN_WINDOW_PROPERTY_KEY($key))if(not $validKeys{$key});return\@confs;@endcode@htmlonly[block]</div>@endhtmlonly
|
static |
Given an input port and a list of window configurations (created via br>SPL::CodeGen::createWindowConfigurationscreateWindowConfigurations@endlink),<br>verifiesthattheinputporthasavalidwindowconfiguration.Printsan<br>errormessageandexitsifthewindowconfigurationoftheinputportisnot<br>amongtheprovidedconfigurations.<br>@paramiporttheinputportobjectfromtheoperatorinstancemodel<br>@paramconfsalistofvalidwindowconfigurations,see<br>createWindowConfigurationsfunctionfordetails.<br><br>Exampleusefromthe\cSortoperator:<br>@code<br>my$confs=SPL::CodeGen::createWindowConfigurations(<br>type=>$SPL::Operator::Instance::Window::TUMBLING,<br>type=>$SPL::Operator::Instance::Window::SLIDING,<br>eviction=>$SPL::Operator::Instance::Window::COUNT,<br>trigger=>$SPL::Operator::Instance::Window::COUNT);<br>my$iport=$model->getInputPortAt(0);<br>SPL::CodeGen::validateWindowConfiguration($iport, $confs);<br>\endcode<br>@htmlonly[block]<divid='codesection-validateWindowConfiguration'class='dynheaderclosed'style='cursor:pointer;'onclick='returntoggleVisibility(this)'><imgid='codesection-validateWindowConfiguration-trigger'src='closed.png'alt='open/closeicon'style='display:inline'/><b>Code:</b></div><divid='codesection-validateWindowConfiguration-summary'class='dyncontent'style='display:block;font-size:small;'>clicktoview</div><divid='codesection-validateWindowConfiguration-content'class='dyncontent'style='display:none;'>@endhtmlonly@code#NumberoflinesofcodeinvalidateWindowConfiguration:12subvalidateWindowConfiguration($$)my($iport,$confs)=@_;returnif(1==checkWindowConfiguration($iport,$confs));if($iport->hasWindow())SPL::CodeGen::exitln(SPL::Msg::STDTK_UNSUPPORTED_WINDOW_CONFIGURATION($iport->getIndex()),$iport->getWindow()->getSourceLocation());elseSPL::CodeGen::exitln(SPL::Msg::STDTK_UNSUPPORTED_WINDOW_CONFIGURATION($iport->getIndex()),$iport->getSourceLocation());@endcode@htmlonly[block]</div>@endhtmlonly
|
static |
Given an input port and a list of window configurations (created via br>SPL::CodeGen::createWindowConfigurationscreateWindowConfigurations@endlink),<br>checksiftheinputporthasavalidwindowconfiguration.Returns0ifthe<br>windowconfigurationoftheinputportisnotamongtheprovided<br>configurations,and1otherwise.<br>@paramiporttheinputportobjectfromtheoperatorinstancemodel<br>@paramconfsalistofvalidwindowconfigurations,see<br>createWindowConfigurationsfunctionfordetails.<br>@return1iftheconfigurationisvalid,0otherwise<br><br>Exampleusefromthe\cSortoperator:<br>@code<br>my$confs=SPL::CodeGen::createWindowConfigurations(<br>type=>$SPL::Operator::Instance::Window::TUMBLING,<br>type=>$SPL::Operator::Instance::Window::SLIDING,<br>eviction=>$SPL::Operator::Instance::Window::COUNT,<br>trigger=>$SPL::Operator::Instance::Window::COUNT);<br>my$iport=$model->getInputPortAt(0);<br>my$res=SPL::CodeGen::checkWindowConfiguration($iport, $confs);<br>\endcode<br>@htmlonly[block]<divid='codesection-checkWindowConfiguration'class='dynheaderclosed'style='cursor:pointer;'onclick='returntoggleVisibility(this)'><imgid='codesection-checkWindowConfiguration-trigger'src='closed.png'alt='open/closeicon'style='display:inline'/><b>Code:</b></div><divid='codesection-checkWindowConfiguration-summary'class='dyncontent'style='display:block;font-size:small;'>clicktoview</div><divid='codesection-checkWindowConfiguration-content'class='dyncontent'style='display:none;'>@endhtmlonly@code#NumberoflinesofcodeincheckWindowConfiguration:35subcheckWindowConfiguration($$)my($iport,$confs)=@_;if(not $iport->hasWindow())if(scalar(@{$confs}))return0;elsereturn1;my$match=0;my$window=$iport->getWindow();foreachmy$conf(@$confs)my$type=$conf->type;my$partitioned=$conf->partitioned;my$eviction=$conf->eviction;my$trigger=$conf->trigger;if(defined($type))nextif($type!=$window->getWindowType());if(defined($partitioned))nextif($partitioned!=$window->isPartitioned());if(defined($eviction))nextif($eviction!=$window->getEvictionPolicyType());if(defined($trigger))nextif($trigger!=$window->getTriggerPolicyType());$match=1;last;return$match;@endcode@htmlonly[block]</div>@endhtmlonly
|
static |
Check if the output tuple to be created is an exact copy of the input tuple
outputPort | the output port that we want to submit a tuple to |
inputPort | the input port from which the tuples are potentially forwarded |
checkMutation | if 1, check that the port mutation settings allow forwarding the input tuple directly, without creating a copy |
|
static |
Given an input or output port, and a list of schema restrictions, ensure that the tuple that
the port is consuming/producing contains all of the desired schema name/types.
If there are attributes/types missing from the tuple, generate an error.
For each restriction, there must be at least one attribute that satisfies it.
port | input or output port object whose schema is to be checked |
schema |
list of name/type pairs that must be present in the input/output tuple schema is a list of hash references that represent schema restrictions using one or more of the following mappings: - name => "attributeName" - type => "splType" or type => [ "splType", "splType" ... ] NOTE: The only blanks allowed in the SPL type string are those that separate a tuple attribute type from the name ( "int32 attr" ). All types are 'unwound' to theexpanded SPL type. User defined type names are not allowed. Here is an example use, which is looking for an attribute foo with type rstring or int32 ,any attribute with type tuple<int32 x, rstring y> , and an attribute bar with any type.
<br> SPL::CodeGen::checkMinimalSchema ($model->getInputPortAt(0),
<br> { name => "foo", type => ["rstring", "int32] },
<br> { type => "tuple<int32 x,rstring y>" },
<br> { name => "bar" });
<br>
|
|
static |
Given an input or output port, and a list of schema restrictions, ensure that the tuple that
the port is consuming/producing only contains attributes with the desired schema name/types.
If there are attributes or types in the schema that are not supported, generate an error.
For each attribute, there must be at least one restriction that permits it.
port | input or output port object whose schema is to be checked |
schema |
list of name/type pairs that are valid in the input/output tuple schema is a list of hash references that represent schema restrictions using one or more of the following mappings: - name => "attributeName" - type => "splType" or type => [ "splType", "splType" ... ] NOTE: The only blanks allowed in the SPL type string are those that separate a tuple attribute type from the name ( "int32 attr" ). All types are 'unwound' to theexpanded SPL type. User defined type names are not allowed. Here is an example use: If attribute foo is present, it must have type rstring or ustring , any attribute with type tuple<int32 x, rstring y> isacceptable, and an attribute with name bar' is allowed.
<br> SPL::CodeGen::checkMaximalSchema ($model->getInputPortAt(0),
<br> { name => "foo", type => [ "rstring", "ustring" ] },
<br> { type => "tuple<int32 x,rstring y>" },
<br> { name => "bar" });
<br>
|
|
static |
Given an input or output port, and a list of schema restrictions, ensure that the tuple that
the port is consuming/producing contains attributes of the right names/types.
If an attribute in the tuple is in the list of restrictions, it must have the right type.
Any attributes NOT in the schema restrictions are accepted without errors.
For each attribute, there must be at least one restriction with a matching name that is satisfied.
port | input or output port from the operator model to be checked |
schema |
list of name/type pairs that must be present in the input/output tuple schema is a list of hash references that represent schema restrictions using one or more of the following mappings: - name => "attributeName" - type => "splType" or type => [ "splType", "splType" ... ] NOTE: The only blanks allowed in the SPL type string are those that separate a tuple attribute type from the name ( "int32 attr" ). All types are 'unwound' to theexpanded SPL type. User defined type names are not allowed. Here is an example use: If an attribute foo is present, it must have type rstring or int32 ,
<br> SPL::CodeGen::checkAnySchema ($model->getInputPortAt(0),
<br> { name => "foo", type => [ "rstring", "int32" ]});
<br>
|
|
static |
This function allows printing to the console during code generation. During
code generation STDOUT is redirected. Attempts to print to it will result in
corruption of the code generator. Note that if no optional params are passed
the Perl print
function will be called.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
|
static |
This function is similar to the print() method with the addition of a new
line added at the end.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
|
static |
This function is similar to the print() method except that it only prints if the -v
or
–verbose-mode
compiler option has been specified.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
|
static |
This function is similar to the println() method except that it only prints if the -v
or
–verbose-mode
compiler option has been specified.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
|
static |
Prints 'WARNING'
plus the contents of the format string.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message. A leading CDISP[0-9][0-9][0-9][0-9][EW] will be moved to before the WARNING |
params | an optional list of parameters to satisfy the format chars in msg |
sloc | an optional reference to a SourceLocation object |
|
static |
This function is the same as warn() with the addition of a newline at the end.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
sloc | an optional reference to a SourceLocation object |
|
static |
This function is the same as warn() except that it only prints if the -v
or –verbose-mode
compiler option has been specified.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
sloc | an optional reference to a SourceLocation object |
|
static |
This function is the same as warnVerbose() with the addition of a new line at the end.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
sloc | an optional reference to a SourceLocation object |
|
static |
Prints 'ERROR
' plus the format string to STDERR.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message. A leading CDISP[0-9][0-9][0-9][0-9]E will be moved to before the ERROR |
params | an optional list of parameters to satisfy the format chars in msg |
sloc | an optional reference to a SourceLocation object |
|
static |
This function is the same as error() with the addition of a newline at the end.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
sloc | an optional reference to a SourceLocation object |
|
static |
This function enables the printing of the format string to STDERR prior to
exiting.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
sloc | an optional reference to a SourceLocation object |
|
static |
This method provides the same functionality as exit with the addition of a
new line at the end.
msg | a string containing text to be printed, which may optionally contain format characters (see printf function of Perl), in which case a set ofparameters should follow the message |
params | an optional list of parameters to satisfy the format chars in msg |
sloc | an optional reference to a SourceLocation object |
|
static |
This method takes a compile-time path and converts it to a runtime path. If the compile-time path
points into a toolkit, then that path will reflect the runtime location of that toolkit, otherwise
the original path will be used.
model | the operator instance model |
path | the path to be converted |
varName | the variable name to assign the runtime path to |
|
static |
This method takes a paramenter value representing a run-time path and converts it to an expression that
can be used at compile time to access resources. undef is returned if the parameter value cannot be evaluated.
The operator model must specify <splExpressionTree param="true"> for this to be used.
model | the operator instance model |
paramValue | The parameter value to be converted |
public method SPL::CodeGen::validateTimeIntervalAttribute | ( | ) |
Undocumented Method
public method SPL::CodeGen::emitInputPortGetEventTime | ( | ) |
Undocumented Method
public method SPL::CodeGen::emitOutputPortGetEventTime | ( | ) |
Undocumented Method
public method SPL::CodeGen::emitGetEventTime | ( | ) |
Undocumented Method
public method SPL::CodeGen::emitAllGetEventTime | ( | ) |
Undocumented Method
public method SPL::CodeGen::emitEventTimeClass | ( | ) |
Undocumented Method
public method SPL::CodeGen::hasEventTimeContext | ( | ) |
Undocumented Method