GeoGen Development snapshot a3
|
00001 /* 00002 00003 This file is part of GeoGen. 00004 00005 GeoGen is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 GeoGen is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with GeoGen. If not, see <http://www.gnu.org/licenses/>. 00017 00018 */ 00019 00046 #pragma once 00047 00048 #include "ggen_support.h" 00049 #include "ggen_data_1d.h" 00050 #include "ggen_data_2d.h" 00051 #include "ggen_scriptarg.h" 00052 00053 class GGen; 00054 00055 class GGEN_EXPORT GGen{ 00056 protected: 00057 static GGen* instance; 00058 00059 GGen_Status status; 00060 public: 00061 void (*message_callback) (const GGen_String& message, GGen_Message_Level, int line, int column); 00062 void (*return_callback) (const GGen_String& name, const int16* map, int width, int height); 00063 void (*progress_callback) (int current_progress, int max_progress); 00064 00065 vector<GGen_ScriptArg> args; 00066 00067 uint16 output_width, output_height; 00068 00069 uint32 max_progress, current_progress; 00070 00071 GGen_Size max_map_size; 00072 uint16 max_map_count; 00073 00074 GGen(); 00075 virtual ~GGen(); 00076 00077 static GGen* GetInstance(); 00078 00079 GGen_Status GetStatus(); 00080 00081 void ThrowMessage(const GGen_String& message, GGen_Message_Level level, int line = -1, int column = -1); 00082 //void ThrowMessage(const wchar_t* message, GGen_Message_Level level, int line = -1, int column = -1); 00083 00084 void SetMessageCallback( void (*message_callback) (const GGen_String& message, GGen_Message_Level, int line, int column)); 00085 void SetReturnCallback( void (*return_callback) (const GGen_String& name, const int16* map, int width, int height) ); 00086 void SetProgressCallback( void (*return_callback) (int current_progress, int max_progress)); 00087 00088 virtual bool SetScript(const GGen_String& script) = 0; 00089 virtual GGen_String GetInfo(const GGen_String& label) = 0; 00090 virtual int GetInfoInt(const GGen_String& label) = 0; 00091 virtual vector<GGen_ScriptArg>* LoadArgs(); 00092 virtual int16* Generate() = 0; 00093 00094 void SetMaxMapSize(GGen_Size size); 00095 void SetMaxMapCount(uint16 count); 00096 00097 /* Constraint getters and progress methods must be static to be exported as globals to Squirrel */ 00098 static GGen_Size GetMaxMapSize(); 00099 static uint16 GetMaxMapCount(); 00100 00101 virtual void RegisterPreset(GGen_Data_1D* preset, const GGen_String& label) = 0; 00102 virtual void RegisterPreset(GGen_Data_2D* preset, const GGen_String& label) = 0; 00103 virtual void RegisterPreset(GGen_Amplitudes* preset, const GGen_String& label) = 0; 00104 00105 void SetSeed(unsigned seed); 00106 };