Exemple #1
0
ret_ CProcessor::Stop()
{
	_START(STOP);

	map_handle::iterator pos;

	for (pos = m_HandleInMap.begin(); pos != m_HandleInMap.end(); pos++)
	{
#ifdef _DEBUG_
		if (!pos->second)
			_RET(ELEMENT_NULL_IN_CONTAINER);
#endif
		_DEL(pos->second);
	}

	for (pos = m_HandleOutMap.begin(); pos != m_HandleOutMap.end(); pos++)
	{
#ifdef _DEBUG_
		if (!pos->second)
			_RET(ELEMENT_NULL_IN_CONTAINER);
#endif
		_DEL(pos->second);
	}

	m_HandleInMap.clear();
	m_HandleOutMap.clear();

	for (map_register::iterator pos_ = m_RegisterMap.begin();
		 pos_ != m_RegisterMap.end(); pos_++)
	{
#ifdef _DEBUG_
		if (!pos_->second)
			_RET(ELEMENT_NULL_IN_CONTAINER);
#endif

		for (set_register::iterator pos_1 = pos_->second->begin();
			 pos_1 != pos_->second->end(); pos_1++)
		{
			ch_1 *sCategory	= (ch_1 *)pos_->first.data();
			ch_1 *pszKey		= (ch_1 *)pos_1->data();
			ret_ Ret		=
				CRegister::Instance()->Unregister(sCategory, pszKey);

#ifdef _DEBUG_
			if (SUCCESS != _ERR(Ret))
				_RET_BY(Ret);
#endif

			CTransactionManager::Instance()->Unregister(sCategory, pszKey);
		}

		pos_->second->clear();
		_DEL(pos_->second);
	}

	m_RegisterMap.clear();

	_RET(SUCCESS);
}
none_ CProtocolManager::stop() {
    for (MapProtocol::iterator pos = _protocolMap.begin();
         pos != _protocolMap.end(); pos++) {
        assert(pos->second);
        _DEL(pos->second);
    }

    _protocolMap.clear();
}
Exemple #3
0
none_ CModuleManager::stop() {
    for (MapModule::iterator pos = _moduleMap.begin();
         pos != _moduleMap.end(); pos++) {
        assert(pos->second);
        _DEL(pos->second);
    }

    _moduleMap.clear();
}
Exemple #4
0
none_ CModuleInfo::stop() {
    for (MapInterface::iterator pos = _interfaceInfoMap.begin();
         pos != _interfaceInfoMap.end(); pos++) {
        assert(null_v != pos->second);
        _DEL(pos->second);
    }

    _interfaceInfoMap.clear();
}
Exemple #5
0
none_ CData::clear() {
    for (MapVariable::iterator pos = _variableMap.begin();
         pos != _variableMap.end(); pos++) {
        _DEL(pos->second);
    }

    for (MapData::iterator pos_ = _dataMap.begin();
         pos_ != _dataMap.end(); pos_++) {
        if (pos_->second->size && pos_->second->data) {
            _DEL_ARR(pos_->second->data);
            pos_->second->size = 0;
        }

        _DEL(pos_->second);
    }

    _variableMap.clear();
    _dataMap.clear();
}
ret_ CXMLLoaderManager::Stop()
{
    _DEL(m_pErrorHandle);
	_DEL(m_pParser);

	try
	{
		XMLPlatformUtils::Terminate();
	}
	catch (const XMLException &err)
	{
		auto_xerces_str sErr(err.getMessage());

		printf("%s\n", (const ch_1 *)sErr);

		return XML_UNINITIALIZE_ERROR;
	}

	return SUCCESS;
}
Exemple #7
0
void CProgram::Clear()
{
	m_Data.Clear();
	m_OrnData.Clear();

	size_ n = (size_)m_OptVector.size();

	for (size_ i = 0; i < n; i++)
		_DEL(m_OptVector[i]);

	m_OptVector.clear();
}
Exemple #8
0
void CData::Clear()
{
	for (map_variable::iterator pos = m_VariableMap.begin(); 
		 pos != m_VariableMap.end(); pos++)
	{
		_DEL(pos->second);
	}

	for (map_data::iterator pos_ = m_DataMap.begin();
		 pos_ != m_DataMap.end(); pos_++)
	{
		if (pos_->second->nSize && pos_->second->pData)
		{
			_DEL_ARR(pos_->second->pData);
			pos_->second->nSize = 0;
		}

		_DEL(pos_->second);
	}

	m_VariableMap.clear();
	m_DataMap.clear();
}
Exemple #9
0
ret_ CModuleInfo::Stop()
{
	_START(STOP);

	for (map_interface::iterator pos = m_InterfaceInfoMap.begin();
		 pos != m_InterfaceInfoMap.end(); pos++)
	{
#ifdef _DEBUG_
		if (!pos->second)
			_RET(ELEMENT_NULL_IN_CONTAINER);
#endif
		_DEL(pos->second);
	}

	m_InterfaceInfoMap.clear();

	_RET(SUCCESS);
}
Exemple #10
0
ret_ CProcessor::Reset()
{
	_START(RESET);

	m_Data = m_OrnData;

	for (size_ i = 0; i < (size_)NORMAL_HANDLE; i++)
		m_NormalHandle[i].Reset();

	m_pHandle = null_v;

	map_handle::iterator pos;

	for (pos = m_HandleInMap.begin(); pos != m_HandleInMap.end(); pos++)
	{
#ifdef _DEBUG_
		if (!pos->second)
			_RET(ELEMENT_NULL_IN_CONTAINER);
#endif
		((CProgram *)pos->second)->Reset();
	}

	for (pos = m_HandleOutMap.begin(); pos != m_HandleOutMap.end(); pos++)
	{
#ifdef _DEBUG_
		if (!pos->second)
			_RET(ELEMENT_NULL_IN_CONTAINER);
#endif
		((CProgram *)pos->second)->Reset();
	}

	for (map_register::iterator pos_ = m_RegisterMap.begin();
		 pos_ != m_RegisterMap.end(); pos_++)
	{
#ifdef _DEBUG_
		if (!pos_->second)
			_RET(ELEMENT_NULL_IN_CONTAINER);
#endif

		for (set_register::iterator pos_1 = pos_->second->begin();
			 pos_1 != pos_->second->end(); pos_1++)
		{
			ch_1 *sCategory	= (ch_1 *)pos_->first.data();
			ch_1 *pszKey		= (ch_1 *)pos_1->data();
			ret_ Ret		=
				CRegister::Instance()->Unregister(sCategory, pszKey);

#ifdef _DEBUG_
			if (SUCCESS != _ERR(Ret))
				_RET_BY(Ret);
#endif

			CTransactionManager::Instance()->Unregister((const ch_1 *)sCategory,
														pszKey);
		}

		pos_->second->clear();
		_DEL(pos_->second);
	}

	m_RegisterMap.clear();

	_RET(SUCCESS);
}
Exemple #11
0
/* g_band3_align(A, B, M, N, up, low, tb, te, data) returns the cost
   of an optimum conversion between
   A[1..M] and B[1..N] and appends such a conversion to the current script.
   tb(te)= 1  no gap-open penalty if the conversion begins(ends) with a delete.
   tb(te)= 2  no gap-open penalty if the conversion begins(ends) with an insert.
*/
static Int4 g_band3_align(Uint1Ptr A, Uint1Ptr B,
			  Int4 M, Int4 N,
			  Int4 low, Int4 up, data_t *data)
{
  Int4 k, v;
  Int4 band, j;
  Int4 leftd, rightd;	/* for CC, DD, CP and DP */
  register Int4 curd;	/* current index for CC, DD CP and DP */
  register Int4 i;
  register Int4 c, d, e, x;
  register dp_ptr ap;
  Int4 t;
  Int4Ptr wa;
  Int1Ptr PNTR state, st, tmp;
  Int4 ib, best=MININT, X, Y;


  /* Boundary cases: M <= 0 , N <= 0, or up-low <= 0 */
  band = up - low + 1;
  state = (Int1Ptr PNTR) MemGet(sizeof(Int1Ptr)*(M+1), MGET_ERRPOST);
  state[0] = (Int1Ptr) MemGet((M+1)*(band+2), MGET_ERRPOST);
  for (i = 1; i <= M; i++) state[i] = state[i-1]+band+2;

  /* Initialization */
  leftd = 1-low;
  rightd = up-low+1;

  data->CD[leftd].CC = 0; state[0][leftd] = -1;

  t = -data->leggB;
  for(j = leftd + 1; j <= rightd; j++) {
    data->CD[j].CC = t = t - data->leghB;
    data->CD[j-1].DD = t - data->m;
    state[0][j] = 1;
  }
  data->CD[rightd+1].CC = MININT;
  data->CD[rightd].DD = MININT;
  data->CD[leftd-1].DD = -data->leggA;
  data->CD[leftd-1].CC = MININT;
  for (i = 1; i <= M; i++) {
    if (i > N-up) rightd--;
    if (leftd > 1) leftd--;
    wa = data->w[A[i]];
    d = data->CD[leftd].DD;
    k = 0;
    if ((ib = leftd+low-1+i) > 0) c = data->CD[leftd].CC+wa[B[ib]];
    if (d > c || ib <= 0) {
      c = d;
      k = 2;
    }
    e = c - data->m;
    if(ib <= 0) {
      data->CD[leftd - 1].DD = d - data->leghA;
      k += 20;
    }
    st = &state[i][leftd];
    *st++ = (Int1) k;
    data->CD[leftd].CC = c;
    for(curd = leftd + 1, ap = &data->CD[curd]; curd <= rightd; curd++) {
      c = ap->CC + wa[B[curd + low - 1 + i]];
      if((d = ap->DD) > c) {
	if(d > e) {
	  ap->CC = d;
	  *st++ =32;
	}
	else {
	  ap->CC = e;
	  *st++=31;
	}
	e -= data->zzh;
	(ap++ - 1)->DD = d - data->zzh;
      }
      else if (e > c) { 	       
	ap->CC = e;
	e -= data->zzh;
	(ap++ - 1)->DD = d - data->zzh;
	*st++ = 31;
      }
      else {
	ap->CC = c;
	if((c -= data->m) > (e -= data->zzh)) {
	  if(c > (d -= data->zzh)) {
	    (ap++ - 1)->DD = e = c;
	    *st++ = 0;
	  }
	  else {
	    e = c;
	    (ap++ - 1)->DD = d;
	    *st++ = 20;
	  } 
	}
	else {
	  if(c > (d -= data->zzh)) {
	    (ap++ - 1)->DD = c;
	    *st++ = 10;
	  }
	  else {
	    (ap++ - 1)->DD = d;
	    *st++ = 30;
	  }
	}
      }
    }
    if(i > N-up &&
       best < (j = (ap - 1)->CC - data->reggA - (N - i) * data->reghA)) {
      best = j; X = i; Y = rightd;
    }
  }
  for(ap = &data->CD[leftd]; ap <= &data->CD[rightd]; ap++) {
    if((j = ap->CC - data->reggB - data->reghB *
	(x = (&data->CD[rightd] - ap)))
       > best) {
      X = M;
      best = j;
      Y = rightd - x;
    }
  }
  if (data->CD[rightd].CC > best) {X=M; Y= N; best = data->CD[rightd].CC;}
  v= best;
  tmp = MemGet(M+N, MGET_ERRPOST);
  for (i = X, j = Y, e=0, c = 0; i>=0; i--, c++) {
    k  = (t=state[i][j]) %10;
    if (t == -1) break;
    if (e == 1 && (t/10)%2 == 1) k = 1;
    if (e == 2 && (t/20)== 1) k = 2;
    if (k == 1) { j--; i++;}
    else if (k == 2) j++;
    e = k;
    tmp[c] = (Int1) e;
  }
  for (i = c-1; i >= 0; i--) 
    switch(tmp[i]) {
    case 0: 
      _REP;
      break;
    case 1:
      _INS(1);
      break;
    case 2:
      _DEL(1);
      break;
    }
  if(X != M) _DEL(M - X)
	       else if(Y != rightd) _INS(rightd-Y)
  
				      MemFree(state[0]);
  MemFree(state);
  MemFree(tmp);
  return(v);
}