i get this errors
call of overloaded ServeWrPar is ambiguous
with the following code
ideas to keep the template without having to make 3 copies of it??Code:int ServeWrPar(Type_StationArgs * StationArgs, unsigned int ParIndex, int Value, unsigned int ServerIndex, int sock) { ;//to be done } int ServeWrPar(Type_StationArgs * StationArgs, unsigned int ParIndex, unsigned int Value, unsigned int ServerIndex, int sock) { int Result; switch ( ParIndex ) { case MAX_PROCESSING_MSEC: Result = SetMaxProcessingMsec(StationArgs, ParIndex, Value, ServerIndex, sock); break; default: Log(LogFile,"Parameter setting : request not available",1 ); Result = -1; break; } return Result; } int ServeWrPar(Type_StationArgs * StationArgs, unsigned int ParIndex, float Value, unsigned int ServerIndex, int sock) { ;//to be done } template < class Type_Value, class Type_WrParComm > int HandleWrParFIFO( Type_Value DummyValue, Type_WrParComm * Comm, pthread_mutex_t * Mutex, unsigned int * AttemptNumber, unsigned long int BlockingAttemptNumber, sem_t * CatastroficError, FILE * ErrLogFile, Type_StationArgs * Args ) { unsigned int ParIndex, TargetIndex, ServerIndex; Type_Value Value; int sock; int mutRes; char LogString[512]; void * status; status=(void*)0; mutRes=1; *AttemptNumber++; //Critic region begin if ((*AttemptNumber)>BlockingAttemptNumber) mutRes=pthread_mutex_lock(Mutex); else mutRes=pthread_mutex_trylock(Mutex); if (mutRes) { if (mutRes==EBUSY) { return(ERR_OK); } else if (mutRes==EINVAL) { sprintf(LogString," : mutex init error!\n");Log(LogFile,LogString,0 ); sem_post(CatastroficError);//CatastroficError=1;//to be tested outside by main thread status=(void*)1; pthread_exit(status);//to be studied } else { sprintf(LogString," : mutex unkown error!\n");Log(LogFile,LogString,0 ); sem_post(CatastroficError); status=(void*)1; pthread_exit(status);//to be studied } } else { if (Comm->ElementsNr) { Comm->ElementsNr-=1; //N.B. once the requests were queued there was no more priority difference TargetIndex=Comm->TargetIndex[Comm->FirstIndex]; ParIndex=Comm->ParIndex[Comm->FirstIndex]; memcpy(Value,(char*)&(Comm->Value[Comm->FirstIndex]),sizeof(Value)); ServerIndex=Comm->ServerIndex[Comm->FirstIndex]; sock=Comm->sock[Comm->FirstIndex]; if (Comm->ElementsNr==0) {Comm->FirstIndex=Comm->LastIndex=0;} else { Comm->FirstIndex=(Comm->FirstIndex+1)%WrFIFO_SIZE; } } pthread_mutex_unlock(Mutex); //critic region : end *AttemptNumber=0; if (!TargetIndex) ServeWrPar(Args, ParIndex, Value, ServerIndex, sock);//overloaded else CAMParameterMailSet(Args, TargetIndex, ParIndex,Value, ServerIndex, sock);//overloaded } return(ERR_OK); }



LinkBack URL
About LinkBacks


