-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegistro.h
71 lines (52 loc) · 2.23 KB
/
Registro.h
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
#ifndef REGISTRO_H_INCLUDED
#define REGISTRO_H_INCLUDED
#include <vector>
#include "Campo.h"
class Registro{
/*------------------------ATRIBUTOS/METODOS PRIVADOS ---------------------*/
private:
std::vector<Campo> campos;//VECTOR DINAMICO DE CAMPOS
int numCampos;//CANTIDAD DE CAMPOS DENTRO DEL REGISTRO
char estado;//DEFINE UN ESTADO PARA EL REGISTRO (VALIDO,INVALIDO)
/**
@pre : El campo debe ser valido.
@post : Agrega un campo al registro. */
void agregarCampo(Campo* campo);
/* --------------------------------------------------------------------- */
/*--------------------------- METODOS PUBLICOS ---------------------------*/
public:
/**
@pre : Vector de campos valido y con al menos un campo valido.
@post : Constructor que inicializar a partir de la lista de campos un registro operable. */
Registro(std::vector<Campo> campo);
/**
@post : Cambia el estado del registro en libre ('L') u ocupado ('O'). */
void cambiarEstado(char estado);
/**
@pre : El nombre del campo debe ser valido. (UPCASE)
@post : Devuelve un campo del registro con el nombre establecido .*/
Campo getCampo(std::string nombre);
/**
@pre : El numero de campo debe ser valido. (< getNumCampos())
@post : Devuelve un campo del registro correspondiente al indice pedido .*/
Campo getCampo(int indice);
unsigned int getNumCampos();
std::vector<int> getCampos();
/**
* Devuelve el tamaño en bytes del registro (datos), mas el tamaño del campo Estado.
*/
unsigned int getSizeCampos();
/**
* @post : Devuelve el estado del registro
*/
char getEstado();
/**
@pre : El nombre del campo debe ser valido. (UPCASE)
@post : Setea el valor del campo */
void setValorCampo(std::string nombre, int valor);
/**
Destructor por defecto..
*/
~Registro();
};
#endif // REGISTRO_H_INCLUDED