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/intvector.h
[mareframe] / trunk / gadget / intvector.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/intvector.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef intvector_h
2 :     #define intvector_h
3 :    
4 :     #include "commentstream.h"
5 :     #include "gadget.h"
6 :    
7 :     /**
8 :     * \class IntVector
9 :     * \brief This class implements a dynamic vector of int values
10 :     */
11 :     class IntVector {
12 :     public:
13 :     /**
14 :     * \brief This is the default IntVector constructor
15 :     */
16 :     IntVector() { size = 0; v = 0; };
17 :     /**
18 :     * \brief This is the IntVector constructor for a specified size with an initial value
19 :     * \param sz is the size of the vector to be created
20 :     * \param initial is the initial value for all the entries of the vector
21 :     */
22 :     IntVector(int sz, int initial);
23 :     /**
24 :     * \brief This is the IntVector constructor that creates a copy of an existing IntVector
25 :     * \param initial is the IntVector to copy
26 :     */
27 :     IntVector(const IntVector& initial);
28 :     /**
29 :     * \brief This is the IntVector destructor
30 :     * \note This will free all the memory allocated to all the elements of the vector
31 :     */
32 :     ~IntVector();
33 :     /**
34 :     * \brief This will add new entries to the vector
35 :     * \param addsize is the number of new entries to the vector
36 :     * \param value is the value that will be entered for the new entries
37 :     */
38 :     void resize(int addsize, int value);
39 :     /**
40 :     * \brief This will delete an entry from the vector
41 :     * \param pos is the element of the vector to be deleted
42 :     * \note This will free the memory allocated to the deleted element of the vector
43 :     */
44 :     void Delete(int pos);
45 :     /**
46 :     * \brief This will return the size of the vector
47 :     * \return the size of the vector
48 :     */
49 :     int Size() const { return size; };
50 :     /**
51 :     * \brief This will return the value of an element of the vector
52 :     * \param pos is the element of the vector to be returned
53 :     * \return the value of the specified element
54 :     */
55 :     int& operator [] (int pos) { return v[pos]; };
56 :     /**
57 :     * \brief This will return the value of an element of the vector
58 :     * \param pos is the element of the vector to be returned
59 :     * \return the value of the specified element
60 :     */
61 :     const int& operator [] (int pos) const { return v[pos]; };
62 :     /**
63 :     * \brief This will reset the vector
64 :     * \note This will delete every entry from the vector and set the size to zero
65 :     */
66 :     void Reset();
67 :     /**
68 :     * \brief This function will set all of the entries of the vector to zero
69 :     */
70 :     void setToZero();
71 :     /**
72 :     * \brief This operator will set the vector equal to an existing IntVector
73 :     * \param iv is the IntVector to copy
74 :     */
75 :     IntVector& operator = (const IntVector& iv);
76 :     protected:
77 :     /**
78 :     * \brief This is the vector of int values
79 :     */
80 :     int* v;
81 :     /**
82 :     * \brief This is the size of the vector
83 :     */
84 :     int size;
85 :     };
86 :    
87 :     #endif

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

Powered By FusionForge