Main Page | Compound List | File List | Compound Members | File Members

utilities.h

Go to the documentation of this file.
00001 /*--------------------------------------------------------------------
00002  *
00003  * (C) Copyright Koninklijke Philips Electronics NV 2006. 
00004  * All rights reserved. This software is licensed under the terms of
00005  * version 2.1 of the GNU Lesser General Public License as published 
00006  * by the Free Software Foundation. For licensing and warranty
00007  * information, see the file COPYING in the main directory.
00008  *
00009  *------------------------------------------------------------------*/
00010 
00011 #ifndef UTILITIES_H
00012 #define UTILITIES_H
00013 
00014 #include <stdio.h>
00015 #include "yapi.h"
00016 #include "vya.h"
00017 
00019 //
00020 // VYA MODULE   : fork2
00021 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00022 // FUNCTION     : copies input to two outputs
00023 // DOCUMENTS    : n/a
00024 // INPUTS       : in:   input
00025 // OUTPUTS      : out1: =input
00026 //              : out2: =input
00027 // NETWORK      : n/a
00028 // HISTORY      :
00029 //    07/24/00  : Kees van Zon; Created (VYA 0.2)
00030 //    08/07/00  : Kees van Zon; Copied to VYA 0.3
00031 //    09/18/00  : Kees van Zon; Added type() function for YAPI 0.5.0
00032 //    10/13/00  : Kees van Zon; Included in utilities.h
00033 
00034 template<class FORK2>
00035 
00036 class fork2: public Process
00037 {
00038 public:
00039     //constructor
00040     fork2 (
00041         Id            n,
00042         In<FORK2>&    inF,
00043         Out<FORK2>&   out1F,
00044         Out<FORK2>&   out2F
00045     )
00046 :
00047     // member initialisation
00048     // process network
00049     Process(n),
00050 
00051     // ports
00052     inP(id("in"), inF),
00053     out1P(id("out1"), out1F),
00054     out2P(id("out2"), out2F)
00055 { }
00056     // member functions
00057     const char* type() const { return "fork2"; }
00058     void main() {
00059         while(true) {
00060             read(inP, in);
00061             write(out1P, in);
00062             write(out2P, in);
00063         }
00064     }
00065 
00066 private:
00067     // ports
00068     InPort<FORK2>     inP;
00069     OutPort<FORK2>    out1P;
00070     OutPort<FORK2>    out2P;
00071 
00072     //member variable
00073     FORK2             in;
00074 };
00075 
00077 //
00078 // VYA MODULE   : fork3
00079 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00080 // FUNCTION     : copies input to three outputs
00081 // DOCUMENTS    : n/a
00082 // INPUTS       : in:   input
00083 // OUTPUTS      : out1: =input
00084 //              : out2: =input
00085 //              : out3: =input
00086 // NETWORK      :
00087 // HISTORY      :
00088 //    07/24/00  : Kees van Zon; Created (VYA 0.2)
00089 //    08/07/00  : Kees van Zon; Copied to VYA 0.3
00090 //    09/18/00  : Kees van Zon; Added type() function for YAPI 0.5.0
00091 //    10/13/00  : Kees van Zon; Included in utilities.h
00092 
00093 template<class FORK3>
00094 
00095 class fork3: public Process
00096 {
00097 public:
00098     //constructor
00099     fork3 (
00100         Id            n,
00101         In<FORK3>&    inF,
00102         Out<FORK3>&   out1F,
00103         Out<FORK3>&   out2F,
00104         Out<FORK3>&   out3F
00105     )
00106 :
00107     // member initialisation
00108     // process network
00109     Process(n),
00110 
00111     // ports
00112     inP(id("in"), inF),
00113     out1P(id("out1"), out1F),
00114     out2P(id("out2"), out2F),
00115     out3P(id("out3"), out3F)
00116 { }
00117     // member functions
00118     const char* type() const { return "fork3"; }
00119     void main() {
00120         while(true) {
00121             read(inP, in);
00122             write(out1P, in);
00123             write(out2P, in);
00124             write(out3P, in);
00125         }
00126     }
00127 
00128 private:
00129     // ports
00130     InPort<FORK3>     inP;
00131     OutPort<FORK3>    out1P;
00132     OutPort<FORK3>    out2P;
00133     OutPort<FORK3>    out3P;
00134 
00135     //member variable
00136     FORK3             in;
00137 };
00138 
00140 //
00141 // VYA MODULE   : fork4
00142 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00143 // FUNCTION     : copies input to four outputs
00144 // DOCUMENTS    : none
00145 // INPUTS       : in:   input
00146 // OUTPUTS      : out1: =input
00147 //              : out2: =input
00148 //              : out3: =input
00149 //              : out4: =input
00150 // NETWORK      :
00151 // HISTORY      :
00152 //    07/24/00  : Kees van Zon; Created (VYA 0.2)
00153 //    08/07/00  : Kees van Zon; Copied to VYA 0.3
00154 //    09/18/00  : Kees van Zon; Added type() function for YAPI 0.5.0
00155 //    10/13/00  : Kees van Zon; Included in utilities.h
00156 
00157 template<class FORK4>
00158 
00159 class fork4: public Process
00160 {
00161 public:
00162     //constructor
00163     fork4 (
00164         Id             n,
00165         In<FORK4>&     inF,
00166         Out<FORK4>&    out1F,
00167         Out<FORK4>&    out2F,
00168         Out<FORK4>&    out3F,
00169         Out<FORK4>&    out4F
00170     )
00171 :
00172     // member initialisation
00173     // process network
00174     Process(n),
00175 
00176     // ports
00177     inP(id("in"), inF),
00178     out1P(id("out1"), out1F),
00179     out2P(id("out2"), out2F),
00180     out3P(id("out3"), out3F),
00181     out4P(id("out4"), out4F)
00182 { }
00183 
00184     // member functions
00185     const char* type() const { return "fork4"; }
00186     void main() {
00187         while(true) {
00188             read(inP, in);
00189             write(out1P, in);
00190             write(out2P, in);
00191             write(out3P, in);
00192             write(out4P, in);
00193         }
00194     }
00195 
00196 private:
00197     // ports
00198     InPort<FORK4>     inP;
00199     OutPort<FORK4>    out1P;
00200     OutPort<FORK4>    out2P;
00201     OutPort<FORK4>    out3P;
00202     OutPort<FORK4>    out4P;
00203 
00204     // member variable
00205     FORK4             in;
00206 };
00207 
00209 //
00210 // VYA MODULE   : fork5
00211 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00212 // FUNCTION     : copies input to five outputs
00213 // DOCUMENTS    : none
00214 // INPUTS       : in:   input
00215 // OUTPUTS      : out1: =input
00216 //              : out2: =input
00217 //              : out3: =input
00218 //              : out4: =input
00219 //              : out5: =input
00220 // NETWORK      :
00221 // HISTORY      :
00222 //    07/24/00  : Kees van Zon; Created (VYA 0.2)
00223 //    08/07/00  : Kees van Zon; Copied to VYA 0.3
00224 //    09/18/00  : Kees van Zon; Added type() function for YAPI 0.5.0
00225 //    10/13/00  : Kees van Zon; Included in utilities.h
00226 
00227 template<class FORK5>
00228 
00229 class fork5: public Process
00230 {
00231 public:
00232     //constructor
00233     fork5 (
00234         Id             n,
00235         In<FORK5>&     inF,
00236         Out<FORK5>&    out1F,
00237         Out<FORK5>&    out2F,
00238         Out<FORK5>&    out3F,
00239         Out<FORK5>&    out4F,
00240         Out<FORK5>&    out5F
00241     )
00242 :
00243     // member initialisation
00244     // process network
00245     Process(n),
00246 
00247    // ports
00248    inP(id("in"), inF),
00249    out1P(id("out1"), out1F),
00250    out2P(id("out2"), out2F),
00251    out3P(id("out3"), out3F),
00252    out4P(id("out4"), out4F),
00253    out5P(id("out5"), out5F)
00254 { }
00255 
00256     // member functions
00257     const char* type() const { return "fork5"; }
00258     void main() {
00259         while(true) {
00260             read(inP, in);
00261             write(out1P, in);
00262             write(out2P, in);
00263             write(out3P, in);
00264             write(out4P, in);
00265             write(out5P, in);
00266         }
00267     }
00268 
00269 private:
00270     // ports
00271     InPort<FORK5>     inP;
00272     OutPort<FORK5>    out1P;
00273     OutPort<FORK5>    out2P;
00274     OutPort<FORK5>    out3P;
00275     OutPort<FORK5>    out4P;
00276     OutPort<FORK5>    out5P;
00277 
00278     // member variable
00279     FORK5             in;
00280 };
00281 
00283 //
00284 // VYA MODULE   : fork6
00285 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00286 // FUNCTION     : copies input to five outputs
00287 // DOCUMENTS    : none
00288 // INPUTS       : in:   input
00289 // OUTPUTS      : out1: =input
00290 //              : out2: =input
00291 //              : out3: =input
00292 //              : out4: =input
00293 //              : out5: =input
00294 //              : out6: =input
00295 // NETWORK      :
00296 // HISTORY      :
00297 //    06/19/01  : Kees van Zon; Created (VYA 0.3)
00298 
00299 template<class FORK6>
00300 
00301 class fork6: public Process
00302 {
00303 public:
00304     //constructor
00305     fork6 (
00306         Id             n,
00307         In<FORK6>&     inF,
00308         Out<FORK6>&    out1F,
00309         Out<FORK6>&    out2F,
00310         Out<FORK6>&    out3F,
00311         Out<FORK6>&    out4F,
00312         Out<FORK6>&    out5F,
00313         Out<FORK6>&    out6F
00314     )
00315 :
00316     // member initialisation
00317     // process network
00318     Process(n),
00319 
00320    // ports
00321    inP(id("in"), inF),
00322    out1P(id("out1"), out1F),
00323    out2P(id("out2"), out2F),
00324    out3P(id("out3"), out3F),
00325    out4P(id("out4"), out4F),
00326    out5P(id("out5"), out5F),
00327    out6P(id("out6"), out6F)
00328 { }
00329 
00330     // member functions
00331     const char* type() const { return "fork6"; }
00332     void main() {
00333         while(true) {
00334             read(inP, in);
00335             write(out1P, in);
00336             write(out2P, in);
00337             write(out3P, in);
00338             write(out4P, in);
00339             write(out5P, in);
00340             write(out6P, in);
00341         }
00342     }
00343 
00344 private:
00345     // ports
00346     InPort<FORK6>     inP;
00347     OutPort<FORK6>    out1P;
00348     OutPort<FORK6>    out2P;
00349     OutPort<FORK6>    out3P;
00350     OutPort<FORK6>    out4P;
00351     OutPort<FORK6>    out5P;
00352     OutPort<FORK6>    out6P;
00353 
00354     // member variable
00355     FORK6             in;
00356 };
00357 
00359 //
00360 // VYA MODULE   : fork7
00361 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00362 // FUNCTION     : copies input to five outputs
00363 // DOCUMENTS    : none
00364 // INPUTS       : in:   input
00365 // OUTPUTS      : out1: =input
00366 //              : out2: =input
00367 //              : out3: =input
00368 //              : out4: =input
00369 //              : out5: =input
00370 //              : out6: =input
00371 //              : out7: =input
00372 // NETWORK      :
00373 // HISTORY      :
00374 //    06/19/01  : Kees van Zon; Created (VYA 0.3)
00375 
00376 template<class FORK7>
00377 
00378 class fork7: public Process
00379 {
00380 public:
00381     //constructor
00382     fork7 (
00383         Id             n,
00384         In<FORK7>&     inF,
00385         Out<FORK7>&    out1F,
00386         Out<FORK7>&    out2F,
00387         Out<FORK7>&    out3F,
00388         Out<FORK7>&    out4F,
00389         Out<FORK7>&    out5F,
00390         Out<FORK7>&    out6F,
00391         Out<FORK7>&    out7F
00392     )
00393 :
00394     // member initialisation
00395     // process network
00396     Process(n),
00397 
00398    // ports
00399    inP(id("in"), inF),
00400    out1P(id("out1"), out1F),
00401    out2P(id("out2"), out2F),
00402    out3P(id("out3"), out3F),
00403    out4P(id("out4"), out4F),
00404    out5P(id("out5"), out5F),
00405    out6P(id("out6"), out6F),
00406    out7P(id("out7"), out7F)
00407 { }
00408 
00409     // member functions
00410     const char* type() const { return "fork7"; }
00411     void main() {
00412         while(true) {
00413             read(inP, in);
00414             write(out1P, in);
00415             write(out2P, in);
00416             write(out3P, in);
00417             write(out4P, in);
00418             write(out5P, in);
00419             write(out6P, in);
00420             write(out7P, in);
00421        }
00422     }
00423 
00424 private:
00425     // ports
00426     InPort<FORK7>     inP;
00427     OutPort<FORK7>    out1P;
00428     OutPort<FORK7>    out2P;
00429     OutPort<FORK7>    out3P;
00430     OutPort<FORK7>    out4P;
00431     OutPort<FORK7>    out5P;
00432     OutPort<FORK7>    out6P;
00433     OutPort<FORK7>    out7P;
00434 
00435     // member variable
00436     FORK7             in;
00437 };
00438 
00440 //
00441 // VYA MODULE   : fork8
00442 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00443 // FUNCTION     : copies input to five outputs
00444 // DOCUMENTS    : none
00445 // INPUTS       : in:   input
00446 // OUTPUTS      : out1: =input
00447 //              : out2: =input
00448 //              : out3: =input
00449 //              : out4: =input
00450 //              : out5: =input
00451 //              : out6: =input
00452 //              : out7: =input
00453 //              : out8: =input
00454 // NETWORK      :
00455 // HISTORY      :
00456 //    06/19/01  : Kees van Zon; Created (VYA 0.3)
00457 
00458 template<class FORK8>
00459 
00460 class fork8: public Process
00461 {
00462 public:
00463     //constructor
00464     fork8 (
00465         Id             n,
00466         In<FORK8>&     inF,
00467         Out<FORK8>&    out1F,
00468         Out<FORK8>&    out2F,
00469         Out<FORK8>&    out3F,
00470         Out<FORK8>&    out4F,
00471         Out<FORK8>&    out5F,
00472         Out<FORK8>&    out6F,
00473         Out<FORK8>&    out7F,
00474         Out<FORK8>&    out8F
00475     )
00476 :
00477     // member initialisation
00478     // process network
00479     Process(n),
00480 
00481    // ports
00482    inP(id("in"), inF),
00483    out1P(id("out1"), out1F),
00484    out2P(id("out2"), out2F),
00485    out3P(id("out3"), out3F),
00486    out4P(id("out4"), out4F),
00487    out5P(id("out5"), out5F),
00488    out6P(id("out6"), out6F),
00489    out7P(id("out7"), out7F),
00490    out8P(id("out8"), out8F)
00491 { }
00492 
00493     // member functions
00494     const char* type() const { return "fork8"; }
00495     void main() {
00496         while(true) {
00497             read(inP, in);
00498             write(out1P, in);
00499             write(out2P, in);
00500             write(out3P, in);
00501             write(out4P, in);
00502             write(out5P, in);
00503             write(out6P, in);
00504             write(out7P, in);
00505             write(out8P, in);
00506        }
00507     }
00508 
00509 private:
00510     // ports
00511     InPort<FORK8>     inP;
00512     OutPort<FORK8>    out1P;
00513     OutPort<FORK8>    out2P;
00514     OutPort<FORK8>    out3P;
00515     OutPort<FORK8>    out4P;
00516     OutPort<FORK8>    out5P;
00517     OutPort<FORK8>    out6P;
00518     OutPort<FORK8>    out7P;
00519     OutPort<FORK8>    out8P;
00520 
00521     // member variable
00522     FORK8             in;
00523 };
00524 
00526 //
00527 // VYA MODULE   : fork9
00528 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00529 // FUNCTION     : copies input to five outputs
00530 // DOCUMENTS    : none
00531 // INPUTS       : in:   input
00532 // OUTPUTS      : out1: =input
00533 //              : out2: =input
00534 //              : out3: =input
00535 //              : out4: =input
00536 //              : out5: =input
00537 //              : out6: =input
00538 //              : out7: =input
00539 //              : out8: =input
00540 //              : out9: =input
00541 // NETWORK      :
00542 // HISTORY      :
00543 //    06/19/01  : Kees van Zon; Created (VYA 0.3)
00544 
00545 template<class FORK9>
00546 
00547 class fork9: public Process
00548 {
00549 public:
00550     //constructor
00551     fork9 (
00552         Id             n,
00553         In<FORK9>&     inF,
00554         Out<FORK9>&    out1F,
00555         Out<FORK9>&    out2F,
00556         Out<FORK9>&    out3F,
00557         Out<FORK9>&    out4F,
00558         Out<FORK9>&    out5F,
00559         Out<FORK9>&    out6F,
00560         Out<FORK9>&    out7F,
00561         Out<FORK9>&    out8F,
00562         Out<FORK9>&    out9F
00563     )
00564 :
00565     // member initialisation
00566     // process network
00567     Process(n),
00568 
00569    // ports
00570    inP(id("in"), inF),
00571    out1P(id("out1"), out1F),
00572    out2P(id("out2"), out2F),
00573    out3P(id("out3"), out3F),
00574    out4P(id("out4"), out4F),
00575    out5P(id("out5"), out5F),
00576    out6P(id("out6"), out6F),
00577    out7P(id("out7"), out7F),
00578    out8P(id("out8"), out8F),
00579    out9P(id("out9"), out9F)
00580 { }
00581 
00582     // member functions
00583     const char* type() const { return "fork9"; }
00584     void main() {
00585         while(true) {
00586             read(inP, in);
00587             write(out1P, in);
00588             write(out2P, in);
00589             write(out3P, in);
00590             write(out4P, in);
00591             write(out5P, in);
00592             write(out6P, in);
00593             write(out7P, in);
00594             write(out8P, in);
00595             write(out9P, in);
00596        }
00597     }
00598 
00599 private:
00600     // ports
00601     InPort<FORK9>     inP;
00602     OutPort<FORK9>    out1P;
00603     OutPort<FORK9>    out2P;
00604     OutPort<FORK9>    out3P;
00605     OutPort<FORK9>    out4P;
00606     OutPort<FORK9>    out5P;
00607     OutPort<FORK9>    out6P;
00608     OutPort<FORK9>    out7P;
00609     OutPort<FORK9>    out8P;
00610     OutPort<FORK9>    out9P;
00611 
00612     // member variable
00613     FORK9             in;
00614 };
00615 
00617 //
00618 // VYA MODULE   : fork10
00619 // AUTHOR(S)    : Kees van Zon (based on Tmux.h by Rob Vogelaar)
00620 // FUNCTION     : copies input to five outputs
00621 // DOCUMENTS    : none
00622 // INPUTS       : in:   input
00623 // OUTPUTS      : out1: =input
00624 //              : out2: =input
00625 //              : out3: =input
00626 //              : out4: =input
00627 //              : out5: =input
00628 //              : out6: =input
00629 //              : out7: =input
00630 //              : out8: =input
00631 //              : out9: =input
00632 //              : out10:=input
00633 // NETWORK      :
00634 // HISTORY      :
00635 //    06/19/01  : Kees van Zon; Created (VYA 0.3)
00636 
00637 template<class FORK10>
00638 
00639 class fork10: public Process
00640 {
00641 public:
00642     //constructor
00643     fork10 (
00644         Id              n,
00645         In<FORK10>&     inF,
00646         Out<FORK10>&    out1F,
00647         Out<FORK10>&    out2F,
00648         Out<FORK10>&    out3F,
00649         Out<FORK10>&    out4F,
00650         Out<FORK10>&    out5F,
00651         Out<FORK10>&    out6F,
00652         Out<FORK10>&    out7F,
00653         Out<FORK10>&    out8F,
00654         Out<FORK10>&    out9F,
00655         Out<FORK10>&    out10F
00656     )
00657 :
00658     // member initialisation
00659     // process network
00660     Process(n),
00661 
00662    // ports
00663    inP(id("in"), inF),
00664    out1P(id("out1"), out1F),
00665    out2P(id("out2"), out2F),
00666    out3P(id("out3"), out3F),
00667    out4P(id("out4"), out4F),
00668    out5P(id("out5"), out5F),
00669    out6P(id("out6"), out6F),
00670    out7P(id("out7"), out7F),
00671    out8P(id("out8"), out8F),
00672    out9P(id("out9"), out9F),
00673    out10P(id("out10"), out10F)
00674 { }
00675 
00676     // member functions
00677     const char* type() const { return "fork10"; }
00678     void main() {
00679         while(true) {
00680             read(inP, in);
00681             write(out1P, in);
00682             write(out2P, in);
00683             write(out3P, in);
00684             write(out4P, in);
00685             write(out5P, in);
00686             write(out6P, in);
00687             write(out7P, in);
00688             write(out8P, in);
00689             write(out9P, in);
00690             write(out10P, in);
00691        }
00692     }
00693 
00694 private:
00695     // ports
00696     InPort<FORK10>     inP;
00697     OutPort<FORK10>    out1P;
00698     OutPort<FORK10>    out2P;
00699     OutPort<FORK10>    out3P;
00700     OutPort<FORK10>    out4P;
00701     OutPort<FORK10>    out5P;
00702     OutPort<FORK10>    out6P;
00703     OutPort<FORK10>    out7P;
00704     OutPort<FORK10>    out8P;
00705     OutPort<FORK10>    out9P;
00706     OutPort<FORK10>    out10P;
00707 
00708     // member variable
00709     FORK10             in;
00710 };
00711 
00713 //
00714 // VYA MODULE   : sink
00715 // AUTHOR(S)    : Kees van Zon (based on Tdrop.h by Rob Vogelaar)
00716 // FUNCTION     : sinks dummy inputs
00717 // DOCUMENTS    : n/a
00718 // INPUTS       : In:    input token
00719 // NETWORK      : n/a
00720 // HISTORY      :
00721 //    06/28/00  : Kees van Zon; Adopted from TDROP.h (VYA 0.2)
00722 //    07/24/00  : Kees van Zon; Removed tabs
00723 //    08/07/00  : Kees van Zon; Copied to VYA 0.3
00724 //    09/19/00  : Kees van Zon; Added type() function for YAPI 0.5.0
00725 //    10/13/00  : Kees van Zon; Included in utilities.h
00726 
00727 template<class SINK>
00728 
00729 class sink : public Process
00730 {
00731 public:
00732     //constructor
00733     sink (
00734         Id           n,
00735         In<SINK>&    InF
00736     )
00737 :
00738     // member initialisation
00739     // process network
00740     Process(n),
00741 
00742     // ports
00743     InP(id("InP"), InF)
00744 { }
00745     // member functions
00746     const char* type() const { return "sink"; }
00747     void main() {
00748         while(true) {
00749             read(InP, in);
00750         }
00751     }
00752 
00753 private:
00754     // port
00755     InPort<SINK> InP;
00756 
00757     // member variable
00758     SINK in;
00759 };
00760 
00762 //
00763 // VYA MODULE   : source
00764 // AUTHOR(S)    : Erwin de Kock
00765 // FUNCTION     : source to dummy input
00766 // DOCUMENTS    : n/a
00767 // OUTPUTS      : Out:    not used
00768 // NETWORK      : n/a
00769 // HISTORY      :
00770 //    06/15/05  : Erwin de Kock; Created
00771 
00772 template<class SOURCE>
00773 
00774 class source : public Process
00775 {
00776 public:
00777     //constructor
00778     source (
00779         Id           n,
00780         Out<SOURCE>& OutF
00781     )
00782 :
00783     // member initialisation
00784     // process network
00785     Process(n),
00786 
00787     // ports
00788     OutP(id("OutP"), OutF)
00789 { }
00790     // member functions
00791     const char* type() const { return "source"; }
00792     void main() { }
00793 
00794 private:
00795     // port
00796     OutPort<SOURCE> OutP;
00797 };
00798 
00800 //
00801 // VYA MODULE   : pass
00802 // AUTHOR(S)    : Erwin de Kock
00803 // FUNCTION     : pass input to output
00804 // DOCUMENTS    : n/a
00805 // OUTPUTS      : Out: copy of input
00806 // NETWORK      : n/a
00807 // HISTORY      :
00808 //    06/15/05  : Erwin de Kock; Created
00809 
00810 template<class PASS>
00811 
00812 class pass : public Process
00813 {
00814 public:
00815     //constructor
00816     pass (
00817         Id            n,
00818         In<PASS>&   InF,
00819         Out<PASS>& OutF
00820     )
00821 :
00822     // member initialisation
00823     // process network
00824     Process(n),
00825 
00826     // ports
00827     InP(id("InP"), InF),
00828     OutP(id("OutP"), OutF)
00829 { }
00830     // member functions
00831     const char* type() const { return "pass"; }
00832     void main() {
00833         while(true) {
00834             read(InP, in);
00835             write(OutP, in);
00836         }
00837     }
00838 
00839 private:
00840     // port
00841     InPort<PASS> InP;
00842     OutPort<PASS> OutP;
00843 
00844     // member variable
00845     PASS in;
00846 };
00847 
00849 //
00850 // VYA MODULE   : i2l
00851 // AUTHOR       : Karl Wittig
00852 // FUNCTION     : Converts image size information to line length information.
00853 // DOCUMENTS    : n/a
00854 // INPUTS       : imgWin        -- input image width
00855 //                imgHin        -- input image height
00856 // OUTPUTS      : lineLout      -- output line length
00857 // NETWORK      : n/a
00858 // HISTORY      :
00859 //    09/29/00  : Karl Wittig;  Created
00860 //    10/13/00  : Kees van Zon; Included in utilities.h
00861 
00862 class i2l : public Process
00863 {
00864 public:
00865     // constructor
00866     i2l(
00867         Id                     n,
00868         In<VYAimageWidth>&     imgWinF,
00869         In<VYAimageHeight>&    imgHinF,
00870         Out<VYAlineLength>&    lineLoutF
00871     )
00872 :
00873     // member initialisation
00874     // process network
00875     Process(n),
00876 
00877     // ports
00878     imgWinP(id("imgWin"), imgWinF),
00879     imgHinP(id("imgHin"), imgHinF),
00880     lineLoutP(id("lineLout"), lineLoutF)
00881 { }
00882 
00883     // member functions
00884     const char* type() const { return "i2l"; }
00885     void main() {
00886         while (true) {
00887            read(imgWinP, imgWin);
00888            read(imgHinP, imgHin);
00889            lineLout = imgWin;
00890            for (int i=0; i < (int)imgHin; i++)
00891               write(lineLoutP, lineLout);
00892         }
00893     }
00894 
00895 private:
00896     // ports
00897     InPort<VYAimageWidth>     imgWinP;
00898     InPort<VYAimageHeight>    imgHinP;
00899     OutPort<VYAlineLength>    lineLoutP;
00900 
00901     // member variables
00902     VYAimageWidth             imgWin;
00903     VYAimageHeight            imgHin;
00904     VYAlineLength             lineLout;
00905 };
00906 
00908 //
00909 // VYA MODULE   : l2i
00910 // AUTHOR       : Karl Wittig
00911 // FUNCTION     : Converts line length information to image size information.
00912 // DOCUMENTS    : n/a
00913 // INPUTS       : lineLin       -- input line length
00914 //                imgHin        -- input image height
00915 // OUTPUTS      : imgWout       -- output image width
00916 // NETWORK      : n/a
00917 // HISTORY      :
00918 //    09/29/00  : Karl Wittig;  Created
00919 //    10/13/00  : Kees van Zon; Included in utilities.h
00920 
00921 class l2i : public Process
00922 {
00923 public:
00924     // constructor
00925     l2i(
00926         Id                      n,
00927         In<VYAlineLength>&      lineLinF,
00928         In<VYAimageHeight>&     imgHinF,
00929         Out<VYAimageWidth>&     imgWoutF
00930     )
00931 :
00932     // member initialisation
00933     // process network
00934     Process(n),
00935 
00936     // ports
00937     lineLinP(id("lineLin"), lineLinF),
00938     imgHinP(id("imgHin"), imgHinF),
00939     imgWoutP(id("imgWout"), imgWoutF)
00940 { }
00941 
00942     // member functions
00943     const char* type() const { return "l2i"; }
00944     void main() {
00945         while (true) {
00946             read(imgHinP, imgHin);
00947             read(lineLinP, lineLin);
00948             imgWout = lineLin;
00949             write(imgWoutP, imgWout);
00950 
00951             for (int i=1; i < (int)imgHin; i++)
00952                 read(lineLinP, lineLin);
00953         }
00954     }
00955 
00956 private:
00957     // ports
00958     InPort<VYAlineLength>     lineLinP;
00959     InPort<VYAimageHeight>    imgHinP;
00960     OutPort<VYAimageWidth>    imgWoutP;
00961 
00962     // member variables
00963     VYAimageWidth             imgWout;
00964     VYAimageHeight            imgHin;
00965     VYAlineLength             lineLin;
00966 };
00967 
00968 
00969 #endif  // UTILITIES_H
00970 
00971 

Generated on Wed Feb 15 14:52:42 2006 for vya by doxygen 1.3.2