QuercusVL Programming Manual
Detector ExampleOfObjectsUse (Unit unit)
{
Detector detectorA, detectorB;
detectorA=unit.get_Detectors().Item(0);
detectorB=detectorA;
return detectorB;
}
Even though the function of the example does not contain useful code, it shows the use made
of objects:
●
Detector ExampleOfObjectsUse(Unit unit);
The objects can be passed as function parameters without using pointers or references,
and it does not affect application performance.
In a classic C++ objects system, this call would turn into a performance decrease and a
potential source of errors, because it would call the object's copy constructor to pass
the copy as a function parameter. When the function returns, it would call the object's
copy destructor and this is dangerous, specially if the object internally contains
pointers. In VL library, all these caveats have been solved, as the object's copy
constructor is only 4 bytes of memory, and at the destruction of the object's copy, the
real object is never destroyed while there is any copy still to destroy.
●
detectorA=unit.get_Detectors().Item(0);
detectorB=detectorA;
return detectorB;
All VL methods returns objects, never pointers or references. The developer can freely
manipulate the object (can be duplicated, returned, etc., and it will remain valid).
2.1.2. Build of executable
Visual Studio
●
Open the workspace “Samples.dsw” located at folder “Samples”.
●
Set the active project “CppApi_Basic”.
●
“Build” the executable.
Linux
●
Open a console window.
●
Go to folder Samples/CppApi_Basic.
●
Type “make” command.
Quercus Technologies
19