00001 //===-- ast/AstResource.h ------------------------------------- -*- C++ -*-===// 00002 // 00003 // This file is distributed under the MIT license. See LICENSE.txt for details. 00004 // 00005 // Copyright (C) 2008, Stephen Wilson 00006 // 00007 //===----------------------------------------------------------------------===// 00008 // 00009 // The AstResource class provides access to "universal" resources necessary for 00010 // builing and managing Ast trees. It provides mechanisms for managing the 00011 // allocation of nodes, a single point of contact for fundamental facilities 00012 // like text providers and an identifier pool. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef COMMA_AST_ASTRESOURCE_HDR_GUARD 00017 #define COMMA_AST_ASTRESOURCE_HDR_GUARD 00018 00019 #include "comma/basic/IdentifierInfo.h" 00020 #include "comma/basic/IdentifierPool.h" 00021 #include "comma/basic/TextProvider.h" 00022 #include "comma/ast/AstBase.h" 00023 00024 namespace comma { 00025 00026 class AstResource { 00027 00028 public: 00029 // For now, this class is simply a bag of important classes: A TextProvider 00030 // associated with the file being processed, and an IdentifierPool for the 00031 // global managment of identifiers. 00032 AstResource(TextProvider &txtProvider, 00033 IdentifierPool &idPool); 00034 00035 // FIXME: Eventually we will replace this single TextProvider resource with 00036 // a manager class which provides services to handle multiple input files. 00037 TextProvider &getTextProvider() { return txtProvider; } 00038 00039 IdentifierPool &getIdentifierPool() { return idPool; } 00040 00041 private: 00042 TextProvider &txtProvider; 00043 IdentifierPool &idPool; 00044 }; 00045 00046 } // End comma namespace. 00047 00048 #endif