GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GoDBTableWidgetContainer.h
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 #ifndef __GoDBTableWidgetContainer_h
35 #define __GoDBTableWidgetContainer_h
36 
38 #include "GoDBTraceRow.h"
39 #include "vtkMySQLDatabase.h"
41 #include <string>
42 #include <vector>
43 #include <list>
44 
45 #include "QGoIOConfigure.h"
53 class QGOIO_EXPORT GoDBTableWidgetContainer
54 {
55 public:
56 
59 
66  explicit GoDBTableWidgetContainer(std::string iCollectionName, std::string iTracesName,
67  int iImgSessionID);
72 
73  typedef std::vector< std::pair< GoDBTraceInfoForTableWidget, std::vector< std::string > > >
75 
82  std::list< std::pair<std::string, std::string> > GetListColumnsNamesAndToolTipsForTableWidget();
83 
90  std::vector< std::string > GetNameComputedColumns();
91 
100  virtual TWContainerType GetContainerLoadedWithAllFromDB(
101  vtkMySQLDatabase *iDatabaseConnector,std::list<unsigned int> iListTPs = std::list<unsigned int>());
102 
111  virtual TWContainerType GetContainerForOneSpecificTrace(vtkMySQLDatabase *iDatabaseConnector,
112  int iTraceID);
113 
117  //virtual TWContainerType GetContainerForLastCreatedTrace(
118  //vtkMySQLDatabase* iDatabaseConnector);
119 
120  //void ClearRowContainer();
121 
122  std::vector< int > GetIndexForGroupColor(std::string iGroupName);
123 
127  std::vector< int > GetAllTraceIDsInContainer();
128 
131  //std::list<std::string> GetTracesIDForAGivenZCoord(int iZCoord);
132 
133  //std::vector<std::vector<std::string> > GetChannelsInfo();
135  //void SetSpecificColumnsInfoForMesh(
136  //std::vector<std::vector<std::string> > iChannelsInfo);
137 
140  //void InsertNewCreatedTrace(GoDBTableWidgetContainer
141  // iLinkToNewTraceContainer);
142 
143  //void DeleteSelectedTraces(std::list<int> iSelectedTraces);
144 
145  //void UpdateIDs(std::list<int> iListTracesToUpdate,unsigned int
146  // NewCollectionID);
147 protected:
148  std::string m_CollectionName;
149  std::string m_CollectionIDName;
150  std::string m_TracesName;
151  std::string m_TracesIDName;
153  std::vector< GoDBTraceInfoForTableWidget > m_ColumnsInfos;
155 
162  virtual std::vector< GoDBTraceInfoForTableWidget > GetColumnsInfoForTraceTable();
163 
168  virtual void SetCommonInfoForTwoTracesTable() = 0;
169 
170  void SetInfoForColumnIsVisible();
171 
172  virtual void FillRowContainerWithDBValues(
173  vtkMySQLDatabase *iDatabaseConnector, std::string iRestrictionName,
174  std::string iRestrictionValue, std::list<unsigned int> iListTimepoints = std::list<unsigned int>());
175 
179  void FillRowContainerForComputedValues(
180  std::vector< std::vector< std::string > > *iComputedValues);
181 
182  //int GetLastCreatedTraceID(vtkMySQLDatabase* iDatabaseConnector);
183 
187  std::vector< std::string > GetQueryStringForSelectFieldsTables(bool SameFieldsInQuery);
188 
193  std::vector< std::string > GetQueryStringForTraceJoinedTables(bool SameFieldsInQuery);
194 
199  void FillRowContainer(std::vector< std::vector< std::string > > iResultsFromQuery,
200  std::vector< std::string > iSelectFields, std::string BaseOn = "");
201 
202  size_t GetNumberOfRows();
203 
206  int GetIndexInsideRowContainer(std::string iInfoName);
207 
208  virtual void ClearRowContainerValues();
209 
212  //virtual void GetSpecificInfoForTraceTable() = 0;
213 };
214 #endif
std::string m_CollectionName
return a list of all the traces with a bounding box containing the given ZCoord
std::vector< std::pair< GoDBTraceInfoForTableWidget, std::vector< std::string > > > TWContainerType
std::vector< GoDBTraceInfoForTableWidget > m_ColumnsInfos
virtual ~GoDBTableWidgetContainer()
desctructor
this class describes the columns of the table widget with the corresponding info to find their values...