#include <Scan.h>
Public Member Functions | |
Scan () | |
Default constructor. | |
Scan (ScanTypes type) | |
Type constructor. | |
Scan (Rays r, Time t) | |
Complete constructor in m. | |
Scan (Raymms r, Time t) | |
Complete constructor in mm. | |
Scan (const Scan &s) | |
Copy constructor. | |
Scan & | operator= (const Scan &s) |
Assigment operator =. | |
bool | operator== (Scan &s) |
Compound operator ==. | |
bool | operator!= (Scan &s) |
Compound operator !=. | |
bool | getConeAmplitude (Decimal &coneAmplitude) |
Writes the cone amplitude in &coneAmplitude. | |
bool | getScanAngle (Decimal &scanAngle) |
Writes the scan angle in &scanAngle. | |
bool | askExclusiveAccess (Time timeout) |
void | leaveExclusiveAccess () |
Release the scan resources. | |
bool | allowed () |
Says if this thread is allowed. | |
bool | reserve (int n) |
Reserve a ray dimension. | |
bool | valid (bool &validity) |
Get scan validity. | |
bool | getScanType (ScanTypes &type) |
Get scan type. | |
bool | getSize (int &size) |
Get scan size. | |
Angle | getAngRes () |
Get the angular resolution of the Scan. | |
bool | getTimeStamp (Time ×tamp) |
Get time stamp. | |
bool | getRay (Ray &ray, int index) |
Get a ray in m. | |
bool | getRay (Raymm &raymm, int index) |
Get a ray in mm. | |
bool | setRay (Ray &ray, int index) |
Sets a ray given in m. | |
bool | setRay (Raymm &raymm, int index) |
Sets a ray given in mm. | |
bool | setTimeStamp (Time t) |
Set time-stamp. | |
bool | addRay (const Ray r) |
Push back a ray in m. | |
bool | addRay (const Raymm r) |
Push back a ray in mm. | |
bool | clear () |
Reset the scan. | |
bool | voidReadings (Decimal minReading, Decimal maxReading) |
Sets valid to false in each ray having reading outside a certain interval (extremes included). | |
string | print () |
Print function. | |
void | printJson (fstream &s) |
Print Json function. | |
UCoordmm | unmutexedGetReading (int index) |
Get a reading in UCoordmm (implemented for efficiency). | |
bool | unmutexedGetValid (int index) |
Get a valid (implemented for efficiency). |
The scan class contains a rays. Each ray has a reading and a bearing, corresponding respectively to the linear and angular coordinate in a polar system of coordinate. Each ray has also a boolean specifying the validity of that ray. Bearing and reading of a ray whose validity is false are not defined. A scan is also equiped with a mutex and an extern function is permitted to ask and leave exclusive access to it to avoid that another thread could modify it. If exclusive access is requested, is good programming to leave as soon as possible. It is important to always leave the exclusive access anyway. For this peculiarity, all get functions of the do not return directly the requested item. They return a boolean that is true if it is possible to retreive the requested item (no other thread has exclusive access) and false otherwise (another thtread has exclusive access). The requested item is stored in an argument passed for reference. The set functions have the same feature.
Another important characteristic of the Scan class is that it can be of two types. First type is Scan in m, in which all linear measures are expressed in m and stored in Decimal variables, while all angular measures are stored in Angle and expressed in radians. The Second type is Scan in mm, in which all linear measures are expressed in mm and stored in int variables, while all angular measures are stored in Anglem and expressed in hundredths of degree.
Rays can be only added, not removed, you can:
1) reset the scan by means clear() and overwrite all with addRay or assigment "="
2) using direcly the assignment
the scan it is considered valid from the first ray pushed in, when cleared it is resetted to invalid
MipBaselib::Scan::Scan | ( | ) | [inline] |
Default constructor.
MipBaselib::Scan::Scan | ( | ScanTypes | type | ) | [inline] |
Type constructor.
bool MipBaselib::Scan::operator== | ( | Scan & | s | ) | [inline] |
Compound operator ==.
Return false if one of the scan is locked, if the types of the scans are different, if the size of the scans are different, if at least one pair of corresponding rays (or raymms according to the type) are different. Return true otherwise.
bool MipBaselib::Scan::operator!= | ( | Scan & | s | ) | [inline] |
Compound operator !=.
It returns !operator==.
bool MipBaselib::Scan::getConeAmplitude | ( | Decimal & | coneAmplitude | ) |
Writes the cone amplitude in &coneAmplitude.
[out] | coneAmplitude | The reference to the variable where to write the coneAmplitude. |
bool MipBaselib::Scan::getScanAngle | ( | Decimal & | scanAngle | ) |
Writes the scan angle in &scanAngle.
[out] | scanAngle | The reference to the variable where to write the s. |
bool MipBaselib::Scan::askExclusiveAccess | ( | Time | timeout | ) | [inline] |
Aks to use the scan resources.
[out] | timeout | Maximum time to obtain exclusive access. |
void MipBaselib::Scan::leaveExclusiveAccess | ( | ) | [inline] |
Release the scan resources.
bool MipBaselib::Scan::allowed | ( | ) | [inline] |
Says if this thread is allowed.
bool MipBaselib::Scan::reserve | ( | int | n | ) | [inline] |
Reserve a ray dimension.
This method wrap the method reserve of _rays or _raymms according with the _scanType.
[in] | n | Dimension to be reserved. |
bool MipBaselib::Scan::valid | ( | bool & | validity | ) | [inline] |
Get scan validity.
[out] | &validity | Returned validity. |
bool MipBaselib::Scan::getScanType | ( | ScanTypes & | type | ) | [inline] |
Get scan type.
[out] | &type | Returned type. |
bool MipBaselib::Scan::getSize | ( | int & | size | ) |
Get scan size.
[out] | &size | Returned size. |
Angle MipBaselib::Scan::getAngRes | ( | ) | [inline] |
bool MipBaselib::Scan::getTimeStamp | ( | Time & | timestamp | ) | [inline] |
Get time stamp.
[out] | ×tamp | Returned timestamp. |
bool MipBaselib::Scan::getRay | ( | Ray & | ray, | |
int | index | |||
) |
Get a ray in m.
[out] | &ray | Returned ray. |
[in] | index | Index of the ray to be set. |
bool MipBaselib::Scan::getRay | ( | Raymm & | raymm, | |
int | index | |||
) |
Get a ray in mm.
[out] | &raymm | Returned ray. |
[in] | index | Index of the ray to be set. |
bool MipBaselib::Scan::setRay | ( | Ray & | ray, | |
int | index | |||
) |
Sets a ray given in m.
[in] | &ray | Ray to copy. |
[in] | index | Index of the ray to be set. |
bool MipBaselib::Scan::setRay | ( | Raymm & | raymm, | |
int | index | |||
) |
Sets a ray given in mm.
[in] | &raymm | Raymm to copy. |
[in] | index | Index of the ray to be set. |
bool MipBaselib::Scan::setTimeStamp | ( | Time | t | ) | [inline] |
Set time-stamp.
t | Timestamp to set |
bool MipBaselib::Scan::addRay | ( | const Ray | r | ) | [inline] |
bool MipBaselib::Scan::addRay | ( | const Raymm | r | ) | [inline] |
bool MipBaselib::Scan::clear | ( | void | ) | [inline] |
Reset the scan.
Sets valid to false in each ray having reading outside a certain interval (extremes included).
[in] | minReading | Low value of the interval. |
[in] | maxReading | Hi value of the interval. |
string MipBaselib::Scan::print | ( | ) |
Print function.
void MipBaselib::Scan::printJson | ( | fstream & | s | ) |
Print Json function.
Print the scan in Json Format on a filestream.
UCoordmm MipBaselib::Scan::unmutexedGetReading | ( | int | index | ) | [inline] |
Get a reading in UCoordmm (implemented for efficiency).
[in] | index | Index of the returned reading. |
bool MipBaselib::Scan::unmutexedGetValid | ( | int | index | ) | [inline] |
Get a valid (implemented for efficiency).
[in] | index | Index of the returned valid. |