11.07.2014 Views

Progetto e Realizzazione di un Sensore Ibrido Omnidirezionale/pin ...

Progetto e Realizzazione di un Sensore Ibrido Omnidirezionale/pin ...

Progetto e Realizzazione di un Sensore Ibrido Omnidirezionale/pin ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Ed ora passiamo ai moduli del sistema:<br />

Generic module MATRICI;<br />

-- E’ <strong>un</strong>a classe generica che permette la creazione r<strong>un</strong>-time e la gestione degli<br />

accessi a matrici bi<strong>di</strong>mensionali <strong>di</strong> dati <strong>di</strong> tipo TipoMatrice.<br />

-- Deve fornire le f<strong>un</strong>zionalità <strong>di</strong> allocazione <strong>di</strong> matrici <strong>di</strong> <strong>di</strong>mensioni definite a<br />

r<strong>un</strong> time, l’accesso in lettura e scrittura, la liberazione della memoria.<br />

Exports Procedure crea(xmatrice:integer, ymatrice:integer);<br />

-- alloca <strong>un</strong>a matrice <strong>di</strong> <strong>di</strong>menzione xmatrice, ymatrice<br />

F<strong>un</strong>ction acce<strong>di</strong>(x:integer, y:integer): TipoMatrice &;<br />

-- che permette <strong>di</strong> accedere ad <strong>un</strong> elemento della matrice.<br />

Procedure libera();<br />

-- che semplicemente libera la memoria allocata.<br />

Implementation<br />

-- per rendere veloce ed efficiente l’accesso alle matrici allocate bisogna rendere<br />

inline i meto<strong>di</strong> <strong>di</strong> accesso.<br />

-- <strong>un</strong>a buona implementazione dei meto<strong>di</strong> <strong>di</strong> accesso richiede l’overloa<strong>di</strong>ng<br />

dell’operatore <strong>di</strong> normale accesso agli array.<br />

End MATRICI;<br />

Module CALIBRA;<br />

-- E’ il modulo centrale che genera e gestisce l’accesso alle tabelle del sistema<br />

-- Fornisce le f<strong>un</strong>zionalità <strong>di</strong>: generazione delle tabelle, lettura e scrittura delle<br />

tabelle su file, accesso alle tabelle da utente esterno.<br />

Uses MATRICI;<br />

-- qui MATRICI viene usato per la rappresentazione della tabella <strong>di</strong> inversione<br />

prospettica e della tabella <strong>di</strong> localizzazione.<br />

-- TipoMatrici assume i valori “pixel” per la prima e “posizione” per la seconda.<br />

Exports F<strong>un</strong>ction Xspa(): integer;<br />

F<strong>un</strong>ction Yspa(): integer;<br />

F<strong>un</strong>ction Ximm(): integer;<br />

63

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!