00001 /**** 00002 Active Objects v4.2 00003 Copyright (C) 2006-2010 Werner Van Belle 00004 http://active.yellowcouch.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 ****/ 00020 #ifndef __loaded__demo1_cpp__ 00021 #define __loaded__demo1_cpp__ 00022 using namespace std; 00023 #line 1 "demo1.c++" 00024 #define TRACE_MESSAGES 00025 #include "demo1.h" 00026 00027 elementResult ActiveDemoSender::startSending(DemoReceiver* recv, int a) 00028 { 00029 tosend = a; 00030 for(int i = 0 ; i < tosend ; i++) 00031 recv->printNumber(i); 00032 deactivate(); 00033 return Done; 00034 } 00035 00036 elementResult ActiveDemoReceiver::printNumber(int nr) 00037 { 00038 printf("%d ",nr); 00039 fflush(stdout); 00040 if (nr==20) deactivate(); 00041 return Done; 00042 } 00043 00044 DemoSender sender; 00045 DemoReceiver recv; 00046 00047 int main(int, char* []) 00048 { 00049 sender.startSending(&recv,100); 00050 sleep(10); 00051 } 00052 #endif // __loaded__demo1_cpp__