All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Utils.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file Utils.h
22 
23  \brief Terralib Data Source Info Tool Utils
24 */
25 
26 #ifndef __TERRALIB_TOOLS_DSINFO_UTILS_H
27 #define __TERRALIB_TOOLS_DSINFO_UTILS_H
28 
29 // Terralib
30 #include <terralib/common.h>
31 #include <terralib/dataaccess.h>
32 #include <terralib/plugin.h>
33 
34 // STL
35 #include <iostream>
36 #include <string>
37 #include <map>
38 
39 /*!
40  \class Utils
41 
42  \brief Class with help methods for the application
43 */
44 class Utils
45 {
46  public:
47 
48  /*!
49  \brief Load Terralib modules
50 
51  \param errorMessage String that receive methods errors description
52 
53  \return True if successfully
54  */
55  static bool loadModules(std::string & errorMessage);
56 
57  /*!
58  \brief Method to connect with a Data Source
59 
60  \param dsType Dataq Source Type
61  \param dataSource Return DataSource
62  \param errorMessage String that receive methods errors description
63 
64  \return True if successfully
65  */
66  static bool getDataSource(std::string dsType, std::string connStr, te::da::DataSource* & dataSource, std::string & errorMessage);
67 
68  static std::string getIdxTypeName(int id);
69 
70  /*!
71  \brief Getting Primary Key Properties Names
72 
73  \param pk Primary Key target
74 
75  \return String vector with the Primary Key properties names.
76  */
77  static std::vector<std::string> getPKPropertiesNames(te::da::PrimaryKey* pk);
78 
79  /*!
80  \brief Getting Foreign Key Properties Names
81 
82  \param fk Foreign Key target
83 
84  \return String vector with the Foreign Key properties names.
85  */
86  static std::vector<std::string> getFKPropertiesNames(te::da::ForeignKey* fk);
87 
88  /*!
89  \brief Getting Unique Key Properties Names
90 
91  \param uk Unique Key target
92 
93  \return String vector with the Unique Key properties names.
94  */
95  static std::vector<std::string> getUKPropertiesNames(te::da::UniqueKey* uk);
96 
97  /*!
98  \brief Getting Index Properties Names
99 
100  \param idx Index Key target
101 
102  \return String vector with the Index properties names.
103  */
104  static std::vector<std::string> getIdxPropertiesNames(te::da::Index* idx);
105 
106  static te::da::DataSet* getDataSet(te::da::DataSource* dataSource, std::string dataSetName);
107 
108 };
109 
110 #endif // __TERRALIB_TOOLS_DSINFO_UTILS_H
static std::vector< std::string > getFKPropertiesNames(te::da::ForeignKey *fk)
Getting Foreign Key Properties Names.
Definition: Utils.cpp:55
This file contains include headers for the Plugin module of TerraLib.
static bool loadModules(std::string &errorMessage)
Load Terralib modules.
Definition: Utils.cpp:110
static std::vector< std::string > getIdxPropertiesNames(te::da::Index *idx)
Getting Index Properties Names.
Definition: Utils.cpp:83
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
static bool getDataSource(std::string dsType, std::string connStr, te::da::DataSource *&dataSource, std::string &errorMessage)
Method to connect with a Data Source.
Definition: Utils.cpp:4
It models a foreign key constraint for a DataSetType.
Definition: ForeignKey.h:50
It describes a unique key (uk) constraint.
Definition: UniqueKey.h:53
static std::vector< std::string > getPKPropertiesNames(te::da::PrimaryKey *pk)
Getting Primary Key Properties Names.
Definition: Utils.cpp:41
static std::vector< std::string > getUKPropertiesNames(te::da::UniqueKey *uk)
Getting Unique Key Properties Names.
Definition: Utils.cpp:69
static te::da::DataSet * getDataSet(te::da::DataSource *dataSource, std::string dataSetName)
Definition: Utils.cpp:97
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
It describes a primary key (pk) constraint.
Definition: PrimaryKey.h:52
This file contains include headers for the TerraLib Common Runtime module.
static std::string getIdxTypeName(int id)
Definition: Utils.cpp:27
Class with help methods for the application.
Definition: Utils.h:44
This file contains include headers for the Data Access module of TerraLib.
It describes an index associated to a DataSetType.
Definition: Index.h:54