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 COSYRTE_H 00012 #define COSYRTE_H 00013 00014 #include "baseRte.h" 00015 #include "os.h" 00016 #ifdef PREEMPTIVE 00017 #include "mutexapi.h" 00018 #endif 00019 00020 #include <iostream> 00021 00022 class cosyRte : public Rte 00023 { 00024 public: 00025 cosyRte(); 00026 ~cosyRte(); 00027 00028 void start (ProcessNetwork& n); 00029 rteNetwork* create(NetworkImpl& n); 00030 rteProcess* create(ProcessImpl& p); 00031 rteFifo* create(FifoImpl& f); 00032 rteSelect* create(SelectImpl& s); 00033 00034 void setCout(std::ostream& o) {outStream = &o;}; 00035 void setCerr(std::ostream& o) {errStream = &o;}; 00036 void setCin(std::istream& i) {inStream = &i;}; 00037 std::ostream& cout () {return *outStream;}; 00038 std::ostream& cerr () {return *errStream;}; 00039 std::istream& cin () {return *inStream;}; 00040 00041 private: 00042 Os* os; // IMPORTANT 'os' must be declared before 'mutex' 00043 std::ostream* outStream; 00044 std::ostream* errStream; 00045 std::istream* inStream; 00046 00047 #ifdef PREEMPTIVE 00048 Mutex mutex; 00049 void lock(); 00050 void unlock(); 00051 #endif 00052 }; 00053 00054 #endif