|
PH Logo
Logo intepreter modeled after UCB Logo.
|
00001 /* 00002 * World.h 00003 * 00004 * Author: Paul Hamilton 00005 * Date: 6 Jun 2011 00006 * 00007 */ 00008 #ifndef _WORLD_H 00009 #define _WORLD_H 00010 00011 #include "Types.h" 00012 00013 #include <string> 00014 #include <boost/shared_ptr.hpp> 00015 00016 namespace phlogo { 00017 00018 class Console; 00019 class Scope; 00020 class Thing; 00021 class Turtle; 00022 00027 class World { 00028 00029 public: 00030 World(Console *console); 00031 00032 Console *getConsole() { return _console; } 00033 00034 // scope 00035 void setScope(Scope *scope) { _curscope = scope; } 00036 Scope *getScope() { return _curscope; } 00037 00038 // things 00039 void setThing(const std::string &name, const std::string &value, bool local=false); 00040 void setThing(const std::string &name, pThing value, bool local=false); 00041 pThing getThing(const std::string &name); 00042 00043 // result 00044 pThing getResult() { return _result; } 00045 pThing allocResult(); 00046 void setResult(pThing thing) { _result = thing; } 00047 00048 void setTurtle(Turtle *turtle) { _turtle = turtle; } 00049 Turtle *getTurtle() { return _turtle; } 00050 00051 private: 00052 Console *_console; 00053 boost::shared_ptr<Scope> _global; 00054 pThing _result; 00055 Scope *_curscope; 00056 Turtle *_turtle; 00057 }; 00058 00059 } 00060 00061 #endif // _WORLD_H
1.7.4