34#include "DGtal/base/Common.h"
35#include "DGtal/base/Clone.h"
36#include "DGtal/base/Alias.h"
37#include "DGtal/base/ConstAlias.h"
38#include "DGtal/helpers/StdDefs.h"
51 std::cout <<
" ~A1() " << std::endl;
56 std::cout <<
" A1( int i ) " << std::endl;
61 std::cout <<
" A1( const A1 & a ) " << std::endl;
67 std::cout <<
" A1::operator=( const A1 & a ) " << std::endl;
90 std::cout <<
" DByValue( A1 a) " << std::endl;
107 std::cout <<
" DByClone( Clone<A1> a) " << std::endl;
124 std::cout <<
" EByAlias( Alias<A1> a ) " <<
myA1 << std::endl;
141 std::cout <<
" EByConstAlias( Alias<A1> a ) " <<
myA1 << std::endl;
167 double dx = (double)
_x;
168 double dy = (double)
_y;
169 return sqrt( dx * dx + dy * dy );
189 :
_a( a ),
_b( b ),
_c( c ) {}
192 return (
_a -
_b).norm() + (
_b -
_c).norm() + (
_c -
_a).norm();
199 :
_a( a ),
_b( b ),
_c( c ) {}
202 return (
_a -
_b).norm() + (
_b -
_c).norm() + (
_c -
_a).norm();
209 :
_a( a ),
_b( b ),
_c( c ) {}
212 return (
_a -
_b).norm() + (
_b -
_c).norm() + (
_c -
_a).norm();
217template <
typename Triangle>
223 for (
int yb = 0; yb < size; ++yb )
224 for (
int xb = 0; xb < size; ++xb )
227 for (
int yc = 0; yc < size; ++yc )
228 for (
int xc = 0; xc < size; ++xc )
232 total += T.perimeter();
242 std::cout <<
" FByCloneHeap( Clone<A1> a ) " <<
myA1 << std::endl;
259 std::cout <<
" FByCloneCowPtr( Clone<A1> a ) " <<
myA1 << std::endl;
275 unsigned int nbok = 0;
276 trace.beginBlock (
"Number of A1 instances with standard by-value parameter passing." );
279 trace.info() <<
"D: d1.value() = " << d1.
value() << std::endl;
282 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
286 trace.beginBlock (
"Number of A1 instances with explicit by-value parameter passing (Clone)." );
290 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
294 trace.beginBlock (
"Number of A1 instances with explicit by-reference parameter passing (Alias)." );
298 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
302 trace.beginBlock (
"Number of A1 instances with explicit by-const reference parameter passing (Alias)." );
306 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
310 trace.beginBlock (
"Number of A1 instances with explicit by-value parameter passing into heap (Clone)." );
314 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
318 trace.beginBlock (
"Number of A1 instances with explicit by-value parameter passing into CowPtr (Clone)." );
322 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
328 trace.beginBlock (
"Total perimeter of triangles with by-value parameter passing." );
330 trace.info() <<
"Perimeter is " << t1 << std::endl;
332 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
338 trace.beginBlock (
"Total perimeter of triangles with by-const reference parameter passing." );
340 trace.info() <<
"Perimeter is " << t2 << std::endl;
343 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
348 trace.beginBlock (
"Total perimeter of triangles with by Clone parameter passing." );
350 trace.info() <<
"Perimeter is " << t3 << std::endl;
353 trace.info() <<
"(" << nbok <<
"/" << nb <<
")"
363 return ( nb == nbok ) ? 0 : 1;
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Aim: This class encapsulates its parameter class to indicate that the given parameter is required to ...
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Aim: Copy on write shared pointer.
MyPoint operator-(const MyPoint &other) const
MyPoint(const MyPoint &other)
DGtal is the top-level namespace which contains all DGtal functions and types.
A1 & operator=(const A1 &a)
EByConstAlias(ConstAlias< A1 > a)
FByCloneCowPtr(Clone< A1 > a)
FByCloneHeap(Clone< A1 > a)
TriangleByClone(Clone< Point > a, Clone< Point > b, Clone< Point > c)
TriangleByConstReference(const Point &a, const Point &b, const Point &c)
TriangleByValue(Point a, Point b, Point c)
double computeTriangles(int size)
HalfEdgeDataStructure::Triangle Triangle