/*******************************************************************************
 * Copyright (c) 2005 IBM,Intel Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Guru Nagarajan, Intel - initial API and implementation
 *    IBM - Initial Java API and implementation
 *
 * $Id: TPTP_BinaryArray.cpp,v 1.3 2005/06/01 20:17:04 vnaikawadi Exp $
 *
 *******************************************************************************/ 


#include "tptp/client/TPTP_BinaryArray.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 

TPTP_BinaryArray::TPTP_BinaryArray()
{ 
	_padding = 0; 
	_data	 = NULL;	
}


TPTP_BinaryArray::~TPTP_BinaryArray()
{

}

void TPTP_BinaryArray::setData(char* data, int offset, int length)
{
	this->_data = data;
}

void TPTP_BinaryArray::setData(char* data)
{
	this->_data = data;
}

long TPTP_BinaryArray::length()
{
	long l =0;
	if(this->_data != NULL)
	{
		while(this->_data[l] != '\0')
		{ 
			l++; 
		}
		return l;
	}
	else {return -1;}
}	

int  TPTP_BinaryArray::getSize()
{
	int i = 0;

	return i;
}

int  TPTP_BinaryArray::getPadding()
{
	this->calculatePadding();
	int ret = this->_padding;
	return ret;
}

char* TPTP_BinaryArray::getData()
{
	return this->_data;
}

void TPTP_BinaryArray::calculatePadding()
{
	this->_padding = 4 - ((strlen(this->_data))%4);
	if (this->_padding == 4)
	{ 
		 this->_padding = 0;
	}
	 	 
	return;
}


