source: trunk/lib/classifier/DataLookup1D.h @ 555

Last change on this file since 555 was 555, checked in by Peter, 16 years ago

inserted private operator=

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1// $Id: DataLookup1D.h 555 2006-03-08 08:48:29Z peter $
2
3#ifndef _theplu_classifier_dataLookup1D_
4#define _theplu_classifier_dataLookup1D_
5
6#include <c++_tools/classifier/DataLookup2D.h>
7
8#include <cassert>
9#include <iostream>
10#include <vector>
11
12namespace theplu {
13namespace classifier { 
14
15  class DataLookup2D;
16
17  ///
18  /// Class for general vector view
19  ///
20
21  class DataLookup1D
22  {
23 
24  public:
25
26    ///
27    /// Constructor.
28    ///
29    /// @parameter row_vector if true (default) DataLookup1D is
30    /// looking into a row of DataLookup2D, otherwise looking into
31    /// a column. @parameter index which row/column to look into.
32    ///
33    DataLookup1D(const DataLookup2D&, const size_t index, 
34                 const bool row_vector=true);
35
36    ///
37    /// Copy constructor
38    ///
39    DataLookup1D(const DataLookup1D&);
40
41    ///
42    /// Construct DataLookup1D that owns its underlying matrix. Object
43    /// has size @ size and all its element is equal to @a value.
44    ///
45    DataLookup1D(const size_t size, const double value=0); 
46
47    ///
48    ///
49    ///
50    virtual ~DataLookup1D();
51
52    ///
53    ///
54    ///
55    inline size_t size(void) const
56      { return column_vector_ ? matrix_->rows() : matrix_->columns(); }
57
58    ///
59    ///
60    ///
61    inline double operator()(const size_t i) const 
62    { 
63      assert(i<size()); 
64      return column_vector_ ? (*matrix_)(i,index_) : (*matrix_)(index_,i); 
65    }
66
67    ///
68    /// scalar product
69    ///
70    double operator*(const DataLookup1D&) const;
71
72  private:
73    const DataLookup1D& operator=(const DataLookup1D&);
74
75    const bool column_vector_;
76    const size_t index_;
77    const DataLookup2D* matrix_;
78    const bool owner_;
79   
80  }; 
81  ///
82  /// The output operator DataLook1D
83  ///
84  /// @todo test that output can be used from gslapi::vector istream constructor
85  std::ostream& operator<< (std::ostream& s, const DataLookup1D&);
86 
87}} // of namespace classifier and namespace theplu
88
89#endif
Note: See TracBrowser for help on using the repository browser.