Content-Based Networking Simulation Library Documentation (v. 1.2.1) |
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: CBNSimulation.h,v 1.6 2004/03/06 22:05:19 rutherfo Exp $ 00026 // 00027 #ifndef CBNSIM_CBNSIMULATION_H 00028 #define CBNSIM_CBNSIMULATION_H 00029 00030 #include <string> 00031 #include <vector> 00032 #include "cbnsim/DataCollector.h" 00033 #include "cbnsim/Driver.h" 00034 #include "cbnsim/NodeFactory.h" 00035 #include "cbnsim/WorkloadParser.h" 00036 00037 namespace cbnsim 00038 { 00041 class CBNSimulation 00042 { 00043 public: 00046 CBNSimulation(); 00047 00048 virtual ~CBNSimulation(); 00049 00052 void add_event_parser( WorkloadEventParser* wep ) 00053 { m_parser.add( wep ); } 00054 00058 void debug_messages( bool debug_on ); 00059 00062 bool debug_messages() const; 00063 00066 void dci( double dci ) 00067 { m_dci = dci; } 00068 00071 double dci() const 00072 { return m_dci; } 00073 00077 void error_messages( bool error_on ); 00078 00082 bool error_messages() const; 00083 00087 void info_messages( bool info_on ); 00088 00091 bool info_messages() const; 00092 00097 void input_fname( const std::string& ifname ); 00098 00103 const std::string& input_fname() const; 00104 00109 void output_fname( const std::string& ofname ); 00110 00115 const std::string& output_fname() const; 00116 00119 void run() throw ( std::exception ); 00120 00126 void set_data_collector( DataCollector* data_collector ) 00127 { delete m_data_collector; m_data_collector = data_collector; } 00128 00134 void set_driver( Driver* driver ) 00135 { delete m_driver; m_driver = driver; } 00136 00142 void set_factory( NodeFactory* node_factory ) 00143 { delete m_node_factory; m_node_factory = node_factory; } 00144 00147 double time_unit() const 00148 { return m_parser.get_time_unit(); } 00149 00150 protected: 00155 virtual void pre_run_simulation_hook() throw () {} 00156 00163 virtual void setup_link_hook( ssim::ProcessId from, 00164 ssim::ProcessId to, 00165 unsigned int length ) throw () {} 00166 00170 virtual void setup_node_hook( Node* node ) throw () {} 00171 00175 virtual void setup_topology_hook() throw () {} 00176 00177 private: 00178 void setup_link( unsigned int from, 00179 unsigned int to, 00180 unsigned int length ); 00181 void setup_node(unsigned int i); 00182 void setup_topology(); 00183 00184 DataCollector* m_data_collector; 00185 double m_dci; 00186 Driver* m_driver; 00187 std::string m_input_fname; 00188 NodeFactory* m_node_factory; 00189 std::vector<Node*> m_nodes; 00190 std::string m_output_fname; 00191 WorkloadParser m_parser; 00192 }; 00193 }; 00194 00195 #endif
Copyright © 2001-2004 University of Colorado.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". This documentation is authored and maintained by Matthew J. Rutherford |