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

Driver.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: Driver.h,v 1.3 2004/04/19 05:26:16 rutherfo Exp $
00026 //
00027 #ifndef CBNSIM_DRIVER_H
00028 #define CBNSIM_DRIVER_H
00029 
00030 #include <siena/ssim.h>
00031 #include <vector>
00032 #include "cbnsim/Node.h"
00033 #include "cbnsim/WorkloadParser.h"
00034 
00035 namespace cbnsim
00036 {
00040   class Driver : public ssim::ProcessWithPId
00041   {
00042     typedef std::vector<Node*>          NodeList;
00043 
00044     const WorkloadEvent                 *m_next_event;
00045     const NodeList*                     m_nodes;
00046     WorkloadParser*                     m_parser;
00047 
00048   public:
00049     Driver()
00050       : m_next_event( NULL ), m_nodes( NULL ), m_parser( NULL ) {}
00051 
00052     virtual ~Driver() {}
00053 
00058     virtual void handle_event( Node& node, const NodeEvent& node_event ) {}
00059 
00060     void init();
00061 
00062     void process_event( const ssim::Event* evt );
00063 
00064     void setup( const NodeList& nodes, WorkloadParser& parser )
00065     { m_nodes = &nodes; m_parser = &parser; }
00066   };
00067 };
00068 #endif