#ifndef ENCODE_DECODE_TRI_TCI
#define ENCODE_DECODE_TRI_TCI

#include "EncodeDecodeTri.h"
#include "Shared/TciData.h"
#include "TriTciCallData.h"

#define HEADER_V3_LENGTH 8
#define ACK_HEADER_V3_LENGTH HEADER_V3_LENGTH + 1
#define TCI_TYPE_LENGTH 8
#define TCI_VALUE_LENGTH 8

int decodeDouble(double * pDbl, const char * pData, int nLen, int nOffset);
int decodeTestCaseIdList(TciTestCaseIdListType *pList, const char * pData, int nLen, int nOffset);
int decodeTciModuleIdList(TciModuleIdListType *pList, const char * pData, int nLen, int nOffset);
int decodeTciTypeClass(TciTypeClass *typeCls, const char * pData, int nLen, int nOffset);
int decodeTciValue(Value *pVal, const char * pData, int nLen, int nOffset);
int decodeTciType(Type *pType,const char *pData, int nLen, int nOffset);
int decodeTciExtension(String ** paStr, const char * pData, int nLen, int nOffset);
int decodeLongLong(long long *ll, const char* pData, int nLen, int nOffset);
int decodeTciParameterTypeType(TciParameterTypeType *tt, const char* pData, int nLen, int nOffset);
int decodeTciParameterTypeList(TciParameterTypeListType *parList, const char* pData, int nLen, int nOffset);
int decodeTciModuleParameterList(TciModuleParameterListType * parList, const char* pData, int nLen, int nOffset);
int decodeTciParamList(TciParameterListType *tciParList, const char * pData, int nLen, int nOffset);
int decodeVerdictValue(VerdictValue *ver, const char * pData, int nLen, int nOffset);
String decodeSimpleStringReply(AbstractTriAckMessage * msg);
double decodeDoubleReply(AbstractTriAckMessage * msg);
Boolean decodeBoolReply(AbstractTriAckMessage * msg);
Value decodeValueReply(AbstractTriAckMessage * msg);
Value decodeValueReplyWithBitPosition(AbstractTriAckMessage * msg, BinaryString *pBS);
Type decodeTypeReply(AbstractTriAckMessage * msg);
BinaryString decodeBinaryStringReply(AbstractTriAckMessage *msg);
char ** decodeStringArrayReply(AbstractTriAckMessage * msg);
unsigned long int decodeNumericReply(AbstractTriAckMessage * msg);
TciUCStringValue decodeUCStringReply(AbstractTriAckMessage * msg);
TciUCStringValue decodeUStringBufferReply(AbstractTriAckMessage * msg);
TciObjidValue decodeObjectidReply(AbstractTriAckMessage * msg);
long long decodeLongIntReply(AbstractTriAckMessage * msg);

int calcTciTypeLen(const Value val);
int calcTciValueLen(const Value val);
int calcDoubleLen(const double * dbl);
int calcObjidLen(TciObjidValue *value);
int calcUCStringLen(TciUCStringValue *ucsVal);
int calcUCStringBufferLen(TciUCStringValue *ucsVal);
int calcTciParamTypeLen(TciParameterType *parType);
int calcTciParamListLen(TciParameterListType *parList);
int encodeBoolean(Boolean val, char * pData, int nOffset);
int encodeDouble(const double * dbl, char * pData, int nOffset);
int encodeTciType(const Type inst, char * pData, int nOffset);
int encodeTciValue(const Value inst, char * pData, int nOffset);
int encodeObjectidValue(TciObjidValue * value, char * pData, int nOffset);
int encodeUCString(TciUCStringValue *val, char * pData, int nLen, int nOffset);
int encodeUCStringBuffer(TciUCStringValue *val, char * pData, int nLen, int nOffset);
int encodeTciParameterType(TciParameterType *parType, char *pData,int nOffset);
int encodeTciParamList(TciParameterListType * parList, char * pData, int nOffset);
#endif
