Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

scope.h

00001 //
00002 // OpenVRML
00003 //
00004 // Copyright (C) 1998  Chris Morley
00005 // Copyright (C) 2002  Braden McDaniel
00006 // 
00007 // This library is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public
00009 // License as published by the Free Software Foundation; either
00010 // version 2.1 of the License, or (at your option) any later version.
00011 // 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // Lesser General Public License for more details.
00016 // 
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this library; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 # ifndef OPENVRML_SCOPE_H
00023 #   define OPENVRML_SCOPE_H
00024 
00025 #   include <list>
00026 #   include <map>
00027 #   include <string>
00028 #   include "nodetypeptr.h"
00029 #   include "scopeptr.h"
00030 
00031 namespace OpenVRML {
00032 
00033     class OPENVRML_SCOPE Scope {
00034         friend class Node;
00035         
00036         std::list<NodeTypePtr> nodeTypeList;
00037         std::map<std::string, Node *> namedNodeMap;
00038     
00039     public:
00040         const std::string id;
00041         const ScopePtr parent;
00042         
00043         explicit Scope(const std::string & id,
00044                        const ScopePtr & scope = ScopePtr());
00045         virtual ~Scope();
00046 
00047         void addNodeType(const NodeTypePtr & nodeType);
00048         const NodeTypePtr findType(const std::string & name) const;
00049         const NodeTypePtr firstType() const;
00050         Node * findNode(const std::string & name) const;
00051     
00052     private:
00053         // Not copyable.
00054         Scope(const Scope &);
00055         Scope & operator=(const Scope &);
00056     };
00057 }
00058 
00059 #endif