/
ATORdatabaseFileIO.hpp
83 lines (68 loc) · 3.9 KB
/
ATORdatabaseFileIO.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*******************************************************************************
*
* This file is part of BAIPROJECT.
*
* BAIPROJECT is licensed under the GNU Affero General Public License
* version 3, as published by the Free Software Foundation. The use of
* intermediary programs or interfaces including file i/o is considered
* remote network interaction. This does not imply such arrangements
* do not constitute derivative works.
*
* BAIPROJECT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Affero General Public License
* version 3 along with BAIPROJECT. If not, see <http://www.gnu.org/licenses/>
* for a copy of the AGPLv3 License.
*
*******************************************************************************/
/*******************************************************************************
*
* File Name: ATORdatabaseFileIO.hpp
* Author: Richard Bruce Baxter - Copyright (c) 2005-2018 Baxter AI (baxterai.com)
* Project: ATOR (Axis Transformation Object Recognition) Functions
* Project Version: 3m11a 10-January-2018
*
*******************************************************************************/
#ifndef HEADER_OR_DATABASE_FILEIO
#define HEADER_OR_DATABASE_FILEIO
#include "ATORglobalDefs.hpp"
#include "SHAREDvars.hpp"
#include "ATORpolygonList.hpp"
#include "ATORdatabaseSQL.hpp" //required for determineGeoBinX()/determineGeoBinY() only ... - these functions and/or compareFeaturesListForMatch() should probably be moved elsewhere instead, say to "ORdatabaseOperations.cpp"
#include "SHAREDvector.hpp"
#include "LDreferenceManipulation.hpp"
#define OR_DATABASE_FILESYSTEM_DEFAULT_DATABASE_NAME ((string)"ORdatabase/")
#define OR_DATABASE_FILESYSTEM_DEFAULT_SERVER_OR_MOUNT_NAME "/home/systemusername/source/"
#define OR_DATABASE_CONCEPT_NAME_SUBDIRECTORY_INDEX_NUMBER_OF_LEVELS (3) //eg e/x/a/example
#define ASCII_TABLE_INDEX_OF_a (97)
#define ASCII_TABLE_NUMBER_OF_LETTERS_IN_ALPHABET (26)
#define ASCII_TABLE_INDEX_OF_z (ASCII_TABLE_INDEX_OF_a + ASCII_TABLE_NUMBER_OF_LETTERS_IN_ALPHABET)
#define OR_DATABASE_TEST_FOLDER_NAME "test"
#define OR_DATABASE_TRAIN_FOLDER_NAME "train"
class ORdatabaseFileIOClass
{
private: SHAREDvarsClass SHAREDvars;
private: SHAREDvectorClass SHAREDvector;
private: ORdatabaseSQLClass ORdatabaseSQL;
private: LDreferenceManipulationClass LDreferenceManipulation;
#ifdef OR_USE_DATABASE
public: void initialiseDatabase(const string newDatabaseFolderName);
private: bool DBdirectoryExists(string* folderName);
private: bool DBcreateDirectory(string* folderName);
private: bool DBsetCurrentDirectory(string* folderName);
private: bool checkIfFolderExistsAndIfNotMakeAndSetAsCurrent(string* folderName);
private: string DBgenerateServerDatabaseName(const string* objectName, const bool trainOrTest);
public: string DBgenerateFolderName(string* objectName, const bool trainOrTest);
#endif
#ifdef OR_METHOD_GEOMETRIC_COMPARISON
public: bool compareFeaturesListForMatch(ORfeature* testFirstFeatureInNearestFeatureList, ORfeature* trainFirstFeatureInNearestFeatureList, const int dimension, bool* exactMatchFound);
private: void addFeatureToEndOfFeatureList(ORfeature* firstFeatureInList, ORfeature* featureToAdd);
public: void createTransformedFeaturesFile(const ORfeature* firstFeatureInList, const string fileName, const string objectName, const int viewIndex, const int zoomIndex, const int polyIndex, const int sideIndex, const int trainOrTest);
public: void createFeaturesListUsingFeaturesFile(const string fileName, ORfeature* firstFeatureInList, const bool createFeatureObjects, const bool appendToList, const bool ignoreOTfeatures);
#endif
};
#endif