Pipeline

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Pipeline

Post by tappatekie »

Just a quick post to check something.

Is this a pipeline? I have a class called Pipe and checking if this is what it actually is and not something else :)
(Every function call returns the the instance its held in)

Code: Select all

Pipe p = new Pipe()
     .DoSomethingWithState()
     .DoSomethingElseWithState();
object result = p.GetState();
qpHalcy0n
Respected Programmer
Respected Programmer
Posts: 387
Joined: Fri Dec 19, 2008 3:33 pm
Location: Dallas
Contact:

Re: Pipeline

Post by qpHalcy0n »

It does not appear so in this case.

A pipelined architecture refers to one with several distinct stages that are linked by some memory bus or transport mechanism. Also you have the concept of a producer/consumer there where stage B consumes what stage A produced and on down the line.
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Pipeline

Post by tappatekie »

qpHalcy0n wrote:It does not appear so in this case.

A pipelined architecture refers to one with several distinct stages that are linked by some memory bus or transport mechanism. Also you have the concept of a producer/consumer there where stage B consumes what stage A produced and on down the line.
Thanks for the reply, there is a transport mechanism by using GetState() and SetState() each function can access and have the current state thus transporting data from one method to the other.

An example of code im using is for a stream

Code: Select all

StreamPipe pipe = new StreamPipe("file");
pipe
        .CreateBuffer(pipe.Length)
        .Read();
byte[] data = (byte[])pipe.GetState();
qpHalcy0n
Respected Programmer
Respected Programmer
Posts: 387
Joined: Fri Dec 19, 2008 3:33 pm
Location: Dallas
Contact:

Re: Pipeline

Post by qpHalcy0n »

Myehhhh -_- ...no, still not seeing it that way.

Looks more like a stream, really if you're just reading files and doing other little things to them. There would be several stages that each do different things. With that you usually have a stream of data that gets progressively modified by the different stages. In the classical sense, look at pipelined microarchitecture. Fetch, decode, execute, write. 4-stage pipeline. Stream of data comes in (instructions/operands) and they are progressively analyzed and modified until they come out the other side. Like building a car in a factory with a single conveyer belt. Raw materials go in...each stage modifies....car comes out.

Querying data isn't really a "pipeline".
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Pipeline

Post by tappatekie »

qpHalcy0n wrote:Myehhhh -_- ...no, still not seeing it that way.

Looks more like a stream, really if you're just reading files and doing other little things to them. There would be several stages that each do different things. With that you usually have a stream of data that gets progressively modified by the different stages. In the classical sense, look at pipelined microarchitecture. Fetch, decode, execute, write. 4-stage pipeline. Stream of data comes in (instructions/operands) and they are progressively analyzed and modified until they come out the other side. Like building a car in a factory with a single conveyer belt. Raw materials go in...each stage modifies....car comes out.

Querying data isn't really a "pipeline".
Thanks for the advice :)
My usage of that class isn't just for streams, but it will be used for more complicated stuff later on (like rendering pipelines and script analysis)
qpHalcy0n
Respected Programmer
Respected Programmer
Posts: 387
Joined: Fri Dec 19, 2008 3:33 pm
Location: Dallas
Contact:

Re: Pipeline

Post by qpHalcy0n »

Well, rendering IS a pipeline because you have a stream of data coming in and it is progressively modified by multiple units until you get some different output. However, simply having two units that both produce and consume isn't a pipeline at all. I'm not giving advice really...this is just....what that is.
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Pipeline

Post by bbguimaraes »

The best example of a pipeline I can think of are unix pipes, where you have a list of programs separated by pipes:
cat myfile | grep sometext | tr ":" " " | cut -d " " -f 1
The first command reads file "myfile" and feeds its content to the second, which filters only the lines with the text "sometext". The third reads these filtered lines and replaces all ":" with spaces and the fourth splits these lines by spaces and prints only the first field. What characterizes the pipeline is that each operation acts (only) on the results of the previous, and you feed this "black box" with some input (the content of the file) and it outputs processed information. I hope this makes things a little bit more clear.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Pipeline

Post by dandymcgee »

bbguimaraes wrote:The best example of a pipeline I can think of are unix pipes, where you have a list of programs separated by pipes:
cat myfile | grep sometext | tr ":" " " | cut -d " " -f 1
That's actually a really useful example. Though I've known what the pipe character is and does for a long time, I've never compared it something like a graphics pipeline.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
Post Reply