Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

environment.h

Go to the documentation of this file.
00001 // environment.h
00002 //
00003 // Copyright (C) 2002, Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #ifndef CELSCRIPT_ENVIRONMENT_H_
00011 #define CELSCRIPT_ENVIRONMENT_H_
00012 
00013 #include <celscript/celx.h>
00014 #include <string>
00015 #include <map>
00016 #include <celscript/value.h>
00017 
00018 namespace celx
00019 {
00020 
00021 class Environment
00022 {
00023  public:
00024     Environment();
00025     virtual ~Environment();
00026 
00027     virtual void bind(const std::string&, const Value&) = 0;
00028     virtual Value* lookup(const std::string&) const = 0;
00029     virtual Environment* getParent() const = 0;
00030 };
00031 
00032 
00033 class GlobalEnvironment : public Environment
00034 {
00035  public:
00036     GlobalEnvironment();
00037     virtual ~GlobalEnvironment();
00038 
00039     virtual void bind(const std::string&, const Value&);
00040     virtual Value* lookup(const std::string&) const;
00041     virtual Environment* getParent() const;
00042 
00043  private:
00044     std::map<std::string, Value*> bindings;
00045 };
00046 
00047 
00048 } // namespace celx
00049 
00050 #endif // CELSCRIPT_ENVIRONMENT_H_

Generated on Sat Jan 14 22:30:32 2006 for Celestia by  doxygen 1.4.1