magistraleinformaticanetworking:spm:supportorec17
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
| Entrambe le parti precedenti la revisioneRevisione precedente | |||
| magistraleinformaticanetworking:spm:supportorec17 [12/01/2018 alle 09:12 (8 anni fa)] – Marco Danelutto | magistraleinformaticanetworking:spm:supportorec17 [25/01/2018 alle 14:17 (8 anni fa)] (versione attuale) – [Course notes] Marco Danelutto | ||
|---|---|---|---|
| Linea 13: | Linea 13: | ||
| ==== Course notes ==== | ==== Course notes ==== | ||
| Course notes (last edition) may be found [[http:// | Course notes (last edition) may be found [[http:// | ||
| + | |||
| + | ==== Trivial ff_comp implementation ==== | ||
| + | In case, you may use this code to implement a trivial ff_comp that **only accepts sequential stages**. | ||
| + | |||
| + | <code " | ||
| + | #ifndef ff_comp_hpp | ||
| + | #define ff_comp_hpp | ||
| + | |||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | using namespace ff; | ||
| + | |||
| + | |||
| + | class ff_comp : public ff_node { | ||
| + | protected: | ||
| + | std:: | ||
| + | int stageno; | ||
| + | public: | ||
| + | |||
| + | ff_comp(ff_node *s1, ff_node *s2) { | ||
| + | stages.push_back(s1); | ||
| + | stages.push_back(s2); | ||
| + | stageno = 2; | ||
| + | } | ||
| + | |||
| + | ff_comp(std:: | ||
| + | stageno = 0; | ||
| + | for(auto i = pats.begin(); | ||
| + | stages.push_back(*i); | ||
| + | stageno++; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | // for cloning | ||
| + | |||
| + | ff_comp() { | ||
| + | stageno=0; | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | void add_stage(ff_node * stage) { | ||
| + | stages.push_back(stage); | ||
| + | stageno++; | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | ff_comp * clone() { | ||
| + | ff_comp * p = new ff_comp(); | ||
| + | for(int i=0; i< | ||
| + | p-> | ||
| + | return(p); | ||
| + | } | ||
| + | // end of bad idea to clone | ||
| + | |||
| + | void * svc (void * t) { | ||
| + | auto x = stages[0]-> | ||
| + | for(int i=1; i< | ||
| + | x = stages[i]-> | ||
| + | return(x); | ||
| + | } | ||
| + | }; | ||
| + | </ | ||
| ====== Support material 2017 (recovery edition) ====== | ====== Support material 2017 (recovery edition) ====== | ||
magistraleinformaticanetworking/spm/supportorec17.1515748348.txt.gz · Ultima modifica: 12/01/2018 alle 09:12 (8 anni fa) da Marco Danelutto
