Exemplo n.º 1
0
/////////////////////////////////////////////////////////////////////////
//                                          
// SetAlgorithm
// 
// Description 
//  Set algorithm from a preallocated buffer. The buffer is not copied so must
//  remain valid for the life of the object.
// Parameters:
//	pData : [in] The buffer
//  cData : [in] The length of the buffer
//	ulId  : [in] optional Id to identify the data
//
// Return Values:
//	S_OK, 
//  E_INVALIDARG E_OUTOFMEMORY, E_FAIL
///////////////////////////////////////////////////////////////////////////
HRESULT Classifier::SetAlgorithm(const PBYTE pData, UINT64 cData, ULONG ulId)
{
    HRESULT     hr = 0;

    if (NULL == pData || 0 == cData )
    {
        hr = -1;
    }

    ResetData();

    if (SUCCEEDED(hr))
    {
        hr =  LoadClassifierData(pData, cData);
    }

    if (SUCCEEDED(hr))
    {
        m_pDatabuf = pData;
        m_cDatabuf = cData;
        m_ulID = ulId;
    }

    return hr;
}
	void Flush()
	{
		if (m_mode != eM_Saving)
			return;

		// write tags and types ending with 0
		WriteFccCodes(m_file, m_tags, eBK_tags);
		WriteFccCodes(m_file, m_types, eBK_typs);

		// write toplevel metadata prefixed with data size
		for (size_t i = 0; i < m_metadata.size(); ++i)
		{
			std::vector<uint8> stm;
			m_metadata[i].SerializeTo(stm);
			uint32 sz = stm.size();
			if (sz == 0)
				continue;
			m_file.Write( &sz, sizeof(sz) );
			m_file.Write(&stm[0], sz);
		}

		// a seperator between flushes
		uint32 seperator = eBK_void;
		m_file.Write(&seperator, sizeof(seperator));

		ResetData();
	}
Exemplo n.º 3
0
bool CFCMReadFile::ParsingTextFile(CString szDelimiter)
{
	if(!IsOpen())
	{
		return false;
	}

	CString szLine;

	ResetData();
	// m_nCols = GetNumberColums(szDelimiter);
	m_nCols = GetNumberColumsMulti(szDelimiter);

	while(!Eof())
	{
		if(ReadLine(szLine))
		{
			if (!szLine.IsEmpty()) {
				++m_nRows;
				//ParsingLine(szLine, szDelimiter);
				ParsingLineMulti(szLine, szDelimiter);
			}
		}
	};

	return true;
}
Exemplo n.º 4
0
void CBaseGameStats_Driver::SendData()
{
	// if we don't own the data container or there's no valid data, nothing to do
	if ( !m_pGamestatsData || !m_pGamestatsData->m_bHaveData )
		return;

	// save the data to a buffer
	CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER );
	m_pGamestatsData->m_pKVData->RecursiveSaveToFile( buf, 0 );

	if ( CommandLine()->FindParm( "-gamestatsfileoutputonly" ) )
	{
		// write file for debugging
		const char szFileName[] = "gamestats.dat";
		filesystem->WriteFile( szFileName, GAMESTATS_PATHID, buf );
	}
	else
	{
		// upload the file to Steam
		if ( gamestatsuploader )
			gamestatsuploader->UploadGameStats( "", 1, buf.TellPut(), buf.Base() );
	}	

	ResetData();
}
Exemplo n.º 5
0
/**********************************************************************
 * Base Renderer interface implementation
 **********************************************************************/
TessResultRenderer::TessResultRenderer(const char* type, const char* extension)
    : full_typename_(type), file_extension_(extension),
      title_(""), imagenum_(-1),
      output_data_(NULL),
      next_(NULL) {
  ResetData();
}
Exemplo n.º 6
0
Arquivo: main.cpp Projeto: nh2/obse
static void ExamplePlugin_LoadCallback(void * reserved)
{
	UInt32	type, version, length;

	ResetData();

	char	buf[512];

	while(g_serialization->GetNextRecordInfo(&type, &version, &length))
	{
		_MESSAGE("record %08X (%.4s) %08X %08X", type, &type, version, length);

		switch(type)
		{
			case 'STR ':
				g_serialization->ReadRecordData(buf, length);
				buf[length] = 0;

				_MESSAGE("got string %s", buf);

				g_strData = buf;
				break;

			case 'ASDF':
				g_serialization->ReadRecordData(buf, length);
				buf[length] = 0;

				_MESSAGE("ASDF chunk = %s", buf);
				break;
			default:
				_MESSAGE("Unknown chunk type $08X", type);
		}
	}
}
Exemplo n.º 7
0
int CSoundPlayer::Open(WAVEFORMATEX _tOutWFX)
{
	DWORD dwFlag = 0;
	HRESULT	hr = NOERROR;
	MMRESULT	mmhr;

	if (NULL != soundObj.hWaveOut)	return -1;

	//if (NULL==soundObj.hNotify)	soundObj.hNotify = CreateEvent( NULL, FALSE, FALSE, 0 );

#if 0
	// Query WaveOut Device for _tOutWFX
	dwFlag = WAVE_FORMAT_DIRECT | WAVE_FORMAT_QUERY; //WAVE_MAPPED
	dwFlag |= CALLBACK_NULL;
	mmhr = waveOutOpen( &soundObj.hWaveOut, WAVE_MAPPER, &_tOutWFX, NULL, 0, dwFlag );
	if( MMSYSERR_NOERROR != mmhr ) {
		_TRACE("waveOutOpen Query Fail ret:%d \n", mmhr );
		return -3;
	}
#endif
	// Open WaveOut Device for _tOutWFX
	dwFlag = WAVE_FORMAT_DIRECT;
	dwFlag |= CALLBACK_EVENT;
	mmhr = waveOutOpen( &soundObj.hWaveOut, WAVE_MAPPER, &_tOutWFX, 
						//(DWORD)NULL, (DWORD_PTR)0, dwFlag );
						(DWORD)soundObj.hNotify, (DWORD_PTR)0, dwFlag );
	if( MMSYSERR_NOERROR != mmhr ) {
		_TRACE("waveOutOpen Fail ret:%d \n", mmhr );
		return -4;
	}

	for( unsigned int i=0; i<soundObj.waveHdrNum; i++ ) 
	{
		soundObj.pWaveHdr[i].dwFlags = 0;
		soundObj.pWaveHdr[i].dwBufferLength = MAX_AUDIO_BUFFER_LENGTH;
		mmhr = waveOutPrepareHeader( soundObj.hWaveOut, &soundObj.pWaveHdr[i], sizeof(WAVEHDR) );
		soundObj.pWaveHdr[i].dwBufferLength = 0;
	}
	soundObj.initWaveHdr = 0x01;

	soundObj.samplerate = _tOutWFX.nSamplesPerSec;
	soundObj.channel    = _tOutWFX.nChannels;
	soundObj.bitpersec  = _tOutWFX.wBitsPerSample;

	ResetData();

	if (NULL == soundObj.hThread)
	{
		soundObj.flag = 0x01;
		soundObj.pEx  = this;
		soundObj.hThread = CreateThread(NULL, 0, __SOUND_PLAY_THREAD, &soundObj, 0, NULL);
		while (soundObj.flag != 0x02 && soundObj.flag != 0x00)	{Sleep(100);}
	}
	soundObj.waveHdrWriteIdx = 0;



	return 0;
}
Exemplo n.º 8
0
void SVisualLogger::OnNewWorld(UWorld* NewWorld)
{
	InternalDevice->SerLastWorld(NewWorld);
	if (ULogVisualizerSettings::StaticClass()->GetDefaultObject<ULogVisualizerSettings>()->bResetDataWithNewSession)
	{
		ResetData();
	}
}
Exemplo n.º 9
0
 void Reset()
 {
     spellId = me->m_spells[0];
     meleeClass = false;
     ResetData();
     castTimer = urand(cooldown, 10000);
     targetTimer = 2000;
 }
Exemplo n.º 10
0
void MathCell::Unbreak()
{
  ResetData();
  m_isBroken = false;
  m_nextToDraw = m_next;
  if (m_nextToDraw != NULL)
    m_nextToDraw->m_previousToDraw = this;
}
Exemplo n.º 11
0
//_______________________________________________________________________
void CloseLine (MtpDrvPtr data)
{
	SCCPtr scc = &data->scc;
	scc->state = false;
	LockedCall(__CloseLine());
    if (data->powerMgr) PwMngOFF;
	ResetData (scc);
}
Exemplo n.º 12
0
void ImgCell::RecalculateWidths(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();
  m_image->ViewportSize(m_canvasSize.x,m_canvasSize.y,scale);
  
  m_width = (scale * m_image->m_width) + 2 * m_imageBorderWidth;
  ResetData();
}
Exemplo n.º 13
0
void DiffCell::RecalculateWidths(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();
  m_baseCell->RecalculateWidthsList(parser, fontsize);
  m_diffCell->RecalculateWidthsList(parser, fontsize);
  m_width = m_baseCell->GetFullWidth(scale) + m_diffCell->GetFullWidth(scale) + 2*MC_CELL_SKIP;
  ResetData();
}
Exemplo n.º 14
0
void DiffCell::RecalculateWidths(int fontsize)
{
  CellParser *parser = CellParser::Get();
  double scale = parser->GetScale();
  m_baseCell->RecalculateWidthsList(fontsize);
  m_diffCell->RecalculateWidthsList(fontsize);
  m_width = m_baseCell->GetFullWidth(scale) + m_diffCell->GetFullWidth(scale) + 2*MC_CELL_SKIP;
  ResetData();
}
Exemplo n.º 15
0
void GLWidget::GenerateAKnot()
{
    ResetData();

    while(!_isTracingDone)
    {
        TraceOneStep();
    }
}
Exemplo n.º 16
0
void	CMultiXWSStream::SetNewRequest(std::string	gSoapDLL,CMultiXBuffer	&InputBuffer)
{
	ResetData();
	if(m_pInBuf)
		m_pInBuf->ReturnBuffer();
	m_pInBuf	=	InputBuffer.Clone();
	InitgSoap(gSoapDLL);
	m_pSoap->keep_alive	=	0;
}
Exemplo n.º 17
0
void EventViewer::Start(int)
{
    std::lock_guard<std::mutex> lock(_mutex);
    _updateTimer.start(1000);
    _currentTime = 0;
    ResetData();
    _binWidth = ui->edBinWidth->text().toInt();
    _rowLength = ui->edRowLen->text().toInt();
}
Exemplo n.º 18
0
void ConjugateCell::RecalculateWidths(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();
  m_innerCell->RecalculateWidthsList(parser, fontsize);
  m_width = m_innerCell->GetFullWidth(scale) + SCALE_PX(8, scale);
  m_open->RecalculateWidthsList(parser, fontsize);
  m_close->RecalculateWidthsList(parser, fontsize);
  ResetData();
}
USIOJRequestJSON::USIOJRequestJSON(const class FObjectInitializer& PCIP)
  : Super(PCIP),
    BinaryContentType(TEXT("application/octet-stream"))
{
	RequestVerb = ESIORequestVerb::GET;
	RequestContentType = ESIORequestContentType::x_www_form_urlencoded_url;

	ResetData();
}
Exemplo n.º 20
0
void SubCell::RecalculateWidths(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();
  m_baseCell->RecalculateWidthsList(parser, fontsize);
  m_indexCell->RecalculateWidthsList(parser, MAX(MC_MIN_SIZE, fontsize - SUB_DEC));
  m_width = m_baseCell->GetFullWidth(scale) + m_indexCell->GetFullWidth(scale) -
            SCALE_PX(2, parser.GetScale());
  ResetData();
}
Exemplo n.º 21
0
void FracCell::RecalculateWidths(int fontsize)
{
  Cell::RecalculateWidths(fontsize);
  wxASSERT(fontsize >= 1);
  Configuration *configuration = (*m_configuration);
  if (m_isBrokenIntoLines || m_exponent)
  {
    m_num->RecalculateWidthsList(fontsize);
    m_denom->RecalculateWidthsList(fontsize);
  }
  else
  {
    m_num->RecalculateWidthsList(MAX(MC_MIN_SIZE, fontsize - FRAC_DEC));
    m_denom->RecalculateWidthsList(MAX(MC_MIN_SIZE, fontsize - FRAC_DEC));
  }
  wxDC *dc = configuration->GetDC();
  dc->SetFont(configuration->GetFont(TS_VARIABLE,fontsize));
  if (m_exponent && !m_isBrokenIntoLines)
  {
    m_protrusion = 0;
    int height;
    dc->GetTextExtent(wxT("/"), &m_expDivideWidth, &height);
    m_width = m_num->GetFullWidth() + m_denom->GetFullWidth() + m_expDivideWidth;
  }
  else
  {
    int dummy;

    dc->GetTextExtent(wxT("X"), &m_protrusion, &dummy);
    m_protrusion /= 3;
    
    // We want half a space's widh of blank space to separate us from the
    // next minus.

    if (((m_previous != NULL) && (m_previous->ToString().EndsWith(wxT("-")))))
      m_horizontalGapLeft = m_protrusion;
    else
      m_horizontalGapLeft = 0;

    if (((m_next != NULL) && (m_next->ToString().StartsWith(wxT("-")))))
      m_horizontalGapRight = m_protrusion;
    else
      m_horizontalGapRight = 0;
    
    m_width = MAX(m_num->GetFullWidth(), m_denom->GetFullWidth()) +
              2 * m_protrusion + m_horizontalGapLeft + m_horizontalGapRight;
  }
  m_open1->RecalculateWidths(fontsize);
  m_close1->RecalculateWidths(fontsize);
  m_open2->RecalculateWidths(fontsize);
  m_close2->RecalculateWidths(fontsize);
  m_divide->RecalculateWidths(fontsize);
  ResetData();
  if(m_isBrokenIntoLines)
    m_width = 0;
}
void RemoteControl::Initialize()
{
	RobotIOControl::Initialize();

	int iCount = m_aryLinks.GetSize();
	for(int iIndex=0; iIndex<iCount; iIndex++)
		m_aryLinks[iIndex]->Initialize();

	ResetData();
}
Exemplo n.º 23
0
CBone::CBone()
{
    construct		();
	flags.zero		();
    rest_length		= 0;
	SelfID			= -1;
    parent			= 0;

    ResetData		();
}
Exemplo n.º 24
0
CMultiXWSStream::CMultiXWSStream(std::string	gSoapDLL,CMultiXSession	&OwningSession)	:
	m_pOutBuf(NULL),
	m_pInBuf(NULL),
	m_pFunctions(NULL),
	m_pSoap(NULL),
	m_pOwningSession(&OwningSession)
{
	InitgSoap(gSoapDLL);
	ResetData();
}
Exemplo n.º 25
0
void ImgCell::RecalculateSize(CellParser& parser, int fontsize)
{
  double scale = parser.GetScale();
  m_image->ViewportSize(m_canvasSize.x,m_canvasSize.y,scale);
  
  m_height = (scale * m_image->m_height) + 2 * m_imageBorderWidth;
  ResetData();

  m_center = m_height / 2;
}
Exemplo n.º 26
0
void NetSocket::InitData( void )
{
	m_qReceiveData = new std::queue<Recv_struct>;
	m_qSendData = new std::queue<string>;

	m_iDescriptor = 0;
	m_hThread = NULL;

	ResetData();
}
Exemplo n.º 27
0
void AtCell::RecalculateWidths(int fontsize)
{
  Configuration *configuration = Configuration::Get();
  double scale = configuration->GetScale();
  m_baseCell->RecalculateWidthsList(fontsize);
  m_indexCell->RecalculateWidthsList(MAX(MC_MIN_SIZE, fontsize - 4));
  m_width = m_baseCell->GetFullWidth(scale) + m_indexCell->GetFullWidth(scale) +
            SCALE_PX(4, scale);
  ResetData();
}
Exemplo n.º 28
0
void SqrtCell::RecalculateWidths(int fontsize)
{
  CellParser *parser = CellParser::Get();
  double scale = parser->GetScale();
  m_innerCell->RecalculateWidthsList(fontsize);
  if (parser->CheckTeXFonts())
  {
    wxDC& dc = parser->GetDC();
    double scale = parser->GetScale();
    m_innerCell->RecalculateSizeList(fontsize);

    m_signFontScale = 1.0;
    int fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);

    dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, parser->GetTeXCMEX()));
    dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
    m_signTop = m_signSize / 5;
    m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;

    int size = m_innerCell->GetMaxHeight();

    if  (size <= (m_signSize) / 5)  {
      m_signType = 1;
      m_signFontScale = (5.0 * size) / (1.5 * m_signSize);
    }
    else if (size <= (2*m_signSize) / 5) {
      m_signType = 2;
      m_signFontScale = (5.0 * size) / (2.2 * m_signSize);
    }
    else if (size <= (3*m_signSize) / 5) {
      m_signType = 3;
      m_signFontScale = (5.0 * size) / (3.0 * m_signSize);
    }
    else if (size <= (4*m_signSize) / 5 ) {
      m_signType = 4;
      m_signFontScale = (5.0 * size) / (3.8 * m_signSize);
    }
    else {
      m_signType = 5;
      m_signFontScale = 1.0;
    }

    fontsize1 = (int)(SIGN_FONT_SCALE*scale*fontsize*m_signFontScale + 0.5);
    dc.SetFont(wxFont(fontsize1, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, parser->GetTeXCMEX()));
    dc.GetTextExtent(wxT("s"), &m_signWidth, &m_signSize);
    m_signTop = m_signSize / 5;
    m_width = m_innerCell->GetFullWidth(scale) + m_signWidth;
  }
  else
    m_width = m_innerCell->GetFullWidth(scale) + SCALE_PX(10, scale) +
              3 * SCALE_PX(1, scale) + 1;
  m_open->RecalculateWidthsList(fontsize);
  m_close->RecalculateWidthsList(fontsize);
  ResetData();
}
void RemoteControl::ResetSimulation()
{
	RobotIOControl::ResetSimulation();

	m_iCyclePartIdx = 0;
	int iCount = m_aryLinks.GetSize();
	for(int iIndex=0; iIndex<iCount; iIndex++)
		m_aryLinks[iIndex]->ResetSimulation();

	ResetData();
}
Exemplo n.º 30
0
bool TessResultRenderer::BeginDocument(const char* title) {
  ResetData();

  title_ = title;
  imagenum_ = -1;
  bool ok = BeginDocumentHandler();
  if (next_) {
    ok = next_->BeginDocument(title) && ok;
  }
  return ok;
}