/*  CAO Compiler
    Copyright (C) 2014 Cryptography and Information Security Group, HASLab - INESC TEC and Universidade do Minho

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#ifndef CAO_VECTOR_H
#define CAO_VECTOR_H

#include "CAO_globals.h"

#ifdef __cplusplus

#include "CAO_matrix.h"

#include <iostream>

typedef struct CAO_Vector_s {
	int size;
	char type;
	CAO_REF *value;
} CAO_vector_s ;

extern "C" {
#endif

	CAO_RES CAO_vector_decl        (CAO_vector*, CAO_rint, const char *, void **);
	CAO_RES _CAO_vector_decl       (CAO_vector*, CAO_rint, const char *, void **, int *);

	CAO_RES CAO_vector_dispose     (CAO_vector);
	CAO_RES CAO_vector_const_init  (CAO_vector, void *);

	CAO_RES CAO_vector_init        (CAO_vector, void **);
	CAO_RES _CAO_vector_init       (CAO_vector, void **, int *); 


	CAO_RES CAO_vector_assign      (CAO_vector, CAO_vector);
	CAO_RES CAO_vector_clone       (CAO_vector *, CAO_vector);

	CAO_REF CAO_vector_ref         (CAO_vector, CAO_rint);
	CAO_REF _CAO_vector_ref        (CAO_vector, CAO_rint, char *);

	CAO_RES CAO_vector_dump        (CAO_vector);
	#define CAO_vector_equal(a,b,c,d) a = _CAO_vector_equal(b,c)	
	CAO_bool _CAO_vector_equal     (CAO_vector, CAO_vector);
	CAO_RES CAO_vector_rot_up      (CAO_vector ,CAO_vector, CAO_rint);
	CAO_RES CAO_vector_rot_down    (CAO_vector ,CAO_vector, CAO_rint);
	CAO_RES CAO_vector_range_select(CAO_vector ,CAO_vector, CAO_rint, CAO_rint);
	CAO_RES CAO_vector_range_set   (CAO_vector ,CAO_vector, CAO_rint, CAO_rint);
	CAO_RES CAO_vector_select      (CAO_REF,CAO_vector, CAO_rint);
	CAO_RES CAO_vector_concat      (CAO_vector, CAO_vector, CAO_vector);
	CAO_RES CAO_vector_cast_vector (CAO_vector, CAO_vector);
	CAO_RES CAO_vector_cast_matrix (CAO_matrix, CAO_vector);
	CAO_RES CAO_matrix_cast_vector (CAO_vector, CAO_matrix);

#ifdef __cplusplus
}
#endif

#endif