Skip to content

Commit

Permalink
Implement RemoveResource method in model interface and bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
3dJan committed Oct 16, 2024
1 parent 57105a4 commit 0b4c011
Show file tree
Hide file tree
Showing 26 changed files with 535 additions and 25 deletions.
13 changes: 11 additions & 2 deletions Autogenerated/Bindings/C/lib3mf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_ismanifoldandoriented(Lib3MF_Mesh
LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_beamlattice(Lib3MF_MeshObject pMeshObject, Lib3MF_BeamLattice * pTheBeamLattice);

/**
* Retrieves the VolumeData this MeshObject.
* Retrieves the VolumeData of this MeshObject.
*
* @param[in] pMeshObject - MeshObject instance.
* @param[out] pTheVolumeData - the VolumeData of this MeshObject
Expand All @@ -1224,7 +1224,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_beamlattice(Lib3MF_MeshObject pMe
LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_getvolumedata(Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData * pTheVolumeData);

/**
* Sets the VolumeData this MeshObject.
* Sets the VolumeData of this MeshObject.
*
* @param[in] pMeshObject - MeshObject instance.
* @param[in] pTheVolumeData - the VolumeData of this MeshObject
Expand Down Expand Up @@ -6244,6 +6244,15 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_addlevelset(Lib3MF_Model pModel, Lib3M
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_getlevelsets(Lib3MF_Model pModel, Lib3MF_LevelSetIterator * pResourceIterator);

/**
* Removes a resource from the model
*
* @param[in] pModel - Model instance.
* @param[in] pResource - The resource to remove
* @return error code or 0 (success)
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_removeresource(Lib3MF_Model pModel, Lib3MF_Resource pResource);

/*************************************************************************************************************************
Global functions
**************************************************************************************************************************/
Expand Down
10 changes: 10 additions & 0 deletions Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable)
pWrapperTable->m_Model_AddVolumeData = NULL;
pWrapperTable->m_Model_AddLevelSet = NULL;
pWrapperTable->m_Model_GetLevelSets = NULL;
pWrapperTable->m_Model_RemoveResource = NULL;
pWrapperTable->m_GetLibraryVersion = NULL;
pWrapperTable->m_GetPrereleaseInformation = NULL;
pWrapperTable->m_GetBuildInformation = NULL;
Expand Down Expand Up @@ -5941,6 +5942,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable,
if (pWrapperTable->m_Model_GetLevelSets == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_Model_RemoveResource = (PLib3MFModel_RemoveResourcePtr) GetProcAddress(hLibrary, "lib3mf_model_removeresource");
#else // _WIN32
pWrapperTable->m_Model_RemoveResource = (PLib3MFModel_RemoveResourcePtr) dlsym(hLibrary, "lib3mf_model_removeresource");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_Model_RemoveResource == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_GetLibraryVersion = (PLib3MFGetLibraryVersionPtr) GetProcAddress(hLibrary, "lib3mf_getlibraryversion");
#else // _WIN32
Expand Down
14 changes: 12 additions & 2 deletions Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ typedef Lib3MFResult (*PLib3MFMeshObject_IsManifoldAndOrientedPtr) (Lib3MF_MeshO
typedef Lib3MFResult (*PLib3MFMeshObject_BeamLatticePtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_BeamLattice * pTheBeamLattice);

/**
* Retrieves the VolumeData this MeshObject.
* Retrieves the VolumeData of this MeshObject.
*
* @param[in] pMeshObject - MeshObject instance.
* @param[out] pTheVolumeData - the VolumeData of this MeshObject
Expand All @@ -1211,7 +1211,7 @@ typedef Lib3MFResult (*PLib3MFMeshObject_BeamLatticePtr) (Lib3MF_MeshObject pMes
typedef Lib3MFResult (*PLib3MFMeshObject_GetVolumeDataPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData * pTheVolumeData);

/**
* Sets the VolumeData this MeshObject.
* Sets the VolumeData of this MeshObject.
*
* @param[in] pMeshObject - MeshObject instance.
* @param[in] pTheVolumeData - the VolumeData of this MeshObject
Expand Down Expand Up @@ -6231,6 +6231,15 @@ typedef Lib3MFResult (*PLib3MFModel_AddLevelSetPtr) (Lib3MF_Model pModel, Lib3MF
*/
typedef Lib3MFResult (*PLib3MFModel_GetLevelSetsPtr) (Lib3MF_Model pModel, Lib3MF_LevelSetIterator * pResourceIterator);

/**
* Removes a resource from the model
*
* @param[in] pModel - Model instance.
* @param[in] pResource - The resource to remove
* @return error code or 0 (success)
*/
typedef Lib3MFResult (*PLib3MFModel_RemoveResourcePtr) (Lib3MF_Model pModel, Lib3MF_Resource pResource);

/*************************************************************************************************************************
Global functions
**************************************************************************************************************************/
Expand Down Expand Up @@ -7017,6 +7026,7 @@ typedef struct {
PLib3MFModel_AddVolumeDataPtr m_Model_AddVolumeData;
PLib3MFModel_AddLevelSetPtr m_Model_AddLevelSet;
PLib3MFModel_GetLevelSetsPtr m_Model_GetLevelSets;
PLib3MFModel_RemoveResourcePtr m_Model_RemoveResource;
PLib3MFGetLibraryVersionPtr m_GetLibraryVersion;
PLib3MFGetPrereleaseInformationPtr m_GetPrereleaseInformation;
PLib3MFGetBuildInformationPtr m_GetBuildInformation;
Expand Down
12 changes: 12 additions & 0 deletions Autogenerated/Bindings/CSharp/Lib3MF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2181,6 +2181,9 @@ public class Lib3MFWrapper
[DllImport("lib3mf.dll", EntryPoint = "lib3mf_model_getlevelsets", CallingConvention=CallingConvention.Cdecl)]
public unsafe extern static Int32 Model_GetLevelSets (IntPtr Handle, out IntPtr AResourceIterator);

[DllImport("lib3mf.dll", EntryPoint = "lib3mf_model_removeresource", CallingConvention=CallingConvention.Cdecl)]
public unsafe extern static Int32 Model_RemoveResource (IntPtr Handle, IntPtr AResource);

[DllImport("lib3mf.dll", EntryPoint = "lib3mf_getlibraryversion", CharSet = CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)]
public extern static Int32 GetLibraryVersion (out UInt32 AMajor, out UInt32 AMinor, out UInt32 AMicro);

Expand Down Expand Up @@ -8907,6 +8910,15 @@ public CLevelSetIterator GetLevelSets ()
return Internal.Lib3MFWrapper.PolymorphicFactory<CLevelSetIterator>(newResourceIterator);
}

public void RemoveResource (CResource AResource)
{
IntPtr AResourceHandle = IntPtr.Zero;
if (AResource != null)
AResourceHandle = AResource.GetHandle();

CheckError(Internal.Lib3MFWrapper.Model_RemoveResource (Handle, AResourceHandle));
}

}

class Wrapper
Expand Down
13 changes: 11 additions & 2 deletions Autogenerated/Bindings/Cpp/lib3mf_abi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_ismanifoldandoriented(Lib3MF_Mesh
LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_beamlattice(Lib3MF_MeshObject pMeshObject, Lib3MF_BeamLattice * pTheBeamLattice);

/**
* Retrieves the VolumeData this MeshObject.
* Retrieves the VolumeData of this MeshObject.
*
* @param[in] pMeshObject - MeshObject instance.
* @param[out] pTheVolumeData - the VolumeData of this MeshObject
Expand All @@ -1224,7 +1224,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_beamlattice(Lib3MF_MeshObject pMe
LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_getvolumedata(Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData * pTheVolumeData);

/**
* Sets the VolumeData this MeshObject.
* Sets the VolumeData of this MeshObject.
*
* @param[in] pMeshObject - MeshObject instance.
* @param[in] pTheVolumeData - the VolumeData of this MeshObject
Expand Down Expand Up @@ -6244,6 +6244,15 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_addlevelset(Lib3MF_Model pModel, Lib3M
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_getlevelsets(Lib3MF_Model pModel, Lib3MF_LevelSetIterator * pResourceIterator);

/**
* Removes a resource from the model
*
* @param[in] pModel - Model instance.
* @param[in] pResource - The resource to remove
* @return error code or 0 (success)
*/
LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_removeresource(Lib3MF_Model pModel, Lib3MF_Resource pResource);

/*************************************************************************************************************************
Global functions
**************************************************************************************************************************/
Expand Down
15 changes: 13 additions & 2 deletions Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3402,6 +3402,7 @@ class CModel : public CBase {
inline PVolumeData AddVolumeData();
inline PLevelSet AddLevelSet();
inline PLevelSetIterator GetLevelSets();
inline void RemoveResource(classParam<CResource> pResource);
};

/*************************************************************************************************************************
Expand Down Expand Up @@ -5262,7 +5263,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
}

/**
* CMeshObject::GetVolumeData - Retrieves the VolumeData this MeshObject.
* CMeshObject::GetVolumeData - Retrieves the VolumeData of this MeshObject.
* @return the VolumeData of this MeshObject
*/
PVolumeData CMeshObject::GetVolumeData()
Expand All @@ -5278,7 +5279,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
}

/**
* CMeshObject::SetVolumeData - Sets the VolumeData this MeshObject.
* CMeshObject::SetVolumeData - Sets the VolumeData of this MeshObject.
* @param[in] pTheVolumeData - the VolumeData of this MeshObject
*/
void CMeshObject::SetVolumeData(classParam<CVolumeData> pTheVolumeData)
Expand Down Expand Up @@ -12078,6 +12079,16 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
}
return std::shared_ptr<CLevelSetIterator>(dynamic_cast<CLevelSetIterator*>(m_pWrapper->polymorphicFactory(hResourceIterator)));
}

/**
* CModel::RemoveResource - Removes a resource from the model
* @param[in] pResource - The resource to remove
*/
void CModel::RemoveResource(classParam<CResource> pResource)
{
Lib3MFHandle hResource = pResource.GetHandle();
CheckError(lib3mf_model_removeresource(m_pHandle, hResource));
}

} // namespace Lib3MF

Expand Down
14 changes: 12 additions & 2 deletions Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ typedef Lib3MFResult (*PLib3MFMeshObject_IsManifoldAndOrientedPtr) (Lib3MF_MeshO
typedef Lib3MFResult (*PLib3MFMeshObject_BeamLatticePtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_BeamLattice * pTheBeamLattice);

/**
* Retrieves the VolumeData this MeshObject.
* Retrieves the VolumeData of this MeshObject.
*
* @param[in] pMeshObject - MeshObject instance.
* @param[out] pTheVolumeData - the VolumeData of this MeshObject
Expand All @@ -1211,7 +1211,7 @@ typedef Lib3MFResult (*PLib3MFMeshObject_BeamLatticePtr) (Lib3MF_MeshObject pMes
typedef Lib3MFResult (*PLib3MFMeshObject_GetVolumeDataPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData * pTheVolumeData);

/**
* Sets the VolumeData this MeshObject.
* Sets the VolumeData of this MeshObject.
*
* @param[in] pMeshObject - MeshObject instance.
* @param[in] pTheVolumeData - the VolumeData of this MeshObject
Expand Down Expand Up @@ -6231,6 +6231,15 @@ typedef Lib3MFResult (*PLib3MFModel_AddLevelSetPtr) (Lib3MF_Model pModel, Lib3MF
*/
typedef Lib3MFResult (*PLib3MFModel_GetLevelSetsPtr) (Lib3MF_Model pModel, Lib3MF_LevelSetIterator * pResourceIterator);

/**
* Removes a resource from the model
*
* @param[in] pModel - Model instance.
* @param[in] pResource - The resource to remove
* @return error code or 0 (success)
*/
typedef Lib3MFResult (*PLib3MFModel_RemoveResourcePtr) (Lib3MF_Model pModel, Lib3MF_Resource pResource);

/*************************************************************************************************************************
Global functions
**************************************************************************************************************************/
Expand Down Expand Up @@ -7017,6 +7026,7 @@ typedef struct {
PLib3MFModel_AddVolumeDataPtr m_Model_AddVolumeData;
PLib3MFModel_AddLevelSetPtr m_Model_AddLevelSet;
PLib3MFModel_GetLevelSetsPtr m_Model_GetLevelSets;
PLib3MFModel_RemoveResourcePtr m_Model_RemoveResource;
PLib3MFGetLibraryVersionPtr m_GetLibraryVersion;
PLib3MFGetPrereleaseInformationPtr m_GetPrereleaseInformation;
PLib3MFGetBuildInformationPtr m_GetBuildInformation;
Expand Down
29 changes: 27 additions & 2 deletions Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3426,6 +3426,7 @@ class CModel : public CBase {
inline PVolumeData AddVolumeData();
inline PLevelSet AddLevelSet();
inline PLevelSetIterator GetLevelSets();
inline void RemoveResource(classParam<CResource> pResource);
};

/*************************************************************************************************************************
Expand Down Expand Up @@ -4427,6 +4428,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
pWrapperTable->m_Model_AddVolumeData = nullptr;
pWrapperTable->m_Model_AddLevelSet = nullptr;
pWrapperTable->m_Model_GetLevelSets = nullptr;
pWrapperTable->m_Model_RemoveResource = nullptr;
pWrapperTable->m_GetLibraryVersion = nullptr;
pWrapperTable->m_GetPrereleaseInformation = nullptr;
pWrapperTable->m_GetBuildInformation = nullptr;
Expand Down Expand Up @@ -9734,6 +9736,15 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
if (pWrapperTable->m_Model_GetLevelSets == nullptr)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_Model_RemoveResource = (PLib3MFModel_RemoveResourcePtr) GetProcAddress(hLibrary, "lib3mf_model_removeresource");
#else // _WIN32
pWrapperTable->m_Model_RemoveResource = (PLib3MFModel_RemoveResourcePtr) dlsym(hLibrary, "lib3mf_model_removeresource");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_Model_RemoveResource == nullptr)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_GetLibraryVersion = (PLib3MFGetLibraryVersionPtr) GetProcAddress(hLibrary, "lib3mf_getlibraryversion");
#else // _WIN32
Expand Down Expand Up @@ -12249,6 +12260,10 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
if ( (eLookupError != 0) || (pWrapperTable->m_Model_GetLevelSets == nullptr) )
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

eLookupError = (*pLookup)("lib3mf_model_removeresource", (void**)&(pWrapperTable->m_Model_RemoveResource));
if ( (eLookupError != 0) || (pWrapperTable->m_Model_RemoveResource == nullptr) )
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

eLookupError = (*pLookup)("lib3mf_getlibraryversion", (void**)&(pWrapperTable->m_GetLibraryVersion));
if ( (eLookupError != 0) || (pWrapperTable->m_GetLibraryVersion == nullptr) )
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;
Expand Down Expand Up @@ -13776,7 +13791,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
}

/**
* CMeshObject::GetVolumeData - Retrieves the VolumeData this MeshObject.
* CMeshObject::GetVolumeData - Retrieves the VolumeData of this MeshObject.
* @return the VolumeData of this MeshObject
*/
PVolumeData CMeshObject::GetVolumeData()
Expand All @@ -13792,7 +13807,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
}

/**
* CMeshObject::SetVolumeData - Sets the VolumeData this MeshObject.
* CMeshObject::SetVolumeData - Sets the VolumeData of this MeshObject.
* @param[in] pTheVolumeData - the VolumeData of this MeshObject
*/
void CMeshObject::SetVolumeData(classParam<CVolumeData> pTheVolumeData)
Expand Down Expand Up @@ -20592,6 +20607,16 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle)
}
return std::shared_ptr<CLevelSetIterator>(dynamic_cast<CLevelSetIterator*>(m_pWrapper->polymorphicFactory(hResourceIterator)));
}

/**
* CModel::RemoveResource - Removes a resource from the model
* @param[in] pResource - The resource to remove
*/
void CModel::RemoveResource(classParam<CResource> pResource)
{
Lib3MFHandle hResource = pResource.GetHandle();
CheckError(m_pWrapper->m_WrapperTable.m_Model_RemoveResource(m_pHandle, hResource));
}

} // namespace Lib3MF

Expand Down
22 changes: 20 additions & 2 deletions Autogenerated/Bindings/Go/lib3mf.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Autogenerated/Bindings/Go/lib3mf_dynamic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable)
pWrapperTable->m_Model_AddVolumeData = NULL;
pWrapperTable->m_Model_AddLevelSet = NULL;
pWrapperTable->m_Model_GetLevelSets = NULL;
pWrapperTable->m_Model_RemoveResource = NULL;
pWrapperTable->m_GetLibraryVersion = NULL;
pWrapperTable->m_GetPrereleaseInformation = NULL;
pWrapperTable->m_GetBuildInformation = NULL;
Expand Down Expand Up @@ -5941,6 +5942,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable,
if (pWrapperTable->m_Model_GetLevelSets == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_Model_RemoveResource = (PLib3MFModel_RemoveResourcePtr) GetProcAddress(hLibrary, "lib3mf_model_removeresource");
#else // _WIN32
pWrapperTable->m_Model_RemoveResource = (PLib3MFModel_RemoveResourcePtr) dlsym(hLibrary, "lib3mf_model_removeresource");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_Model_RemoveResource == NULL)
return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_GetLibraryVersion = (PLib3MFGetLibraryVersionPtr) GetProcAddress(hLibrary, "lib3mf_getlibraryversion");
#else // _WIN32
Expand Down
Loading

0 comments on commit 0b4c011

Please sign in to comment.