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

SimpleCopier.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2004 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010  */
00011 
00012 //
00013 // SimpleCopier
00014 //
00015 // 24 September 2004 -- tds
00016 //
00017 // SimpleCopier just makes a copy of a query tree and stores it.
00018 // This is useful for keeping a copy of a query tree around.
00019 //
00020 
00021 #ifndef INDRI_SIMPLECOPIER_HPP
00022 #define INDRI_SIMPLECOPIER_HPP
00023 
00024 #include "Copier.hpp"
00025 namespace indri
00026 {
00027   namespace lang
00028   {
00029     
00030     class SimpleCopier : public indri::lang::Copier {
00031     private:
00032       std::vector<indri::lang::Node*> _nodes;
00033 
00034     public:
00035       ~SimpleCopier() {
00036         indri::utility::delete_vector_contents( _nodes );
00037       }
00038 
00039       indri::lang::Node* defaultAfter( indri::lang::Node* oldNode, indri::lang::Node* newNode ) {
00040         _nodes.push_back(newNode);
00041         return newNode;
00042       }
00043 
00044       indri::lang::Node* root() {
00045         if( _nodes.size() )
00046           return _nodes.back();
00047         return 0;
00048       }
00049     };
00050   }
00051 }
00052 
00053 #endif // INDRI_SIMPLECOPIER_HPP

Generated on Tue Jun 15 11:02:55 2010 for Lemur by doxygen 1.3.4