# US 2010/0251228 A1 · Type propagation for automatic casting of output types in a data flow program

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2010/0251228 A1
- Document ID: US20100251228A1
- Status: Published application
- Kind: A1
- Application number: 12/779,341
- Filed: 2010-05-13
- Published: 2010-09-30
- Earliest claimed: 2004-11-23
- Assignees: National Instruments Corporation
- Inventors: Stephen R. Mercer; Steven W. Rogers
- Web page: https://patentgrep.com/patent/US20100251228A1

## CPC

- G06F 9/4484: {Executing subprograms}
- G06F 9/4492: {Inheritance}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

System and method for implicit downcasting at compile time in a data flow program. A first data flow function in an object-oriented dataflow program is identified, where the first function includes an input of a parent data type and an output of the parent data type. The first function is analyzed to determine if the output preserves the run-time data type of the input. A second dataflow function in the object-oriented data flow program is identified, where the second function includes a program element that calls the first function, passing an input parameter of a child data type of the parent data type as input. If the analysis determines that an output parameter returned by the output of the first function will always be of the child data type, the program element is automatically configured at compile time to always downcast the output parameter from the parent data type to the child data type at run-time.

## Claims

### Claim 1

A memory medium comprising program instructions, wherein the program instructions are executable to perform:
identifying a first data flow function in an object-oriented data flow program that comprises at least one input of a parent data type and at least one output of the parent data type;
analyzing the first data flow function to determine if the at least one output preserves the run-time data type of the at least one input;
identifying a second data flow function in the object-oriented data flow program that comprises a program element that calls the first data flow function, passing an input parameter of a child data type of the parent data type as input;
if said analyzing determines that an output parameter returned by the at least one output of the first function will always be of the child data type,
automatically configuring the program element to downcast the output parameter from the parent data type to the child data type at run-time.

### Claim 2 (depends on 1)

The memory medium of claim 1, wherein the at least one output of the first data flow function has one or more ultimate sources, wherein each ultimate source comprises an input or output whose type at run-time is not determined by upstream data in the first data flow function, and wherein said analyzing the first data flow function comprises:
determining if the one or more ultimate sources for the at least one output of the first data flow function are all of the child data type.

### Claim 3 (depends on 1)

The memory medium of claim 1, wherein the first data flow function includes calls to one or more of:
at least one user-defined function; or
at least one language primitive.

### Claim 4 (depends on 1)

The memory medium of claim 1, wherein said identifying the first data flow function, said analyzing the first data flow function, said identifying the second data flow function, and said automatically configuring are performed by a compiler.

### Claim 5 (depends on 1)

The memory medium of claim 1, wherein said identifying the first data flow function, said analyzing the first data flow function, said identifying the second data flow function, and said automatically configuring are performed at compile time.

### Claim 6 (depends on 1)

The memory medium of claim 1, wherein said identifying the first data flow function, said analyzing the first data flow function, said identifying the second data flow function, and said automatically configuring are performed at edit time.

### Claim 7 (depends on 1)

The memory medium of claim 1, wherein said identifying the first data flow function, said analyzing the first data flow function, said identifying the second data flow function, and said automatically configuring are performed without direct guidance by human intelligence.

### Claim 8 (depends on 1)

The memory medium of claim 1,
wherein the object-oriented data flow program is a graphical program comprising a first plurality of interconnected nodes that visually indicate functionality of the first graphical program;
wherein the first data flow function comprises a first graphical subprogram;
wherein the second data flow function comprises a second graphical subprogram comprising a second plurality of interconnected nodes, wherein the second graphical subprogram is represented by a first node comprised in the first plurality of interconnected nodes; and
wherein the program element is a second node comprised in the second plurality of interconnected nodes, and wherein the second node represents an invocation of the first data flow function.

### Claim 9 (depends on 8)

The memory medium of claim 8, wherein the program instructions are further executable to implement:
configuring an input terminal of the second node to receive data of the child data type;
wherein said identifying the second data flow function comprises analyzing the second graphical program, including:
determining the second node of the second plurality of nodes, wherein the second node has an input terminal of the parent data type and an output terminal of the parent data type, wherein the second graphical program provides the input parameter of the child data type for the input terminal, and wherein the second node is executable to provide the output parameter for the output terminal;
wherein said analyzing the first data flow function comprises analyzing the program element to determine if the output parameter of the program element is always of the child data type upcast to the parent data type, including:
analyzing the second node to determine if an output terminal of the second node will always provide the output parameter of the child data type; and
wherein said automatically configuring the program element to downcast the output parameter from the parent data type to the child data type at run-time comprises:
automatically configuring the second node to provide data of the child data type on the output terminal.

### Claim 10 (depends on 9)

The memory medium of claim 9,
wherein the first graphical subprogram comprises a third plurality of interconnected nodes;
wherein the output terminal of the second node has one or more ultimate sources, wherein each ultimate source comprises a source terminal whose type at run-time is not determined by upstream data in the first graphical subprogram, and wherein said analyzing the second node to determine if an output terminal of the second node can always provide the output parameter of the child data type comprises:
traversing a diagram of the first graphical subprogram to determine the one or more ultimate sources for the output terminal of the second node;
determining if the one or more ultimate sources for the output terminal of the second node are all of the child data type.

### Claim 11 (depends on 10)

The memory medium of claim 10,
wherein each of the third plurality of nodes includes one or more terminals; and
wherein said traversing the diagram of the first graphical subprogram comprises:
generating a map of each terminal in the first graphical subprogram to a respective set of terminals in the first graphical subprogram that are ultimate sources.

### Claim 12 (depends on 11)

The memory medium of claim 11, wherein said generating a map comprises:
for each node in the diagram that has no input terminals,
a) for each output terminal of the node,
if the output terminal is its own ultimate source, adding the output terminal to the map, and specifying the output terminal as its ultimate source;
for each sink terminal associated with the output terminal,
adding the sink terminal to the map, and specifying the output terminal's ultimate sources as the sink terminal's ultimate sources; and
performing a) for a node corresponding to the sink terminal.

### Claim 13 (depends on 11)

The memory medium of claim 11, wherein the traversal is performed in execution order of the nodes.

### Claim 14 (depends on 10)

The memory medium of claim 10, wherein the diagram comprises one or more of:
a block diagram of the first graphical subprogram;
a data structure specifying the diagram; or
a description of the diagram.

### Claim 15 (depends on 8)

The memory medium of claim 8, wherein said analyzing the program element comprises analyzing source code for the program element.

### Claim 16 (depends on 8)

The memory medium of claim 8, wherein said analyzing the function comprises analyzing source code for the function.

### Claim 17 (depends on 8)

The memory medium of claim 8, wherein the graphical program comprises a LabVIEW graphical program.

### Claim 18 (depends on 1)

The memory medium of claim 1, wherein the object-oriented data flow program comprises a text-based data flow program.

### Claim 19

A method for implicit downcasting in a data flow program, comprising:
identifying a first data flow function in an object-oriented data flow program that comprises at least one input of a parent data type and at least one output of the parent data type;
analyzing the first data flow function to determine if the at least one output preserves the run-time data type of the at least one input;
identifying a second data flow function in the object-oriented data flow program that comprises a program element that calls the first data flow function, passing an input parameter of a child data type of the parent data type as input;
if said analyzing determines that an output parameter returned by the at least one output of the first function will always be of the child data type,
automatically configuring the program element to downcast the output parameter from the parent data type to the child data type at run-time.

### Claim 20

A system for implicit downcasting in a data flow program:
a processor; and
a memory medium coupled to the processor, wherein the memory medium stores program instructions which are executable by the processor to:
identify a first data flow function in an object-oriented data flow program that comprises at least one input of a parent data type and at least one output of the parent data type;
analyze the first data flow function to determine if the at least one output preserves the run-time data type of the at least one input;
identify a second data flow function in the object-oriented data flow program 4 comprises a program element that calls the first data flow function, passing an input parameter of a child data type of the parent data type as input;
if said analysis determines that an output parameter returned by the at least one output of the first function will always be of the child data type,
automatically configure the program element to downcast the output parameter from the parent data type to the child data type at run-time.
