This file is indexed.

/usr/include/gofigure2/GoDBExport.h is in libgofigure-dev 0.9.0-3+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
/*=========================================================================
 Authors: The GoFigure Dev. Team.
 at Megason Lab, Systems biology, Harvard Medical school, 2009-11

 Copyright (c) 2009-11, President and Fellows of Harvard College.
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:

 Redistributions of source code must retain the above copyright notice,
 this list of conditions and the following disclaimer.
 Redistributions in binary form must reproduce the above copyright notice,
 this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.
 Neither the name of the  President and Fellows of Harvard College
 nor the names of its contributors may be used to endorse or promote
 products derived from this software without specific prior written
 permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

=========================================================================*/

#ifndef __GoDBExport_h
#define __GoDBExport_h

#include "vtkMySQLDatabase.h"
#include <vector>

#include "QGoIOConfigure.h"

/**
\class GoDBExport
\brief export the data from the database into a textfile 
\ingroup DB
*/
class QGOIO_EXPORT GoDBExport
{
public:

  GoDBExport(std::string iServerName, std::string iLogin,
             std::string iPassword, int iImagingSessionID,
             std::string iFilename);
  virtual ~GoDBExport();

  /** 
  \brief get all the imagingsession info,the info
  for the contours, the meshes they belong to and the
  tracks the previous meshes belong to from the database
  and put them in a text file
  */
  void ExportContours();

  /** 
  \brief get all the imagingsession info,the info
  for the meshes with points(that can be visualized),
  the tracks they belong to and the lineages the
  previous tracks belong to from the database
  and put them in a text file
  */
  void ExportMeshes();

private:
  
  vtkMySQLDatabase *m_DatabaseConnector;
  std::string       m_ServerName;
  std::string       m_Password;
  std::string       m_Login;
  int               m_ImagingSessionID;
  std::fstream      m_outfile;
  std::string       m_NameDocXml;

  std::vector< std::string > m_VectorContourIDs;
  std::vector< std::string > m_VectorMeshIDs;
  std::vector< std::string > m_VectorTrackIDs;
  std::vector< std::string > m_VectorLineageIDs;
  std::vector< std::string > m_VectorChannelIDs;

  /** 
  \brief get the info for imagingsession from the database
  \return a vector of pair containing the name of the info as .first
  and the info as .second. for Imagingsession such as Name, creation date and
  microscope name 
  */
  std::vector< std::pair< std::string, std::string > > GetImagingSessionInfoFromDB();

  /** 
  \brief get one info for the current imagingsession from the database
  corresponding to the iNameInfo
  \param[in] iNameInfo name of the field in the database
  \return a pair containing as .first the iNameInfo and as.second the
  corresponding info found in the Database for the table imagingsession
  */
  std::pair< std::string, std::string > GetOneInfoFromDBForImgSession(
    std::string iNameInfo);

  /** 
  \brief Write the generale info about the textfile
  */
  void WriteGeneraleInfo();

  /** 
  \brief get the info from the database for all the entities from a table or
  with a limitation defined with field and value and write them in the output file
  after having written first the number of entities to be described
  \param[in] iField field defining the limitation
  \param[in] iValue value defining the limitation
  \tparam T children of GoDBRow
  */
  template< typename T >
  void WriteTableInfoFromDB(std::string iField, std::string iValue)
  {
    T TableRow;

    std::vector< std::string > ListTableIDs = ListSpecificValuesForOneColumn(
      this->m_DatabaseConnector, TableRow.GetTableName(),
      TableRow.GetTableIDName(), iField, iValue);
    std::vector< std::string >::iterator iter = ListTableIDs.begin();
    while ( iter != ListTableIDs.end() )
      {
      std::vector< std::pair< std::string, std::string > > EntityInfo =
        this->GetOneEntityInfoFromDB(*iter, TableRow);
      this->WriteOnTheOutputFile(TableRow.GetTableName(), EntityInfo);
      iter++;
      }
  }

  /** 
  \brief get the info from the database for all the entities from a table
  which IDs are in iListIDs and write them in the output file
  \param[in] iListIDs List of the IDs for which the info need to be written
  \tparam children of GoDBRow
  */
  template< typename T >
  void WriteTableInfoFromDB(std::vector< std::string > iListIDs)
  {
    T TableRow;

    if ( iListIDs.empty() )
      {
      this->WriteNumberOfEntities(TableRow.GetTableName(), 0);
      return;
      }
    this->WriteNumberOfEntities( TableRow.GetTableName(), iListIDs.size() );
    std::vector< std::string >::iterator iter = iListIDs.begin();
    while ( iter != iListIDs.end() )
      {
      std::vector< std::pair< std::string, std::string > > EntityInfo =
        this->GetOneEntityInfoFromDB(*iter, TableRow);     
      this->WriteOnTheOutputFile(TableRow.GetTableName(), EntityInfo); 
      iter++;
      }
  }

  /** 
  \brief get the info with their names for an entity from the database
  and put them in a vector of pair of string (name of the info + value of the info)
  \param[in] iEntityID ID of the entity for which the info are needed
  \param[in] iTableRow 
  \tparam T children of GoDBRow
  \return vector of pair of string (name of the info + value of the info)
  */
  template< typename T >
  std::vector< std::pair< std::string, std::string > >
  GetOneEntityInfoFromDB(std::string iEntityID, T iTableRow)
  {
    std::vector< std::pair< std::string, std::string > > oEntityInfo = 
      std::vector< std::pair< std::string, std::string > >();
    iTableRow.SetValuesForSpecificID(atoi( iEntityID.c_str() ), 
      this->m_DatabaseConnector);
    std::vector< std::string >           FieldNames = iTableRow.GetVectorColumnNames();
    std::vector< std::string >::iterator iter = FieldNames.begin();
    while ( iter != FieldNames.end() )
      {
      std::pair< std::string, std::string > FieldInfo;
      FieldInfo.first = *iter;
      FieldInfo.second = iTableRow.GetMapValue(*iter);
      oEntityInfo.push_back(FieldInfo);
      iter++;
      }
    return oEntityInfo;
  }

  /** 
  \brief fill the different vectors needed for the queries
  depending if the vectors of IDs are empty or not: get the
  tables names, the key for the table and the tracesIDs
  \param[in,out] ioVectorTableNames names of the tables
  \param[in,out] ioVectorTracesIDs IDs of the traces
  \param[in,out] ioVectorFields names of the database fields
  \param[in] IncludeChannelIDs 
  */
  void GetVectorsTableNamesTracesIDsAndFields(
    std::vector< std::string > & ioVectorTableNames,
    std::vector< std::vector< std::string > > & ioVectorTracesIDs,
    std::vector< std::string > & ioVectorFields,
    bool IncludeChannelIDs = false);

  /** 
  \brief Get the celltype and subcelltype for the needed meshes from
  the database and write them on the output file
  */
  void WriteCellTypeAndSubCellTypeInfoFromDatabase();

  /** 
  \brief get the contours info which IDs are in the m_VectorContourIDs
  from the database and write them on the output file
  */
  void WriteContoursInfoFromDatabase();

  /** 
  \brief get the tracks info which IDs are in the m_VectorTrackIDs
  from the database and write them on the output file
  */
  void WriteTracksInfoFromDatabase();

  /** 
  \brief get the meshes info which IDs are in the m_VectorMeshIDs
  from the database and write them on the output file
  */
  void WriteMeshesInfoFromDatabase();

  /** 
  \brief get the lineages info which IDs are in the m_VectorLineageIDs
  from the database and write them on the output file
  */
  void WriteLineagesInfoFromDatabase();

  /** 
  \brief get the channels info which IDs are in the m_VectorChannelIDs
  from the database and write them on the output file
  */
  void WriteChannelsInfoFromDatabase();

  /** 
  \brief get the info for the intensities corresponding to the m_VectorMeshIDs
  and the m_VectorChannelIDs and write them on the output file
  */
  void WriteIntensityInfoFromDatabase();

  /** 
  \brief get the IDs of the contour belonging to the current imagingsession
  and fill the m_VectorContourIDs with them
  */
  void UpdateVectorContourIDsForExportContours();

  /** 
  \brief when exporting contours, if the contours belong to
  meshes, the info regarding these meshes are needed also, so fill
  m_VectorMeshIDs with these meshes IDs
  */
  void UpdateVectorMeshIDsForExportContours();

  /** 
  \brief when exporting meshes, we don't export the potential contours
  associated to the meshes, so we clear m_VectorContourIDs
  */
  void UpdateVectorContourIDsForExportMeshes();

  /** 
  \brief when exporting meshes, we export only the meshes with a 3D surface
  so we fill the m_VectorMeshIDs with the meshes with a non empty "Points"
  column from the database
  */
  void UpdateVectorMeshIDsForExportMeshes();

  /** 
  \brief when exporting meshes, the total intensity per channel has to be
  calculated, and the info for the channels need to be stored
  */
  void UpdateVectorChannelIDsForExportMeshes();

  /** 
  \brief check if for the meshes IDs found in the m_VectorMeshIDs,
  the corresponding meshes belongs to tracks, if so these tracks IDs
  are put in the m_VectorTrackIDs
  */
  void UpdateVectorTrackIDsToExportInfo();

  /** 
  \brief check if for the tracks IDs found in the m_VectorTrackIDs,
  the corresponding tracks belongs to lineages, if so these lineages IDs
  are put in the m_VectorLineageIDs
  */
  void UpdateVectorLineageIDsToExportInfo();

  /** 
  \brief fill the different vectors of traces IDs corresponding to
  the contours to export
  */
  void UpdateAllVectorTracesIDsToExportContours();

  /** 
  \brief fill the different vectors of traces IDs corresponding to
  the meshes to export
  */
  void UpdateAllVectorTracesIDsToExportMeshes();

  /** 
  \brief get the colors info from the database for the corresponding traces
  to export and write them in the output file
  */
  void WriteTheColorsInfoFromDatabase();

  /** 
  \brief get the coordinates without doublon corresponding to the coordidmax
  and min of the traces to export from the database and write them in the
  output file
  */
  void WriteCoordinatesInfoFromDatabase();

  /** 
  \brief put iName within brackets
  \param[in] iName
  \return iName within brackets
  */
  std::string GetNameWithBrackets(std::string iName);

  /** 
  \brief put iName into slash brackets 
  \param[in] iName
  \return /iName within brackets 
  */
  std::string GetNameWithSlashBrackets(std::string iName);

  /**
  \brief write on the output file the info contained in the vector with
  the name of the entity they describe
  \param[in] iNameOfEntity name of the entity described
  \param[in] iInfoToWrite info to be written in the output file
  */
  void WriteOnTheOutputFile(std::string iNameOfEntity,
                            std::vector< std::pair< std::string, std::string > > iInfoToWrite);

  /** 
  \brief write on the output file the number of entities that are exported
  \param[in] iNameOfEntity entity name
  \param[in] iNumber number of entities
  */
  void WriteNumberOfEntities(std::string iNameOfEntity, size_t iNumber);

  /** 
  \brief add 2 spaces to the output file for xml tabulation
  */
  void AddTabulation();

  /**
  \brief open a connection to the database.
  */
  void OpenDBConnection();

  /**
  \brief close and delete the connection to the database.
  */
  void CloseDBConnection();
};
#endif