rdbstats  2.0.7
StatsResult.cc
1 // File: StatsResult.cc
2 
3 // --8<--8<--8<--8<--
4 //
5 // Copyright (C) 2006 Smithsonian Astrophysical Observatory
6 //
7 // This file is part of rdbstats
8 //
9 // rdbstats is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // rdbstats is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the
21 // Free Software Foundation, Inc.
22 // 51 Franklin Street, Fifth Floor
23 // Boston, MA 02110-1301, USA
24 //
25 // -->8-->8-->8-->8--
26 
27 #define StatsResult_cc
28 #include "StatsResult.h"
29 
30 template <class Type>
31 StatsResult<Type>::StatsResult( Type& col, RDB& otable ) :
32  rdb_stats_columns( col ), ordbtable( otable ) {
33 
34  // set_output_columns must be done here instead of within
35  // the constructor of RdbStats is because stl calls the
36  // ~RdbStats upon inserting an element in the vector container
37  // which will lead the pointers of RdbStats to point to no man's land.
38  for ( size_t ii = 0; ii < rdb_stats_columns.size( ); ii++ )
39  rdb_stats_columns[ ii ].set_output_columns( ordbtable );
40 }
41 
42 template <class Type>
44 
45  for ( size_t ii = 0; ii < rdb_stats_columns.size( ); ii++ )
46  rdb_stats_columns[ ii ].calculate_statistics( ) ;
47 
48  // ordbtable.advanceIdx( );
49  ordbtable.write( );
50 
51  for ( size_t ii = 0; ii < rdb_stats_columns.size( ); ii++ )
52  rdb_stats_columns[ ii ].init( );
53 
54 }
55 
56 template <class Type>
58 
59  for ( size_t ii = 0; ii < rdb_stats_columns.size( ); ii++ )
60  rdb_stats_columns[ ii ].update_statistics( );
61 }
A container class to hold the relevant data for the rdb data columns.
Definition: StatsResult.h:36