TeQuerierDBStr2.h

Go to the documentation of this file.
00001 /************************************************************************************
00002 TerraLib - a library for developing GIS applications.
00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
00004 
00005 This code is part of the TerraLib library.
00006 This library is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU Lesser General Public
00008 License as published by the Free Software Foundation; either
00009 version 2.1 of the License, or (at your option) any later version.
00010 
00011 You should have received a copy of the GNU Lesser General Public
00012 License along with this library.
00013 
00014 The authors reassure the license terms regarding the warranties.
00015 They specifically disclaim any warranties, including, but not limited to,
00016 the implied warranties of merchantability and fitness for a particular purpose.
00017 The library provided hereunder is on an "as is" basis, and the authors have no
00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
00020 indirect, special, incidental, or consequential damages arising out of the use
00021 of this library and its documentation.
00022 *************************************************************************************/
00023 /*! \file TeQuerierDBStr2.h
00024         \brief This file contains a mechanism named "TeQuerierDBStr2" that is 
00025         responsible for loading spatio-temporal elements from a TerraLib database. 
00026 */
00027 
00028 #ifndef  __TERRALIB_INTERNAL_QUERIER_DBSTR2_H
00029 #define  __TERRALIB_INTERNAL_QUERIER_DBSTR2_H
00030 
00031 #include "TeQuerierDB.h"
00032 #include "TeTemporalSeries.h"
00033 
00034 /*! \class TeQuerierDBStr2
00035         \brief A class responsible for loading spatio-temporal elements from a TerraLib database.
00036 
00037         This class implements a mechanism that is responsible for loading 
00038         spatio-temporal elements from a TerraLib database, following a specific strategy (Strategy 2). 
00039         Each spatio-temporal elements is represented through a TeSTInstance class. 
00040         This class is internally used by the factory of queriers. It should NOT be used 
00041         by anyone. This Strategy 2 works with simple chronon, without geometry, 
00042         theme with collection table and existence operator in the DBMS.  
00043 
00044         \sa
00045         TeQuerierDB TeQuerierParams TeSTInstance 
00046 */
00047 
00048 class TL_DLL TeQuerierDBStr2: public TeQuerierDB
00049 {
00050 private:
00051         int                             timeFramePortal_;  // the time frame appointed by the portal 
00052         TeTSEntry               TSEntry_;
00053         
00054         /* @name Internal functions to initialize portals */
00055         //@{
00056         bool initPortal(TeTSEntry* ent=0); 
00057         //@}
00058 
00059         //! Internal function to fill STO
00060         bool fillSTO(TeSTInstance& sto); 
00061         
00062 public:
00063         //! Constructor
00064         TeQuerierDBStr2(TeQuerierParams* params): 
00065                 TeQuerierDB(params), 
00066                 timeFramePortal_(-1)
00067         {} 
00068 
00069         //! Loads the instances
00070         bool loadInstances(TeTSEntry* ent=0); 
00071 
00072         //! Returns each loaded STO
00073         bool fetchInstance(TeSTInstance&  sto); 
00074 
00075         //! Returns the number of instances 
00076         int  numElemInstances();
00077 };
00078 
00079 /*! \class TeQuerierDBStr2Factory
00080         \brief A class that define a factory to build a querier strategy (strategy 2) from TerraLib database.
00081 
00082         \sa
00083         TeQuerierImplFactory TeQuerierDBStr2
00084 */
00085 class TL_DLL TeQuerierDBStr2Factory : public TeQuerierImplFactory
00086 {
00087 public:
00088         //! Constructor
00089         TeQuerierDBStr2Factory(const string& name) : TeQuerierImplFactory(name) {}
00090 
00091         //! Builds a database querier
00092         virtual TeQuerierImpl* build (const TeQuerierParams& arg)
00093         {  
00094                 TeQuerierParams* tempArg = new TeQuerierParams();
00095                 *tempArg = arg;
00096                 return new TeQuerierDBStr2(tempArg); 
00097         }
00098 };
00099 
00100 //! Creates a static factory to build TeQuerierDBStr2 
00101 namespace 
00102 {
00103   static TeQuerierDBStr2Factory querierDBStr2("querierDBStr2");
00104 };
00105 
00106 #endif

Generated on Sun Jul 29 04:01:27 2012 for TerraLib - Development Source by  doxygen 1.5.3