global_function.h

Go to the documentation of this file.
00001 //    sampalib.org ESL library and tools
00002 //    Copyright (C) 2007  Thierry Grellier
00003 //
00004 //    This program is free software; you can redistribute it and/or modify
00005 //    it under the terms of the GNU General Public License version 2 as
00006 //    published by the Free Software Foundation.
00007 //
00008 //    This program is distributed in the hope that it will be useful,
00009 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //    GNU General Public License for more details.
00012 //
00013 //    You should have received a copy of the GNU General Public License along
00014 //    with this program; if not, write to the Free Software Foundation, Inc.,
00015 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016 //
00017 //    contact: www.sampalib.org
00018 
00019 #ifndef SAMPA_GLOBAL_FUNCTION_H
00020 #define SAMPA_GLOBAL_FUNCTION_H
00021 
00022 #include <string>
00023 #include "sampa/core/time.h"
00024 #include "sampa/core/persistence.h"
00025 #include "lua.hpp"
00026 #include <cstdarg>
00027 
00028 namespace Sampa {
00029 
00030   class Module;
00031   
00032   bool initialize(int argc, char** argv, Module*&);
00033   
00034   template<class TopLevel> 
00035   bool initialize(int argc, char** argv, TopLevel*& top_level) {
00036     Module* m;
00037     if (!initialize(argc, argv, m)) return false;
00038     top_level = dynamic_cast<TopLevel*>(m);
00039     return true;
00040   }
00041 
00042   lua_State* get_interpreter();
00043 
00044   Time        get_current_time();
00045   std::string get_current_time_as_string();
00046   unsigned long long get_current_time_to_default_time_unit();
00047 
00048   bool simulate();
00049   unsigned int sampa_rand();
00050   double       sampa_rand01();
00051 
00052   enum Severity {
00053     S_INFO,
00054     S_WARNING,
00055     S_ERROR
00056   };
00057 
00058 //  void log(Severity s, Module* m, const char* fmt, va_list ap);
00059 }
00060 
00061 #endif

Generated on Sat Feb 16 16:23:15 2008 for Sampa by  doxygen 1.5.3