-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBin.h
More file actions
145 lines (120 loc) · 3.42 KB
/
Bin.h
File metadata and controls
145 lines (120 loc) · 3.42 KB
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
/*
Bin: The bin interface
@file vector3D.h
@author Adanna Obibuaku
@date 14/11/20
*/
#ifndef VECT_HEADER
#define VECT_HEADER
#include "Vector3D.h"
#endif
#ifndef IO
#define IO
#include <iostream>
using namespace std;
#include <iomanip>
#endif
#define EMPTY 0
#define INIT 1
class Bin {
public:
/*
* constructor: To initalise our class
* Input:
* Size (int): Denotes the size of out class
*/
Bin(int num);
/*
* copy constructor: To copy the class
* Input:
* bin (Bin): An address of a bin, which copies content of our class
*/
Bin(const Bin &bincpy);
/*
* deconstructor: To remove elements
*/
virtual ~Bin();
/*
* getIndex: To return index of bin
* Output:
* (int): index of array
*/
int getIndex();
/*
* getSize: To return size of bin
* Output:
* (int): Size of array
*/
int getSize();
/*
* getX: Provides the x component of the [a]th Vector3D element in the bin.
* Input:
* a (int): The postion of vector within bin
* Output:
* (float): This would return the x componets in position a
* or 0.0 if ath value does not exits
*/
float getX(int a);
/*
* getY: Provides the y component of the [a]th Vector3D element in the bin.
* Input:
* a (int): The postion of vector within bin
* Output:
* (float): This would return the y componets in position a
* or 0.0 if ath value does not exits
*/
float getY(int a);
/*
* getZ: Provides the z component of the [a]th Vector3D element in the bin.
* Input:
* a (int): The postion of vector within bin
* Output:
* (float): This would return the z componets in position a
* or 0.0 if ath value does not exits
*/
float getZ(int a);
/*
* add: adds a given vector into the bin
* Input:
* v (Vector): The vector to be added
*/
void add(Vector3D v);
/*
* remove: removes a vector from the bin
* Input:
* b (int): The postion of vector within bin
*/
void remove(int b);
/*
* Operator = assigns another operator to bin
* Input:
* Bin (rhs): The rhs of the bin
*/
Bin operator= (const Bin &rhs);
/*
* Operator []: returns the index at c
* Input:
* c (int): The position of the vector within b
* Output:
* (Vector3D): The vector at postion b.
*/
Vector3D operator[] (int c);
private:
Vector3D *bin;
int size;
int index;
int init;
/*
* vectorCpy: To paste content from vector pst to vector cpy
* Input:
* cpy (Vector3D[]): An array off vector which caries the pasted contents.
* pst (Vector3D[]): An array off vector which you want to copy from and paste into vector
* cpy
* size (int): The size of the vector
*/
void vectorCpy(Vector3D cpy[], Vector3D pst[],int index, int size);
};
/*
* Operator>>: To define the string output
*/
ostream& operator<< (ostream& ostr , Bin& Bin);