diff --git a/.gitignore b/.gitignore index 1eacf7c..144b9ac 100644 --- a/.gitignore +++ b/.gitignore @@ -35,10 +35,4 @@ Olivia/[Dd]ebug*/ OliviaTasks/x64/ OliviaTasks/[Rr]elease*/ OliviaTasks/[Dd]ebug*/ -lib/ -bin/ -bin/x64/debug -bin/x64/release -lib -bin -includes + diff --git a/bin/Debug/ClientLic.dll b/bin/Debug/ClientLic.dll new file mode 100644 index 0000000..80faa93 Binary files /dev/null and b/bin/Debug/ClientLic.dll differ diff --git a/bin/Debug/FileTransfer.dll b/bin/Debug/FileTransfer.dll new file mode 100644 index 0000000..72f6017 Binary files /dev/null and b/bin/Debug/FileTransfer.dll differ diff --git a/bin/Debug/Olivia.dll b/bin/Debug/Olivia.dll new file mode 100644 index 0000000..5a7e53f Binary files /dev/null and b/bin/Debug/Olivia.dll differ diff --git a/bin/Debug/OliviaTasks.exe b/bin/Debug/OliviaTasks.exe new file mode 100644 index 0000000..edad466 Binary files /dev/null and b/bin/Debug/OliviaTasks.exe differ diff --git a/bin/Debug/OliviaTasks.lic b/bin/Debug/OliviaTasks.lic new file mode 100644 index 0000000..c7711a6 Binary files /dev/null and b/bin/Debug/OliviaTasks.lic differ diff --git a/bin/Debug/licUtiles.dll b/bin/Debug/licUtiles.dll new file mode 100644 index 0000000..205fd68 Binary files /dev/null and b/bin/Debug/licUtiles.dll differ diff --git a/bin/Debug/sqlite3.dll b/bin/Debug/sqlite3.dll new file mode 100644 index 0000000..d5d1586 Binary files /dev/null and b/bin/Debug/sqlite3.dll differ diff --git a/bin/Debug/utiles.dll b/bin/Debug/utiles.dll new file mode 100644 index 0000000..2fd2d63 Binary files /dev/null and b/bin/Debug/utiles.dll differ diff --git a/bin/Release/ClientLic.dll b/bin/Release/ClientLic.dll new file mode 100644 index 0000000..8dd2acc Binary files /dev/null and b/bin/Release/ClientLic.dll differ diff --git a/bin/Release/FileTransfer.dll b/bin/Release/FileTransfer.dll new file mode 100644 index 0000000..4ff39eb Binary files /dev/null and b/bin/Release/FileTransfer.dll differ diff --git a/bin/Release/Olivia.dll b/bin/Release/Olivia.dll new file mode 100644 index 0000000..c9c33af Binary files /dev/null and b/bin/Release/Olivia.dll differ diff --git a/bin/Release/OliviaTasks.exe b/bin/Release/OliviaTasks.exe new file mode 100644 index 0000000..084b6a7 Binary files /dev/null and b/bin/Release/OliviaTasks.exe differ diff --git a/bin/Release/OliviaTasks.lic b/bin/Release/OliviaTasks.lic new file mode 100644 index 0000000..c7711a6 Binary files /dev/null and b/bin/Release/OliviaTasks.lic differ diff --git a/bin/Release/licUtiles.dll b/bin/Release/licUtiles.dll new file mode 100644 index 0000000..77c2439 Binary files /dev/null and b/bin/Release/licUtiles.dll differ diff --git a/bin/Release/sqlite3.dll b/bin/Release/sqlite3.dll new file mode 100644 index 0000000..d5d1586 Binary files /dev/null and b/bin/Release/sqlite3.dll differ diff --git a/bin/Release/utiles.dll b/bin/Release/utiles.dll new file mode 100644 index 0000000..2b895be Binary files /dev/null and b/bin/Release/utiles.dll differ diff --git a/bin/x64/debug/ClientLic.dll b/bin/x64/debug/ClientLic.dll new file mode 100644 index 0000000..20aae47 Binary files /dev/null and b/bin/x64/debug/ClientLic.dll differ diff --git a/bin/x64/debug/FileTransfer.dll b/bin/x64/debug/FileTransfer.dll new file mode 100644 index 0000000..ac30355 Binary files /dev/null and b/bin/x64/debug/FileTransfer.dll differ diff --git a/bin/x64/debug/Olivia.dll b/bin/x64/debug/Olivia.dll new file mode 100644 index 0000000..564c0db Binary files /dev/null and b/bin/x64/debug/Olivia.dll differ diff --git a/bin/x64/debug/OliviaTasks.exe b/bin/x64/debug/OliviaTasks.exe new file mode 100644 index 0000000..157d04a Binary files /dev/null and b/bin/x64/debug/OliviaTasks.exe differ diff --git a/bin/x64/debug/acceso.bin b/bin/x64/debug/acceso.bin new file mode 100644 index 0000000..0059e82 Binary files /dev/null and b/bin/x64/debug/acceso.bin differ diff --git a/bin/x64/debug/licUtiles.dll b/bin/x64/debug/licUtiles.dll new file mode 100644 index 0000000..27a3f51 Binary files /dev/null and b/bin/x64/debug/licUtiles.dll differ diff --git a/bin/x64/debug/sqlite3.dll b/bin/x64/debug/sqlite3.dll new file mode 100644 index 0000000..6fda325 Binary files /dev/null and b/bin/x64/debug/sqlite3.dll differ diff --git a/bin/x64/debug/utiles.dll b/bin/x64/debug/utiles.dll new file mode 100644 index 0000000..2c54510 Binary files /dev/null and b/bin/x64/debug/utiles.dll differ diff --git a/bin/x64/release/ClientLic.dll b/bin/x64/release/ClientLic.dll new file mode 100644 index 0000000..1ad1e31 Binary files /dev/null and b/bin/x64/release/ClientLic.dll differ diff --git a/bin/x64/release/FileTransfer.dll b/bin/x64/release/FileTransfer.dll new file mode 100644 index 0000000..1bc35c5 Binary files /dev/null and b/bin/x64/release/FileTransfer.dll differ diff --git a/bin/x64/release/Olivia.dll b/bin/x64/release/Olivia.dll new file mode 100644 index 0000000..acade70 Binary files /dev/null and b/bin/x64/release/Olivia.dll differ diff --git a/bin/x64/release/OliviaTasks.exe b/bin/x64/release/OliviaTasks.exe new file mode 100644 index 0000000..692bca4 Binary files /dev/null and b/bin/x64/release/OliviaTasks.exe differ diff --git a/bin/x64/release/OliviaTasks.lic b/bin/x64/release/OliviaTasks.lic new file mode 100644 index 0000000..b559028 Binary files /dev/null and b/bin/x64/release/OliviaTasks.lic differ diff --git a/bin/x64/release/licUtiles.dll b/bin/x64/release/licUtiles.dll new file mode 100644 index 0000000..d8e4873 Binary files /dev/null and b/bin/x64/release/licUtiles.dll differ diff --git a/bin/x64/release/sqlite3.dll b/bin/x64/release/sqlite3.dll new file mode 100644 index 0000000..6fda325 Binary files /dev/null and b/bin/x64/release/sqlite3.dll differ diff --git a/bin/x64/release/utiles.dll b/bin/x64/release/utiles.dll new file mode 100644 index 0000000..b794e3a Binary files /dev/null and b/bin/x64/release/utiles.dll differ diff --git a/includes/ClientLic/ClientLicDef.h b/includes/ClientLic/ClientLicDef.h new file mode 100644 index 0000000..56aa9fb --- /dev/null +++ b/includes/ClientLic/ClientLicDef.h @@ -0,0 +1,9 @@ +#pragma once +#ifndef CLIC_EXPORT +#ifdef _WINDLL +#define CLIC_EXPORT __declspec(dllexport) +#else +#define CLIC_EXPORT __declspec(dllimport) +#endif + +#endif diff --git a/includes/ClientLic/ClienteLicencias.h b/includes/ClientLic/ClienteLicencias.h new file mode 100644 index 0000000..ed0a608 --- /dev/null +++ b/includes/ClientLic/ClienteLicencias.h @@ -0,0 +1,43 @@ +#pragma once +#include "LicUtilesDef.h" +#include "ClientLicDef.h" +#include "FileTransferDef.h" + + +class FileTransferClient; +class CLIC_EXPORT ClienteLicencias: public LicClientEscucha, public FileTransferClientLisener +{ + CDialog *dprog; + double porcen; +public: + FileTransferClient *ft; + int dias_pregun; + bool cancelaDescarga; + bool espera_dlg; + char dirTemp[256];//directorio temporal para dejar el instalador + char dirLic[256];//path para guardar la licencia y la ultima vez que se pregunto si descargar lic + + ClienteLicencias(void); + ~ClienteLicencias(void); + + bool cargaLicencia(); + + virtual bool getClave(char* clave, char* producto ); + + virtual void muestaError( char* info, char* producto ); + + virtual bool descargaInstalador( Licencia *lic ); + + void descargaVersion( Licencia *lic); + + virtual void setStatus( double porcent ); + + virtual void finTransfer( bool finalFeliz ); + + virtual bool getPathLic( char* path, char* producto ); + + virtual bool cancelTransfer(); + + private: + bool preguntarDescarga(); +}; diff --git a/includes/FileTransfer/FileTransferDef.h b/includes/FileTransfer/FileTransferDef.h new file mode 100644 index 0000000..7b79ff8 --- /dev/null +++ b/includes/FileTransfer/FileTransferDef.h @@ -0,0 +1,28 @@ +#ifndef FT_EXPORT +#ifdef _WINDLL +#define FT_EXPORT __declspec(dllexport) +#else +#define FT_EXPORT __declspec(dllimport) +#endif +struct Usuario_conx_0; +class FT_EXPORT IDataUserProvider +{ +public: + virtual bool fill(Usuario_conx_0 *user, char *pathRaid) = 0; + virtual bool getConf(char *ip, int *port) = 0; + + +}; + +#define FILE_TRANSMISION_GET_FILES 7 +#define FILE_TRANSMISION_GET_DIRS 8 + +class FT_EXPORT FileTransferClientLisener +{ +public: + virtual void setStatus(double porcent){}; + virtual void finTransfer(bool finalFeliz){}; + virtual bool cancelTransfer(){ return false;}; + +}; +#endif diff --git a/includes/LicUtiles/LicUtilesDef.h b/includes/LicUtiles/LicUtilesDef.h new file mode 100644 index 0000000..9c8d6cc --- /dev/null +++ b/includes/LicUtiles/LicUtilesDef.h @@ -0,0 +1,44 @@ +#pragma once +#ifndef LICUTL_EXPORT +#ifdef _WINDLL +#define LICUTL_EXPORT __declspec(dllexport) +#else +#define LICUTL_EXPORT __declspec(dllimport) +#endif + +#define VERSION_LICENCIA 100 + +#define LU_LICENCIA_CADUCA 1 //licencia normal +#define LU_LICENCIA_PROPIETARIA 2 //licencia propietaria, por defecto da licencia + + +#define LU_DEFAULT_FILE "data.lic" +#define LU_DEFAULT_SERVER "desa.narvaling.com" +//#define LU_DEFAULT_SERVER "192.168.1.60" + +#define LU_DEFAULT_PUERTO 8051 + +class Licencia; +//structuras +class LICUTL_EXPORT DBLicProvider +{ +public: + virtual bool fill( Licencia* lic )=0;//rellena datos licencia + virtual int licCount( Licencia* lic )=0;//cuenta numero de licencias + virtual bool fillInstal( Licencia* lic )=0;//rellena instalador + virtual bool setAcceso( Licencia* lic, __int64 *ultAcc, __int64 *actualAcceso)=0; + virtual bool getConf( char *ip, int *port )=0;//configuracion de escucha +}; + +class LICUTL_EXPORT LicClientEscucha +{ +public: + virtual bool getClave(char* clave, char* producto )=0;//pide clave (pidiendosela al usuario) + virtual bool getServer( char*server, int *puerto, char* producto){ server[0]=0;*puerto=0;return false;}//pide servidor de licencias (no obligada) + virtual bool getPathLic( char* path, char* producto ){path[0]=0; return true;}//pide path de archivo de licencia (no obligada) + virtual void muestaError(char* info, char* producto){} + virtual bool descargaInstalador(Licencia *lic){return true;}//true si revisamos instalador, false si no + +}; + +#endif diff --git a/includes/Olivia/OliviaDef.cs b/includes/Olivia/OliviaDef.cs new file mode 100644 index 0000000..6d696fb --- /dev/null +++ b/includes/Olivia/OliviaDef.cs @@ -0,0 +1,591 @@ +/** +* @file GeneralDef.cs +* Clase con definiciones globales comunes al proyecto Olivia y a OliviaTasks. +*/ +/** +* Clase con definiciones globales comunes al proyecto Olivia y a OliviaTasks. +*/ +namespace OliviaDef +{ + public static class GeneralDef + { + //************************************************************************************* + //Enums y structs generales + /** + * Tipos de ejecución de la herramienta Olivia + */ + public enum TiposOliv + { + OlivNoDef = -1, + OlivLimp, // +/* +hacer el memoryclear +guardar dbf ia +*/ +class Cb_file; +class UTILES_EXPORT CartoBase: public SetEntities, public SetPtsR, public DataIaCartoBase +{ + //clases amigo----------------- + friend class CartoBaseInfoEntity; + friend class CartoBaseInfoPto; + friend class CartoBaseInfoLine; + friend class CartoBaseInfoBuilder; + friend class CartoPto; + friend class CartoLine; +private: + //info interna------------------------------- + int ref;//referencia para el siguiente elemento + CartoBasePaintedProps _defaultpaintedProps; + CartoBaseColor _defaultColor; + //array de informacion de entidades + Cgarray _entities;//entidades + Cgarray _points;//coordenadas + Cgarray _lines;//lineas + Cgarray _paintedProps;//propiedades de pintado + Cgarray _colors; + std::map refIndex;//indexado por referencias; + //datos de ia----------------------------------------- + char iaName[12];//nombre columna ia tipo IntIa + int typeIA;//indica el tipo de informacion asociada que se utilizara +public: + + IaDataTable dataIa; + DataIaCartoBase *iaEx; + enum TypedataIa + { + NIa=0,//sin informacion asociada + IntIa,//usa solo un entero por entidad como ia con nombre de columna iaName + DtIa,//usa la dataIa para almacenar info asociada + ExIa//informacion asociada externa + }; + + CartoBase(void); + ~CartoBase(void); + + //funciones----------------------------------------------------------------- + CartoBaseInfoEntity get(int i);//acceso a entidad iesima (modo lectura) + CartoBaseInfoEntity getRef(int r);//acceso a entidad con referencia r (modo lectura) + + + //añade elementos + bool add(CartoEntity& element); + bool add(CartoBase& cad); + + bool remove(int i);//pone marca de flag de borrado (pero sigue siendo accesible) + bool removeRef(int r); + + bool FastClear();//solo borra entidades y rehace las referencias + bool clear();//limpia elementos borrados y ajusta memoria + bool MemClear();//limpia memoria de todos los arrays + + EntitiesArray* filter(EntitiesArray* dst, FilterEntities *filter); + + virtual bool leer(char *path); + virtual bool grabar(char *path); + virtual bool leer(Cb_file *f); + virtual bool grabar(Cb_file *f); + + int addDefaultPaintedProps();//crea unas propiedades de pintado como las por defecto + + bool importShp(char* path);//importa shp + bool exportShp(char* path);//exporta a shp (todos los tipos que cuinciden con la primera) + bool ptosExportShp(char* path); + bool linesExportShp(char* path); + + void del();//limpia toda la carto (sin liberar memoria) + + //funciones de ia------------------------------------------------------------------- + void* getIa(int refEnt);//devuelve informacion asociada externa de la entidad refEnt + int getTypeIA(){return typeIA;}//devuelve el tipo de ia que tiene actualmente + void setExIa(DataIaCartoBase* ia);//setea un ia externo + int getEntityRef(int ientity);//devuelve la referencia + void setNameIa(char *name);//pone el nombre de la col + + //funciones por ser SetEntities + virtual CartoBaseInfoEntity getEntity(int i); + virtual int getNumberEntities(); + //funciones por ser SetPts + virtual double* getPto(int i); + virtual int getNumberPtos(); + //funciones auxiliares------------ + int getNexRef(){return ref;}; + + //funciones DataIaCartoBase + virtual bool IaGetSize( int *ncolm ); + virtual bool IaGetColm( int icol, char* name, BYTE *type, int *size, int*ndecimal ); + virtual bool IaGetVal( int refEnt, int icol, int* v ); + virtual bool IaFinW(){return true;} + +private: + + int add(CartoBaseEntity* src); + int add(CartoBasePoint* src); + int add(CartoBaseLine* src); + int add(CartoBasePaintedProps* src); + int add(CartoBaseColor* src); + + bool fexportShp(char* path, int type = CartoBaseTypes::Ndef); + + void indexRef(bool buscaRepes=false);//indexa referencias + void iniIndexRef();//crea indexado + void reIndexRef(); +}; + +class FiterCartoBase: public SetEntities +{ +public: + CartoBase* cb; + Cgarray ind; + + virtual CartoBaseInfoEntity getEntity( int i ); + + virtual int getNumberEntities(); +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/CartoBaseDBFManager.h b/includes/Utiles/CartoBaseDBFManager.h new file mode 100644 index 0000000..44f616c --- /dev/null +++ b/includes/Utiles/CartoBaseDBFManager.h @@ -0,0 +1,49 @@ +#pragma once +#include "base_head.h" +#include "Fdbf.h" +#include "CartoBase.h" + +//clase helper para imporacion de un dbf a informacion asociada de cartobase +class UTILES_EXPORT CartoBaseDBFManager: public ListenerDbf_W, public ListenerDbf_R +{ + CartoBase *cb; + int _oldRef; + int _icol; + int _nncol; + int _nnrow; + CartoBaseInfoEntity e; + int rowE; + SetEntities *setEnt; + DataIaCartoBase* ia; +public: + + CartoBaseDBFManager(void); + ~CartoBaseDBFManager(void); + virtual bool leer(char *path, CartoBase*cartb); + virtual bool grabar(char *path, DataIaCartoBase* iawx, SetEntities* s); + + + //funciones auxiliares----------------------------------- + //funciones de lectura de shp-------------------------- + virtual bool DbfSet( int nrow, int ncolm ); + virtual bool DbfSetColm( char* name, BYTE type, int size ); + virtual bool DbfaddVal( int icol, int v ); + virtual bool DbfaddVal( int icol, double v ); + virtual bool DbfaddVal( int icol, __int64 v ); + virtual bool DbfaddVal( int icol, char* v ); + virtual bool DbfaddVal( int icol, void* v ); + virtual bool DbfFinRow(); + virtual bool DbfFinR(); + + //funciones de escritura de dbf----------------------- + virtual bool DbfGet( int *nrow, int *ncolm); + virtual bool DbfGetColm( int icol, char* name, BYTE *type, int *size, int*ndecimal ); + virtual bool DbfGetVal( int irow, int icol, int* v ); + virtual bool DbfGetVal( int irow, int icol, double* v ); + virtual bool DbfGetVal( int irow, int icol, __int64* v ); + virtual bool DbfGetVal( int irow, int icol, char** v ); + virtual bool DbfGetVal( int irow, int icol, void** v ); + virtual bool DbfFinW(); + + +}; diff --git a/includes/Utiles/CartoBaseDef.h b/includes/Utiles/CartoBaseDef.h new file mode 100644 index 0000000..1358893 --- /dev/null +++ b/includes/Utiles/CartoBaseDef.h @@ -0,0 +1,75 @@ +#pragma once +#ifndef CartoBaseDef_H +#define CartoBaseDef_H +#include "base_head.h" + +namespace CartoBaseTypes{ + enum { + Ndef = 0, + Point, + Line + }; +}; + +//calse coleccion de puntos (double[3]) solo lectura +class UTILES_EXPORT SetPtsR +{ +public: + virtual double* getPto(int i)=0;//devuelve el punto iesimo + virtual int getNumberPtos()=0;//devuelve numero de puntos totales +}; +//coleccion de puntos al que se le puede añadir mas +class UTILES_EXPORT SetPtsW +{ +public: + virtual bool addPto(double* p)=0;//añade el punto p al conjunto +}; +//constructor de setPtsW +class UTILES_EXPORT SetPtsWBuilder +{ +public: + virtual SetPtsW *build()=0;//devuelve una nueva clase SetPtsW +}; +class CartoBase; +//interface de ia +class UTILES_EXPORT DataIaCartoBase +{ +public: + virtual void* IaGet(int refEnt){return NULL;} + + virtual void CBSet(CartoBase* cb){} + virtual void IaRemove(int refEnt){} + virtual void IaRemoveAll(){} + virtual void IaAdd(int refEnt){} + + //informa del numero de filas y columnas que tiene la ia + virtual bool IaSet(int nrow, int ncolm){return true;} + virtual bool IaSetColm(int icol, char* name, BYTE type, int size){return true;} + virtual bool IaAddVal(int refEnt, int icol, int v){return true;} + virtual bool IaAddVal(int refEnt, int icol, double v){return true;} + virtual bool IaAddVal(int refEnt, int icol, __int64 v){return true;} + virtual bool IaAddVal(int refEnt, int icol, char* v){return true;} + virtual bool IaAddVal(int refEnt, int icol, void* v){return true;} + virtual bool IaFinRow(int refEnt){return true;} + virtual bool IaFinR(){return true;} + + + virtual bool IaGetSize( int *ncolm ){return false;} + virtual bool IaGetColm( int icol, char* name, BYTE *type, int *size, int*ndecimal ){return false;} + virtual bool IaGetVal( int refEnt, int icol, int* v ){return false;} + virtual bool IaGetVal( int refEnt, int icol, double* v ){return false;} + virtual bool IaGetVal( int refEnt, int icol, __int64* v ){return false;} + virtual bool IaGetVal( int refEnt, int icol, char** v ){return false;} + virtual bool IaGetVal( int refEnt, int icol, void** v ){return false;} + virtual bool IaFinW(){return true;} +}; + +#define TYPE_FILE "CartoBase" +#define VERSION_CART_BASE 100 +//falgs de entidades-------------- +#define CARTOBASE_DELETED_ENTITY 0x01 + + + +#endif + diff --git a/includes/Utiles/CartoBaseElements.h b/includes/Utiles/CartoBaseElements.h new file mode 100644 index 0000000..eab9336 --- /dev/null +++ b/includes/Utiles/CartoBaseElements.h @@ -0,0 +1,172 @@ +#pragma once +#include "base_head.h" +#include "cartoBaseDef.h" +#include "garray.h" +#ifndef CartoBaseElements_H +#define CartoBaseElements_H +class CartoEntity; +//clases internas de cartobase---------------------------------------------- +class UTILES_EXPORT CartoBaseEntity +{ +public: + int id; //indice a objeto + int type; //tipo de entidad + int idPaintp; //inide a propiedades + int flagsUser; //flags para uso de usuario + int flagsInt; //flags para uso interno + int ref; //referencia unica por elemento + + //tamaño--------- + int mima[2]; //indice a punto maximo y minimo (el elemento esta contenido entre dichos puntos) + int ia; //indice a informacion adicional + + CartoBaseEntity() + { + id = -1; + idPaintp = -1; + flagsInt = 0; + } +}; +//entidad interna de putno +class UTILES_EXPORT CartoBasePoint +{ +public: + double pts[3];//coordenadas del punto + + CartoBasePoint(){ + pts[0]=pts[1]=pts[2]=0; + } +}; + +//entidad interna de linea +class UTILES_EXPORT CartoBaseLine +{ +public: + int ini; //inidce a punto inicio + int n; //numero de puntos del lineal + CartoBaseLine() + { + n = 0; + ini = -1; + } +}; +//entidad interna de propiedades de pintado +class UTILES_EXPORT CartoBasePaintedProps +{ +public: + int color; //indice a color + int peso; //grosor o tamaño de letra (segun entidad) + int prioridad; //prioridad de pintado + int flags; //flags internos 0x1 (visto para los clear) + CartoBasePaintedProps() + { + color = -1; + peso = 1; + flags = 0; + } +}; +//entidad interna de color +class UTILES_EXPORT CartoBaseColor +{ +public: + + int color; + int flags; //flags internos 0x1 (visto para los clear) + CartoBaseColor() + { + color = 0; + flags = 0; + } +}; + +//entidad base de informacion +class CartoBase; +class UTILES_EXPORT CartoBaseInfoEntity: public SetPtsR +{ +public: + //funciones externas + CartoBasePoint* (*fpto)(CartoBaseInfoEntity *c); + CartoBaseLine* (*fline)(CartoBaseInfoEntity *c); + int i_entity; + + CartoBase* ptr; + + CartoBaseInfoEntity(); + + virtual bool isValid(); //dice si es valido o no la entidad de informacion + virtual CartoBaseInfoEntity next(); //devuelve entidad siguiente + virtual CartoBaseInfoEntity prev(); //devuelve entidad anterior + + //acceso a informacion interna + virtual CartoBasePoint* pto(); + virtual CartoBaseEntity* entity(); + virtual CartoBaseLine* line(); + virtual CartoBasePaintedProps* paintp(); + virtual CartoBaseColor* color(); + virtual CartoEntity* getCopy(CartoEntity *buf=NULL); + //funciones SetPts-------------------------- + virtual double* getPto(int i); + virtual int getNumberPtos(); + + void* getIa(); + double getLong(); + double disMedLines(SetPtsR *line2, double l_avan, double *desv=NULL); + double disMedLines(SetPtsR *line2, double *desv=NULL); + double DisPtoLine(double*p, int* idpto=NULL, double *lamb=NULL); + SetPtsW *GetNPrimePtos(SetPtsW *ldst, int nptos, double dis, BOOL avanza); + bool DivLine(SetPtsW* ldst1, SetPtsW* ldst2, int ip, double lamb); + double *GetPtoDis(double dis, double *dst, double *distTot); + double *PtInLine(int ip, double lamb, double *pp); + double DplineSeg(double* s1, double *s2,int *n=NULL, double *lamd1=NULL,double *lamb2=NULL); +}; +//calse coleccion de entidades +class UTILES_EXPORT SetEntities +{ +public: + virtual CartoBaseInfoEntity getEntity(int i)=0; + virtual int getNumberEntities()=0; +}; + +//clase de filtrado de entidades +class UTILES_EXPORT FilterEntities +{ +public: + virtual bool IsSeletedEntity(CartoBaseInfoEntity *e)=0; +}; + +//array de entidades +class UTILES_EXPORT EntitiesArray: public Cgarray, public SetEntities, public SetPtsR +{ +public: + virtual CartoBaseInfoEntity getEntity(int i); + virtual int getNumberEntities(); + + virtual double* getPto(int i); + virtual int getNumberPtos(); + + EntitiesArray* filter(EntitiesArray* dst, FilterEntities* filter); + bool exportShp(char* path, int type = CartoBaseTypes::Ndef); +}; +//entidad de informacion punto +class UTILES_EXPORT CartoBaseInfoPto +{ +public: + static CartoBasePoint* pto(CartoBaseInfoEntity*c); +}; +//entidad de informacion linea +class UTILES_EXPORT CartoBaseInfoLine +{ +public: + + static CartoBasePoint* pto(CartoBaseInfoEntity*c); + static CartoBaseLine* line(CartoBaseInfoEntity*c); +}; + +//clase constructor de entidades info +class UTILES_EXPORT CartoBaseInfoBuilder +{ +public: + static CartoBaseInfoEntity get(int i, CartoBase* ptr); + static CartoEntity* get(int type); +}; +#endif diff --git a/includes/Utiles/CartoBaseShpManager.h b/includes/Utiles/CartoBaseShpManager.h new file mode 100644 index 0000000..53554de --- /dev/null +++ b/includes/Utiles/CartoBaseShpManager.h @@ -0,0 +1,28 @@ +#pragma once +#include "base_head.h" +#include "garray.h" +#include "CartoBase.h" + +class Cb_file; +class Fshape; +//clase helper para inportacion de shp a un carto base +class UTILES_EXPORT CartoBaseShpManager +{ + CartoBase* cad; + bool ImportPoints(Fshape *shp); + bool Importline(Fshape *shp); + bool ImportPoligon(Fshape *shp); + bool ExportLine(Cb_file *file, Cb_file *fshx, SetEntities *entities); + bool ExportPts(Cb_file *file, Cb_file *fshx, SetEntities *entities); + +public: + CartoBaseShpManager(void); + ~CartoBaseShpManager(void); + + void set(CartoBase* cb){cad = cb;} + + bool ImportShp(Cb_file *file); + + bool ExportShp(Cb_file *file,Cb_file *fshx, SetEntities *entities, int type = CartoBaseTypes::Ndef); + +}; diff --git a/includes/Utiles/CartoElements.h b/includes/Utiles/CartoElements.h new file mode 100644 index 0000000..aaffae3 --- /dev/null +++ b/includes/Utiles/CartoElements.h @@ -0,0 +1,107 @@ +#pragma once + +#include "base_head.h" +#include "CartoBaseDef.h" + +class CartoBaseEntity; +class CartoBasePaintedProps; +class CartoBaseColor; +//clases de elmentos de cartobase +class UTILES_EXPORT CartoEntity : public SetPtsR +{ +public: + virtual int getType()//devuelve tipo de entidad + { + return CartoBaseTypes::Ndef; + }; + + virtual int getnLines() + { + return 0; + } + + virtual CartoEntity* set(CartoBaseInfoEntity *src) + { + return 0; + } + virtual int CopyInTo(CartoBase *src) + { + return -1; + } + virtual double* getPto(int i){return 0;} + + virtual int getNumberPtos(){return 0;} + virtual double disMedLines(SetPtsR *line2, double *desv=NULL); + +}; + +class UTILES_EXPORT CartoComun: public CartoEntity +{ +public: + int flagsUser; + int color; + int peso; + int id;//ide de entidad + int ia; + int idPropsP;//ide de propiedades de pintado al que se va a poner + + CartoComun() + { + flagsUser =0; + color = 0; + peso = 0; + id = -1; + ia=0; + idPropsP = -1; + } + + //auxiliary funcition + bool setInfo(CartoBaseInfoEntity * info); + + CartoBaseEntity* get(CartoBaseEntity * dst); + CartoBasePaintedProps* get(CartoBasePaintedProps * dst); + CartoBaseColor* get(CartoBaseColor * dst); + + +}; + +class UTILES_EXPORT CartoPto: public CartoComun +{ +public: + + double pt[3]; + CartoPto(){}; + virtual int getType()//devuelve tipo de entidad + { + return CartoBaseTypes::Point; + }; + + virtual CartoEntity* set(CartoBaseInfoEntity *src); + + virtual int CopyInTo(CartoBase *src); + virtual double* getPto(int i); + + virtual int getNumberPtos(){return 1;} +}; + +class UTILES_EXPORT CartoLine: public CartoComun, public SetPtsW +{ +public: + Cgarray pts; + CartoLine(){}; + + virtual int getType()//devuelve tipo de entidad + { + return CartoBaseTypes::Line; + }; + + virtual CartoEntity* set(CartoBaseInfoEntity *src); + virtual int CopyInTo(CartoBase *src); + virtual int getNumberPtos(){return pts.n;} + virtual double* getPto(int i); + virtual bool addPto(double* p); + //funciones de geometria---------------------------------- + void invert();//invierte el sentido de los pts + double getLong(); + double *GetPtoDis(double dis, double *dst, double *distTot = NULL); +}; diff --git a/includes/Utiles/Csock_cl.h b/includes/Utiles/Csock_cl.h new file mode 100644 index 0000000..29fe83a --- /dev/null +++ b/includes/Utiles/Csock_cl.h @@ -0,0 +1,50 @@ +#if !defined(AFX_SOCK_SIMPLE_H__8491F9CB_65AF_44E1_80A3_52176804CD08__INCLUDED_) +#define AFX_SOCK_SIMPLE_H__8491F9CB_65AF_44E1_80A3_52176804CD08__INCLUDED_ + +#include +#include "utiles_def.h" +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#endif +#define MODULO_CSOCK_CL "Csock_cl" +#include + +class C_error; +//socket cliente--------------------------------- +class UTILES_EXPORT Csock_cl : public CAsyncSocket +{ +public: + //variables---------------------------------- + BOOL *pirate; + BOOL borra_pirate; + BYTE *buf; + int mb,nb; + Package_head_0 cab; + C_error* er; + int time_sleep;//tiempo espera + int intentos; + bool creado; + //variables aux------------------------------ +private: + BOOL borra_er; + //cons--------------------------------------- +public: + Csock_cl(BOOL*sal=NULL,C_error*e=NULL); + virtual ~Csock_cl(void); + + //funciones---------------------------------- + BOOL Create( UINT puerto=0 , int tipo=SOCK_STREAM , + long evento=FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE , + LPCTSTR ip=NULL ); + + BOOL conectar(char *ipdot,int puerto);//conecta con un puerto y ip + + BOOL recibe_package(int indice);//recibe package y lo pone en buffer apartir de indice; + BOOL envia_package(BYTE* buff, int n, int encrip=0);//envia el buffer en packages si encrip=1 (hacemos encrip1) + //funciones auxiliares----------------------- + void cuida_buf(int n);//asegura en buf un espacio de n bytes; + BOOL recibe(BYTE*b, int n);//recive n bytes y lo pone en b; + BOOL envia(BYTE*buff, int n);//envia bytes sin mas; + +}; diff --git a/includes/Utiles/DijkstraUtiles.h b/includes/Utiles/DijkstraUtiles.h new file mode 100644 index 0000000..241b782 --- /dev/null +++ b/includes/Utiles/DijkstraUtiles.h @@ -0,0 +1,206 @@ +#pragma once +#ifndef DijkstraUtiles_h +#define DijkstraUtiles_h +#include +#include +#include +#include "mapmatrix.h" +#ifndef MAYUSCULO +#define MAYUSCULO (double) 1.e+30 + +#endif +#ifndef MINUSCULO +#define MINUSCULO (double) 1.e-20 +#endif + +#define EXT_ARCH_DIJ_DEFAULT "ndj" +#define NOMB_ARCH_DIJ_DEF "snodos_dj" + +/** + * Estructura de elemento de la cola para el cálculo de caminos óptimos por Dijkstra + */ +struct Djkt_elem_cola +{ + int id; // dat; + inline BOOL operator[](__int64 i) + { + BYTE j =(BYTE)(1<<(i%(sizeof(BYTE)*8))); + return (BOOL)((dat[(int)(i/(sizeof(BYTE)*8.))] & j) == j); + } + inline void set(__int64 i, BOOL v) + { + BYTE j; + j =(BYTE)(1<<(i%(sizeof(BYTE)*8))); + + if(!v) + { + j = ~j; + dat[(int)(i/(sizeof(BYTE)*8.))] &= j; + return; + } + dat[(int)(i/(sizeof(BYTE)*8.))] |= j; + } + + inline BOOL dimensiona(__int64 n) + { + dat.n = 0; + int nn = (int)(0.5+n/(sizeof(BYTE)*8.)); + if(!(dat+=nn)) + return FALSE; + dat.n = nn; + return TRUE; + } + inline void setAll(BOOL v) + { + BYTE j = 0; + if(v) + j =~j; + memset(dat.ptr, j, dat.n*sizeof(BYTE)); + } +}; +//************************************************************************************* +class UTILES_EXPORT DijkstraUtiles +{ +public: + static BOOL dijkstra_ang_inv_ok(CmapMatFloat &costes, Djkt_ang_ady *angs, int n, int fin, Djkt_nodo **nodos, FlagsArray *visto_ang_); + static double ruta_dj_inv_ok(int id_ini, int *secu, Djkt_nodo *nodos, int nmax, int *n); + static double ruta_dj_inv(int id_ini, int *secu, Djkt_nodo *nodos, int nmax, int *n); +}; + +//************************************************************************************* +/** +* Clase de manejo de archivos de nodos djtra +* cada archivo tiene un numero de bloques o array de nodos de longitud fija "nnod" +*/ +//estructura cabecera de archivo +typedef struct Head_dj_arch +{ + int version; //version del archivo + int nn; //numero de nodos por bloque + int nb; //numero de bloques del dj + int max_conex; //maximo de conexiones por nodo + +}Head_dj_arch; +#define VERSION_DJ_ARCHI 100 +#define MAX_CONEX_DJ_ARCHI 16 + +class UTILES_EXPORT InfoIndice +{ +public: + virtual int get(int iamb, int iextremo) = 0;//da del ambito iamb el indice a inicio o a fin //si iextremo es o o 1 +}; + +class UTILES_EXPORT Cdijkstra_arch +{ +public: + char extension[16];//extension de archivos + char path[MAX_PATH];//nombre sin extension + Head_dj_arch hd;//cabecera de archivo + int sizn;//tamaño en BYTES de cada nodo + BOOL salta_ids_padres; + //int flags;//0x1-->modo escritura 0x2-->modo lectura + //info de distancias ambitos + float *dis;//distancia de un nodo a otro (matriz de nnod*nnod) + int nod_amb;//nodos por ambito + int nambi;//numero de ambitos + int nnod;//numero de nodos por fila + int id_instal;//fila planta + int id_plan;//fila instal + int nod_instal;//nodo instalacion + int nod_plan;//nodo planta + int tip_ambitos; + + InfoIndice* ia;//puntero a info asoc + + //funciones-------------------------------------------------------------------------- + Cdijkstra_arch(); + ~Cdijkstra_arch(); + + BOOL inicia(char* path_arch, BOOL nuevo=FALSE, BOOL borra = TRUE, int n_nod=0, int max_conex=MAX_CONEX_DJ_ARCHI);//si nuevo -> crea vacio + BOOL add_b(Djkt_nodo* blq, int iref, int inod, BOOL pon_inf=FALSE);//añade un bloque a el archivo + BOOL inicia_inf_amb(InfoIndice* ina, int namb,int tip_amb, int id_instal=-1, int id_plan=-1); + void pon_info_amb(Djkt_nodo* nodos, int iref,int ib); + Djkt_nodo* get_b(int iref, int ibloq, Djkt_nodo* buf=NULL);//develve el bloque ibloq-esimo + float dame_dis(int aorig,int norig, int ades, int n_des); + + Djkt_nodo* dame_buf_nodos(BOOL angulos=FALSE ); + void libera_buf(Djkt_nodo* buf ); + BOOL graba_dis(int id); + BOOL lee_dis(); +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/Fdbf.h b/includes/Utiles/Fdbf.h new file mode 100644 index 0000000..94a7eef --- /dev/null +++ b/includes/Utiles/Fdbf.h @@ -0,0 +1,184 @@ +#pragma once +#ifndef Fdbf_H +#define Fdbf_H +#include "base_head.h" +#include "b_file.h" +#include "garray.h" +#pragma pack(1) + +typedef struct Hdr_dbf +{ + BYTE ver,year,mes,dia; // cuatro primeros bytes + long nrec; // nº de records (filas) + short nb_cab; // nº de bytes de la cabecera + short nb_rec; // nº de bytes de cada record + BYTE res[20]; +} Hdr_dbf; + +typedef struct Fld_dbf +{ + char nombre[11]; // nombre del campo + BYTE tipo; // tipo de campo + // C caracter + // N número + // L lógico (Y/N,T/F, y mas) + // D fecha (YYYYMMDD) + // F float, double + BYTE res1[4]; + BYTE nb; // nº de bytes del campo + //Nuevo elena 201709 + union + { + BYTE res2[15]; + struct{ + + + BYTE nd; //nº de decimales + BYTE res2_[14]; + }; + }; +} Fld_dbf; + +#pragma pack(8) + +#define DBF_TYPE_DATA_STR 'C' +#define DBF_TYPE_DATA_I64 'D' +#define DBF_TYPE_DATA_D 'F' +#define DBF_TYPE_DATA_BOOL 'L' +#define DBF_TYPE_DATA_BIN 'M' +#define DBF_TYPE_DATA_I 'N' + +//clase base de dbf------------------------------------- +class UTILES_EXPORT Fdbf +{ + Hdr_dbf head; + Cgarraycolm; + Cgarray buf;//buffer de fila + Cgarray buf2;//buffer auxi + + CgarrayiniCol;//indice a el bite deonde empieza la columna iesima dentro de una fila + Cb_file *f; + int nReadRow;//numero de filas leidas actualmente +public: + Fdbf(void); + ~Fdbf(void); + + //funciones de lectura + bool lee( Cb_file *file); + int leeNexRow();//devuelve 1 si ok 0 si no mas -1 si error + + double getD(int ncol); + int getI(int ncol); + char* getStr(int ncol); + __int64 getI64(int ncol); + char* get(int ncol);//devuelve buffer tal cual + + BYTE getType(int ncol); + char* getName(int ncol); + int findCol(char *name); + + int getSize(int ncol); + int getNrow(); + int getNcolm(); + //funciones de escritura + bool set(int ncol, int nRow, Cb_file *file); + bool setCol(int icol, char *name, BYTE type, int size, int ndecimals=0); + + bool addVal(int icol, int v); + bool addVal(int icol, double v); + bool addVal(int icol, __int64 v); + bool addVal(int icol, char* v); + bool addVal(int icol, void* v); + bool finRow(); + +private: + bool bufMem(int ncol); + bool iniciaRecords(); +}; + +//clase lisener de lectura +class UTILES_EXPORT ListenerDbf_W +{ +public: + virtual bool DbfSet(int nrow, int ncolm){return true;} + virtual bool DbfSetColm(char* name, BYTE type, int size){return true;} + virtual bool DbfaddVal(int icol, int v){return true;} + virtual bool DbfaddVal(int icol, double v){return true;} + virtual bool DbfaddVal(int icol, __int64 v){return true;} + virtual bool DbfaddVal(int icol, char* v){return true;} + virtual bool DbfaddVal(int icol, void* v){return true;} + virtual bool DbfFinRow(){return true;} + virtual bool DbfFinR(){return true;} + +}; +//clase lisener de escritura +class UTILES_EXPORT ListenerDbf_R +{ +public: + virtual bool DbfGet(int *nrow, int *ncolm){return false;} + virtual bool DbfGetColm(int icol, char* name, BYTE *type, int *size, int*ndecimal){return false;} + virtual bool DbfGetVal(int irow, int icol, int* v){return false;} + virtual bool DbfGetVal(int irow, int icol, double* v){return false;} + virtual bool DbfGetVal(int irow, int icol, __int64* v){return false;} + virtual bool DbfGetVal(int irow, int icol, char** v){return false;} + virtual bool DbfGetVal(int irow, int icol, void** v){return false;} + virtual bool DbfFinW(){return false;} + +}; + + +//clase manager dbf------------------------- +class UTILES_EXPORT ManagerDbf +{ +public: + static bool leer(Cb_file *file, ListenerDbf_W* lr); + static bool grabar(Cb_file *file, ListenerDbf_R* lw); + + static bool leer(char* file, ListenerDbf_W* lr); + static bool grabar(char* file, ListenerDbf_R* lw); +}; + +#endif +/* +ejemplo de uso-------------------------------- +escritura--------- +if(!f.abre("d:\\temp\\p2.dbf",2,true)) +error =true; +if(!dbf.set(3,5,&f)) +error = true; +if(!dbf.setCol(0,"id",DBF_TYPE_DATA_I,10)) +error = true; +if(!dbf.setCol(1,"idf",DBF_TYPE_DATA_D,10,3)) +error = true; +if(!dbf.setCol(2,"str",DBF_TYPE_DATA_STR,128)) +error = true; +for(int i =0; i<5; i++) +{ +if(!dbf.addVal(0,i)) +error = true; +if(!dbf.addVal(1,i+(i*1./10))) +error = true; +if(!dbf.addVal(2,"holaHolita")) +error = true; +if(!dbf.finRow()) +error = true; +} +f.cierra(); +//lectura +if(!f.abre("d:\\temp\\p2.dbf",1)) +error =true; +if(!dbf.lee(&f)) +error = true; +idd =dbf.leeNexRow(); +while(idd ==1) +{ +int ii = dbf.getI(0); +double d= dbf.getD(1); +char* ss = dbf.getStr(2); + +ii++; +d++; +ss[0]=0; +idd =dbf.leeNexRow(); +} +*/ \ No newline at end of file diff --git a/includes/Utiles/GdataTable.h b/includes/Utiles/GdataTable.h new file mode 100644 index 0000000..6f5930a --- /dev/null +++ b/includes/Utiles/GdataTable.h @@ -0,0 +1,74 @@ +#pragma once +#ifndef GdataTable_h +#define GdataTable_h +//tabla de datos generica +//tabla con nombre de columnas +#include "base_head.h" +#include "garray.h" +#include "StrArray.h" +class UTILES_EXPORT GdataTableColum +{ +public: + int type;//tipo de dato + int nb;//numero de bytes de informacion + int flags; +}; + +class UTILES_EXPORT GdataTable +{ + Cgarraybuf; //array de Garray de datos + Cgarraycolm; //datos de columnas + StrArray colmName; //nombre de columnas + +public: + enum TypedataTable + { + Tndef=0, + Tbool, + Tint, + Tdouble, + Tint64, + Tstring, + Tbin, + Tntip + }; + GdataTable(void); + ~GdataTable(void); + + //funciones de lectura y set------------ + int getType(int icol); + int getInd(char* colName); + int nRow(); + int nColm(); + int getSize(int icol); + int getSizeASCII(int icol); + + char* getName(int icol); + bool rename(int icol, char* nomb); + int* getI(int row, int colm); + __int64* getI64(int row, int colm); + double* getD(int row, int colm); + char* getS(int row, int colm); + void* getBin(int row, int colm); + bool* getBool(int row, int col); + + void* get(int row, int colm); + //funciones de modificacion------------- + + //adicionar----------------------------- + bool addColm(char* name, int type, int size=0); + bool addRow(int nrow); + bool addMemRow(int nrow); + //borrado------------------------------- + void delAllRow();//borra todas las filas + void delAll();//borra todo + + void removeRow(int i); + void removeColm(int i); + + //ajusta memoria + void clear(); + //funciones auxiliares-------------------- +private: +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/GeometryFunction.h b/includes/Utiles/GeometryFunction.h new file mode 100644 index 0000000..90095c8 --- /dev/null +++ b/includes/Utiles/GeometryFunction.h @@ -0,0 +1,78 @@ +#pragma once +#ifndef GeometriFunction_h +#define GeometriFunction_h +#include "base_head.h" +#include "cartoBaseDef.h" +#include "garray.h" + +class UTILES_EXPORT GeometryFunction +{ +public: + //distancia entre 2 ptos + static double Dist2d(double*p1, double*p2); + //longitud de la linea + static double LongLine2d(SetPtsR *line); + //distancia de un punto p a una linea infinita de puntos l1 y l2 + static double Dpline(double* l1, double *l2, double *p, double *lamb = 0); + //distancia de punto p a segmento s1-s2 + static double DpSeg(double* s1, double *s2, double *p, double *lamb = 0); + //interseccion entre lineas (formada por l11-l12) a otra linea (formada por l21-l22) + static double* intersecLine(double* l11, double *l12, double* l21, double *l22, double *p_inters); + //distancia entre linea (l1-l2)y segmento(s1,s2) + static double DLineSeg(double* l1, double *l2, double* s1, double *s2, double *lamdl,double *lambs, bool*paralelos ); + + //distancia entre linea (l1-l2)y segmento(s1,s2) + static double DsegSeg(double* s11, double *s12, double* s21, double *s22, double *lamd1,double *lamb2); + //distancia de polilinea a segmento + static double DplineSeg(SetPtsR* line1, double* s1, double *s2,int *n=NULL, double *lamd1=NULL,double *lamb2=NULL); + + + //calcula coordenadas minimas y maximas + static void CompMima(double dst[2][3], SetPtsR* pts); + //calcula envoltura convexa + static Cgarray* EnvConvex(SetPtsR* pts, Cgarray* dst); + //distancia de un punto a una linea + static double DisPtoLine(SetPtsR* line, double*p, int* idpto=NULL, double *lamb=NULL); + //distancia media entre dos líneas + static double DisMedLines( SetPtsR* line1, SetPtsR* line2, double *desv=NULL); + static double DisMedLines( SetPtsR* line1, SetPtsR* line2, double l_avan, double *desv=NULL); + //parte una linea en 2 + static bool DivLine(SetPtsR* linesrc, SetPtsW* ldst1, SetPtsW* ldst2, double dis); + //dado el ip y el lamb da la distancia desde el principio de la linea + static double DisInLine(SetPtsR* linesrc, int ip, double lamb); + //dado el ip y el lamb da la distancia desde el punto contenido en la línea + static double *PtInLine( SetPtsR* linesrc, int ip, double lamb , double *pp ); + //devuelve los nptos primeros puntos de line, equiespaciados dis + //si avanza, los coge del principio, si no, del final + static SetPtsW *GetNPrimePtos(SetPtsR* line, SetPtsW *ldst, int nptos, double dis, BOOL avanza); + + //divide la linea en partes equidistantes + static bool DivLine(SetPtsR* line, SetPtsWBuilder *manager, double dis); + + //devuelve el punto que esta en la polilinea a una distancia dist + static double* GetPto(SetPtsR* line, double dis, double *dst, double *distTot = NULL); + + static double ang_vect_ptos(double (*ptos1)[][3], double (*ptos2)[][3]); + + //devuelve el angulo que forman los 2 vectores + static double AngVect(double v1[2], double v2[2]); + //dice si el punto p esta a la derecha de la linea que forman los puntos ip1 y ip2 + static bool IsDer(SetPtsR* ptos, double *p, int ip1, int ip2); + static double ProdEscalar(SetPtsR* line1, SetPtsR* line2); + + //funcion auxiliar potencia + static inline double Poten(double bas, int exp = 2) + { + if(exp<=0) + return 0; + double res = bas; + while(exp>1) + { + res = res * bas; + exp--; + } + return res; + } +}; + +#endif \ No newline at end of file diff --git a/includes/Utiles/IaDataTable.h b/includes/Utiles/IaDataTable.h new file mode 100644 index 0000000..6199b1d --- /dev/null +++ b/includes/Utiles/IaDataTable.h @@ -0,0 +1,45 @@ +#pragma once + +#ifndef IaDataTable_h +#define IaDataTable_h +#include "gdatatable.h" +#include "base_head.h" +#include "CartoBaseDef.h" +#include +class CartoBase; +//tabla de datos para albergar informacion asiciada generica (diseñada para el cartobase) +class UTILES_EXPORT IaDataTable : + public GdataTable, public DataIaCartoBase +{ + std::map RefIndex;//indexado por referencias; + std::map rowIndex;//indexado por filas; + CartoBase* _cb; + int auxnrow,auxcolm,auxref,auxc; +public: + IaDataTable(void); + ~IaDataTable(void); + + virtual void* IaGet( int refEnt ); + virtual void CBSet( CartoBase* cb ); + virtual void IaRemove( int refEnt ); + virtual void IaRemoveAll(); + virtual void IaAdd( int refEnt ); + virtual bool IaSet( int nrow, int ncolm ); + virtual bool IaSetColm( int icol, char* name, BYTE type, int size ); + virtual bool IaAddVal( int refEnt, int icol, int v ); + virtual bool IaAddVal( int refEnt, int icol, double v ); + virtual bool IaAddVal( int refEnt, int icol, __int64 v ); + virtual bool IaAddVal( int refEnt, int icol, char* v ); + virtual bool IaAddVal( int refEnt, int icol, void* v ); + virtual bool IaFinRow( int refEnt ); + virtual bool IaFinR(); + virtual bool IaGetSize( int *ncolm ); + virtual bool IaGetColm( int icol, char* name, BYTE *type, int *size, int*ndecimal ); + virtual bool IaGetVal( int refEnt, int icol, int* v ); + virtual bool IaGetVal( int refEnt, int icol, double* v ); + virtual bool IaGetVal( int refEnt, int icol, __int64* v ); + virtual bool IaGetVal( int refEnt, int icol, char** v ); + virtual bool IaGetVal( int refEnt, int icol, void** v ); + virtual bool IaFinW(); +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/ManagerDbfGdataTable.h b/includes/Utiles/ManagerDbfGdataTable.h new file mode 100644 index 0000000..4fe04fb --- /dev/null +++ b/includes/Utiles/ManagerDbfGdataTable.h @@ -0,0 +1,52 @@ +#pragma once + +#ifndef ManagerDbfGdataTable_H +#define ManagerDbfGdataTable_H + +#include "base_head.h" +#include "Fdbf.h" + +class IAddColDbf +{ +public: + int size = 0; + virtual void setData(int i, void *data)=0; +}; +class GdataTable; +class UTILES_EXPORT ManagerDbfGdataTable: public ListenerDbf_W, public ListenerDbf_R +{ + + GdataTable *_dt; + int _nrow; + int _ncolm; + public: + ManagerDbfGdataTable(void); + ~ManagerDbfGdataTable(void); + + bool LeeDbf(char* path, GdataTable *dt); + bool grabaDbf(char* path, GdataTable *dt); + bool AddCol( char* path, char* name, BYTE type,IAddColDbf *dt, int size=0); + bool DelCol(char* path, char* name); + + //funciones de herencia---------------------------------------- + //LisenerDbf_R------------------------------------------------- + virtual bool DbfSet( int nrow, int ncolm ); + virtual bool DbfSetColm( char* name, BYTE type, int size ); + virtual bool DbfaddVal( int icol, int v ); + virtual bool DbfaddVal( int icol, double v ); + virtual bool DbfaddVal( int icol, __int64 v ); + virtual bool DbfaddVal( int icol, char* v ); + virtual bool DbfaddVal( int icol, void* v ); + virtual bool DbfFinRow(); + virtual bool DbfFinR(); + //LisenerDbf_W---------------------------------------------------- + virtual bool DbfGet( int *nrow, int *ncolm ); + virtual bool DbfGetColm(int icol, char* name, BYTE *type, int *size, int*ndecimal ); + virtual bool DbfGetVal(int irow, int icol, int* v ); + virtual bool DbfGetVal(int irow, int icol, double* v ); + virtual bool DbfGetVal(int irow, int icol, __int64* v ); + virtual bool DbfGetVal(int irow, int icol, char** v ); + virtual bool DbfGetVal(int irow, int icol, void** v ); + virtual bool DbfFinW(); +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/Matrix2d.h b/includes/Utiles/Matrix2d.h new file mode 100644 index 0000000..126a5b3 --- /dev/null +++ b/includes/Utiles/Matrix2d.h @@ -0,0 +1,104 @@ + +#pragma once + +#ifndef Matrix2d_h +#define Matrix2d_H + +#include "b_file.h" +#include "garray.h" +//matiz de clases genericas de 2 dimensiones +template +class ComClasFunction +{ +public: + virtual Tc comp(Tc a, Tc b) = 0; +}; +template +class Matrix2d +{ + Cgarray dat; + int ysize; +public: + Matrix2d() + { + ysize = 0; + } + bool inline inicia(int xmax, int ymax) + { + ysize = ymax; + dat.borra(); + if(!(dat+=xmax*ymax)) + return false; + dat.n = xmax*ymax; + return true; + } + + inline ClasVal* operator[](int x)//devuelve puntero a fila x + { + return dat.get(x*ysize); + } + + //******************************************************************************************************* + + inline bool graba( char* path ) + { + Cb_file file; + if(!file.abre(path,2,TRUE)) + return false; + if(!file.escribe(&ysize, sizeof(ysize))) + return false; + if(!dat.graba(&file)) + return false; + return true; + } + inline bool lee( char* path ) + { + Cb_file file; + if(!file.abre(path,1,FALSE,TRUE)) + return false; + if(!file.lee(&ysize, sizeof(ysize))) + return false; + if(!dat.leer(&file)) + return false; + return true; + } + inline void clear() + { + dat.borra(); + } + inline bool fileMix( char* path, ComClasFunction *ccomp ) + { + if(ysize<=0) + return false; + Cgarray fdat; + int yfile, xfile; + Cb_file file; + if(!file.abre(path,1,FALSE,TRUE)) + return false; + //lee tamaño matriz + if(!file.lee(&yfile, sizeof(yfile))) + return false; + if(!file.lee(&xfile, sizeof(xfile))) + return false; + xfile = xfile/yfile; + //inicia buffer + if(!(fdat+=yfile)) + return false; + //calcula numero de bytes a leer y margenes de matriz + int nb = sizeof(ClasVal)*yfile; + xfile = min(xfile, dat.n/ysize); + yfile = min(yfile, ysize); + for(int x = 0 ; xcomp(dat.get(x*ysize)[y], fdat[y]); + } + + return true; + } +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/StrArray.h b/includes/Utiles/StrArray.h new file mode 100644 index 0000000..d9ae8b3 --- /dev/null +++ b/includes/Utiles/StrArray.h @@ -0,0 +1,38 @@ +#pragma once +#ifndef StrArray_h +#define StrArray_H + +#include "base_head.h" +class UTILES_EXPORT StrArray +{ + //variables------------------------------ + int incremento_char; + int incremento_str; +public: + char *str; + int n_str;//numero de chars + int m_str;//memoria reser + int (*ind)[]; + int n_i;//numero de str + int m_i;//memoria reser + //constructor---------------------------- +public: + StrArray(void); + ~StrArray(void); + //funciones------------------------------ + char* get(int i);//da string i + void add(char*c);//mete str + void add(char*c, int ncharReser);//mete str y reserva en memoria un minimo de ncharReser; + void add( StrArray* st );//mete un array entero de caracteres + void borra(int i);//borra el elemento iesimo + int size();//da numero de str + void borra();//borra todo + void compacta();//reduce al minimo la memoria necesaria para comtener la informacion + StrArray* filtra(StrArray*buf, char *filter); + BOOL replace(int i, char* cadena); + int find(char* st); + //funciones aux------------------------- +private: + void cuida_memoria(int n,int ni=1);//asegura tener memoria para un str mas +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/TaskProcess.h b/includes/Utiles/TaskProcess.h new file mode 100644 index 0000000..3009a32 --- /dev/null +++ b/includes/Utiles/TaskProcess.h @@ -0,0 +1,32 @@ +#pragma once +#include +#include "th.h" +#ifndef TaskProcess_h +#define TaskProcess_h +/* +Tarea delegada en otro proceso(normalmente en programa de consola) +definir en funcion override run la tarea +*/ +class Csock_cl; +class UTILES_EXPORT TaskProcess: public Cth +{ + Csock_cl *sc; +public: + bool pirate;//indica que hay que irse + + TaskProcess(void); + ~TaskProcess(void); + bool initTask(char* url, int port, __int64 timer); + bool envia(void * buf, int nb);//envia buffer al proceso principal + void* recibe(int *nb );//recibe del proceso principal nb da el numero de bytes recib + //overrides---------------------------------- + void cancela();//cancela tarea; + virtual void preTask()=0; + virtual void inTask()=0; + virtual void postTask()=0; + + virtual bool conecta(char* url, int port); + virtual void desconecta(); + +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/_app.h b/includes/Utiles/_app.h new file mode 100644 index 0000000..76cfdcb --- /dev/null +++ b/includes/Utiles/_app.h @@ -0,0 +1,36 @@ +#pragma once +#include "base_head.h" +#include +#include "_error.h" +#include "dir_manager.h" +#include "_log.h" + +class UTILES_EXPORT C_app //clase aplicacion---- +{ + static C_app *p_app;//puntero a la clase aplicacion + +public: + //variables globales----------------------- + Cdir_manager archi;//manager de archivos + C_log log;//clase de trazas (log) + C_error er;//clase de manejo de errores; + //variables de thread; + BOOL pirate;//indica a los thread que hay que irse + long nth;//indica el numero de thread que hay activos + C_app(void); + virtual ~C_app(void); + //funciones y overrides------------ + static C_app* GetApp(); + BOOL inicio(); + int fin(); + void suma_th();//añade al conteo de thread +1 + void resta_th();//disminulle el conteo de thread en 1 + virtual BOOL on_inicia();//funcion inicia lo necesario para el programa + virtual BOOL on_cierra();//funcion que se ejecuta al final del todo antes de cerrar + + virtual void cierra();//fuerza el fin de la aplicacion; +protected: + +}; + + diff --git a/includes/Utiles/_error.h b/includes/Utiles/_error.h new file mode 100644 index 0000000..addbae9 --- /dev/null +++ b/includes/Utiles/_error.h @@ -0,0 +1,19 @@ +#pragma once +#include "base_head.h" + +class UTILES_EXPORT C_error +{ +public: + //variables----------------------------- + char modulo[32];//parte del programa que causa el error + char msg[256];//mensaje de error + int tipo;//codigo de error + //constructor--------------------------- + C_error(void); + virtual ~C_error(void); + //funciones----------------------------- + void pon(char *mod, char *mens, int tip=-1);//pone error propio + void pon_win(char *modulo);//pone error windows + void aclara(char *mens);//pone aclaracion + void limpia();//limpia error +}; diff --git a/includes/Utiles/_log.h b/includes/Utiles/_log.h new file mode 100644 index 0000000..0f56f96 --- /dev/null +++ b/includes/Utiles/_log.h @@ -0,0 +1,42 @@ +#pragma once +#include "base_head.h" +#include "lock.h" +#include +typedef struct Msg_evento_log +{ + int id_e; + char nivel[64]; + char mensage[256]; + __time64_t tiempo; +}Msg_evento_log; +class C_error; +class UTILES_EXPORT C_escucha_log//clase para escuchar eventos de log +{ +public: + virtual void log_ext(__time64_t tiemp, char *modulo, char *fmt)=0; +}; +class UTILES_EXPORT C_log//clase para logear eventos +{ +public: + //variavles----------------------------------------- + HFILE archivo_log; + int nb; + Clock cerrojo; + C_escucha_log *l_lisener;//puntero a escucha actual + //BOOL log_consola; + char nombre[32]; + char path[256]; + + void (*log_ext)(__time64_t tiemp, char *modulo, char *fmt);//funcion de log externa + C_log(void); + ~C_log(void); + //funcion------------------------------------------- + void loguea(__time64_t tiemp, char *modulo, char *fmt);//añade un suceso + void loguea(char *modulo, char *fmt);//añade suceso actual + void loguea(C_error *er);//añade el error como suceso + static void log(char *modulo, char *fmt,...);//funcion estatica para loguear + static void log( C_error *er ); + //static void log(std::string &mod, std::string &msg); + +}; + diff --git a/includes/Utiles/_proceso.h b/includes/Utiles/_proceso.h new file mode 100644 index 0000000..9451101 --- /dev/null +++ b/includes/Utiles/_proceso.h @@ -0,0 +1,28 @@ +#pragma once +#include "base_head.h" + +const DWORD MS_VC_EXCEPTION_PROCESO_UTILES=0x406D1388; + +#pragma pack(push,8) +typedef struct tagTHREADNAME_INFO +{ + DWORD dwType; // Must be 0x1000. + LPCSTR szName; // Pointer to name (in user addr space). + DWORD dwThreadID; // Thread ID (-1=caller thread). + DWORD dwFlags; // Reserved for future use, must be zero. +} THREADNAME_INFO; +#pragma pack(pop) + +class UTILES_EXPORT C_proceso//proceso base +{ +public: + C_proceso(void); + char nombre[32]; + CWinThread * m_thread; + virtual ~C_proceso(void); + BOOL lanza(char *nombre=NULL);//lanzar thread + virtual void run();//funcion que hace el thread + void join();//espera al thread +}; +UINT main_c_proceso(LPVOID pp); +UTILES_EXPORT void SetThreadName( DWORD dwThreadID, char* threadName); \ No newline at end of file diff --git a/includes/Utiles/b_file.h b/includes/Utiles/b_file.h new file mode 100644 index 0000000..7926eed --- /dev/null +++ b/includes/Utiles/b_file.h @@ -0,0 +1,175 @@ +#pragma once +#include "base_head.h" +#include "_error.h" +#include "utiles_def.h" +class UTILES_EXPORT Cb_file: public IdataTransfer//manejo de archivos binarios +{ +private: + HANDLE hfile;//hanled del archivo + LARGE_INTEGER li;//se usa para dividir enteros de 64 + DWORD dw;//bites movidos y respuestas al escribir +public: + C_error *er; + + Cb_file(void); + ~Cb_file(void); + //****************************************************************************************************************** + //funciones-------------------------------------------------------------------- + //****************************************************************************************************************** + inline BOOL abierto() + { + return hfile != INVALID_HANDLE_VALUE; + }; + //****************************************************************************************************************** + BOOL abre(char* path,int modo, BOOL sobre_escri=FALSE, BOOL shared=FALSE);//modo 1 lectura modo 2 escritura modo 3 ambos + //****************************************************************************************************************** + inline void cierra()//cierra archivo; + { + if (hfile != INVALID_HANDLE_VALUE) + { + CloseHandle(hfile); + hfile=INVALID_HANDLE_VALUE; + } + } + //****************************************************************************************************************** + QWORD size();//te devuelve el tamaño del archivo en bytes + //****************************************************************************************************************** + inline BOOL lee(void* buf,int nb)//lee un numero de bites y lo pone en buf + { + if (!ReadFile(hfile, (LPSTR) buf ,nb,&dw,NULL)) + { + if (er) + er->pon_win("Cb_file"); + //cierra--------------------- + if (hfile != INVALID_HANDLE_VALUE) + { + CloseHandle(hfile); + hfile=INVALID_HANDLE_VALUE; + } + //--------------------------- + return FALSE; + } + return TRUE; + } + //****************************************************************************************************************** + inline BOOL escribe(void* buf,int nb)//escribe numero de bites + { + if (!WriteFile(hfile, (LPSTR) buf ,nb,&dw,NULL)) + { + if (er) + er->pon_win("Cb_file"); + //cierra--------------------- + if (hfile != INVALID_HANDLE_VALUE) + { + CloseHandle(hfile); + hfile=INVALID_HANDLE_VALUE; + } + //--------------------------- + return FALSE; + } + return TRUE; + } + //****************************************************************************************************************** + inline BOOL irAfin()//va a la posicion del final del archivo + { + dw=SetFilePointer(hfile,0,NULL,FILE_END); + if(dw==INVALID_SET_FILE_POINTER) + { + if (er) + er->pon_win("Cb_file"); + //cierra--------------------- + if (hfile != INVALID_HANDLE_VALUE) + { + CloseHandle(hfile); + hfile=INVALID_HANDLE_VALUE; + } + //--------------------------- + return FALSE; + } + return TRUE; + } + //****************************************************************************************************************** + BOOL irAini(int nb=0)//va al inicio del archivo + nb bytes; + { + + dw=SetFilePointer(hfile,nb,NULL,FILE_BEGIN); + if(dw==INVALID_SET_FILE_POINTER) + { + if (er) + er->pon_win("Cb_file"); + //cierra--------------------- + if (hfile != INVALID_HANDLE_VALUE) + { + CloseHandle(hfile); + hfile=INVALID_HANDLE_VALUE; + } + //--------------------------- + return FALSE; + } + return TRUE; + } + //****************************************************************************************************************** + BOOL irA(int nb=0)//salta nbites; + { + + dw=SetFilePointer(hfile,nb,NULL,FILE_CURRENT); + if(dw==INVALID_SET_FILE_POINTER) + { + if (er) + er->pon_win("Cb_file"); + //cierra--------------------- + if (hfile != INVALID_HANDLE_VALUE) + { + CloseHandle(hfile); + hfile=INVALID_HANDLE_VALUE; + } + //--------------------------- + return FALSE; + } + return TRUE; + } + //****************************************************************************************************************** + inline BOOL irAini( QWORD nb)//entero de 64 bytes + { + li.QuadPart = nb; + dw=SetFilePointer(hfile,li.LowPart,&li.HighPart,FILE_BEGIN); + if(dw==INVALID_SET_FILE_POINTER) + { + if (er) + er->pon_win("Cb_file"); + //cierra--------------------- + if (hfile != INVALID_HANDLE_VALUE) + { + CloseHandle(hfile); + hfile=INVALID_HANDLE_VALUE; + } + //--------------------------- + return FALSE; + } + return TRUE; + } + + virtual __int64 getNB_it() + { + return size(); + } + + virtual __int64 getNext_it( void* buf,__int64 nb ) + { + if(lee(buf,(int)nb)) + return nb; + return -1; + } + + virtual bool setPosition_it( __int64 nb ) + { + return irAini((int)nb) ==TRUE; + } + + virtual bool set_it( void* buf, __int64 nb ) + { + return escribe(buf,(int)nb) == TRUE; + } + //****************************************************************************************************************** + +}; diff --git a/includes/Utiles/base_head.h b/includes/Utiles/base_head.h new file mode 100644 index 0000000..c5648ce --- /dev/null +++ b/includes/Utiles/base_head.h @@ -0,0 +1,22 @@ +#pragma once + +#ifndef UTILES_EXPORT +#ifdef _WINDLL +#define UTILES_EXPORT __declspec(dllexport) +#else +#define UTILES_EXPORT __declspec(dllimport) +#endif +#endif + +#include +#ifndef UINT16_MAX +#define UINT16_MAX 0xffff +#endif +#ifdef _WIN64 +typedef __int64 ssize_t; +#else +typedef _w64 int ssize_t; + +#endif + +#pragma warning(disable:4996) diff --git a/includes/Utiles/dir_manager.h b/includes/Utiles/dir_manager.h new file mode 100644 index 0000000..b89f7ec --- /dev/null +++ b/includes/Utiles/dir_manager.h @@ -0,0 +1,43 @@ +#pragma once +#include "base_head.h" + +class C_error; +class StrArray; +class UTILES_EXPORT Cdir_manager//clase para manejar carpetas +{ +public: + + //carpetas------------------------------------------------------- + char dir_work[FILENAME_MAX]; + char dir_exe[FILENAME_MAX]; + char dir_log[FILENAME_MAX]; + char dir_datos[FILENAME_MAX]; + //archivos------------------------------------------------------- + char path_conf[FILENAME_MAX]; + //rutas de ejecucion--------------------------------------------- + char dir_ejecucion[FILENAME_MAX]; + char path_ejecutable[FILENAME_MAX]; + //funciones------------------------------------------------------ + Cdir_manager(void); + ~Cdir_manager(void); + //funciones------------------------------------------------------ + void absoluta(char *ruta); + void relativa(char *ruta); + + BOOL lee_reg(char* clave, C_error *er=NULL); + BOOL rellena_dirs_ejecucion(); + //funciones estaticas--------------------------------------- + static char* dir_anterior(char*dir);//da el directorio anterior + static char* nombre_archivo(char *path,char*nombre);//devuelve en nombre el nombre del archivo + static char* extension_archivo(char *path);//te da la extension de un path o de un nombre de archivo + static char* cambia_extension_archivo(char *path, char *pathDst, char *newext);//te da la extension de un path o de un nombre de archivo + static BOOL crea_dir(char *path);//asegura que existe los directorios indicados + static BOOL borra_archivos(char *paht, char *ext, BOOL recursivo = FALSE);//borra archivos de una extension dada, si ext es null borra todos + //funciones de listado----------- + static BOOL listar_elementos(char *dir,StrArray *files,StrArray *dirs,C_error *er=NULL);//dice los files y las dir dentro de un dir(no recursivo) + static BOOL lista_files(char *dir,StrArray *files,BOOL recursivo=FALSE,C_error *er=NULL,char *omite=NULL); + + static BOOL listar( char* dir,StrArray *files,StrArray *dirs=NULL,BOOL recursivo=FALSE,C_error *er=NULL,char *omite=NULL );//funcion generica de listar + //devuelve version de el archivo + static char* getVersionFile(char *path, char *buf);//buffer de 64 sobra +}; diff --git a/includes/Utiles/garray.h b/includes/Utiles/garray.h new file mode 100644 index 0000000..573257f --- /dev/null +++ b/includes/Utiles/garray.h @@ -0,0 +1,261 @@ + +#pragma once +#ifndef Cgarray_H +#define Cgarray_H + +#define GARRAY_INCREMENT 100 +#include "b_file.h" +//array generico--------------------------------- +/* +Clase para manejar arrays genericos de cualquier tipo de clase o estructura +*/ +template +class Cgarray +{ +public: + //variables---------------------------------------------------------------------------------- + int m; //cache del array + int n; //numero de elementos en array + int increment; //valor a incrementar en la cache + T* ptr; //array de elementos + //************************************************************** + //constructores------------------------------------------------------------------------------- + //************************************************************** + Cgarray() + { + m=0; + ptr=NULL; + n=0; + increment=GARRAY_INCREMENT; + }; + //************************************************************** + Cgarray(int cache)//constructor poniendo en memoria posiciones + { + m=cache; + ptr=(T*)malloc(sizeof(T)*m); + if (ptr) + memset(ptr,0,m * sizeof(T)); + else + m=0; + n=0; + increment=GARRAY_INCREMENT; + }; + //************************************************************** + ~Cgarray() + { + if (ptr) + free(ptr); + }; + //************************************************************** + //funciones----------------------------------------------------------------------------------- + //************************************************************** + inline T& operator[](int i)//da el elemento i-esimo por referencia + { + return ptr[i]; + }; + //************************************************************** + inline T* get(int i)//da el elemento i-esimo + { + return &ptr[i] ; + }; + //************************************************************** + inline void remove(int ini, int nelem = 1) + { + if(ini<0) + ini =0; + if(ini>=n || nelem<1) + return; + int fin = ini+nelem; + if(fin>=n) + { + n =ini; + return; + } + + memmove(&ptr[ini], &ptr[fin], (n-fin)*sizeof(T)); + n-=(fin-ini); + }; + //************************************************************** + inline BOOL operator+(T &e )//añade nuevo elemento + { + T*pp; + if (m0) + { + if (inc &e) //añade una lista entera + { + int inc=n+e.n-m; + T*pp; + if (inc>0) + { + if (inc *e) //añade una lista entera + { + int inc=n+e->n-m; + T*pp; + if (inc>0) + { + if (incptr,e.n*sizeof(T)); + n+=e->n; + return TRUE ; + };*/ + //************************************************************** + inline BOOL add(T *e, int ne) //añade una lista de elementos + { + int inc=n+ne-m; + if (!e || ne<=0) + return FALSE; + T*pp; + if (inc>0) + { + if (incescribe(&n,sizeof(n))) + return FALSE; + if(!file->escribe(ptr,n*sizeof(T))) + return FALSE; + return TRUE; + } + //************************************************************** + inline BOOL leer(Cb_file *file)//lee de archivo el array + { + int nn; + if(!file->lee(&nn,sizeof(n))) + return FALSE; + if( nn<=0 || !((*this)+=nn)) + return FALSE; + if(!file->lee(&ptr[n],nn*sizeof(T))) + return FALSE; + n+=nn; + return TRUE; + } + //************************************************************** +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/gcola.h b/includes/Utiles/gcola.h new file mode 100644 index 0000000..15da222 --- /dev/null +++ b/includes/Utiles/gcola.h @@ -0,0 +1,141 @@ +#pragma once +#define GARRAY_INCREMENT 100 +//cola generico--------------------------------- +//+cosas por le final +//-por el inicio +template +struct Element_Cgcola +{ + T t; + Element_Cgcola *ant; + Element_Cgcola *sig; +}; +template +class Cgcola +{ +public: + //variables---------------------------------------------------------------------------------- + int n; //numero de elementos en array + Element_Cgcola *ini; //inicio del array + Element_Cgcola *fin; //fin del array + //************************************************************** + //constructores------------------------------------------------------------------------------- + //************************************************************** + Cgcola() + { + ini=fin=NULL; + n=0; + }; + //************************************************************** + ~Cgcola() + { + borra(); + }; + //************************************************************** + //funciones----------------------------------------------------------------------------------- + //************************************************************** + virtual inline T* operator++()//da puntero al ultimo elemento + { + if (fin) + return &fin->t; + return NULL; + + }; + //************************************************************** + virtual inline T* operator--()//da puntero al primero + { + if(ini) + return &ini->t; + return NULL; + }; + //************************************************************** + virtual inline BOOL operator+(T &e )//añade al final + { + if (fin) + { + fin->sig=(Element_Cgcola*)malloc(sizeof(Element_Cgcola)); + if (!fin->sig) + return FALSE; + fin->sig->ant=fin; + fin=fin->sig; + } + else + { + fin=(Element_Cgcola*)malloc(sizeof(Element_Cgcola)); + if (!fin) + return FALSE; + ini=fin; + fin->ant=NULL; + } + fin->t=e; + fin->sig=NULL; + n++; + return TRUE ; + }; + //************************************************************** + virtual inline BOOL operator-(T &e) //añade al principio + { + if (ini) + { + ini->ant=(Element_Cgcola*)malloc(sizeof(Element_Cgcola)); + if (!ini->ant) + return FALSE; + ini->ant->sig=ini; + ini=ini->ant; + } + else + { + ini=(Element_Cgcola*)malloc(sizeof(Element_Cgcola)); + if (!ini) + return FALSE; + fin=ini; + ini->sig=NULL; + } + ini->t=e; + ini->ant=NULL; + n++; + return TRUE ; + }; + //************************************************************** + virtual inline BOOL operator+=(T* e )//da el ultimo u lo elimina + { + if (!fin) + return FALSE; + *e=fin->t; + Element_Cgcola *el=fin; + fin=fin->ant; + fin->sig=NULL; + if (!fin) + ini=fin; + free(el); + n--; + return TRUE ; + }; + //************************************************************** + virtual inline BOOL operator-=(T* e )//da el primero y lo elimina + { + if (!ini) + return FALSE; + *e=ini->t; + Element_Cgcola *el=ini; + ini=ini->sig; + if (!ini) + fin=ini; + else + ini->ant=NULL; + free(el); + n--; + return TRUE ; + }; + //************************************************************** + virtual inline void borra()//libera la memoria del array + { + while(ini) + { + fin=ini->sig; + free(ini); + ini=fin; + } + } + //************************************************************** +}; \ No newline at end of file diff --git a/includes/Utiles/gcola_con.h b/includes/Utiles/gcola_con.h new file mode 100644 index 0000000..2e9dd26 --- /dev/null +++ b/includes/Utiles/gcola_con.h @@ -0,0 +1,118 @@ +#pragma once +#include "gcola.h" +#include "lock.h" +//cola concurrente para usar con multiples thread +template +class Cgcola_con : + public Cgcola +{ +public: + //variables-------------------------------------------------------------------------------- + Clock cerrojo;//interlock para protejer la cola + int modo;//modo 0 bloqueante, modo 1 no bloqueante + //funciones-------------------------------------------------------------------------------- + //************************************************************************* + Cgcola_con(void) + :Cgcola() + { + modo=0; + }; + //************************************************************************* + virtual ~Cgcola_con(void) + { + borra(); + }; + //************************************************************************* + //************************************************************************* + virtual inline T* operator++()//da puntero al ultimo elemento + { + T* res=NULL; + if (modo) + { + if(!cerrojo.puedo()) + return NULL; + } + else + cerrojo.entro(); + res= Cgcola::operator++(); + cerrojo.salgo(); + return res; + + }; + //************************************************************************* + virtual inline T* operator--()//da puntero al primero + { + T* res=NULL; + if (modo) + { + if(!cerrojo.puedo()) + return NULL; + } + else + cerrojo.entro(); + res= Cgcola::operator--(); + cerrojo.salgo(); + return res; + }; + //************************************************************************* + virtual inline BOOL operator+(T &e )//añade al final + { + BOOL res=FALSE; + if (modo) + { + if(!cerrojo.puedo()) + return FALSE; + } + else + cerrojo.entro(); + res= Cgcola::operator+(e); + cerrojo.salgo(); + return res; + }; + //************************************************************************* + virtual inline BOOL operator-(T &e) //añade al principio + { + BOOL res=FALSE; + if (modo) + { + if(!cerrojo.puedo()) + return FALSE; + } + else + cerrojo.entro(); + res= Cgcola::operator-(e); + cerrojo.salgo(); + return res; + }; + //************************************************************************* + virtual inline BOOL operator+=(T* e )//da el ultimo y lo elimina + { + BOOL res=FALSE; + if (modo) + { + if(!cerrojo.puedo()) + return FALSE; + } + else + cerrojo.entro(); + res= Cgcola::operator+=(e); + cerrojo.salgo(); + return res; + }; + //************************************************************************* + virtual inline BOOL operator-=(T* e )//da el primero y lo elimina + { + BOOL res=FALSE; + if (modo) + { + if(!cerrojo.puedo()) + return FALSE; + } + else + cerrojo.entro(); + res= Cgcola::operator-=(e); + cerrojo.salgo(); + return res; + }; + //************************************************************************* +}; diff --git a/includes/Utiles/ini_file.h b/includes/Utiles/ini_file.h new file mode 100644 index 0000000..0c2de1d --- /dev/null +++ b/includes/Utiles/ini_file.h @@ -0,0 +1,88 @@ +#pragma once +#include "base_head.h" +#include "StrArray.h" +#include "static_array.h" +#define INI_FILE_FLAGS_VACIO 0x0001 +#define MODULO_INI_FILE "Cini_file" +//estructuras necesarias------------------------------------------------------------------ +typedef struct Ini_file_props +{ + short flags; + int p;//propiedad + int v;//valor +}Ini_file_props; + +typedef struct Ini_file_grupo//cabecera base de la cumunicación +{ + int n; //indice a nombre + short flags; + Cstatic_array prop; + Ini_file_grupo() + { + inicia(); + n=0; + } + void inicia() + { + prop.n=prop.m=0; + prop.buf=NULL; + prop.z=sizeof(Ini_file_props); + prop.incremento=100; + } + Ini_file_props* get(int i)//da la propiedad i + { + return (Ini_file_props*) prop.get(i); + } + Ini_file_props* set_coun()//reserva para una propiedad mas y da el puntero + { + prop.reserva(); + prop.n++; + return (Ini_file_props*) &prop.buf[prop.z*(prop.n-1)]; + } +}Ini_file_grupo; + + +//------------------------------------------------------------------------------------------------------------ +class C_error; +class UTILES_EXPORT Cini_file +{ + //variables-------------------------- +private: + StrArray str; + Cstatic_array grupos; + BOOL borra_error; +public: + C_error *er; + + Cini_file(C_error* err=NULL); + ~Cini_file(void); + //funciones-------------------------- + BOOL lee(char *path_);//lee archivo ini y lo carga en memoria + + + int get_grupo(char* gr); + int geti_valor(int gr,char *pro);//devuelve el indice del str valor + + //funciones que dan el valor-------------- + char* get(int gr,char *pro);// valor en forma de char* + int get(int gr,char *pro, int def); + double get(int gr,char *pro, double def); + char* get( int gr,char *pro, char *def); + void dame_valor( int gr,char *pro, char* dst,char *def); + //funciones de escritura----------------- + void borra(); + BOOL guarda(char *path);//guarda ini cargado en memoria en un archivo; + int add_grupo(char *gr);//añade un grupo nuevo y da el indice + int add(int gr,char *pro,char *val);//añade valor de propiedad + + //sobrecarga escritura----------------- + int add(int gr,char *pro,int val);//añade valor de propiedad + int add(int gr,char *pro,double val);//añade valor de propiedad + //funciones aux------------------------ +private: + //funciones ayuda para leer + char* busca(char *st,char c);//busca en str el char c o el nulo + char* buscamos_grupo(char *st);//busca el siguiente grupo en str + char* busca_prop(char* st); + Ini_file_grupo* set_coun(); +}; diff --git a/includes/Utiles/lock.h b/includes/Utiles/lock.h new file mode 100644 index 0000000..a3036bd --- /dev/null +++ b/includes/Utiles/lock.h @@ -0,0 +1,29 @@ +#pragma once +#include "base_head.h" + +#define CLOCK_ESTADO_BLOQUEADO 1 +#define CLOCK_ESTADO_DESBLOQUEADO 0 + +class UTILES_EXPORT Clock//estructura para concurrencia +{ +public: + + long t_sleep;//tiempo de sleep en milisegundos + + Clock(void); + ~Clock(void); + + void entro();//pilla el cerrojo durmiendo si es necesario + void salgo();//libera el cerrojo + BOOL puedo();//intenta pillar el cerrojo, si ya estaba pillado devuelve false si no true + +private: + long volatile cerrojo;//variable volatile + long cliente;//id del thred que tiene el cerrojo + CRITICAL_SECTION cerrojo1; + int modo;//indica si usa cerrojo 0 o 1 + + + +}; +UTILES_EXPORT long lck_sum_atm(long *n,int i);//suma de manera atomica i a n \ No newline at end of file diff --git a/includes/Utiles/mapmatrix.h b/includes/Utiles/mapmatrix.h new file mode 100644 index 0000000..8daf54a --- /dev/null +++ b/includes/Utiles/mapmatrix.h @@ -0,0 +1,354 @@ +#pragma once +#ifndef CmapMat_H +#define CmapMat_H + +#include "stdafx.h" +#include +#include +#define VALNOEXIST_FLOAT (float) 1.e+30 +#define VALNOEXIST_INT (int) -1 +#include "garray.h" +#include "th.h" + +#pragma pack(8) +typedef struct HeadCostConj +{ + int ver; //versión + bool isVect; // vect o map + int n; //num de elems guardados +}HeadCostConj; +typedef struct HeadCostAng +{ + int ver; //versión + int n; //num de elems guardados +}HeadCostAng; +#pragma pack (1) +typedef struct MapDataFloat{ + int k; + float v; +}MapDataFloat; +typedef struct MapDataInt{ + int k; + int v; +}MapDataInt; +#pragma pack(16) +#define MAX_THREAD_LEE 8 +//matixFloat--------------------------------------------- +class UTILES_EXPORT CmapRowFloat +{ + +public: + //********************************* + //Variables + bool isVect; + int imin, imax; + std::map dat; + std::vector datv; + //********************************* + //Métodos + CmapRowFloat() + { + isVect = false; + imin=INT_MAX; + imax=INT_MIN; + } + ~CmapRowFloat(void) + { + } + //****************************************************** + inline void set(int i, float v) + { + + + if(isVect) + datv[i]=v; + else + { + if(v== VALNOEXIST_FLOAT) + return; + dat[i] = v; + if(iimax) + imax=i; + } + } + //****************************************************** + inline float operator[](int irow) + { + if(isVect) + return datv[irow]; + if(irow< imin || irow>imax) + return VALNOEXIST_FLOAT; + //si tiene esa clave la devuelve, si no, devuelve MAYUSCULO + std::map::iterator elem = dat.find(irow); + if(elem == dat.end()) + //no tiene la clave + return VALNOEXIST_FLOAT; + return elem->second; + } + inline void configVector(int ymax) + { + isVect = true; + dat.clear(); + + //datv.reserve(ymax); + datv.insert(datv.begin(),ymax,VALNOEXIST_FLOAT); + + bool inVector = false; + /*for (int i =0 ; i *bufer = NULL); + BOOL lee(int ic, char *path , char *ext, int ntot, BOOL mismosvect=TRUE, Cgarray *bufer = NULL); +}; +#define MAX_MEM_MAPFLOAT 1024.*1024.*300./sizeof(float) + +class UTILES_EXPORT CmapMatFloat +{ +public: + //********************************* + //Variables + std::vector dat; + + //********************************* + //Métodos + CmapMatFloat() + { + } + ~CmapMatFloat(void) + { + } + //****************************************************** + inline CmapRowFloat& operator[](int irow) + { + return dat[irow]; + } + + inline void set(int x, int y, float val) + { + if(val>= VALNOEXIST_FLOAT) + return; + + dat[x].set(y,val); + } + //ajusta los map a la memoria minima posible + inline void memAjust() + { + for(std::vector::iterator elem = dat.begin(); elem!= dat.end(); elem++) + { + elem->memAjust(); + } + } + inline void clear() + { + dat.clear(); + } + + //reparte los nvect disponibles entre los threads, poniendo las primeras filas de cada uno de vect + inline void inicializa(int xmax, int nthr, int nvect=-1) + { + dat.reserve(xmax); + bool inVector = false; + if(nvect<0) + nvect =(int)(MAX_MEM_MAPFLOAT/xmax); + + int vectthr=0,novecthr=0,iparc=0; + if(nvect=xmax) + dat[i].configVector(xmax); + else if(nvect>0) + { + if((i-iparc)=(vectthr+novecthr)) + iparc+=vectthr+novecthr; + } + } + } + BOOL lee(char *path, char *ext, BOOL mismosvect=TRUE); + BOOL leeThread( char *path, char *ext, int nthread, BOOL mismosvect/*=TRUE*/); +}; +class UTILES_EXPORT ThMapMatFloatLee: public Cth +{ +public: + CmapMatFloat *pclas; + int ini;//fila inicio + int fin;//fila fin + int ithr; + BOOL mal;//indica si ha ido bien + BOOL mismosvect; + char*path; + char*ext; + virtual void run(); +}; +class UTILES_EXPORT CmapRowInt +{ +public: + //********************************* + //Variables + std::map dat; + std::vector datv; + int imin, imax; + bool isVect; + //********************************* + //Métodos + CmapRowInt() + { + imin=INT_MAX; + imax=INT_MIN; + isVect = false; + } + ~CmapRowInt(void) + { + } + //****************************************************** + inline void set(int i, int v) + { + if(v== VALNOEXIST_INT) + return; + + if(isVect) + datv[i]=v; + else + dat[i] = v; + + if(iimax) + imax=i; + } + //****************************************************** + inline int operator[](int irow) + { + if(isVect) + return datv[irow]; + if(irow< imin || irow>imax) + return -1; + + //si tiene esa clave la devuelve, si no, devuelve MAYUSCULO + std::map::iterator elem = dat.find(irow); + if(elem == dat.end()) + //no tiene la clave + return VALNOEXIST_INT; + return elem->second; + } + //ajusta map a memoria justa + inline void memAjust() + { + + } + inline void configVector(int ymax) + { + isVect = true; + dat.clear(); + datv.insert(datv.begin(),ymax,VALNOEXIST_INT); + /*datv.reserve(ymax); + for (int i =0 ; i dat; + + //********************************* + //Métodos + CmapMatInt() + { + } + ~CmapMatInt(void) + { + } + //****************************************************** + inline CmapRowInt& operator[](int irow) + { + return dat[irow]; + } + + inline void set(int x, int y, int val) + { + if(val== VALNOEXIST_INT) + return; + dat[x].set(y,val); + } + //ajusta los map a la memoria minima posible + inline void memAjust() + { + for(std::vector::iterator elem = dat.begin(); elem!= dat.end(); elem++) + { + elem->memAjust(); + } + } + inline void clear() + { + dat.clear(); + } + + inline void inicializa(int xmax, int nthr, int nvect=-1) + { + dat.reserve(xmax); + bool inVector = false; + if(nthr<=0) + nthr=1; + if(nvect<0) + nvect =(int)(MAX_MEM_MAPINT/xmax); + int vectthr=0,novecthr=0,iparc=0; + if(nvect=xmax)//nvec>=xmax + dat[i].configVector(xmax); + else if(nvect==0) + continue; + else + { + if((i-iparc)=(vectthr+novecthr)) + iparc+=vectthr+novecthr; + } + } + } + +}; + +#endif \ No newline at end of file diff --git a/includes/Utiles/proceso_cliente.h b/includes/Utiles/proceso_cliente.h new file mode 100644 index 0000000..d1cb232 --- /dev/null +++ b/includes/Utiles/proceso_cliente.h @@ -0,0 +1,12 @@ +#pragma once +#include "_proceso.h" +#include "base_head.h" +class Csock_sv; +class UTILES_EXPORT Cproceso_cliente: public C_proceso +{ +public: + Csock_sv *soc; + Cproceso_cliente(void); + ~Cproceso_cliente(void); + //virtual void run(){}; +}; diff --git a/includes/Utiles/sock_sv.h b/includes/Utiles/sock_sv.h new file mode 100644 index 0000000..15a762a --- /dev/null +++ b/includes/Utiles/sock_sv.h @@ -0,0 +1,50 @@ +#pragma once +#include "Csock_cl.h" +#include "th.h" +#include +class Cproceso_cliente; +class UTILES_EXPORT Cescucha_sock_sv//interface para que te entren los accept +{ +public: + virtual Cproceso_cliente* crea_cliente(BOOL *pirate)=0;//funcion que crea los procesos cliente en el accept (devuelve null si no se acepta) +}; +//socket generico si se pone una escucha crea los socket cliente desde la escucha +//si no desde la funcion crea_cliente +//si el proceso cliente ya tiene un socket creado no se crea si no se crea un socket cliente +class UTILES_EXPORT Csock_sv : public Csock_cl +{ +public: + BOOL sock_cerrado; + Cescucha_sock_sv *escucha; + Csock_sv(BOOL* sal=NULL, C_error*e=NULL); + virtual ~Csock_sv(void); + Cproceso_cliente* (*crea_cliente)(BOOL *pirate ); + //funciones servidor------------------------------------ + virtual void OnAccept(int nErrorCode); + virtual void OnClose(int nErrorCode); + //virtual void run(); + //funciones virtuales de thread win +}; +//socket servidor con thread y cola de evntos propia + +class UTILES_EXPORT Csock_svThread :public CWinThread +{ + //DECLARE_DYNCREATE(Csock_svThread) + BOOL isLisening; + BOOL pireateTread; + int port, type, evenFlag; + char * url; + +public: + Cescucha_sock_sv *escucha; + Cproceso_cliente* (*crea_cliente)(BOOL *pirate ); + BOOL liseningThread(int port, char * url, int type = SOCK_STREAM, int evenFlag = FD_ACCEPT | FD_READ | FD_CLOSE );//inicia escucha + void close();//cierra escucha + //funciones aux------------------------ + ~Csock_svThread(); + Csock_svThread(); +//AfxSocketInit() + virtual BOOL InitInstance() ; + virtual int Run() ; + CString sName ;//nombre thread +}; \ No newline at end of file diff --git a/includes/Utiles/static_array.h b/includes/Utiles/static_array.h new file mode 100644 index 0000000..00191e9 --- /dev/null +++ b/includes/Utiles/static_array.h @@ -0,0 +1,20 @@ +#pragma once +#include "base_head.h" +class UTILES_EXPORT Cstatic_array +{ +public: + int z;//tamaño de la memoria + int n;//capacidad usada de la memoria + int m;//capacidad total de la memoria + int incremento; + BYTE* buf; + Cstatic_array(int size=1); + ~Cstatic_array(void); + //funciones--------------------------------------- + BYTE* get(int i);//da el elemento i + BYTE* get_cp(int i);//da una copia del elemento i + void add(BYTE* e);//añade elemento + void borra();//borra elementos + //funciones aux---------------------------------- + BOOL reserva(int p=1);//reserva memoria para p posiciones mas +}; diff --git a/includes/Utiles/stdint.h b/includes/Utiles/stdint.h new file mode 100644 index 0000000..d02608a --- /dev/null +++ b/includes/Utiles/stdint.h @@ -0,0 +1,247 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2008 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +# include +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + + +#endif // _MSC_STDINT_H_ ] diff --git a/includes/Utiles/str_socket.h b/includes/Utiles/str_socket.h new file mode 100644 index 0000000..559f3fe --- /dev/null +++ b/includes/Utiles/str_socket.h @@ -0,0 +1,87 @@ +#pragma once +#include +#include "base_head.h" +#define MAX_CHAR_BLOQ_STRSOCKET 1024 //Maximo de caracteres por envio +#include "_error.h" + +#define ESPERA_STRSOCKET 1 //milis en sleep +#define ESPERA_SEG_STRSOCKET 3//SEGUNDOS MAXIMOS INTENTANDO RECIBIR ENVITOS +#define VECES_ESPERA_STRSOCKET ((1000 * ESPERA_SEG_STRSOCKET) / ESPERA_STRSOCKET) +#define MIN_REALLOC_STR_SOC 512 //bytes +/* +Socket cliente para envio de informacion ascii (string) +*/ +class UTILES_EXPORT Cstr_socket : public CAsyncSocket +{ +public: + //variables-------------------------------------- + C_error er;//variable que da info de posibles errores + BOOL pirate;//==TRUE -> se cancela todas las tareas del socket + long cli_currando;//indica que el socket esta en uso + Cstr_socket *pp; //puntero al padre + //variables aux---------------------------------- +private: + char *buf;//buffer de envios + int n, m;//ocupacion y capacidad del buffer + int nb;//indica el numero de bytes que va por envio total + +public: + //c y d------------------------------------------ + Cstr_socket(void); + ~Cstr_socket(void); +public: + //funciones-------------------------------------- + BOOL crear(char *ip=NULL, int puerto=0);//crea el socket en la ip y puerto de salida indicados + BOOL conecta(char *ip, int puerto);//contecta a servidor + char* recibir();//recibe string; + BOOL envia( char *fmt, ...);//envia string + void cierra();//cierra socket + char *getbuf();//devuelve buffer del socket + //funciones auxiliares--------------------------- +private: + BOOL cuida_mem(int nbb);//pide memoria si hace falta + int recibir(BYTE *b, int nbb);//recive nbb bytes y los deja en b + BOOL enviar(int nbb,BYTE *b); + +}; +/* +Socket servidor para envio de informacion ascii (string) +*/ +class UTILES_EXPORT Cstr_socket_srv : public Cstr_socket +{ + //variables aux---------------------------------- +private: + HWND wnd;//ventana a la que mandar eventos + int id_even, id_comman; + BOOL *sal_soc; + int t_out;//tiempo de salida sin hacer nada + __int64 t; +public: + //c y d------------------------------------------ + Cstr_socket_srv(void); + ~Cstr_socket_srv(void); + //funciones-------------------------------------- + virtual BOOL on_datos_recibidos(char *txt)=0;//funcion donde procesar los datos + virtual Cstr_socket_srv* crea_cliente()=0;//funcion donde procesar los datos + + BOOL pon_escucha(char *ip, int puerto); + void pon_wnd_destruc(HWND wnd,int id_comman,int id_even); + //funciones auxiliares--------------------------- +private: + + +public: + void run(); + virtual void OnAccept(int nErrorCode); + virtual void OnClose(int nErrorCode); + static UINT th_funcion(LPVOID pp); + void pon_tout( int t_out ); +}; +//funciones de socket cliente para pinvoke----------------------------------------------------- +extern "C" UTILES_EXPORT Cstr_socket *str_socket_crea(); +extern "C" UTILES_EXPORT BOOL str_socket_conecta(Cstr_socket *soc, char *ip, int puerto); +extern "C" UTILES_EXPORT BOOL str_socket_envia(Cstr_socket *soc, char *txt); +extern "C" UTILES_EXPORT int str_socket_recive(Cstr_socket* soc); +extern "C" UTILES_EXPORT void str_socket_dame_buf(Cstr_socket* soc, char* buf); +extern "C" UTILES_EXPORT void str_socket_dame_error(Cstr_socket* soc, char* error); +extern "C" UTILES_EXPORT void str_socket_borra(Cstr_socket* soc); \ No newline at end of file diff --git a/includes/Utiles/th.h b/includes/Utiles/th.h new file mode 100644 index 0000000..b2f91ea --- /dev/null +++ b/includes/Utiles/th.h @@ -0,0 +1,38 @@ +#pragma once +#ifndef INCLUDE_TH_UTILES +#define INCLUDE_TH_UTILES + +#include "base_head.h" +const DWORD MS_VC_EXCEPTION_TH_UTILES=0x406D1388; +//funciones necesarias------------- +UTILES_EXPORT void SetThName( DWORD dwThreadID, char* threadName); +UINT main_th_proceso(LPVOID pp); +//thead basico--------------------- +class UTILES_EXPORT Cth +{ + +public: + bool running;//variable interna no usar + //variables + + char nombre[32];//nombre del thread + CWinThread * m_thread;//puntero a thread + //cosntructor y destructor--------------- + Cth(void); + ~Cth(void); + //funicones------------------------------ + virtual void run()=0;//funcion que hace el thread + bool isRunning();//indica si se esta currando o no + + BOOL lanza(char *nombre=NULL);//lanzar thread + + //******************************** + void join();//espera a que el thread termine +}; + +class UTILES_EXPORT Crunable +{ +public: + virtual void frun(int modo=0)=0; +}; +#endif \ No newline at end of file diff --git a/includes/Utiles/th_cola.h b/includes/Utiles/th_cola.h new file mode 100644 index 0000000..065e11c --- /dev/null +++ b/includes/Utiles/th_cola.h @@ -0,0 +1,141 @@ +#pragma once +#include "th.h" +#include "gcola_con.h" + + +template +struct Timers_Cth_cola +{ + T tarea;//tarea a encadenar + __int64 t;//tiempo desde la ultima ejecucion + int dt;//periodo del timer +}; +//------------------------------------------------------------ +class Cth_rimers_cola : //tread para los timers + public Cth +{ +public: + Crunable *clase_run; + inline virtual void run() + { + clase_run->frun(0); + } +}; +//cola asincrona-------------------------------------------- +//thread de tareas tipico----------------------------------- +template +class Cth_cola : //falta probar, poner timers + public Cth, Crunable +{ +public: + Cgcola_con cola;//cola de tareas pendientes + Cgcola_con> timers;//tareas periodicas activas + BOOL pirate;//indica al tread que hay que terminar + BOOL eje_fin;//indica que hay que ejecutar la tarea final + int time_sleep;//tiempo de espera cuando no hay tareas + int tp_max;//maximo de tareas pendientes en cola + T tfin;//tarea final; + Cth_rimers_cola thtimers;//thread de control de tareas periodicas + //constructor y destructor-------------------------------- + //************************************************** + Cth_cola(void) + { + pirate=FALSE; + time_sleep=1; + tp_max=1000; + eje_fin=FALSE; + thtimers.clase_run=this; + thtimers.join(); + + + }; + //************************************************** + ~Cth_cola(void) + { + fin(); + }; + //funciones----------------------------------------------- + void pon_tfin(T &e) + { + tfin=e; + eje_fin=TRUE; + }; + //************************************************** + virtual inline BOOL operator+(T &e )//añade tarea + { + return !pirate && cola.n<=tp_max && cola+e; + }; + //************************************************** + virtual inline BOOL operator-(T &e )//añade tarea y elimina el resto + { + if (pirate) + return FALSE; + cola.cerrojo.entro(); + cola.borra(); + cola.cerrojo.salgo(); + return cola+e; + }; + //************************************************** + virtual void fin()//termina el proceso + { + pirate=TRUE; + thtimers.join(); + join(); + + }; + //************************************************** + BOOL pon_timer(int seg, T &tar)//pone una tarea periodica siendo t el periodo en seg + { + Timers_Cth_cola tim; + tim.t=0; + tim.tarea=tar; + tim.dt=seg; + timers+tim; + return TRUE; + }; + //************************************************** + virtual void procesa(T &t)//override de procesado que hay que sobreescribir + { + + }; + //************************************************** + virtual void run()//proceso que despacha + { + T tarea; + sprintf(thtimers.nombre,"%s_timers",nombre); + if (timers.n) + thtimers.lanza(); + while (!pirate) + { + if (cola-=&tarea) + procesa(tarea); + else + Sleep(time_sleep); + } + if(eje_fin) + procesa(tfin); + }; + //************************************************** + virtual void frun(int modo=0)//proceso del timer + { + __int64 t; + Element_Cgcola> *e; + while(!pirate) + { + timers.cerrojo.entro(); + e=timers.ini; + t=_time64(NULL); + while(e) + { + if (e->t.tt.tarea)) + e->t.t=t+e->t.dt; + } + e=e->sig; + } + Sleep(500); + } + }; + //************************************************** +}; diff --git a/includes/Utiles/utiles_def.h b/includes/Utiles/utiles_def.h new file mode 100644 index 0000000..3c00f81 --- /dev/null +++ b/includes/Utiles/utiles_def.h @@ -0,0 +1,85 @@ +#pragma once +//defines de carpetas----------------------------------------------------------------------- + +#define D_WORK "%dir_work%" +#define D_LOG "%dir_log%" +#define D_APP "%dir_exe%" +#define D_DAT "%dir_dat%" +#define P_CONG "%p_config%" + +//define para comunicacion------------------------------------------------------------------ +#define VERSION_PACKAGE_HEAD 1 //version de metodo de comunicacion +#define MAX_LONG_PACKAGE_0 0x04000 //maximo de bytes por package +//flags de cabecera + +/* +#define FLAG_PACKAGE_HEAD_0_INICIO 0x00000001 +#define FLAG_PACKAGE_HEAD_0_CONTINUACION 0x00000002 +#define FLAG_PACKAGE_HEAD_0_FINAL 0x00000004*/ + +#define FLAG_PACKAGE_HEAD_0_ENCRIPT1 0x00000001 +#define FLAG_PACKAGE_HEAD_0_REPLICADO 0x00000002 +//estructuras para comunicacion------------------------------------------------------------- +typedef struct Package_head_0//cabecera base de la cumunicación +{ + int version; //version de comunicacion + int flags; //flags + int nb; //numero de bytes del paquete + int n; //numero de bloques de este paquete +}Package_head_0; +//en esta version el identificador de los paquetes sera un entero (int) +//paquetes generales de envio---------------------------------------------------------------- +#define PETICION_GENERAL_NO 0//paquete de negacion + +#define PETICION_GENERAL_PRESENTA 1//peticion de presentacion usuario y key +#define PETICION_GENERAL_OK 2//respuesta ok automatica +#define PETICION_GENERAL_DESCONECTA 3//peticion de desconexion +#define PETICION_GENERAL_DAME_LOG 4//peticion de eventos (normalmente con id) +#define PETICION_GENERAL_TOMA_COMANDO 5//peticionde comando para servidor +#define PETICION_GENERAL_FIN 6 + + +//define para usuarios------------------------------------------------------------------------ +#define VERSION_USUARIO_CONEXION 1 //version de usuarios +//flags usuarios +#define FLAG_USUARIO_CONEXION_INDI 0x00000001//indica que solo se acepta una conexion por dicho usuario +#define FLAG_USUARIO_CONEXION_EN_USO 0x00000002//indica que el usuario esta en uso actualmente +#define FLAG_USUARIO_CONEXION_VACIO 0x00000004//indica que el usuario esta borrado +#define FLAG_USUARIO_CONEXION_BLOQ 0x00000008//indica que el usuario esta bloqueado (no se puede usar) +//flags archivo +#define FLAG_FILE_USUARIO_CONEX_ENCRIP 0x00000001//indica que el archivo esta encriptado +//flags permisos + +//estructura para usuarios--------------------------------------------------------------------- +typedef struct Usuario_conx_0//informacion de usuario +{ + int flags; + int id; //identificador de usuario + int permisos; //flags de permisos + int ia; //informacion adicional + int ncon; //numero de conectados con este usuario + char nombre[32]; //nombre de usuario + char clave[32]; //calve de usuario +}Usuario_conx_0; + +typedef struct Head_usuario_conex_0//cabecera de archivo de usuario +{ + int version; //version informacion de usuaros + int flags; //flags + int n; //numero de usuarios en archivo +}Head_usuario_conex_0; + +//interface de elemento que se transfiere---------------------------------- +class IdataTransfer +{ +public: + //para lectura + virtual __int64 getNB_it()=0;//devuelve numero de bites totales de informacion + virtual __int64 getNext_it(void* buf,__int64 nb)=0;//copia en buffer buf el los siguientes nb bytes y devuelve el numero total de bites leidos + + //lectura y escritura + inline virtual bool setPosition_it(__int64 nb){ return false; };//se posiciona en el byte nb los datos + + //para escritura----------- + inline virtual bool set_it(void* buf, __int64 nb){ return true; };//prepara datos para recivir nb bites +}; \ No newline at end of file diff --git a/includes/Utiles/utl.h b/includes/Utiles/utl.h new file mode 100644 index 0000000..7b3b388 --- /dev/null +++ b/includes/Utiles/utl.h @@ -0,0 +1,33 @@ +#pragma once +#include "base_head.h" +class StrArray; +class UTILES_EXPORT Cutl +{ +public: + Cutl(void); + ~Cutl(void); + //cifra y descifra datos con FLAG_PACKAGE_HEAD_0_ENCRIPT1 + static void cifra1(BYTE*b,int nb); + static void cifra1(char*b);//ojo con los char despues de cifrar no usar stlen ni semejantes + static void descifra1(char*b); + static void descifra1(BYTE* b,int nb); + //-------------------------------------------------------- + static void big_little(BYTE* b,int nb);//cambia de little a big_endian y viceversa + //ordenacion---------------------------------------------- + static int busca(BYTE*lista,int n,int sizeElement,BYTE *e, int (*funcion)(BYTE*,BYTE*) );//busqueda dicotomica + static StrArray* stringSplit(char *orig,char* subStr, StrArray*buf); + + //identificador pc---------------------------------------- + static char* id_pc(char*idm, int nb);//proporciona un identificador unico de la computadora + static DWORDLONG getMemoDisp();//devuelve la memoria disponible + static DWORDLONG getMemoDisp1Malloc();//devuelve la memoria disponible real en mem1 en un malloc + + //identificacion de usuario de windows-------------------- + static char* getWinUser(char* buf);//leng de 256 + + //funciones de string-------------------------------- + static int str_hex2int(char* st);//pasa de cadena de caracteres tipo 0xff a entero + static void int2str_hex( char* st , int n); + + static bool lanza_exe(char *appName, char *comline, DWORD *processId = NULL);//ejecuta appName +}; diff --git a/lib/Debug/ClientLic.lib b/lib/Debug/ClientLic.lib new file mode 100644 index 0000000..cdf819b Binary files /dev/null and b/lib/Debug/ClientLic.lib differ diff --git a/lib/Debug/FileTransfer.lib b/lib/Debug/FileTransfer.lib new file mode 100644 index 0000000..fffeb93 Binary files /dev/null and b/lib/Debug/FileTransfer.lib differ diff --git a/lib/Debug/Olivia.lib b/lib/Debug/Olivia.lib new file mode 100644 index 0000000..1ac744a Binary files /dev/null and b/lib/Debug/Olivia.lib differ diff --git a/lib/Debug/licUtiles.lib b/lib/Debug/licUtiles.lib new file mode 100644 index 0000000..aa09b1e Binary files /dev/null and b/lib/Debug/licUtiles.lib differ diff --git a/lib/Debug/sqlite3.lib b/lib/Debug/sqlite3.lib new file mode 100644 index 0000000..ed40f91 Binary files /dev/null and b/lib/Debug/sqlite3.lib differ diff --git a/lib/Debug/utiles.lib b/lib/Debug/utiles.lib new file mode 100644 index 0000000..113cd8a Binary files /dev/null and b/lib/Debug/utiles.lib differ diff --git a/lib/Release/ClientLic.lib b/lib/Release/ClientLic.lib new file mode 100644 index 0000000..c08d66b Binary files /dev/null and b/lib/Release/ClientLic.lib differ diff --git a/lib/Release/FileTransfer.lib b/lib/Release/FileTransfer.lib new file mode 100644 index 0000000..4b0e68d Binary files /dev/null and b/lib/Release/FileTransfer.lib differ diff --git a/lib/Release/Olivia.lib b/lib/Release/Olivia.lib new file mode 100644 index 0000000..3f33953 Binary files /dev/null and b/lib/Release/Olivia.lib differ diff --git a/lib/Release/licUtiles.lib b/lib/Release/licUtiles.lib new file mode 100644 index 0000000..3394c33 Binary files /dev/null and b/lib/Release/licUtiles.lib differ diff --git a/lib/Release/sqlite3.lib b/lib/Release/sqlite3.lib new file mode 100644 index 0000000..ed40f91 Binary files /dev/null and b/lib/Release/sqlite3.lib differ diff --git a/lib/Release/utiles.lib b/lib/Release/utiles.lib new file mode 100644 index 0000000..b30f882 Binary files /dev/null and b/lib/Release/utiles.lib differ diff --git a/lib/x64/debug/ClientLic.lib b/lib/x64/debug/ClientLic.lib new file mode 100644 index 0000000..864dce9 Binary files /dev/null and b/lib/x64/debug/ClientLic.lib differ diff --git a/lib/x64/debug/FileTransfer.lib b/lib/x64/debug/FileTransfer.lib new file mode 100644 index 0000000..93997d0 Binary files /dev/null and b/lib/x64/debug/FileTransfer.lib differ diff --git a/lib/x64/debug/Olivia.lib b/lib/x64/debug/Olivia.lib new file mode 100644 index 0000000..b0c24c3 Binary files /dev/null and b/lib/x64/debug/Olivia.lib differ diff --git a/lib/x64/debug/licUtiles.lib b/lib/x64/debug/licUtiles.lib new file mode 100644 index 0000000..e5ec7f4 Binary files /dev/null and b/lib/x64/debug/licUtiles.lib differ diff --git a/lib/x64/debug/sqlite3.lib b/lib/x64/debug/sqlite3.lib new file mode 100644 index 0000000..727e29c Binary files /dev/null and b/lib/x64/debug/sqlite3.lib differ diff --git a/lib/x64/debug/utiles.lib b/lib/x64/debug/utiles.lib new file mode 100644 index 0000000..7318d28 Binary files /dev/null and b/lib/x64/debug/utiles.lib differ diff --git a/lib/x64/release/ClientLic.lib b/lib/x64/release/ClientLic.lib new file mode 100644 index 0000000..9f6e3c4 Binary files /dev/null and b/lib/x64/release/ClientLic.lib differ diff --git a/lib/x64/release/FileTransfer.lib b/lib/x64/release/FileTransfer.lib new file mode 100644 index 0000000..5e7e754 Binary files /dev/null and b/lib/x64/release/FileTransfer.lib differ diff --git a/lib/x64/release/Olivia.lib b/lib/x64/release/Olivia.lib new file mode 100644 index 0000000..b3e3578 Binary files /dev/null and b/lib/x64/release/Olivia.lib differ diff --git a/lib/x64/release/licUtiles.lib b/lib/x64/release/licUtiles.lib new file mode 100644 index 0000000..3d2c55b Binary files /dev/null and b/lib/x64/release/licUtiles.lib differ diff --git a/lib/x64/release/sqlite3.lib b/lib/x64/release/sqlite3.lib new file mode 100644 index 0000000..727e29c Binary files /dev/null and b/lib/x64/release/sqlite3.lib differ diff --git a/lib/x64/release/utiles.lib b/lib/x64/release/utiles.lib new file mode 100644 index 0000000..1bf6ebd Binary files /dev/null and b/lib/x64/release/utiles.lib differ