Content-Based Networking Simulation Library Documentation (v. 1.2.1)

SetPredicateWNP.h

00001 // -*- C++ -*-
00002 //
00003 //  This file is part of CBNSIM, the Content-Based Networking
00004 //  Simulation Library.
00005 //
00006 //  Authors: See the file AUTHORS for full details.
00007 //
00008 //  Copyright (C) 2002-2004 University of Colorado
00009 //
00010 //  This program is free software; you can redistribute it and/or
00011 //  modify it under the terms of the GNU General Public License
00012 //  as published by the Free Software Foundation; either version 2
00013 //  of the License, or (at your option) any later version.
00014 //
00015 //  This program is distributed in the hope that it will be useful,
00016 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 //  GNU General Public License for more details.
00019 //
00020 //  You should have received a copy of the GNU General Public License
00021 //  along with this program; if not, write to the Free Software
00022 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
00023 //  USA, or send email to serl@cs.colorado.edu.
00024 //
00025 // $Id: SetPredicateWNP.h,v 1.4 2004/04/19 05:26:16 rutherfo Exp $
00026 //
00027 #ifndef CBNSIM_SETPREDICATEWPN_H
00028 #define CBNSIM_SETPREDICATEWPN_H
00029 
00030 #include <siena/ssbg.h>
00031 #include "cbnsim/WorkloadNodeProcess.h"
00032 
00033 namespace cbnsim
00034 {
00037   class SetPredicateWNP : public WorkloadNodeProcess
00038     {
00039     public:
00042         SetPredicateWNP( unsigned int nid, std::ostream& out,
00043                          ssbg::SSBG& ssbg, unsigned int delay, bool t0_pred,
00044                          unsigned int msg_rate );
00045 
00049       void init();
00050 
00054       void process_event( const ssim::Event* evt );
00055 
00056     private:
00057       std::ostream & output_attr( std::ostream& out, 
00058                                           const std::string& x, 
00059                                      const std::string& o, 
00060                                      const std::string& v)
00061         {
00062           return out << x << ' ' << o << ' ' << '"' << v << '"';
00063         }
00064 
00065       template<class T>
00066         std::ostream & output_attr(std::ostream & out, 
00067                                            const std::string & x, 
00068                                            const std::string & o, 
00069                                            T v )
00070         {
00071           return out << x << ' ' << o << ' ' << v;
00072         }
00073       
00074       void print( const ssbg::predicate& );
00075 
00076         unsigned int    m_delay;
00077         ssbg::SSBG&     m_ssbg;
00078         bool            m_t0_pred;
00079         unsigned int    m_msg_rate;
00080     };
00081 };
00082 
00083 #endif