Olivia_v2017/OliviaTasks/olv_task.cpp

69 lines
1.5 KiB
C++

#include "StdAfx.h"
#include "olv_task.h"
#include "olv_dll.h"
#include "olv.h"
Colv_task OlvApp;
//************************************************************************************
Colv_task::Colv_task(void)
{
isConnected = true;
olv = NULL;
//log.l_lisener=this;
#ifdef _DEBUG
//strcpy(log.path,"C:\\Proyectos\\Olivia\\Instal\\temp");
//strcpy(log.nombre,"OlvTask");
#endif
}
//************************************************************************************
void Colv_task::log_ext( __time64_t tiemp, char *modulo, char *fmt )
{
char tiem[32];
char str[1024];
strftime(tiem, 20, "%Y-%m-%d %H:%M:%S", localtime(&tiemp));
sprintf_s(str,1024, "%s %-12s %s\r\n",
(char *) LPCTSTR (tiem),
(char *) LPCTSTR (modulo),
(char *) LPCTSTR (fmt));
if(isConnected)
colaLog.pon(str);
//_tprintf(str);
//OutputDebugString(str);
}
Colv_task::~Colv_task( void )
{
if(olv)
delete olv;
}
//************************************************************************************
bool Cstr_arrayEx::dame( StrArray& stout )
{
if(n_i<=0)
return false;
lock_cola.entro();
stout.ind=ind;
stout.str=str;
stout.m_str=m_str;
stout.m_i=m_i;
stout.n_str=n_str;
stout.n_i=n_i;
m_str=m_i=n_i=n_str=0;
str=NULL;
ind=NULL;
lock_cola.salgo();
return true;
}
//************************************************************************************
void Cstr_arrayEx::pon( char* str)
{
lock_cola.entro();
add(str);
lock_cola.salgo();
}
//************************************************************************************