00001
00002
00003
00004
00005 #ifndef _YANSCORE_H
00006 #define _YANSCORE_H
00007
00008 #include <map>
00009 #include <string>
00010 #include <boost/random.hpp>
00011 #include <boost/shared_ptr.hpp>
00012 #include <boost/signal.hpp>
00013
00014 #include "../YansCore/Types.h"
00015 #include "../YansCore/Modules.h"
00016 #include "../YansCore/Event.h"
00017 #include "../YansCore/EventQueue.h"
00018
00021 namespace YansCoreNS
00022 {
00025 typedef std::map<std::string, boost::shared_ptr<std::ostream> > FileTable;
00026
00029 typedef std::deque<boost::shared_ptr<MonitorNS::Monitor> > Monitors;
00030
00034 typedef void (NotifyFunction) (Time time,
00035 boost::shared_ptr<Event const> event);
00036
00044 class YansCore
00045 {
00046 friend class ConfigParser;
00047
00048 public:
00051 explicit YansCore (void);
00052
00055 ~YansCore (void);
00056
00060 void SetBasePath (std::string const & basePath);
00061
00065 std::string GetBasePath (void) const;
00066
00070 void SetSeed (RngSeed rngSeed);
00071
00075 RngSeed GetSeed (void) const;
00076
00080 void Setup (boost::shared_ptr<std::istream> configuration);
00081
00084 void RunSimulation (void);
00085
00086 private:
00091 YansCore (YansCore const &);
00092
00097 YansCore operator= (YansCore const &);
00098
00102 void LoadTopology (void);
00103
00107 void LoadMonitors (void);
00108
00112 void LoadServices (NodeDefinition & nodeDef);
00113
00117 void LoadNodes (void);
00118
00119 boost::shared_ptr<TopologyNS::Topology> topology;
00120 Monitors monitors;
00121
00122 Definitions defs;
00123 FileTable fileTable;
00124 std::string basePath;
00125 RngSeed seed;
00126
00127 Time currentTime;
00128 EventQueue eventQueue;
00129 boost::signal<NotifyFunction> notify;
00130
00131 RandomNumberGenerator rng;
00132 ScheduleEventFunction scheduleEvent;
00133 };
00134 }
00135
00136 #endif