Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/intmatrix.h
[mareframe] / trunk / gadget / intmatrix.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/intmatrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef intmatrix_h
2 :     #define intmatrix_h
3 :    
4 :     #include "intvector.h"
5 :    
6 :     /**
7 :     * \class IntMatrix
8 :     * \brief This class implements a dynamic vector of IntVector values
9 :     */
10 :     class IntMatrix {
11 :     public:
12 :     /**
13 :     * \brief This is the default IntMatrix constructor
14 :     */
15 :     IntMatrix() { nrow = 0; v = 0; };
16 :     /**
17 :     * \brief This is the IntMatrix constructor for a specified size
18 :     * \param nr is the size of the vector to be created
19 :     * \param nc is the length of each row to be created (ie. the size of the IntVector to be created for each row)
20 :     * \param initial is the initial value for all the entries of the vector
21 :     */
22 :     IntMatrix(int nr, int nc, int initial);
23 :     /**
24 :     * \brief This is the IntMatrix constructor that creates a copy of an existing IntMatrix
25 :     * \param initial is the IntMatrix to copy
26 :     */
27 :     IntMatrix(const IntMatrix& initial);
28 :     /**
29 :     * \brief This is the IntMatrix destructor
30 :     * \note This will free all the memory allocated to all the elements of the vector
31 :     */
32 :     ~IntMatrix();
33 :     /**
34 :     * \brief This will return the number of columns in row i of the vector
35 :     * \param i is the row of the vector to have the number of columns counted
36 :     * \return the number of columns in row i of the vector
37 :     * \note This is the number of entries in the IntVector that is entry i of the IntMatrix
38 :     */
39 :     int Ncol(int i = 0) const { return v[i]->Size(); };
40 :     /**
41 :     * \brief This will return the number of rows of the vector
42 :     * \return the number of rows of the vector
43 :     */
44 :     int Nrow() const { return nrow; };
45 :     /**
46 :     * \brief This will return the value of an element of the vector
47 :     * \param pos is the element of the vector to be returned
48 :     * \return the value of the specified element
49 :     */
50 :     IntVector& operator [] (int pos) { return *v[pos]; };
51 :     /**
52 :     * \brief This will return the value of an element of the vector
53 :     * \param pos is the element of the vector to be returned
54 :     * \return the value of the specified element
55 :     */
56 :     const IntVector& operator [] (int pos) const { return *v[pos]; };
57 :     /**
58 :     * \brief This will add new entries to the vector
59 :     * \param add is the number of new entries to the vector
60 :     * \param length is the number of entries to the IntVector that is created
61 :     * \param value is the value that will be entered for the new entries
62 :     */
63 :     void AddRows(int add, int length, int value);
64 :     /**
65 :     * \brief This will delete an entry from the vector
66 :     * \param pos is the element of the vector to be deleted
67 :     * \note This will free the memory allocated to the deleted element of the vector
68 :     */
69 :     void Delete(int pos);
70 :     /**
71 :     * \brief This will reset the vector
72 :     * \note This will delete every entry from the vector and set the number of rows to zero
73 :     */
74 :     void Reset();
75 :     /**
76 :     * \brief This function will set all of the entries of the vector to zero
77 :     */
78 :     void setToZero();
79 :     /**
80 :     * \brief This function will print the data stored in the vector
81 :     * \param outfile is the ofstream that all the model information gets sent to
82 :     */
83 :     void Print(ofstream& outfile) const;
84 :     /**
85 :     * \brief This operator will set the vector equal to an existing IntMatrix
86 :     * \param initial is the IntMatrix to copy
87 :     */
88 :     IntMatrix& operator = (const IntMatrix& initial);
89 :     protected:
90 :     /**
91 :     * \brief This is number of rows of the vector
92 :     */
93 :     int nrow;
94 :     /**
95 :     * \brief This is the vector of IntVector values
96 :     */
97 :     IntVector** v;
98 :     };
99 :    
100 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge