CortidQCT  1.2.2.52
CortidQCT-Common.h
1 #pragma once
2 
3 #include "CortidQCT.h"
4 #include "cortidqct-c_export.h"
5 
6 #include <CortidQCT/CortidQCT.h>
7 
8 #include <cstddef>
9 #include <cstring>
10 
11 namespace CortidQCT {
12 namespace Internal {
13 namespace C {
14 
15 typedef void (*Deleter)(Id);
16 
17 CQCT_EXTERN struct Control {
18  std::size_t retainCount = 1;
19  Deleter deleter;
20 };
21 
22 template <class T> struct GenericObjectWrapper {
23  Control control;
24  T *objPtr = nullptr;
25 
27  if (objPtr != nullptr) { delete objPtr; }
28  }
29 };
30 
31 template <class T> void genericDeleter(Id obj) {
32  auto objWrapperPtr = static_cast<GenericObjectWrapper<T> *>(obj);
33  delete objWrapperPtr;
34 }
35 
36 template <class T, class... Args> Id constructObject(Args &&... args) {
37  auto wrapperPtr = new GenericObjectWrapper<T>;
38 
39  wrapperPtr->control.deleter = &genericDeleter<T>;
40  wrapperPtr->objPtr = new T{std::forward<Args>(args)...};
41 
42  return static_cast<Id>(wrapperPtr);
43 }
44 
46 createMeshFitterState(CQCT_MeshFitter meshFitter,
47  ::CortidQCT::MeshFitter::State const &state);
48 
50  CQCT_Mesh deformedMesh = nullptr;
51  CQCT_Mesh referenceMesh = nullptr;
52 
54 
55  void updateMesh();
56 
57  ~MeshFitterState() {
58  CQCT_release(deformedMesh);
59  CQCT_release(referenceMesh);
60  }
61 };
62 
63 } // namespace C
64 } // namespace Internal
65 } // namespace CortidQCT
66 
70  impl;
71 };
72 
75 };
76 
77 struct CQCT_Mesh_t {
79 };
80 
84  impl_;
85 };
86 
89 };
90 
Name namespace for CortidQCT library.
Definition: CortidQCT.h:23
Definition: CortidQCT-Common.h:49
Definition: CortidQCT-Common.h:17
Main header file for CortidQCT library.
Definition: CortidQCT-Common.h:81
Internal State type.
Definition: MeshFitter.h:159
Definition: CortidQCT-Common.h:67
Definition: CortidQCT-Common.h:22
void * Id
Generic &#39;object&#39; type.
Definition: CortidQCT.h:68
CQCT_EXTERN void CQCT_release(Id obj)
Definition: ObjectBase.cpp:83
Definition: CortidQCT-Common.h:87
A customaizable color to label map.
Definition: ColorToLabelMap.h:98
Definition: CortidQCT-Common.h:73
Definition: CortidQCT-Common.h:77