00001 /******************************************************************************* 00002 Copyright (c) 2011, Yahoo! Inc. 00003 All rights reserved. 00004 00005 Redistribution and use of this software in source and binary forms, 00006 with or without modification, are permitted provided that the following 00007 conditions are met: 00008 00009 * Redistributions of source code must retain the above 00010 copyright notice, this list of conditions and the 00011 following disclaimer. 00012 00013 * Redistributions in binary form must reproduce the above 00014 copyright notice, this list of conditions and the 00015 following disclaimer in the documentation and/or other 00016 materials provided with the distribution. 00017 00018 * Neither the name of Yahoo! Inc. nor the names of its 00019 contributors may be used to endorse or promote products 00020 derived from this software without specific prior 00021 written permission of Yahoo! Inc. 00022 00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00024 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00025 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00026 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 00035 The Initial Developer of the Original Code is Shravan Narayanamurthy. 00036 ******************************************************************************/ 00037 /* 00038 * Model_Builder.h 00039 * 00040 * 00041 * 00042 * 00043 * 00044 * Created on: 11-May-2010 00045 * 00046 */ 00047 00048 #ifndef MODELBUILDER_H_ 00049 #define MODELBUILDER_H_ 00050 00051 #include "Model_Refiner.h" 00052 #include "Pipeline.h" 00053 #include "Execution_Strategy.h" 00054 #include "Model.h" 00055 00056 //!The builder class which builds the different components 00057 //!needed to create the model. 00058 /** 00059 * We use the Builder pattern. 00060 * 00061 * The components are: 00062 * 1. Model_Refiner: This main component that describes how 00063 * the model should be refined as documents 00064 * pass through the pipeline 00065 * 2. Pipeline: A pipeline of filters that perform the various 00066 * refinements defined by the refiner 00067 * 3. Execution_Strategy: A strategy that defines how the pipeline 00068 * of filters has to be executed 00069 * 00070 * Usually, different modes demand different builders and similar 00071 * or different components. So keep in mind that inheritance can 00072 * be used here to maximize code reuse 00073 */ 00074 class Model_Builder { 00075 00076 public: 00077 virtual Model_Refiner& create_model_refiner() = 0; 00078 virtual Pipeline& create_pipeline(Model_Refiner&) = 0; 00079 virtual Execution_Strategy& create_execution_strategy(Pipeline&) = 0; 00080 virtual void create_output() = 0; 00081 00082 virtual Model& get_model() = 0; 00083 }; 00084 00085 #endif /* MODELBUILDER_H_ */