58 template<
typename T >
63 struct Destroyer< SettingsInterface >
66 static void destroy( SettingsInterface *settings )
74 struct Destroyer< CameraInterface >
77 static void destroy( CameraInterface *camera )
85 struct Destroyer< CameraCalibrationInterface >
88 static void destroy( CameraCalibrationInterface *calib )
96 struct Destroyer< CamerasLoaderInterface >
98 static void destroy( CamerasLoaderInterface *camerasLoader )
106 struct Destroyer< SparsePointCloudInterface >
109 static void destroy( SparsePointCloudInterface *pointCloud )
117 struct Destroyer< StereoPointCloudInterface >
120 static void destroy( StereoPointCloudInterface *pointCloud )
128 struct Destroyer< StereoMeshInterface >
131 static void destroy( StereoMeshInterface *mesh )
139 struct Destroyer< StereoTexturedMeshInterface >
141 static void destroy( StereoTexturedMeshInterface *texturedMesh )
149 struct Destroyer< WorkspaceLoaderInterface >
152 static void destroy( WorkspaceLoaderInterface *workspaceLoader )
160 struct Destroyer< WorkspaceSaverInterface >
163 static void destroy( WorkspaceSaverInterface *workspaceSaver )
171 struct Destroyer< ControlPointConstraintInterface >
174 static void destroy( ControlPointConstraintInterface *controlPoint )
182 struct Destroyer< BoundingBoxInterface >
185 static void destroy( BoundingBoxInterface *bb )
193 struct Destroyer< OrthophotoInterface >
196 static void destroy( OrthophotoInterface *op )
204 struct Destroyer< ProjectedCoordinateSystemInterface >
207 static void destroy( ProjectedCoordinateSystemInterface *pcs )
215 struct Destroyer< CameraConstraintInterface >
218 static void destroy( CameraConstraintInterface *cc )
226 struct Destroyer< DynamicBufferInterface >
229 static void destroy( DynamicBufferInterface *ptr )
237 struct Destroyer< LicenseInfoInterface >
240 static void destroy( LicenseInfoInterface *ptr )
248 struct Destroyer< DistanceConstraintInterface >
251 static void destroy( DistanceConstraintInterface *ptr )
259 struct Destroyer< CameraGroupManagerInterface >
262 static void destroy( CameraGroupManagerInterface *ptr )
270 struct Destroyer< GaussianSplatsInterface >
273 static void destroy( GaussianSplatsInterface *ptr )
279 template<
typename T >
280 class UniquePtr final
284 UniquePtr() =
default;
286 UniquePtr( T *
object )
290 UniquePtr( UniquePtr &&other )
291 : mObject( other.release() )
294 UniquePtr &operator =( UniquePtr &&other )
296 if (
this != &other )
298 reset( other.release() );
311 explicit operator bool()
const
313 return mObject !=
nullptr;
321 const T *operator ->()
const
331 const T &operator *()
const
348 void reset( T *
object =
nullptr )
351 Detail::Destroyer< T >::destroy( mObject );
365 T *mObject =
nullptr;
370 template<
typename T >
373 static_assert( std::is_same< CameraInterface, T >::value ||
374 std::is_same< CamerasLoaderInterface, T >::value ||
375 std::is_same< ControlPointConstraintInterface, T >::value ||
376 std::is_same< SparsePointCloudInterface, T >::value ||
377 std::is_same< StereoPointCloudInterface, T >::value ||
378 std::is_same< StereoMeshInterface, T >::value ||
379 std::is_same< StereoTexturedMeshInterface, T >::value ||
380 std::is_same< CameraConstraintInterface, T >::value ||
381 std::is_same< ProjectedCoordinateSystemInterface, T >::value ||
382 std::is_same< BoundingBoxInterface, T >::value ||
383 std::is_same< DistanceConstraintInterface, T >::value ||
384 std::is_same< OrthophotoInterface, T >::value ||
385 std::is_same< GaussianSplatsInterface, T >::value ||
386 std::is_same< CameraGroupManagerInterface, T >::value,
387 "This kind of buffer can only be used with object classes" );
399 : data( v.empty() ? nullptr : v.data() )
400 , count( v.empty() ? 0 : v.size() )
406 Buffer( std::vector< Detail::UniquePtr< T > > &v )
407 : data( v.empty() ? nullptr : reinterpret_cast< T ** >( v.data() ) )
408 , count( v.empty() ? 0 : v.size() )
410 static_assert(
sizeof( Detail::UniquePtr< T > ) ==
411 sizeof( std::ptrdiff_t ),
"" );
414 explicit operator bool()
const
416 return data !=
nullptr;
421 template<
typename T >
424 static_assert( std::is_same< CameraInterface, T >::value ||
425 std::is_same< CamerasLoaderInterface, T >::value ||
426 std::is_same< ControlPointConstraintInterface, T >::value ||
427 std::is_same< SparsePointCloudInterface, T >::value ||
428 std::is_same< StereoPointCloudInterface, T >::value ||
429 std::is_same< StereoMeshInterface, T >::value ||
430 std::is_same< StereoTexturedMeshInterface, T >::value ||
431 std::is_same< ProjectedCoordinateSystemInterface, T >::value ||
432 std::is_same< CameraConstraintInterface, T >::value ||
433 std::is_same< DistanceConstraintInterface, T >::value ||
434 std::is_same< BoundingBoxInterface, T >::value ||
435 std::is_same< OrthophotoInterface, T >::value ||
436 std::is_same< GaussianSplatsInterface, T >::value ||
437 std::is_same< CameraGroupManagerInterface, T >::value,
438 "This kind of buffer can only be used with object classes" );
441 const T *
const *data =
nullptr;
450 : data( v.empty() ? nullptr : v.data() )
451 , count( v.empty() ? 0 : v.size() )
453 static_assert(
sizeof( Detail::UniquePtr< T > ) ==
454 sizeof( std::ptrdiff_t ),
"" );
459 : data( v.empty() ? nullptr : reinterpret_cast< const T *const * >( v.data() ) )
460 , count( v.empty() ? 0 : v.size() )
462 static_assert(
sizeof( Detail::UniquePtr< T > ) ==
463 sizeof( std::ptrdiff_t ),
"" );
466 explicit operator bool()
const
468 return data !=
nullptr;
479 const std::size_t len = std::strlen( nMessage );
481 if ( len > 3 && nMessage[ 0 ] ==
'[' && nMessage[ 2 ] ==
']' )
482 nMessage = nMessage + 3;
486 ( *mFileStream ) << nMessage;
490 std::cout << nMessage;
502 void start(
const char *nWindowTitle,
bool nShowGlobalProgress,
bool nShowCancelButton )
514 void resetTicks(
unsigned int nTicks,
const char *nLoadingText )
616 const Point2 &referencePoint,
Stores a camera object to feed the Structure from Motion parameters.
Definition: CameraInterface.h:38
Pure virtual Log Listener interface.
Definition: LogListenerInterface.h:41
Pure virtual Progress Bar interface.
Definition: ProgressBarInterface.h:32
Definition: BoundingBoxInterface.cpp:26
void DestroyDynamicBuffer(DynamicBufferInterface *buf)
Definition: DynamicBufferInterface.cpp:32
void DestroyOrthophoto(OrthophotoInterface *orthophoto)
Definition: OrthophotoInterface.cpp:32
void DestroyProjectedCoordinateSystem(ProjectedCoordinateSystemInterface *pcs)
Definition: ProjectedCoordinateSystemInterface.cpp:32
Detail::UniquePtr< DynamicBufferInterface > UniqueDynamicBufferPtr
Automatically manages the lifetime of a DynamicBuffer object.
Definition: Utilities.h:584
Detail::UniquePtr< OrthophotoInterface > UniqueOrthophotoPtr
Automatically manages the lifetime of a Orthophoto object.
Definition: Utilities.h:575
void DestroyStereoTexturedMesh(StereoTexturedMeshInterface *stereoTexturedMesh)
Definition: StereoTexturedMeshInterface.cpp:32
void DestroyStereoPointCloud(StereoPointCloudInterface *stereoPointCloud)
Definition: StereoPointCloudInterface.cpp:32
void DestroyWorkspaceSaver(WorkspaceSaverInterface *workspaceSaver)
Definition: WorkspaceSaverInterface.cpp:32
FLE_DLL void DestroyCameraGroupManager(CameraGroupManagerInterface *cameraGroupManager)
Definition: CameraGroupManagerInterface.cpp:30
Detail::UniquePtr< CameraConstraintInterface > UniqueCameraConstraintPtr
Automatically manages the lifetime of a CameraConstraint object.
Definition: Utilities.h:581
Result SampleEpipolarLine(const CameraInterface &referenceCamera, const Point2 &referencePoint, const CameraInterface &targetCamera, int sampleCount, Buffer< Point2 > inOutPoints)
Definition: Utilities.cpp:208
Detail::UniquePtr< StereoTexturedMeshInterface > UniqueStereoTexturedMeshPtr
Automatically manages the lifetime of a Stereo textured mesh object.
Definition: Utilities.h:557
void DestroyBoundingBox(BoundingBoxInterface *boundingBox)
Definition: BoundingBoxInterface.cpp:32
void DestroySettings(SettingsInterface *settings)
Definition: SettingsInterface.cpp:32
Detail::UniquePtr< GaussianSplatsInterface > UniqueGaussianSplatsPtr
Automatically manages the lifetime of a GaussianSplats object.
Definition: Utilities.h:596
void DestroyWorkspaceLoader(WorkspaceLoaderInterface *workspaceLoader)
Definition: WorkspaceLoaderInterface.cpp:32
Result ComputeCamerasRating(Buffer< CameraInterface * > cameras, Buffer< Pair< CameraInterface *, Point2 > > selectedPoints, Buffer< int > inOutRatings)
Compute camera ratings based on point visibility.
Definition: Utilities.cpp:313
Detail::UniquePtr< WorkspaceSaverInterface > UniqueWorkspaceSaverPtr
Automatically manages the lifetime of a Workspace Saver object.
Definition: Utilities.h:566
void DestroyCamerasLoader(CamerasLoaderInterface *CamerasLoader)
Definition: CamerasLoaderInterface.cpp:32
const char * GetResultMessage(Result inResult)
Definition: Utilities.cpp:157
Detail::UniquePtr< CamerasLoaderInterface > UniqueCamerasLoaderPtr
Automatically manages the lifetime of a CamerasLoader object.
Definition: Utilities.h:545
void DestroyStereoMesh(StereoMeshInterface *stereoMesh)
Definition: StereoMeshInterface.cpp:32
void DestroyGaussianSplats(GaussianSplatsInterface *gaussianSplats)
Definition: GaussianSplatsInterface.cpp:32
void DestroyCameraConstraint(CameraConstraintInterface *cameraConstraint)
Definition: CameraConstraintInterface.cpp:32
Detail::UniquePtr< WorkspaceLoaderInterface > UniqueWorkspaceLoaderPtr
Automatically manages the lifetime of a Workspace Loader object.
Definition: Utilities.h:569
Detail::UniquePtr< CameraCalibrationInterface > UniqueCameraCalibrationPtr
Automatically manages the lifetime of a Camera calibration object.
Definition: Utilities.h:542
Detail::UniquePtr< StereoPointCloudInterface > UniqueStereoPointCloudPtr
Automatically manages the lifetime of a Stereo Point cloud object.
Definition: Utilities.h:551
Detail::UniquePtr< LicenseInfoInterface > UniqueLicenseInfoPtr
Automatically manages the lifetime of a LicenseInfo object.
Definition: Utilities.h:587
Detail::UniquePtr< BoundingBoxInterface > UniqueBoundingBoxPtr
Automatically manages the lifetime of a Bounding box object.
Definition: Utilities.h:563
void DestroySparsePointCloud(SparsePointCloudInterface *boundingBox)
Definition: SparsePointCloudInterface.cpp:32
Detail::UniquePtr< ControlPointConstraintInterface > UniqueControlPointConstraintPtr
Automatically manages the lifetime of a Control Point Constraint object.
Definition: Utilities.h:572
void DestroyLicenseInfo(LicenseInfoInterface *buf)
Definition: LicenseInfoInterface.cpp:32
void DestroyCamera(CameraInterface *camera)
Definition: CameraInterface.cpp:32
Detail::UniquePtr< CameraGroupManagerInterface > UniqueCameraGroupManagerPtr
Automatically manages the lifetime of a CameraGroupManager object.
Definition: Utilities.h:593
Detail::UniquePtr< StereoMeshInterface > UniqueStereoMeshPtr
Automatically manages the lifetime of a Stereo mesh object.
Definition: Utilities.h:554
Detail::UniquePtr< SparsePointCloudInterface > UniqueSparsePointCloudPtr
Automatically manages the lifetime of a Sparse Point Cloud object.
Definition: Utilities.h:548
void DestroyCameraCalibration(CameraCalibrationInterface *cameraCalibration)
Definition: CameraCalibrationInterface.cpp:32
Detail::UniquePtr< ProjectedCoordinateSystemInterface > UniqueProjectedCoordinateSystemPtr
Automatically manages the lifetime of a ProjectedCoordinateSystem object.
Definition: Utilities.h:578
void DestroyDistanceConstraint(DistanceConstraintInterface *distance)
Definition: DistanceConstraintInterface.cpp:32
void DestroyControlPointConstraint(ControlPointConstraintInterface *controlPoint)
Definition: ControlPointConstraintInterface.cpp:32
std::size_t Size
Size type.
Definition: CommonDef.h:106
Detail::UniquePtr< DistanceConstraintInterface > UniqueDistanceConstraintPtr
Automatically manages the lifetime of a DistanceConstraint object.
Definition: Utilities.h:590
Detail::UniquePtr< SettingsInterface > UniqueSettingsPtr
Automatically manages the lifetime of a Settings object.
Definition: Utilities.h:560
Detail::UniquePtr< CameraInterface > UniqueCameraPtr
Automatically manages the lifetime of a Camera object.
Definition: Utilities.h:539
Result
Enumerates possible results generated by FlowEngine.
Definition: CommonDef.h:48
Buffer(std::vector< T * > &v)
Constructor from std::vector.
Definition: Utilities.h:398
Buffer(std::vector< Detail::UniquePtr< T > > &v)
Constructor from std::vector of unique pointers.
Definition: Utilities.h:406
Holds a (mutable) non_owning pointer and a size Used to marshal memory buffers as arguments in a safe...
Definition: CommonDef.h:127
ConstBuffer(const std::vector< T * > &v)
Conversion from std::vector.
Definition: Utilities.h:449
ConstBuffer(const std::vector< Detail::UniquePtr< T > > &v)
Conversion from std::vector of unique pointers.
Definition: Utilities.h:458
Holds a (non mutable) non_owning pointer and a count Used to marshal memory buffers as arguments in a...
Definition: CommonDef.h:200
Simple log listener class.
Definition: Utilities.h:474
std::ostream * mFileStream
Pointer to an optional file stream.
Definition: Utilities.h:495
void messageLogged(const char *nMessage)
Send to stdout and optionally on a file stream.
Definition: Utilities.h:476
Bound 2 values together.
Definition: CommonDef.h:596
a 2 dimensional point
Definition: CommonDef.h:472
Simple/Empty progress bar class.
Definition: Utilities.h:500
void resetGlobalTicks(unsigned int nGlobalTicks, const char *nLoadingText)
Set global progress bar ticks (if any) and reset the counter to 0.
Definition: Utilities.h:520
void start(const char *nWindowTitle, bool nShowGlobalProgress, bool nShowCancelButton)
Show the progress bar.
Definition: Utilities.h:502
void resetTicks(unsigned int nTicks, const char *nLoadingText)
Set progress bar ticks and reset the counter to 0.
Definition: Utilities.h:514
void update()
Progress the loading bar - Add + 1 Tick.
Definition: Utilities.h:526
void finish()
Hide the loading bar.
Definition: Utilities.h:508
void updateGlobal()
Progress the global progress bar - Add + 1 Tick.
Definition: Utilities.h:532