- primo commit.
This commit is contained in:
SaraP
2021-09-07 16:50:23 +02:00
parent a5a65b4c8d
commit f8c998f6ff
633 changed files with 108631 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# /
/revision.h
/*.aps
/*.ncb
/*.suo
/*.user
/*.sdf
/*.opensdf
/Debug32
/Release32
/Trial32
/Debug64
/Release64
/ipch
/bin
/obj
/.vs
+74
View File
@@ -0,0 +1,74 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CAccessRight
*/
#ifndef __LIB3MF_DECRYPTRIGHT
#define __LIB3MF_DECRYPTRIGHT
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_KeyStoreAccessRight.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CAccessRight
**************************************************************************************************************************/
class CAccessRight : public virtual IAccessRight, public virtual CBase {
private:
NMR::PKeyStoreAccessRight m_pAccessRight;
public:
CAccessRight(NMR::PKeyStoreAccessRight ar);
// Inherited via IAccessRight
virtual IConsumer * GetConsumer() override;
virtual Lib3MF::eWrappingAlgorithm GetWrappingAlgorithm();
virtual Lib3MF::eMgfAlgorithm GetMgfAlgorithm();
virtual Lib3MF::eDigestMethod GetDigestMethod();
// Other access methods
NMR::PKeyStoreAccessRight accessRight() const;
};
}
}
#endif
+109
View File
@@ -0,0 +1,109 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CAttachment
*/
#ifndef __LIB3MF_ATTACHMENT
#define __LIB3MF_ATTACHMENT
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelAttachment.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CAttachment
**************************************************************************************************************************/
class CAttachment : public virtual IAttachment, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PModelAttachment m_pModelAttachment;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CAttachment(NMR::PModelAttachment pModelAttachment);
/**
* Public member functions to implement.
*/
std::string GetPath ();
void SetPath (const std::string & sPath);
IPackagePart * PackagePart();
std::string GetRelationShipType ();
void SetRelationShipType (const std::string & sPath);
void WriteToFile (const std::string & sFileName);
void ReadFromFile (const std::string & sFileName);
void ReadFromCallback(const Lib3MF::ReadCallback pTheReadCallback, const Lib3MF_uint64 nStreamSize, const Lib3MF::SeekCallback pTheSeekCallback, const Lib3MF_pvoid pUserData);
Lib3MF_uint64 GetStreamSize ();
void WriteToBuffer (Lib3MF_uint64 nBufferBufferSize, Lib3MF_uint64* pBufferNeededCount, Lib3MF_uint8 * pBufferBuffer);
void ReadFromBuffer(const Lib3MF_uint64 nBufferBufferSize, const Lib3MF_uint8 * pBufferBuffer);
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_ATTACHMENT
+93
View File
@@ -0,0 +1,93 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CBase
*/
#ifndef __LIB3MF_BASE
#define __LIB3MF_BASE
#include "lib3mf_interfaces.hpp"
#include <vector>
#include <list>
#include <memory>
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CBase
**************************************************************************************************************************/
class CBase : public virtual IBase {
private:
std::unique_ptr<std::list<std::string>> m_pErrors;
Lib3MF_uint32 m_nReferenceCount = 1;
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
bool GetLastErrorMessage(std::string & sErrorMessage);
void ClearErrorMessages();
void RegisterErrorMessage(const std::string & sErrorMessage);
void IncRefCount();
bool DecRefCount();
/**
* Public member functions to implement.
*/
};
} // namespace Impl
} // namespace Lib3MF
#endif // __LIB3MF_BASE
+103
View File
@@ -0,0 +1,103 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CBaseMaterial
*/
#ifndef __LIB3MF_BASEMATERIALGROUP
#define __LIB3MF_BASEMATERIALGROUP
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resource.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelBaseMaterial.h"
#include "Model/Classes/NMR_ModelBaseMaterials.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CBaseMaterialGroup
**************************************************************************************************************************/
class CBaseMaterialGroup : public virtual IBaseMaterialGroup, public virtual CResource {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
NMR::CModelBaseMaterialResource& baseMaterialGroup();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CBaseMaterialGroup(NMR::PModelBaseMaterialResource pResource);
/**
* Public member functions to implement.
*/
Lib3MF_uint32 GetCount ();
Lib3MF_uint32 AddMaterial(const std::string & sName, const sLib3MFColor DisplayColor);
void RemoveMaterial (const Lib3MF_uint32 nPropertyID);
std::string GetName (const Lib3MF_uint32 nPropertyID);
void SetName (const Lib3MF_uint32 nPropertyID, const std::string & sName);
void SetDisplayColor(const Lib3MF_uint32 nPropertyID, const sLib3MFColor TheColor);
sLib3MFColor GetDisplayColor(const Lib3MF_uint32 nPropertyID);
void GetAllPropertyIDs(Lib3MF_uint64 nPropertyIDsBufferSize, Lib3MF_uint64* pPropertyIDsNeededCount, Lib3MF_uint32 * pPropertyIDsBuffer);
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_BASEMATERIALGROUP
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CBaseMaterialGroupIterator
*/
#ifndef __LIB3MF_BASEMATERIALGROUPITERATOR
#define __LIB3MF_BASEMATERIALGROUPITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CBaseMaterialGroupIterator
**************************************************************************************************************************/
class CBaseMaterialGroupIterator : public virtual IBaseMaterialGroupIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
IBaseMaterialGroup * GetCurrentBaseMaterialGroup ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_BASEMATERIALGROUPITERATOR
+137
View File
@@ -0,0 +1,137 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CBeamLattice
*/
#ifndef __LIB3MF_BEAMLATTICE
#define __LIB3MF_BEAMLATTICE
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
#include "Common/Mesh/NMR_Mesh.h"
#include "Model/Classes/NMR_ModelMeshBeamLatticeAttributes.h"
#include "Model/Classes/NMR_ModelMeshObject.h"
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CBeamLattice
**************************************************************************************************************************/
class CBeamLattice : public virtual IBeamLattice, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::CMesh& m_mesh;
NMR::PModelMeshBeamLatticeAttributes m_pAttributes;
NMR::PModelMeshObject m_pMeshObject;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CBeamLattice(NMR::PModelMeshObject pMeshObject, NMR::PModelMeshBeamLatticeAttributes pAttributes);
/**
* Public member functions to implement.
*/
Lib3MF_double GetMinLength ();
void SetMinLength (const Lib3MF_double dMinLength);
void GetClipping (eBeamLatticeClipMode & eClipMode, Lib3MF_uint32 & nUniqueResourceID);
void SetClipping (const eBeamLatticeClipMode eClipMode, const Lib3MF_uint32 nUniqueResourceID);
bool GetRepresentation(Lib3MF_uint32 & nUniqueResourceID);
void SetRepresentation(const Lib3MF_uint32 nUniqueResourceID);
void GetBallOptions (eBeamLatticeBallMode & eBallMode, Lib3MF_double & dBallRadius);
void SetBallOptions (const eBeamLatticeBallMode eBallMode, const Lib3MF_double dBallRadius);
Lib3MF_uint32 GetBeamCount ();
sLib3MFBeam GetBeam (const Lib3MF_uint32 nIndex);
Lib3MF_uint32 AddBeam (const sLib3MFBeam BeamInfo);
void SetBeam (const Lib3MF_uint32 nIndex, const sLib3MFBeam BeamInfo);
void SetBeams (const Lib3MF_uint64 nBeamInfoBufferSize, const sLib3MFBeam * pBeamInfoBuffer);
void GetBeams (Lib3MF_uint64 nBeamInfoBufferSize, Lib3MF_uint64 * pBeamInfoNeededCount, sLib3MFBeam * pBeamInfoBuffer);
Lib3MF_uint32 GetBallCount ();
sLib3MFBall GetBall (const Lib3MF_uint32 nIndex);
Lib3MF_uint32 AddBall (const sLib3MFBall BallInfo);
void SetBall (const Lib3MF_uint32 nIndex, const sLib3MFBall BallInfo);
void SetBalls (const Lib3MF_uint64 nBallInfoBufferSize, const sLib3MFBall * pBallInfoBuffer);
void GetBalls (Lib3MF_uint64 nBeamInfoBufferSize, Lib3MF_uint64 * pBallInfoNeededCount, sLib3MFBall * pBallInfoBuffer);
Lib3MF_uint32 GetBeamSetCount ();
IBeamSet * AddBeamSet ();
IBeamSet * GetBeamSet (const Lib3MF_uint32 nIndex);
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_BEAMLATTICE
+111
View File
@@ -0,0 +1,111 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CBeamSet
*/
#ifndef __LIB3MF_BEAMSET
#define __LIB3MF_BEAMSET
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
#include "Common/Mesh/NMR_MeshTypes.h"
#include "Common/Mesh/NMR_Mesh.h"
#include "Model/Classes/NMR_ModelMeshObject.h"
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
#define LIB3MF_MAXBEAMCOUNT (1UL << 31)
/*************************************************************************************************************************
Class declaration of CBeamSet
**************************************************************************************************************************/
class CBeamSet : public virtual IBeamSet, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PBEAMSET m_pBeamSet;
NMR::CMesh& m_mesh;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CBeamSet(NMR::PBEAMSET pBeamSet, NMR::PModelMeshObject pMeshObject);
/**
* Public member functions to implement.
*/
virtual void SetName(const std::string & sName);
virtual std::string GetName();
virtual void SetIdentifier(const std::string & sIdentifier);
virtual std::string GetIdentifier();
virtual Lib3MF_uint32 GetReferenceCount();
virtual void SetReferences(const Lib3MF_uint64 nReferencesBufferSize, const Lib3MF_uint32 * pReferencesBuffer);
virtual void GetReferences(Lib3MF_uint64 nReferencesBufferSize, Lib3MF_uint64 * pReferencesNeededCount, Lib3MF_uint32 * pReferencesBuffer);
virtual Lib3MF_uint32 GetBallReferenceCount();
virtual void SetBallReferences(const Lib3MF_uint64 nBallReferencesBufferSize, const Lib3MF_uint32 * pBallReferencesBuffer);
virtual void GetBallReferences(Lib3MF_uint64 nBallReferencesBufferSize, Lib3MF_uint64 * pBallReferencesNeededCount, Lib3MF_uint32 * pBallReferencesBuffer);
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_BEAMSET
+111
View File
@@ -0,0 +1,111 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CBuildItem
*/
#ifndef __LIB3MF_BUILDITEM
#define __LIB3MF_BUILDITEM
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelBuildItem.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CBuildItem
**************************************************************************************************************************/
class CBuildItem : public virtual IBuildItem, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PModelBuildItem m_pBuildItem;
protected:
/**
* Put protected members here.
*/
NMR::CModelBuildItem& buildItem();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CBuildItem(NMR::PModelBuildItem pBuildItem);
Lib3MF_uint32 GetHandle();
/**
* Public member functions to implement.
*/
IObject * GetObjectResource ();
std::string GetUUID (bool & bHasUUID);
void SetUUID (const std::string & sUUID);
Lib3MF_uint32 GetObjectResourceID ();
bool HasObjectTransform ();
sLib3MFTransform GetObjectTransform ();
void SetObjectTransform (const sLib3MFTransform Transform);
std::string GetPartNumber ();
void SetPartNumber (const std::string & sSetPartnumber);
IMetaDataGroup * GetMetaDataGroup ();
Lib3MF::sBox GetOutbox();
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_BUILDITEM
+100
View File
@@ -0,0 +1,100 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CBuildItemIterator
*/
#ifndef __LIB3MF_BUILDITEMITERATOR
#define __LIB3MF_BUILDITEMITERATOR
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelBuildItem.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CBuildItemIterator
**************************************************************************************************************************/
class CBuildItemIterator : public virtual IBuildItemIterator, public virtual CBase {
private:
/**
* Put private members here.
*/
std::vector<NMR::PModelBuildItem> m_pBuildItems;
Lib3MF_int32 m_nCurrentIndex;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CBuildItemIterator();
void addBuildItem(NMR::PModelBuildItem pBuildItem);
/**
* Public member functions to implement.
*/
bool MoveNext ();
bool MovePrevious ();
IBuildItem * GetCurrent ();
IBuildItemIterator * Clone ();
Lib3MF_uint64 Count();
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_BUILDITEMITERATOR
+101
View File
@@ -0,0 +1,101 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CColorGroup
*/
#ifndef __LIB3MF_COLORGROUP
#define __LIB3MF_COLORGROUP
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resource.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelColorGroup.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CColorGroup
**************************************************************************************************************************/
class CColorGroup : public virtual IColorGroup, public virtual CResource {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
NMR::CModelColorGroupResource& colorGroup();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CColorGroup(NMR::PModelColorGroupResource pResource);
/**
* Public member functions to implement.
*/
Lib3MF_uint32 GetCount ();
void GetAllPropertyIDs (Lib3MF_uint64 nPropertyIDsBufferSize, Lib3MF_uint64* pPropertyIDsNeededCount, Lib3MF_uint32 * pPropertyIDsBuffer);
Lib3MF_uint32 AddColor (const sLib3MFColor TheColor);
void SetColor (const Lib3MF_uint32 nPropertyID, const sLib3MFColor TheColor);
sLib3MFColor GetColor (const Lib3MF_uint32 nPropertyID);
void RemoveColor(const Lib3MF_uint32 nPropertyID);
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_COLORGROUP
+89
View File
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CColorGroupIterator
*/
#ifndef __LIB3MF_COLORGROUPITERATOR
#define __LIB3MF_COLORGROUPITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CColorGroupIterator
**************************************************************************************************************************/
class CColorGroupIterator : public virtual IColorGroupIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
IColorGroup * GetCurrentColorGroup ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_COLORGROUPITERATOR
+100
View File
@@ -0,0 +1,100 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CComponent
*/
#ifndef __LIB3MF_COMPONENT
#define __LIB3MF_COMPONENT
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelComponent.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CComponent
**************************************************************************************************************************/
class CComponent : public virtual IComponent, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PModelComponent m_pComponent;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CComponent(NMR::PModelComponent pComponent);
/**
* Public member functions to implement.
*/
IObject * GetObjectResource ();
Lib3MF_uint32 GetObjectResourceID ();
std::string GetUUID (bool & bHasUUID);
void SetUUID (const std::string & sUUID);
bool HasTransform ();
void SetTransform (const sLib3MFTransform Transform);
virtual sLib3MFTransform GetTransform();
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_COMPONENT
+94
View File
@@ -0,0 +1,94 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CComponentsObject
*/
#ifndef __LIB3MF_COMPONENTSOBJECT
#define __LIB3MF_COMPONENTSOBJECT
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_object.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelComponentsObject.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CComponentsObject
**************************************************************************************************************************/
class CComponentsObject : public virtual IComponentsObject, public virtual CObject {
private:
/**
* Put private members here.
*/
protected:
NMR::CModelComponentsObject * getComponentsObject();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CComponentsObject(NMR::PModelResource pResource);
static IComponentsObject* fnCreateComponentsObjectFromModelResource(NMR::PModelResource pResource, bool bFailIfUnkownClass);
/**
* Public member functions to implement.
*/
IComponent * AddComponent (IObject* pObjectResource, const sLib3MFTransform Transform);
IComponent * GetComponent (const Lib3MF_uint32 nIndex);
Lib3MF_uint32 GetComponentCount ();
bool IsMeshObject();
bool IsComponentsObject();
};
}
}
#endif // __LIB3MF_COMPONENTSOBJECT
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CComponentsObjectIterator
*/
#ifndef __LIB3MF_COMPONENTSOBJECTITERATOR
#define __LIB3MF_COMPONENTSOBJECTITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CComponentsObjectIterator
**************************************************************************************************************************/
class CComponentsObjectIterator : public virtual IComponentsObjectIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
IComponentsObject * GetCurrentComponentsObject ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_COMPONENTSOBJECTITERATOR
+102
View File
@@ -0,0 +1,102 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CCompositeMaterials
*/
#ifndef __LIB3MF_COMPOSITEMATERIALS
#define __LIB3MF_COMPOSITEMATERIALS
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resource.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelCompositeMaterials.h"
#define LIB3MF_MAXCOMPOSITEMATERIALS (1UL << 31)
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CCompositeMaterials
**************************************************************************************************************************/
class CCompositeMaterials : public virtual ICompositeMaterials, public virtual CResource {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
NMR::CModelCompositeMaterialsResource& compositeMaterials();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CCompositeMaterials(NMR::PModelCompositeMaterialsResource pResource);
/**
* Public member functions to implement.
*/
Lib3MF_uint32 GetCount ();
void GetAllPropertyIDs (Lib3MF_uint64 nPropertyIDsBufferSize, Lib3MF_uint64* pPropertyIDsNeededCount, Lib3MF_uint32 * pPropertyIDsBuffer);
IBaseMaterialGroup * GetBaseMaterialGroup ();
Lib3MF_uint32 AddComposite(const Lib3MF_uint64 nCompositeBufferSize, const sLib3MFCompositeConstituent * pCompositeBuffer);
void RemoveComposite (const Lib3MF_uint32 nPropertyID);
void GetComposite(const Lib3MF_uint32 nPropertyID, Lib3MF_uint64 nCompositeBufferSize, Lib3MF_uint64* pCompositeNeededCount, sLib3MFCompositeConstituent * pCompositeBuffer);
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_COMPOSITEMATERIALS
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CCompositeMaterialsIterator
*/
#ifndef __LIB3MF_COMPOSITEMATERIALSITERATOR
#define __LIB3MF_COMPOSITEMATERIALSITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CCompositeMaterialsIterator
**************************************************************************************************************************/
class CCompositeMaterialsIterator : public virtual ICompositeMaterialsIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
ICompositeMaterials * GetCurrentCompositeMaterials ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_COMPOSITEMATERIALSITERATOR
+66
View File
@@ -0,0 +1,66 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CConsumer
*/
#ifndef __LIB3MF_CONSUMER
#define __LIB3MF_CONSUMER
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
#include "Model/Classes/NMR_KeyStoreConsumer.h"
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CConsumer
**************************************************************************************************************************/
class CConsumer : public virtual IConsumer, public virtual CBase {
private:
NMR::PKeyStoreConsumer m_Consumer;
public:
inline NMR::PKeyStoreConsumer consumer() const {
return m_Consumer;
}
CConsumer(NMR::PKeyStoreConsumer const & consumer);
// Inherited via IConsumer
std::string GetConsumerID() override;
std::string GetKeyID() override;
std::string GetKeyValue() override;
};
}
}
#endif
@@ -0,0 +1,74 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CContentEncryptionParams
*/
#ifndef __LIB3MF_CIPHERDATA
#define __LIB3MF_CIPHERDATA
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
#include "Model/Classes/NMR_KeyStoreCEKParams.h"
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CContentEncryptionParams
**************************************************************************************************************************/
class CContentEncryptionParams : public virtual IContentEncryptionParams, public virtual CBase {
private:
NMR::PCKeyStoreContentEncryptionParams m_pParams;
public:
CContentEncryptionParams(NMR::PCKeyStoreContentEncryptionParams const & p);
// Inherited via IContentEncryptionParams
Lib3MF_uint64 GetDescriptor();
Lib3MF::eEncryptionAlgorithm GetEncryptionAlgorithm();
void GetKey(Lib3MF_uint64 nByteDataBufferSize, Lib3MF_uint64 *pByteDataNeededCount, Lib3MF_uint8 *pByteDataBuffer);
void GetInitializationVector(Lib3MF_uint64 nByteDataBufferSize, Lib3MF_uint64 *pByteDataNeededCount, Lib3MF_uint8 *pByteDataBuffer);
void GetAuthenticationTag(Lib3MF_uint64 nByteDataBufferSize, Lib3MF_uint64 *pByteDataNeededCount, Lib3MF_uint8 *pByteDataBuffer);
void SetAuthenticationTag(Lib3MF_uint64 const nByteDataBufferSize, const Lib3MF_uint8 *pByteDataBuffer);
void GetAdditionalAuthenticationData(Lib3MF_uint64 nByteDataBufferSize, Lib3MF_uint64 *pByteDataNeededCount, Lib3MF_uint8 *pByteDataBuffer);
void SetAdditionalAuthenticationData(Lib3MF_uint64 const nByteDataBufferSize, const Lib3MF_uint8 *pByteDataBuffer);
std::string GetKeyUUID();
inline NMR::PKeyStoreCEKParams params() const {
return m_pParams;
}
};
}
}
#endif
+119
View File
@@ -0,0 +1,119 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CKeyStore
*/
#ifndef __LIB3MF_KEYSTORE
#define __LIB3MF_KEYSTORE
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_KeyStore.h"
#include "Model/Classes/NMR_Model.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CKeyStore
**************************************************************************************************************************/
class CKeyStore : public virtual IKeyStore, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PKeyStore m_pKeyStore;
NMR::PModel m_pModel;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CKeyStore(NMR::PModel const & pModel);
/**
* Public member functions to implement.
*/
// Inherited via IKeyStore
IConsumer * AddConsumer(const std::string & sConsumerID, const std::string & sKeyID, const std::string & sKeyValue) override;
Lib3MF_uint64 GetConsumerCount() override;
IConsumer * GetConsumer(const Lib3MF_uint64 nConsumerIndex) override;
IConsumer * FindConsumer(const std::string & sConsumerID) override;
virtual void RemoveConsumer(IConsumer * pConsumerInstance) override;
std::string GetUUID(bool & bHasUUID) override;
void SetUUID(const std::string & sUUID) override;
virtual Lib3MF_uint64 GetResourceDataGroupCount() override;
virtual IResourceDataGroup * GetResourceDataGroup(const Lib3MF_uint64 nResourceDataIndex) override;
virtual IResourceDataGroup * AddResourceDataGroup() override;
virtual void RemoveResourceDataGroup(IResourceDataGroup * pTheResourceDataGroup) override;
virtual Lib3MF::Impl::IResourceDataGroup * FindResourceDataGroup(Lib3MF::Impl::IPackagePart *pPartPath);
virtual IResourceData * AddResourceData(IResourceDataGroup* pResourceDataGroup, IPackagePart* pPartPath, const Lib3MF::eEncryptionAlgorithm eAlgorithm, const Lib3MF::eCompression eCompression, const Lib3MF_uint64 nAdditionalAuthenticationDataBufferSize, const Lib3MF_uint8 * pAdditionalAuthenticationDataBuffer);
virtual void RemoveResourceData(Lib3MF::Impl::IResourceData *pResourceData);
virtual Lib3MF_uint64 GetResourceDataCount();
virtual Lib3MF::Impl::IResourceData * GetResourceData(const Lib3MF_uint64 nResourceDataIndex);
virtual IResourceData * FindResourceData(IPackagePart * pResourcePath) override;
};
} // namespace Impl
} // namespace Lib3MF
#endif // __LIB3MF_KEYSTORE
+137
View File
@@ -0,0 +1,137 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CMeshObject
*/
#ifndef __LIB3MF_MESHOBJECT
#define __LIB3MF_MESHOBJECT
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_object.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelMeshObject.h"
#include "Common/MeshInformation/NMR_MeshInformation_Properties.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CMeshObject
**************************************************************************************************************************/
class CMeshObject : public virtual IMeshObject, public virtual CObject {
private:
/**
* Put private members here.
*/
NMR::PModelMeshObject meshObject();
NMR::CMesh* mesh();
NMR::CMeshInformation_Properties* getMeshInformationProperties();
protected:
/**
* Put protected members here.
*/
public:
static IMeshObject* fnCreateMeshObjectFromModelResource(NMR::PModelResource pResource, bool bFailIfUnkownClass);
/**
* Put additional public members here. They will not be visible in the external API.
*/
CMeshObject(NMR::PModelResource pResource);
/**
* Public member functions to implement.
*/
Lib3MF_uint32 GetVertexCount ();
Lib3MF_uint32 GetTriangleCount ();
void SetVertex (const Lib3MF_uint32 nIndex, const sLib3MFPosition Coordinates);
sLib3MFPosition GetVertex(const Lib3MF_uint32 nIndex);
Lib3MF_uint32 AddVertex (const sLib3MFPosition Coordinates);
virtual void GetVertices(Lib3MF_uint64 nVerticesBufferSize, Lib3MF_uint64* pVerticesNeededCount, sLib3MFPosition * pVerticesBuffer);
sLib3MFTriangle GetTriangle (const Lib3MF_uint32 nIndex);
void SetTriangle (const Lib3MF_uint32 nIndex, const sLib3MFTriangle Indices);
Lib3MF_uint32 AddTriangle (const sLib3MFTriangle Indices);
void GetTriangleIndices (Lib3MF_uint64 nIndicesBufferSize, Lib3MF_uint64* pIndicesNeededCount, sLib3MFTriangle * pIndicesBuffer);
void SetGeometry(const Lib3MF_uint64 nVerticesBufferSize, const sLib3MFPosition * pVerticesBuffer, const Lib3MF_uint64 nIndicesBufferSize, const sLib3MFTriangle * pIndicesBuffer);
bool IsManifoldAndOriented();
bool IsMeshObject();
bool IsComponentsObject();
bool IsValid();
virtual IBeamLattice * BeamLattice();
void SetObjectLevelProperty(const Lib3MF_uint32 nUniqueResourceID, const Lib3MF_uint32 nPropertyID);
bool GetObjectLevelProperty(Lib3MF_uint32 & nUniqueResourceID, Lib3MF_uint32 & nPropertyID);
void SetTriangleProperties(const Lib3MF_uint32 nIndex, const sLib3MFTriangleProperties Properties);
void GetTriangleProperties(const Lib3MF_uint32 nIndex, sLib3MFTriangleProperties & sProperty);
void SetAllTriangleProperties(const Lib3MF_uint64 nPropertiesArrayBufferSize, const sLib3MFTriangleProperties * pPropertiesArrayBuffer);
void GetAllTriangleProperties(Lib3MF_uint64 nPropertiesArrayBufferSize, Lib3MF_uint64* pPropertiesArrayNeededCount, sLib3MFTriangleProperties * pPropertiesArrayBuffer);
void ClearAllProperties();
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_MESHOBJECT
+89
View File
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CMeshObjectIterator
*/
#ifndef __LIB3MF_MESHOBJECTITERATOR
#define __LIB3MF_MESHOBJECTITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CMeshObjectIterator
**************************************************************************************************************************/
class CMeshObjectIterator : public virtual IMeshObjectIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
IMeshObject * GetCurrentMeshObject ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_MESHOBJECTITERATOR
+110
View File
@@ -0,0 +1,110 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CMetaData
*/
#ifndef __LIB3MF_METADATA
#define __LIB3MF_METADATA
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
#include "Model/Classes/NMR_ModelMetaData.h"
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CMetaData
**************************************************************************************************************************/
class CMetaData : public virtual IMetaData, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PModelMetaData m_pMetaData;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CMetaData(NMR::PModelMetaData pMetaData);
/**
* Public member functions to implement.
*/
std::string GetNameSpace ();
void SetNameSpace (const std::string & sNameSpace);
std::string GetName ();
std::string GetKey();
void SetName (const std::string & sName);
bool GetMustPreserve ();
void SetMustPreserve (const bool bMustPreserve);
std::string GetType ();
void SetType (const std::string & sType);
std::string GetValue ();
void SetValue (const std::string & sValue);
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_METADATA
+101
View File
@@ -0,0 +1,101 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CMetaDataGroup
*/
#ifndef __LIB3MF_METADATAGROUP
#define __LIB3MF_METADATAGROUP
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
#include "Model/Classes/NMR_ModelMetaDataGroup.h"
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CMetaDataGroup
**************************************************************************************************************************/
class CMetaDataGroup : public virtual IMetaDataGroup, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PModelMetaDataGroup m_pModelMetaDataGroup;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CMetaDataGroup(NMR::PModelMetaDataGroup pMetaDataGroup);
/**
* Public member functions to implement.
*/
virtual Lib3MF_uint32 GetMetaDataCount();
IMetaData * GetMetaData(const Lib3MF_uint32 nIndex);
IMetaData * GetMetaDataByKey(const std::string & sNameSpace, const std::string & sName);
void RemoveMetaDataByIndex(const Lib3MF_uint32 nIndex);
void RemoveMetaData(IMetaData* pTheMetaData);
IMetaData * AddMetaData(const std::string & sNameSpace, const std::string & sName, const std::string & sValue, const std::string & sType, const bool bMustPreserve);
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_METADATAGROUP
+206
View File
@@ -0,0 +1,206 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CModel
*/
#ifndef __LIB3MF_MODEL
#define __LIB3MF_MODEL
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_Model.h"
#include "Model/Classes/NMR_KeyStore.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CModel
**************************************************************************************************************************/
class CModel : public virtual IModel, public virtual CBase {
private:
NMR::PModel m_model;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CModel();
NMR::CModel& model();
/**
* Public member functions to implement.
*/
IPackagePart * RootModelPart() override;
IPackagePart * FindOrCreatePackagePart(const std::string & sAbsolutePath) override;
void SetUnit (const eLib3MFModelUnit eUnit) override;
eLib3MFModelUnit GetUnit() override;
std::string GetLanguage() override;
void SetLanguage(const std::string & sLanguage) override;
IWriter * QueryWriter(const std::string & sWriterClass) override;
IReader * QueryReader(const std::string & sReaderClass) override;
ITexture2D * GetTexture2DByID(const Lib3MF_uint32 nUniqueResourceID) override;
eLib3MFPropertyType GetPropertyTypeByID(const Lib3MF_uint32 nUniqueResourceID) override;
IBaseMaterialGroup * GetBaseMaterialGroupByID(const Lib3MF_uint32 nUniqueResourceID) override;
IMeshObject * GetMeshObjectByID(const Lib3MF_uint32 nUniqueResourceID) override;
IComponentsObject * GetComponentsObjectByID(const Lib3MF_uint32 nUniqueResourceID) override;
IColorGroup * GetColorGroupByID(const Lib3MF_uint32 nUniqueResourceID) override;
ITexture2DGroup * GetTexture2DGroupByID(const Lib3MF_uint32 nUniqueResourceID) override;
ICompositeMaterials * GetCompositeMaterialsByID(const Lib3MF_uint32 nUniqueResourceID) override;
IMultiPropertyGroup * GetMultiPropertyGroupByID(const Lib3MF_uint32 nUniqueResourceID) override;
ISliceStack * GetSliceStackByID(const Lib3MF_uint32 nUniqueResourceID) override;
std::string GetBuildUUID (bool & bHasUUID) override;
void SetBuildUUID (const std::string & sUUID) override;
IBuildItemIterator * GetBuildItems() override;
IResourceIterator * GetResources() override;
IObjectIterator * GetObjects() override;
IMeshObjectIterator * GetMeshObjects() override;
IComponentsObjectIterator * GetComponentsObjects() override;
ITexture2DIterator * GetTexture2Ds() override;
IBaseMaterialGroupIterator * GetBaseMaterialGroups() override;
IColorGroupIterator * GetColorGroups() override;
ITexture2DGroupIterator * GetTexture2DGroups() override;
ICompositeMaterialsIterator * GetCompositeMaterials() override;
IMultiPropertyGroupIterator * GetMultiPropertyGroups() override;
ISliceStackIterator * GetSliceStacks() override;
IModel * MergeToModel() override;
IMeshObject * AddMeshObject() override;
IComponentsObject * AddComponentsObject() override;
ISliceStack * AddSliceStack(const Lib3MF_double dZBottom) override;
ITexture2D * AddTexture2DFromAttachment(IAttachment* pTextureAttachment) override;
IBaseMaterialGroup * AddBaseMaterialGroup() override;
IColorGroup * AddColorGroup() override;
ITexture2DGroup * AddTexture2DGroup(ITexture2D* pTexture2DInstance) override;
ICompositeMaterials * AddCompositeMaterials(IBaseMaterialGroup* pBaseMaterialGroupInstance) override;
IMultiPropertyGroup * AddMultiPropertyGroup() override;
IBuildItem * AddBuildItem(IObject* pObject, const sLib3MFTransform Transform) override;
void RemoveBuildItem(IBuildItem* pBuildItemInstance) override;
IMetaDataGroup * GetMetaDataGroup() override;
IAttachment * AddAttachment(const std::string & sURI, const std::string & sRelationShipType) override;
void RemoveAttachment(IAttachment* pAttachmentInstance) override;
IAttachment * GetAttachment(const Lib3MF_uint32 nIndex) override;
IAttachment * FindAttachment(const std::string & sURI) override;
Lib3MF_uint32 GetAttachmentCount() override;
bool HasPackageThumbnailAttachment() override;
IAttachment * CreatePackageThumbnailAttachment() override;
IAttachment * GetPackageThumbnailAttachment() override;
void RemovePackageThumbnailAttachment() override;
void AddCustomContentType(const std::string & sExtension, const std::string & sContentType) override;
void RemoveCustomContentType(const std::string & sExtension) override;
Lib3MF::sBox GetOutbox() override;
IKeyStore * GetKeyStore();
void SetRandomNumberCallback(const Lib3MF::RandomNumberCallback pTheCallback, const Lib3MF_pvoid pUserData);
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_MODEL
+111
View File
@@ -0,0 +1,111 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CMultiPropertyGroup
*/
#ifndef __LIB3MF_MULTIPROPERTYGROUP
#define __LIB3MF_MULTIPROPERTYGROUP
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resource.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelMultiPropertyGroup.h"
#define LIB3MF_MAXMULTIPROPERTIES (1UL << 31)
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CMultiPropertyGroup
**************************************************************************************************************************/
class CMultiPropertyGroup : public virtual IMultiPropertyGroup, public virtual CResource {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
NMR::CModelMultiPropertyGroupResource& multiPropertyGroup();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CMultiPropertyGroup(NMR::PModelMultiPropertyGroupResource pResource);
/**
* Public member functions to implement.
*/
Lib3MF_uint32 GetCount ();
void GetAllPropertyIDs (Lib3MF_uint64 nPropertyIDsBufferSize, Lib3MF_uint64* pPropertyIDsNeededCount, Lib3MF_uint32 * pPropertyIDsBuffer);
Lib3MF_uint32 AddMultiProperty (const Lib3MF_uint64 nPropertyIDsBufferSize, const Lib3MF_uint32 * pPropertyIDsBuffer);
void SetMultiProperty (const Lib3MF_uint32 nPropertyID, const Lib3MF_uint64 nPropertyIDsBufferSize, const Lib3MF_uint32 * pPropertyIDsBuffer);
void GetMultiProperty (const Lib3MF_uint32 nPropertyID, Lib3MF_uint64 nPropertyIDsBufferSize, Lib3MF_uint64* pPropertyIDsNeededCount, Lib3MF_uint32 * pPropertyIDsBuffer);
void RemoveMultiProperty (const Lib3MF_uint32 nPropertyID);
Lib3MF_uint32 GetLayerCount ();
Lib3MF_uint32 AddLayer (const sLib3MFMultiPropertyLayer TheLayer);
sLib3MFMultiPropertyLayer GetLayer (const Lib3MF_uint32 nLayerIndex);
void RemoveLayer (const Lib3MF_uint32 nLayerIndex);
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_MULTIPROPERTYGROUP
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CMultiPropertyGroupIterator
*/
#ifndef __LIB3MF_MULTIPROPERTYGROUPITERATOR
#define __LIB3MF_MULTIPROPERTYGROUPITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CMultiPropertyGroupIterator
**************************************************************************************************************************/
class CMultiPropertyGroupIterator : public virtual IMultiPropertyGroupIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
IMultiPropertyGroup * GetCurrentMultiPropertyGroup ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_MULTIPROPERTYGROUPITERATOR
+135
View File
@@ -0,0 +1,135 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CObject
*/
#ifndef __LIB3MF_OBJECT
#define __LIB3MF_OBJECT
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resource.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelResource.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CObject
**************************************************************************************************************************/
class CObject : public virtual IObject, public virtual CResource {
private:
/**
* Put private members here.
*/
protected:
NMR::CModelObject* object();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CObject(NMR::PModelResource pResource);
CObject() = delete;
static IObject* fnCreateObjectFromModelResource(NMR::PModelResource pResource, bool bFailIfUnkownClass);
/**
* Public member functions to implement.
*/
eLib3MFObjectType GetType ();
void SetType (const eLib3MFObjectType eObjectType);
std::string GetName ();
void SetName (const std::string & sName);
std::string GetPartNumber ();
void SetPartNumber (const std::string & sPartNumber);
virtual bool IsMeshObject ();
virtual bool IsComponentsObject ();
virtual IMeshObject * AsMeshObject();
virtual IComponentsObject * AsComponentsObject();
bool IsValid ();
void SetAttachmentAsThumbnail(IAttachment* pAttachment);
IAttachment * GetThumbnailAttachment();
void ClearThumbnailAttachment();
IMetaDataGroup * GetMetaDataGroup ();
std::string GetUUID(bool & bHasUUID);
void SetUUID(const std::string & sUUID);
void SetSlicesMeshResolution(const eLib3MFSlicesMeshResolution eMeshResolution);
eLib3MFSlicesMeshResolution GetSlicesMeshResolution();
bool HasSlices(const bool bRecursive);
void ClearSliceStack();
ISliceStack * GetSliceStack();
void AssignSliceStack(ISliceStack* pSliceStackInstance);
Lib3MF::sBox GetOutbox();
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_OBJECT
+89
View File
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CObjectIterator
*/
#ifndef __LIB3MF_OBJECTITERATOR
#define __LIB3MF_OBJECTITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CObjectIterator
**************************************************************************************************************************/
class CObjectIterator : public virtual IObjectIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
IObject * GetCurrentObject ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_OBJECTITERATOR
+92
View File
@@ -0,0 +1,92 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CPackagePart
*/
#ifndef __LIB3MF_MODELPART
#define __LIB3MF_MODELPART
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_PackageResourceID.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CPackagePart
**************************************************************************************************************************/
class CPackagePart : public virtual IPackagePart, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PPackageModelPath m_pPath;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CPackagePart(NMR::PPackageModelPath pPath);
/**
* Public member functions to implement.
*/
std::string GetPath() override;
void SetPath(const std::string & sPath) override;
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_MODELPART
+114
View File
@@ -0,0 +1,114 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CReader
*/
#ifndef __LIB3MF_READER
#define __LIB3MF_READER
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Reader/NMR_ModelReader.h"
#include "Model/Reader/NMR_ModelReader_3MF_Native.h"
#include "Model/Reader/NMR_ModelReader_STL.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CReader
**************************************************************************************************************************/
class CReader : public virtual IReader, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PModelReader m_pReader;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CReader(std::string sReaderClass, NMR::PModel model);
NMR::CModelReader& reader();
/**
* Public member functions to implement.
*/
void ReadFromFile (const std::string & sFilename);
void ReadFromBuffer (const Lib3MF_uint64 nBufferBufferSize, const Lib3MF_uint8 * pBufferBuffer);
void ReadFromCallback(const Lib3MFReadCallback pTheReadCallback, const Lib3MF_uint64 nStreamSize, const Lib3MFSeekCallback pTheSeekCallback, const Lib3MF_pvoid pUserData);
void AddRelationToRead (const std::string & sRelationShipType);
void SetProgressCallback(const Lib3MFProgressCallback pProgressCallback, const Lib3MF_pvoid pUserData);
void RemoveRelationToRead (const std::string & sRelationShipType);
void SetStrictModeActive (const bool bStrictModeActive);
bool GetStrictModeActive ();
std::string GetWarning (const Lib3MF_uint32 nIndex, Lib3MF_uint32 & nErrorCode);
Lib3MF_uint32 GetWarningCount ();
void AddKeyWrappingCallback(const std::string &sConsumerID, const Lib3MF::KeyWrappingCallback pTheCallback, const Lib3MF_pvoid pUserData);
void SetContentEncryptionCallback(const Lib3MF::ContentEncryptionCallback pTheCallback, const Lib3MF_pvoid pUserData);
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_READER
+97
View File
@@ -0,0 +1,97 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CResource
*/
#ifndef __LIB3MF_RESOURCE
#define __LIB3MF_RESOURCE
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelResource.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CResource
**************************************************************************************************************************/
class CResource : public virtual IResource, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PModelResource m_pResource;
protected:
NMR::PModelResource resource();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CResource() = delete;
CResource(NMR::PModelResource pResource);
/**
* Public member functions to implement.
*/
Lib3MF_uint32 GetResourceID() override;
Lib3MF_uint32 GetUniqueResourceID() override;
virtual IObject * AsObject();
IPackagePart * PackagePart() override;
void SetPackagePart(IPackagePart* pPackagePath) override;
Lib3MF_uint32 GetModelResourceID() override;
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_RESOURCE
+74
View File
@@ -0,0 +1,74 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CResourceData
*/
#ifndef __LIB3MF_RESOURCEDATA
#define __LIB3MF_RESOURCEDATA
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
#include "Model/Classes/NMR_KeyStoreResourceData.h"
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CResourceData
**************************************************************************************************************************/
class CResourceData : public virtual IResourceData, public virtual CBase {
private:
NMR::PKeyStoreResourceData m_pResourceData;
public:
CResourceData(NMR::PKeyStoreResourceData resourceData);
// Inherited via IResourceData
IPackagePart * GetPath() override;
Lib3MF::eEncryptionAlgorithm GetEncryptionAlgorithm() override;
Lib3MF::eCompression GetCompression() override;
void GetAdditionalAuthenticationData(Lib3MF_uint64 nByteDataBufferSize, Lib3MF_uint64 * pByteDataNeededCount, Lib3MF_uint8 * pByteDataBuffer) override;
inline NMR::PKeyStoreResourceData resourceData() const {
return m_pResourceData;
}
};
}
}
#endif
+74
View File
@@ -0,0 +1,74 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CResourceDataGroup
*/
#ifndef __LIB3MF_RESOURCEDATAGROUP
#define __LIB3MF_RESOURCEDATAGROUP
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
#include "Model/Classes/NMR_KeyStoreResourceDataGroup.h"
#include "Model/Classes/NMR_KeyStore.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CResourceData
**************************************************************************************************************************/
class CResourceDataGroup : public virtual IResourceDataGroup, public virtual CBase {
NMR::PKeyStoreResourceDataGroup m_pDataGroup;
public:
CResourceDataGroup(NMR::PKeyStoreResourceDataGroup const & dg);
// Inherited via IResourceDataGroup
virtual IAccessRight * AddAccessRight(IConsumer * pConsumer, const Lib3MF::eWrappingAlgorithm eWrappingAlgorithm, const Lib3MF::eMgfAlgorithm eMgfAlgorithm, const Lib3MF::eDigestMethod eDigestMethod) override;
virtual IAccessRight * FindAccessRightByConsumer(IConsumer * pConsumerInstance) override;
virtual void RemoveAccessRight(IConsumer * pConsumerInstance) override;
virtual std::string GetKeyUUID() override;
inline NMR::PKeyStoreResourceDataGroup resourceDataGroup() const {
return m_pDataGroup;
}
};
}
}
#endif // !__LIB3MF_RESOURCEDATAGROUP
+93
View File
@@ -0,0 +1,93 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CResourceIterator
*/
#ifndef __LIB3MF_RESOURCEITERATOR
#define __LIB3MF_RESOURCEITERATOR
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelResource.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CResourceIterator
**************************************************************************************************************************/
class CResourceIterator : public virtual IResourceIterator, public virtual CBase {
private:
std::vector<NMR::PModelResource> m_pResources;
Lib3MF_int32 m_nCurrentIndex;
protected:
virtual NMR::PModelResource GetCurrentResource();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CResourceIterator();
void addResource(NMR::PModelResource pResource);
/**
* Public member functions to implement.
*/
bool MoveNext ();
bool MovePrevious ();
IResource * GetCurrent ();
IResourceIterator * Clone ();
Lib3MF_uint64 Count();
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_RESOURCEITERATOR
+104
View File
@@ -0,0 +1,104 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CSlice
*/
#ifndef __LIB3MF_SLICE
#define __LIB3MF_SLICE
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelSlice.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CSlice
**************************************************************************************************************************/
class CSlice : public virtual ISlice, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PSlice m_pSlice;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CSlice(NMR::PSlice);
/**
* Public member functions to implement.
*/
void SetVertices (const Lib3MF_uint64 nVerticesBufferSize, const sLib3MFPosition2D * pVerticesBuffer);
void GetVertices (Lib3MF_uint64 nVerticesBufferSize, Lib3MF_uint64* pVerticesNeededCount, sLib3MFPosition2D * pVerticesBuffer);
Lib3MF_uint64 GetVertexCount ();
Lib3MF_uint64 GetPolygonCount();
Lib3MF_uint64 AddPolygon(const Lib3MF_uint64 nIndicesBufferSize, const Lib3MF_uint32 * pIndicesBuffer);
void SetPolygonIndices (const Lib3MF_uint64 nIndex, const Lib3MF_uint64 nIndicesBufferSize, const Lib3MF_uint32 * pIndicesBuffer);
void GetPolygonIndices (const Lib3MF_uint64 nIndex, Lib3MF_uint64 nIndicesBufferSize, Lib3MF_uint64* pIndicesNeededCount, Lib3MF_uint32 * pIndicesBuffer);
Lib3MF_uint64 GetPolygonIndexCount (const Lib3MF_uint64 nIndex);
double GetZTop();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_SLICE
+108
View File
@@ -0,0 +1,108 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CSliceStack
*/
#ifndef __LIB3MF_SLICESTACK
#define __LIB3MF_SLICESTACK
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resource.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelSliceStack.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CSliceStack
**************************************************************************************************************************/
class CSliceStack : public virtual ISliceStack, public virtual CResource {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
NMR::PModelSliceStack sliceStack();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CSliceStack(NMR::PModelSliceStack pSliceStack);
/**
* Public member functions to implement.
*/
double GetBottomZ();
Lib3MF_uint64 GetSliceCount ();
ISlice * AddSlice(const double fZTop);
ISlice * GetSlice (const Lib3MF_uint64 nSliceIndex);
Lib3MF_uint64 GetSliceRefCount();
void AddSliceStackReference(ISliceStack* pTheSliceStack) ;
ISliceStack * GetSliceStackReference(const Lib3MF_uint64 nSliceRefIndex);
void CollapseSliceReferences();
virtual void SetOwnPath(const std::string & sPath);
virtual std::string GetOwnPath();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_SLICESTACK
+89
View File
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CSliceStackIterator
*/
#ifndef __LIB3MF_SLICESTACKITERATOR
#define __LIB3MF_SLICESTACKITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CSliceStackIterator
**************************************************************************************************************************/
class CSliceStackIterator : public virtual ISliceStackIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
ISliceStack * GetCurrentSliceStack ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_SLICESTACKITERATOR
+105
View File
@@ -0,0 +1,105 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CTexture2D
*/
#ifndef __LIB3MF_TEXTURE2D
#define __LIB3MF_TEXTURE2D
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resource.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelTexture2D.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CTexture2D
**************************************************************************************************************************/
class CTexture2D : public virtual ITexture2D, public virtual CResource {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
NMR::PModelTexture2DResource texture();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CTexture2D(NMR::PModelTexture2DResource pResource);
/**
* Public member functions to implement.
*/
IAttachment * GetAttachment ();
void SetAttachment (IAttachment* pAttachment);
eLib3MFTextureType GetContentType ();
void SetContentType (const eLib3MFTextureType eContentType);
void GetTileStyleUV (eLib3MFTextureTileStyle & eTileStyleU, eLib3MFTextureTileStyle & eTileStyleV);
void SetTileStyleUV (const eLib3MFTextureTileStyle eTileStyleU, const eLib3MFTextureTileStyle eTileStyleV);
eLib3MFTextureFilter GetFilter ();
void SetFilter (const eLib3MFTextureFilter eFilter);
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_TEXTURE2D
+101
View File
@@ -0,0 +1,101 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CTexture2DGroup
*/
#ifndef __LIB3MF_TEXTURE2DGROUP
#define __LIB3MF_TEXTURE2DGROUP
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resource.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Classes/NMR_ModelTexture2DGroup.h"
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CTexture2DGroup
**************************************************************************************************************************/
class CTexture2DGroup : public virtual ITexture2DGroup, public virtual CResource {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
NMR::CModelTexture2DGroupResource& texture2DGroup();
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CTexture2DGroup(NMR::PModelTexture2DGroupResource pResource);
/**
* Public member functions to implement.
*/
ITexture2D * GetTexture2D();
Lib3MF_uint32 GetCount ();
void GetAllPropertyIDs (Lib3MF_uint64 nPropertyIDsBufferSize, Lib3MF_uint64* pPropertyIDsNeededCount, Lib3MF_uint32 * pPropertyIDsBuffer);
Lib3MF_uint32 AddTex2Coord (const sLib3MFTex2Coord UVCoordinate);
sLib3MFTex2Coord GetTex2Coord (const Lib3MF_uint32 nPropertyID);
void RemoveTex2Coord(const Lib3MF_uint32 nPropertyID);
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_TEXTURE2DGROUP
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CTexture2DGroupIterator
*/
#ifndef __LIB3MF_TEXTURE2DGROUPITERATOR
#define __LIB3MF_TEXTURE2DGROUPITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CTexture2DGroupIterator
**************************************************************************************************************************/
class CTexture2DGroupIterator : public virtual ITexture2DGroupIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
ITexture2DGroup * GetCurrentTexture2DGroup ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_TEXTURE2DGROUPITERATOR
+89
View File
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CTexture2DIterator
*/
#ifndef __LIB3MF_TEXTURE2DITERATOR
#define __LIB3MF_TEXTURE2DITERATOR
#include "lib3mf_interfaces.hpp"
// Parent classes
#include "lib3mf_resourceiterator.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CTexture2DIterator
**************************************************************************************************************************/
class CTexture2DIterator : public virtual ITexture2DIterator, public virtual CResourceIterator {
private:
/**
* Put private members here.
*/
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
/**
* Public member functions to implement.
*/
ITexture2D * GetCurrentTexture2D ();
};
} // namespace Impl
} // namespace Lib3MF
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_TEXTURE2DITERATOR
+60
View File
@@ -0,0 +1,60 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This file contains utilties used in the API of lib3mf
*/
#ifndef __LIB3MF_UTILS
#define __LIB3MF_UTILS
#include "lib3mf_interfaces.hpp"
// Include custom headers here.
#include "Common/Math/NMR_Matrix.h"
#include "Common/NMR_SecureContentTypes.h"
namespace Lib3MF {
NMR::NMATRIX3 TransformToMatrix(const sLib3MFTransform Transform);
sLib3MFTransform MatrixToTransform(const NMR::NMATRIX3 matrix);
eLib3MFEncryptionAlgorithm translateEncryptionAlgorithm(const NMR::eKeyStoreEncryptAlgorithm algorithm);
NMR::eKeyStoreEncryptAlgorithm translateEncryptionAlgorithm(const eLib3MFEncryptionAlgorithm algorithm);
eLib3MFWrappingAlgorithm translateWrappingAlgorithm(const NMR::eKeyStoreWrapAlgorithm algorithm);
NMR::eKeyStoreWrapAlgorithm translateWrappingAlgorithm(const eLib3MFWrappingAlgorithm algorithm);
eLib3MFCompression translateCompression(bool compression);
bool translateCompression(const eLib3MFCompression compression);
}
#endif // __LIB3MF_UTILS
+121
View File
@@ -0,0 +1,121 @@
/*++
Copyright (C) 2019 3MF Consortium (Original Author)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: This is the class declaration of CWriter
*/
#ifndef __LIB3MF_WRITER
#define __LIB3MF_WRITER
#include "lib3mf_interfaces.hpp"
#include "lib3mf_base.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4250)
#endif
// Include custom headers here.
#include "Model/Writer/NMR_ModelWriter.h"
#include "Model/Writer/NMR_ModelWriter_3MF_Native.h"
#include "Model/Writer/NMR_ModelWriter_STL.h"
namespace NMR {
class CExportStreamMemory;
using PExportStreamMemory = std::shared_ptr<CExportStreamMemory>;
}
namespace Lib3MF {
namespace Impl {
/*************************************************************************************************************************
Class declaration of CWriter
**************************************************************************************************************************/
class CWriter : public virtual IWriter, public virtual CBase {
private:
/**
* Put private members here.
*/
NMR::PModelWriter m_pWriter;
NMR::PExportStreamMemory momentBuffer;
protected:
/**
* Put protected members here.
*/
public:
/**
* Put additional public members here. They will not be visible in the external API.
*/
CWriter(std::string sWriterClass, NMR::PModel model);
NMR::CModelWriter& writer();
/**
* Public member functions to implement.
*/
void WriteToFile(const std::string & sFilename) override;
Lib3MF_uint64 GetStreamSize() override;
void WriteToBuffer(Lib3MF_uint64 nBufferBufferSize, Lib3MF_uint64* pBufferNeededCount, Lib3MF_uint8 * pBufferBuffer) override;
void WriteToCallback(const Lib3MFWriteCallback pTheWriteCallback, const Lib3MFSeekCallback pTheSeekCallback, const Lib3MF_pvoid pUserData) override;
void SetProgressCallback(const Lib3MFProgressCallback pProgressCallback, const Lib3MF_pvoid pUserData) override;
Lib3MF_uint32 GetDecimalPrecision() override;
void SetDecimalPrecision(const Lib3MF_uint32 nDecimalPrecision) override;
void AddKeyWrappingCallback(const std::string & sConsumerID, const Lib3MF::KeyWrappingCallback pTheCallback, const Lib3MF_pvoid pUserData);
void SetContentEncryptionCallback(const Lib3MF::ContentEncryptionCallback pTheCallback, const Lib3MF_pvoid pUserData);
void SetStrictModeActive(const bool bStrictModeActive);
bool GetStrictModeActive();
std::string GetWarning(const Lib3MF_uint32 nIndex, Lib3MF_uint32 & nErrorCode);
Lib3MF_uint32 GetWarningCount();
};
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // __LIB3MF_WRITER
+81
View File
@@ -0,0 +1,81 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: Progress Monitor
--*/
#ifndef __NMR_PROGRESSMONITOR
#define __NMR_PROGRESSMONITOR
#include "Common/3MF_ProgressTypes.h"
#include <memory>
#include <mutex>
#include <stack>
#include <string>
namespace NMR
{
#define PROGRESS_SLICEUPDATE 1000
#define PROGRESS_NODEUPDATE 100000
#define PROGRESS_TRIANGLEUPDATE 100000
#define PROGRESS_READUPDATE 20000
#define PROGRESS_READSLICESUPDATE 100
#define PROGRESS_READBUFFERUPDATE 100
class CProgressMonitor
{
public:
CProgressMonitor();
void SetProgressCallback(Lib3MFProgressCallback callback, void* userData);
void ClearProgressCallback();
// Returns true if the last callback call returned false
bool WasAborted();
bool QueryCancelled(bool throwIfCancelled);
bool ReportProgressAndQueryCancelled(bool throwIfCancelled);
void IncrementProgress(double dProgressIncrement);
void SetProgressIdentifier(ProgressIdentifier identifier);
void SetMaxProgress(double);
void DecreaseMaxProgress(double);
static void GetProgressMessage(ProgressIdentifier progressIdentifier, std::string& progressString);
private:
ProgressIdentifier m_eProgressIdentifier;
double m_dProgress;
double m_dProgressMax;
Lib3MFProgressCallback m_progressCallback;
void* m_userData;
bool m_lastCallbackResult;
std::mutex m_callbackMutex;
};
typedef std::shared_ptr <CProgressMonitor> PProgressMonitor;
};
#endif // __NMR_PROGRESSMONITOR
+67
View File
@@ -0,0 +1,67 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract: Progress Types
--*/
#pragma once
#include <functional>
namespace NMR
{
enum ProgressIdentifier {
PROGRESS_QUERYCANCELED = 0,
PROGRESS_DONE,
PROGRESS_CLEANUP,
PROGRESS_READSTREAM,
PROGRESS_EXTRACTOPCPACKAGE,
PROGRESS_READNONROOTMODELS,
PROGRESS_READROOTMODEL,
PROGRESS_READRESOURCES,
PROGRESS_READMESH,
PROGRESS_READSLICES,
PROGRESS_READBUILD,
PROGRESS_READCUSTOMATTACHMENTS,
PROGRESS_READTEXTURETACHMENTS,
PROGRESS_CREATEOPCPACKAGE,
PROGRESS_WRITEMODELSTOSTREAM,
PROGRESS_WRITEROOTMODEL,
PROGRESS_WRITENONROOTMODELS,
PROGRESS_WRITEATTACHMENTS,
PROGRESS_WRITECONTENTTYPES,
PROGRESS_WRITEOBJECTS,
PROGRESS_WRITENODES,
PROGRESS_WRITETRIANGLES,
PROGRESS_WRITESLICES
};
// Matches dll interface type, always modify both!
// If the first parameter is -1, it does not indicate progress;In that case
// it must only be used to stop the execution of the calling function.
typedef std::function<bool(int, ProgressIdentifier, void*)> Lib3MFProgressCallback;
};
+117
View File
@@ -0,0 +1,117 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Geometry.h defines all basic structures for vector and matrix calculations.
--*/
#ifndef __NMR_GEOMETRY
#define __NMR_GEOMETRY
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#define NMR_VECTOR_MINNORMALIZELENGTH 1.0e-10f
#define NMR_VECTOR_DEFAULTUNITS 0.001f
#define NMR_VECTOR_MINUNITS 0.00001f
#define NMR_VECTOR_MAXUNITS 1000.0f
#define NMR_OUTBOX_MAXCOORDINATE 10000000000.0f
namespace NMR {
typedef union {
nfFloat m_fields[2];
struct { nfFloat x; nfFloat y; } m_values;
} NVEC2;
typedef union {
nfFloat m_fields[3];
struct { nfFloat x; nfFloat y; nfFloat z; } m_values;
} NVEC3;
typedef union {
nfDouble m_fields[3];
struct { nfDouble x; nfDouble y; nfDouble z; } m_values;
} NVEC3D;
typedef union {
nfInt32 m_fields[2];
struct { nfInt32 x; nfInt32 y; } m_values;
} NVEC2I;
typedef union {
nfInt32 m_fields[3];
struct { nfInt32 x; nfInt32 y; nfInt32 z; } m_values;
} NVEC3I;
typedef union {
nfInt64 m_fields[3];
struct { nfInt64 x; nfInt64 y; nfInt64 z; } m_values;
} NVEC3I64;
typedef struct {
nfFloat m_fields[3][3];
} NMATRIX2;
typedef struct {
nfFloat m_fields[2][2];
} NLINMATRIX2;
typedef struct {
nfFloat m_fields[4][4];
} NMATRIX3;
typedef struct {
NVEC2 m_min;
NVEC2 m_max;
} NOUTBOX2;
typedef struct {
NVEC3 m_min;
NVEC3 m_max;
} NOUTBOX3;
typedef struct {
NVEC2I m_vMin;
NVEC2I m_vMax;
} NOUTBOX2I;
typedef struct {
NVEC3I m_vMin;
NVEC3I m_vMax;
} NOUTBOX3I;
typedef struct {
NVEC2 m_vPoints[3];
NLINMATRIX2 m_vMatrix;
NLINMATRIX2 m_vInvMatrix;
} NBARYCENTRICTRIANGLE;
}
#endif // __NMR_GEOMETRY
+77
View File
@@ -0,0 +1,77 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Matrix.h defines all needed matrix calculations and transforms for
2D and 3D vectors.
--*/
#ifndef __NMR_MATRIX
#define __NMR_MATRIX
#include "Common/Math/NMR_Geometry.h"
#include <string>
#define NMR_MATRIX_MINDETERMINANT 0.00001f
#define NMR_MATRIX_IDENTITYTHRESHOLD 0.0000001
namespace NMR {
NMATRIX2 fnMATRIX2_identity();
NMATRIX2 fnMATRIX2_rotation(_In_ const nfFloat fAngle);
NMATRIX2 fnMATRIX2_translation(_In_ const NVEC2 vTranslation);
NMATRIX2 fnMATRIX2_uniformscale(_In_ nfFloat fScale);
NMATRIX2 fnMATRIX2_scale(_In_ nfFloat fScaleX, _In_ nfFloat fScaleY);
NMATRIX2 fnMATRIX2_transformation(_In_ const nfFloat fAngle, _In_ const NVEC2 vTranslation);
NMATRIX2 fnMATRIX2_multiply(_In_ const NMATRIX2 mMatrix1, _In_ const NMATRIX2 mMatrix2);
NVEC2 fnMATRIX2_apply(_In_ const NMATRIX2 mMatrix, _In_ const NVEC2 vVector);
NLINMATRIX2 fnLINMATRIX2_identity();
NLINMATRIX2 fnLINMATRIX2_rotation(_In_ const nfFloat fAngle);
NLINMATRIX2 fnLINMATRIX2_uniformscale(_In_ nfFloat fScale);
NLINMATRIX2 fnLINMATRIX2_scale(_In_ nfFloat fScaleX, _In_ nfFloat fScaleY);
NLINMATRIX2 fnLINMATRIX2_multiply(_In_ const NLINMATRIX2 mMatrix1, _In_ const NLINMATRIX2 mMatrix2);
NVEC2 fnLINMATRIX2_apply(_In_ const NLINMATRIX2 mMatrix, _In_ const NVEC2 vVector);
NLINMATRIX2 fnLINMATRIX2_invert(_In_ const NLINMATRIX2 mMatrix, _In_ nfBool bFailIfSingular);
NMATRIX3 fnMATRIX3_identity();
NMATRIX3 fnMATRIX3_rotation(_In_ const NVEC3 vAxis, _In_ const nfFloat fAngle);
NMATRIX3 fnMATRIX3_translation(_In_ const NVEC3 vTranslation);
NMATRIX3 fnMATRIX3_transformation(_In_ const NVEC3 vAxis, _In_ const nfFloat fAngle, _In_ const NVEC3 vTranslation);
NMATRIX3 fnMATRIX3_multiply(_In_ const NMATRIX3 mMatrix1, _In_ const NMATRIX3 mMatrix2);
NMATRIX3 fnMATRIX3_uniformscale(_In_ nfFloat fScale);
NMATRIX3 fnMATRIX3_scale(_In_ nfFloat fScaleX, _In_ nfFloat fScaleY, _In_ nfFloat fScaleZ);
NVEC3 fnMATRIX3_apply(_In_ const NMATRIX3 mMatrix, _In_ const NVEC3 vVector);
nfBool fnMATRIX3_isIdentity(_In_ const NMATRIX3 mMatrix);
std::string fnMATRIX3_toString(_In_ const NMATRIX3 mMatrix);
NMATRIX3 fnMATRIX3_fromString(_In_ const std::string sString);
nfBool fnMATRIX3_isplanar(_In_ const NMATRIX3 mMatrix);
}
#endif // __NMR_MATRIX
@@ -0,0 +1,68 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_PairMatchingTree.h defines a n-log-n tree class which is able to identify
duplicate pairs of numbers in a given data set.
--*/
#ifndef __NMR_PAIRMATCHINGTREE
#define __NMR_PAIRMATCHINGTREE
#include "Common/Math/NMR_Geometry.h"
#include "Common/NMR_Types.h"
#include <map>
namespace NMR {
typedef struct {
nfInt32 m_pair[2];
} PAIRMATCHINGTREEENTRY;
bool operator< (_In_ const PAIRMATCHINGTREEENTRY & entry1, _In_ const PAIRMATCHINGTREEENTRY & entry2);
class CPairMatchingTree {
private:
std::map <PAIRMATCHINGTREEENTRY, nfInt32> m_entries;
public:
CPairMatchingTree();
~CPairMatchingTree();
void addMatch(_In_ nfInt32 data1, _In_ nfInt32 data2, _In_ nfInt32 param);
_Success_(return) nfBool checkMatch(_In_ nfInt32 data1, _In_ nfInt32 data2, _Out_opt_ nfInt32 &param);
void deleteMatch(_In_ nfInt32 data1, _In_ nfInt32 data2);
};
}
#endif // __NMR_PAIRMATCHINGTREE
+131
View File
@@ -0,0 +1,131 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Vector.cpp implements all needed direct operations on 2D and 3D vectors.
--*/
#ifndef __NMR_VECTOR
#define __NMR_VECTOR
#include "Common/Math/NMR_Geometry.h"
namespace NMR {
NVEC2 fnVEC2_make(_In_ nfFloat fX, _In_ nfFloat fY);
NVEC2 fnVEC2_add(_In_ const NVEC2 vVector1, _In_ const NVEC2 vVector2);
NVEC2 fnVEC2_sub(_In_ const NVEC2 vMinuend, _In_ const NVEC2 vSubtrahend);
NVEC2 fnVEC2_scale(_In_ const NVEC2 vVector, _In_ nfFloat vFactor);
NVEC2 fnVEC2_combine(_In_ const NVEC2 vVector1, _In_ nfFloat vFactor1, _In_ const NVEC2 vVector2, _In_ nfFloat vFactor2);
nfFloat fnVEC2_dotproduct(_In_ const NVEC2 vVector1, _In_ const NVEC2 vVector2);
nfFloat fnVEC2_crossproduct(_In_ const NVEC2 vVector1, _In_ const NVEC2 vVector2);
nfFloat fnVEC2_length(_In_ const NVEC2 vVector);
nfFloat fnVEC2_distance(_In_ const NVEC2 vPoint1, _In_ const NVEC2 vPoint2);
NVEC2 fnVEC2_normalize(_In_ const NVEC2 vVector);
NVEC3 fnVEC3_make(_In_ nfFloat fX, _In_ nfFloat fY, _In_ nfFloat fZ);
NVEC3 fnVEC3_add(_In_ const NVEC3 vVector1, _In_ const NVEC3 vVector2);
NVEC3 fnVEC3_sub(_In_ const NVEC3 vMinuend, _In_ const NVEC3 vSubtrahend);
NVEC3 fnVEC3_scale(_In_ const NVEC3 vVector, _In_ nfFloat vFactor);
NVEC3 fnVEC3_combine(_In_ const NVEC3 vVector1, _In_ nfFloat vFactor1, _In_ const NVEC3 vVector2, _In_ nfFloat vFactor2);
nfFloat fnVEC3_dotproduct(_In_ const NVEC3 vVector1, _In_ const NVEC3 vVector2);
NVEC3 fnVEC3_crossproduct(_In_ const NVEC3 vVector1, _In_ const NVEC3 vVector2);
nfFloat fnVEC3_length(_In_ const NVEC3 vVector);
nfFloat fnVEC3_distance(_In_ const NVEC3 vPoint1, _In_ const NVEC3 vPoint2);
NVEC3 fnVEC3_normalize(_In_ const NVEC3 vVector);
NVEC3 fnVEC3_calcTriangleNormal(_In_ const NVEC3 vVector1, _In_ const NVEC3 vVector2, _In_ const NVEC3 vVector3);
NVEC2I fnVEC2I_make(_In_ nfInt32 nX, _In_ nfInt32 nY);
NVEC2I fnVEC2I_floor(_In_ NVEC2 vVector, _In_ nfFloat fUnits);
NVEC2 fnVEC2I_uncast(_In_ NVEC2I vVector, _In_ nfFloat fUnits);
NVEC2I fnVEC2I_add(_In_ const NVEC2I vVector1, _In_ const NVEC2I vVector2);
NVEC2I fnVEC2I_sub(_In_ const NVEC2I vMinuend, _In_ const NVEC2I vSubtrahend);
NVEC2I fnVEC2I_scale(_In_ const NVEC2I vVector, _In_ nfInt32 vFactor);
nfInt64 fnVEC2I_dotproduct(_In_ const NVEC2I vVector1, _In_ const NVEC2I vVector2);
nfFloat fnVEC2I_distance(_In_ const NVEC2I vPoint1, _In_ const NVEC2I vPoint2);
nfFloat fnVEC2I_length(_In_ const NVEC2I vVector);
NVEC3I fnVEC3I_make(_In_ nfInt32 nX, _In_ nfInt32 nY, _In_ nfInt32 nZ);
NVEC3I fnVEC3I_floor(_In_ NVEC3 vVector, _In_ nfFloat fUnits);
NVEC3I fnVEC3I_round(_In_ NVEC3 vVector, _In_ nfFloat fUnits);
NVEC3 fnVEC3I_uncast(_In_ NVEC3I vVector, _In_ nfFloat fUnits);
NVEC3I fnVEC3I_add(_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2);
NVEC3I fnVEC3I_sub(_In_ const NVEC3I vMinuend, _In_ const NVEC3I vSubtrahend);
NVEC3I fnVEC3I_scale(_In_ const NVEC3I vVector, _In_ nfInt32 vFactor);
nfInt64 fnVEC3I_dotproduct(_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2);
NVEC3I fnVEC3I_crossproduct(_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2);
NVEC3I64 fnVEC3I_crossproduct64(_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2);
nfFloat fnVEC3I_length(_In_ const NVEC3I vVector);
nfFloat fnVEC3I_distance(_In_ const NVEC3I vPoint1, _In_ const NVEC3I vPoint2);
nfInt32 fnVEC3I_comparelexicographic(_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2);
nfBool fnVEC3I_iszero(_In_ const NVEC3I vVector);
nfBool fnVEC3I_triangleIsDegenerate(_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2, _In_ const NVEC3I vVector3);
NVEC3I fnVEC3I_setOrderedVector(_In_ nfInt32 nValue1, _In_ nfInt32 nValue2, _In_ nfInt32 nValue3);
nfBool fnVEC3I_checkForCollinearity(_In_ NVEC3I vVector1, _In_ NVEC3I vVector2);
NVEC2 operator+ (_In_ const NVEC2 vVector1, _In_ const NVEC2 vVector2);
NVEC2 operator- (_In_ const NVEC2 vMinuend, _In_ const NVEC2 vSubtrahend);
NVEC2 operator* (_In_ const NVEC2 vVector, _In_ nfFloat vFactor);
NVEC2 operator* (_In_ nfFloat vFactor, _In_ const NVEC2 vVector);
nfFloat operator* (_In_ const NVEC2 vVector1, _In_ const NVEC2 vVector2);
NVEC2I operator+ (_In_ const NVEC2I vVector1, _In_ const NVEC2I vVector2);
NVEC2I operator- (_In_ const NVEC2I vMinuend, _In_ const NVEC2I vSubtrahend);
NVEC2I operator* (_In_ const NVEC2I vVector, _In_ nfInt32 vFactor);
NVEC2I operator* (_In_ nfInt32 vFactor, _In_ const NVEC2I vVector);
nfUint64 operator* (_In_ const NVEC2I vVector1, _In_ const NVEC2I vVector2);
NVEC3 operator+ (_In_ const NVEC3 vVector1, _In_ const NVEC3 vVector2);
NVEC3 operator- (_In_ const NVEC3 vMinuend, _In_ const NVEC3 vSubtrahend);
NVEC3 operator* (_In_ const NVEC3 vVector, nfFloat vFactor);
NVEC3 operator* (nfFloat vFactor, _In_ const NVEC3 vVector);
nfFloat operator* (_In_ const NVEC3 vVector1, _In_ const NVEC3 vVector2);
NVEC3I operator+ (_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2);
NVEC3I operator- (_In_ const NVEC3I vMinuend, _In_ const NVEC3I vSubtrahend);
NVEC3I operator* (_In_ const NVEC3I vVector, _In_ nfInt32 vFactor);
NVEC3I operator* (_In_ nfInt32 vFactor, _In_ const NVEC3I vVector);
nfUint64 operator* (_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2);
nfInt32 fnInt32_sign(_In_ nfInt32 nValue);
nfInt32 fnInt64_sign(_In_ nfInt64 nValue);
nfInt32 fnInt32_compare(_In_ nfInt32 nValue1, _In_ nfInt32 nValue2);
nfInt32 fnInt64_compare(_In_ nfInt64 nValue1, _In_ nfInt64 nValue2);
void fnOutboxInitialize(_Out_ NOUTBOX3 &oOutbox);
void fnOutboxMergeVector(_Inout_ NOUTBOX3 &oOutbox, _In_ NVEC3 vVector);
void fnOutboxMergeOutbox(_Inout_ NOUTBOX3 &oOutboxDest, _In_ NOUTBOX3 &oOutboxSource);
nfBool fnOutboxIsValid(_In_ const NOUTBOX3 oOutbox);
void fnOutbox3IMergeVector(_Inout_ NOUTBOX3I &oOutbox, _In_ NVEC3I vVector);
void fnOutbox3IMergeOutbox(_Inout_ NOUTBOX3I &oOutboxDest, _In_ NOUTBOX3I &oOutboxSource);
NOUTBOX3I fnCalcTriangleOutbox3I(_In_ const NVEC3I vVector1, _In_ const NVEC3I vVector2, _In_ const NVEC3I vVector3);
nfBool fnOutbox3IDoIntersect(_In_ const NOUTBOX3I oOutbox1, _In_ const NOUTBOX3I oOutbox2);
}
#endif // __NMR_VECTOR
+79
View File
@@ -0,0 +1,79 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_VectorTree.h defines a n*log(n) lookup tree class to identify vectors by
their position.
--*/
#ifndef __NMR_VECTORTREE
#define __NMR_VECTORTREE
#include "Common/Math/NMR_Geometry.h"
#include "Common/NMR_Types.h"
#include <map>
namespace NMR {
typedef struct {
NVEC3I m_position;
} VECTORTREEENTRY;
bool operator< (_In_ const VECTORTREEENTRY & entry1, _In_ const VECTORTREEENTRY & entry2);
class CVectorTree {
private:
nfFloat m_fUnits;
std::map <VECTORTREEENTRY, nfUint32> m_entries;
public:
CVectorTree();
CVectorTree(_In_ nfFloat fUnits);
nfFloat getUnits();
void setUnits(_In_ nfFloat fUnits);
_Success_(return) nfBool findVector2(_In_ NVEC2 vVector, _Out_opt_ nfUint32 & value);
_Success_(return) nfBool findVector3(_In_ NVEC3 vVector, _Out_opt_ nfUint32 & value);
_Success_(return) nfBool findIntVector2(_In_ NVEC2I vVector, _Out_opt_ nfUint32 & value);
_Success_(return) nfBool findIntVector3(_In_ NVEC3I vVector, _Out_opt_ nfUint32 & value);
void addVector2(_In_ NVEC2 vVector, _In_ nfUint32 value);
void addVector3(_In_ NVEC3 vVector, _In_ nfUint32 value);
void addIntVector2(_In_ NVEC2I vVector, _In_ nfUint32 value);
void addIntVector3(_In_ NVEC3I vVector, _In_ nfUint32 value);
void removeVector2(_In_ NVEC2 vVector);
void removeVector3(_In_ NVEC3 vVector);
void removeIntVector2(_In_ NVEC2I vVector);
void removeIntVector3(_In_ NVEC3I vVector);
};
}
#endif // __NMR_VECTORTREE
+70
View File
@@ -0,0 +1,70 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshBeamLattice.h defines the class CMeshBeamLattice.
--*/
#ifndef __NMR_MESHBEAMLATTICE
#define __NMR_MESHBEAMLATTICE
#include "Common/Math/NMR_Geometry.h"
#include "Common/Mesh/NMR_MeshTypes.h"
#include "Common/NMR_Types.h"
#include "Model/Classes/NMR_ModelTypes.h"
#include <unordered_set>
namespace NMR {
class CBeamLattice {
private:
friend class CMesh;
MESHNODES &m_Nodes; // reference to the nodes of the parent mesh
std::unordered_set<nfInt32> m_OccupiedNodes; // datastructure used to ensure that balls are only placed at nodes with beams
MESHBEAMS m_Beams;
std::vector<PBEAMSET> m_pBeamSets;
MESHBALLS m_Balls;
nfDouble m_dMinLength;
eModelBeamLatticeBallMode m_eBallMode;
nfDouble m_dDefaultBallRadius;
public:
CBeamLattice(_In_ MESHNODES &nodes);
void clearBeams();
void clearBalls();
void clear();
};
typedef std::shared_ptr <CBeamLattice> PBeamLattice;
}
#endif // __NMR_BEAMLATTICE
+130
View File
@@ -0,0 +1,130 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Mesh.h defines the class CMesh.
The class CMesh is not really a mesh, since it lacks the component edges and the
topological information. It only holds the nodes and the faces (triangles).
Each node, and face have a ID, which allows to identify them. Each face have an
orientation (i.e. the face can look up or look down) and have three nodes.
The orientation is defined by the order of its nodes.
You can only add nodes and faces to mesh. You cannot remove the existing structure.
--*/
#ifndef __NMR_MESH
#define __NMR_MESH
#include "Common/Math/NMR_Geometry.h"
#include "Common/Mesh/NMR_MeshTypes.h"
#include "Common/MeshInformation/NMR_MeshInformationHandler.h"
#include "Common/NMR_Types.h"
#include "Common/Mesh/NMR_BeamLattice.h"
#include <map>
namespace NMR {
class CMesh {
private:
MESHNODES m_Nodes;
MESHFACES m_Faces;
CBeamLattice m_BeamLattice;
PMeshInformationHandler m_pMeshInformationHandler;
public:
CMesh();
CMesh(_In_opt_ CMesh * pMesh);
void mergeMesh(_In_opt_ CMesh * pMesh);
void addToMesh(_In_opt_ CMesh * pMesh);
void mergeMesh(_In_opt_ CMesh * pMesh, _In_ NMATRIX3 mMatrix);
void addToMesh(_In_opt_ CMesh * pMesh, _In_ NMATRIX3 mMatrix);
_Ret_notnull_ MESHNODE * addNode(_In_ const NVEC3 vPosition);
_Ret_notnull_ MESHNODE * addNode(_In_ const nfFloat posX, _In_ const nfFloat posY, _In_ const nfFloat posZ);
_Ret_notnull_ MESHFACE * addFace(_In_ MESHNODE * pNode1, _In_ MESHNODE * pNode2, _In_ MESHNODE * pNode3);
_Ret_notnull_ MESHFACE * addFace(_In_ nfInt32 nNodeIndex1, _In_ nfInt32 nNodeIndex2, _In_ nfInt32 nNodeIndex3);
_Ret_notnull_ MESHBEAM * addBeam(_In_ MESHNODE * pNode1, _In_ MESHNODE * pNode2, _In_ nfDouble dRadius1, _In_ nfDouble dRadius2,
_In_ nfInt32 eCapMode1, _In_ nfInt32 eCapMode2);
_Ret_notnull_ MESHBALL * addBall(_In_ MESHNODE * pNode, _In_ nfDouble dRadius);
_Ret_notnull_ PBEAMSET addBeamSet();
nfUint32 getNodeCount();
nfUint32 getFaceCount();
nfUint32 getBeamCount();
nfUint32 getBallCount();
nfUint32 getBeamSetCount();
nfUint32 getOccupiedNodeCount();
nfBool isNodeOccupied(_In_ nfUint32 nIdx);
_Ret_notnull_ MESHNODE * getNode(_In_ nfUint32 nIdx);
_Ret_notnull_ MESHFACE * getFace(_In_ nfUint32 nIdx);
_Ret_notnull_ MESHBEAM * getBeam(_In_ nfUint32 nIdx);
_Ret_notnull_ MESHBALL * getBall(_In_ nfUint32 nIdx);
_Ret_notnull_ PBEAMSET getBeamSet(_In_ nfUint32 nIdx);
_Ret_notnull_ MESHNODE * getOccupiedNode(_In_ nfUint32 nIdx);
void setBeamLatticeMinLength(nfDouble dMinLength);
nfDouble getBeamLatticeMinLength();
// TODO: make these return sensible values
void setDefaultBeamRadius(nfDouble dRadius);
nfDouble getDefaultBeamRadius();
void setDefaultBallRadius(nfDouble dBallRadius);
nfDouble getDefaultBallRadius();
void setBeamLatticeAccuracy(nfDouble dAccuracy);
nfBool getBeamLatticeAccuracy(nfDouble& dAccuracy);
void setBeamLatticeBallMode(eModelBeamLatticeBallMode eBallMode);
eModelBeamLatticeBallMode getBeamLatticeBallMode();
void setBeamLatticeCapMode(eModelBeamLatticeCapMode eCapMode);
eModelBeamLatticeCapMode getBeamLatticeCapMode();
nfBool checkSanity();
void clear();
void clearBeamLattice();
void clearBeamLatticeBeams();
void clearBeamLatticeBalls();
void scanOccupiedNodes();
void validateBeamLatticeBalls();
_Ret_maybenull_ CMeshInformationHandler * getMeshInformationHandler();
_Ret_notnull_ CMeshInformationHandler * createMeshInformationHandler();
void clearMeshInformationHandler();
void patchMeshInformationResources(_In_ std::map<UniqueResourceID, UniqueResourceID> &oldToNewMapping);
void extendOutbox(_Out_ NOUTBOX3& vOutBox, _In_ const NMATRIX3 mAccumulatedMatrix);
};
typedef std::shared_ptr <CMesh> PMesh;
}
#endif // __NMR_MESH
+66
View File
@@ -0,0 +1,66 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshBuilder.h defines the class CMeshBuilder.
The class CMeshBuilder is auxiliary class, which construct a valid mesh by adding single faces and nodes.
In addition already existing meshes can be added.
--*/
#ifndef __NMR_MESHBUILDER
#define __NMR_MESHBUILDER
#include "Common/Mesh/NMR_Mesh.h"
#include "Common/MeshInformation/NMR_MeshInformationHandler.h"
#include "Common/Math/NMR_VectorTree.h"
namespace NMR {
class CMeshBuilder {
private:
CVectorTree m_VectorTree;
CPagedVector<NVEC3> m_Nodes;
CPagedVector<NVEC3I> m_Faces;
public:
CMeshBuilder();
CMeshBuilder(_In_ nfFloat fUnits);
nfUint32 addNode(_In_ const NVEC3 vPoint);
nfUint32 addFace(_In_ const NVEC3 vPoint1, _In_ const NVEC3 vPoint2, _In_ const NVEC3 vPoint3);
PMesh createMesh(_In_ nfBool bIgnoreInvalidFaces);
void addToMesh(_In_ CMesh * pMesh, _In_ nfBool bIgnoreInvalidFaces);
};
typedef std::shared_ptr <CMeshBuilder> PMeshBuilder;
}
#endif // __NMR_MESHBUILDER
+112
View File
@@ -0,0 +1,112 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshTypes.h defines the basic datastructures for the mesh CMesh.
The mesh has nodes and faces, which are defined in this file.
In addition, some constants are defined here.
--*/
#ifndef __NMR_MESHTYPES
#define __NMR_MESHTYPES
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include "Common/Math/NMR_Geometry.h"
#include "Common/NMR_PagedVector.h"
#include <string>
// The maximum allowed number of certain entities (2^31-1)
#define NMR_MESH_MAXNODECOUNT 2147483647
#define NMR_MESH_MAXEDGECOUNT 2147483647
#define NMR_MESH_MAXFACECOUNT 2147483647
#define NMR_MESH_MAXBEAMCOUNT 2147483647
#define NMR_MESH_MAXBALLCOUNT 2147483647
#define NMR_MESH_MAXCOORDINATE 1000000000.0f
#define NMR_MESH_NODEBLOCKCOUNT 256
#define NMR_MESH_EDGEBLOCKCOUNT 256
#define NMR_MESH_FACEBLOCKCOUNT 256
#define NMR_MESH_BEAMBLOCKCOUNT 256
#define NMR_MESH_BALLBLOCKCOUNT 256
#define NMR_MESH_NODEEDGELINKBLOCKCOUNT 256
namespace NMR {
typedef struct {
nfInt32 m_index;
NVEC3 m_position;
} MESHNODE;
typedef CPagedVector<MESHNODE, NMR_MESH_NODEBLOCKCOUNT> MESHNODES;
typedef struct {
nfInt32 m_index;
nfInt32 m_nodeindices[3];
} MESHFACE;
typedef CPagedVector<MESHFACE, NMR_MESH_FACEBLOCKCOUNT> MESHFACES;
typedef struct BEAMSET {
std::vector<nfUint32> m_Refs;
std::vector<nfUint32> m_BallRefs;
std::string m_sName; // "" for no name
std::string m_sIdentifier; // "" for no identifier
BEAMSET() {
m_sName = "";
m_sIdentifier = "";
}
} BEAMSET;
typedef std::shared_ptr <BEAMSET> PBEAMSET;
typedef struct MESHBEAM {
nfInt32 m_index;
nfInt32 m_nodeindices[2];
nfDouble m_radius[2];
nfInt32 m_capMode[2];
// eModelBeamLatticeCapMode m_capMode[2];
MESHBEAM() {
};
} MESHBEAM;
typedef CPagedVector<MESHBEAM, NMR_MESH_BEAMBLOCKCOUNT> MESHBEAMS;
typedef struct MESHBALL {
nfInt32 m_index;
nfInt32 m_nodeindex;
nfDouble m_radius;
MESHBALL() {
};
} MESHBALL;
typedef CPagedVector<MESHBALL, NMR_MESH_BALLBLOCKCOUNT> MESHBALLS;
typedef struct {
nfInt32 m_index;
NVEC2 m_position;
} SLICENODE;
}
#endif // __NMR_MESHTYPES
@@ -0,0 +1,63 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshExportEdgeMap.h defines the Mesh Export Edge Map Class.
This class acts as a container for additional topology information.
--*/
#ifndef __NMR_MESHEXPORTEDGEMAP
#define __NMR_MESHEXPORTEDGEMAP
#include "Common/NMR_Types.h"
#include "Common/Math/NMR_Geometry.h"
#include <vector>
namespace NMR {
typedef union {
nfInt32 m_edgeindices[3];
} NMESHEXPORTFACE;
class CMeshExportEdgeMap {
private:
std::vector<NMESHEXPORTFACE> m_FaceInfos;
public:
CMeshExportEdgeMap() = delete;
CMeshExportEdgeMap(nfUint32 nFaceCount);
NMESHEXPORTFACE getFaceData(_In_ nfInt32 nIdx);
void setFaceData(_In_ nfInt32 nIdx, _In_ NMESHEXPORTFACE ExportFace);
};
typedef std::shared_ptr <CMeshExportEdgeMap> PMeshExportEdgeMap;
}
#endif // __NMR_MESHEXPORTEDGEMAP
@@ -0,0 +1,67 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshExporter.h defines the Mesh Exporter Class.
This is an abstract base class for exporting different Mesh Formats.
--*/
#ifndef __NMR_MESHEXPORTER
#define __NMR_MESHEXPORTER
#include "Common/NMR_Types.h"
#include "Common/Math/NMR_Geometry.h"
#include "Common/Mesh/NMR_Mesh.h"
#include "Common/MeshExport/NMR_MeshExportEdgeMap.h"
#include "Common/Platform/NMR_ExportStream.h"
#include <vector>
namespace NMR {
class CMeshExporter {
private:
PExportStream m_stream;
public:
CMeshExporter();
CMeshExporter(_In_ PExportStream pStream);
virtual ~CMeshExporter() = default;
void setStream(_In_ PExportStream pStream);
CExportStream * getStream();
virtual void exportMeshEx(_In_ CMesh * pMesh, _In_opt_ NMATRIX3 * pmMatrix, _In_opt_ CMeshExportEdgeMap * pExportEdgeMap) = 0;
void exportMesh(_In_ CMesh * pMesh, _In_opt_ NMATRIX3 * pmMatrix);
};
typedef std::shared_ptr <CMeshExporter> PMeshExporter;
}
#endif // __NMR_MESHEXPORTER
@@ -0,0 +1,58 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshExporter_STL.h defines the Mesh Exporter Class.
This is a derived class for Exporting the binary STL and color STL Mesh Format.
--*/
#ifndef __NMR_MESHEXPORTER_STL
#define __NMR_MESHEXPORTER_STL
#include "Common/NMR_Types.h"
#include "Common/Math/NMR_Geometry.h"
#include "Common/Mesh/NMR_Mesh.h"
#include "Common/MeshExport/NMR_MeshExporter.h"
#include <vector>
namespace NMR {
class CMeshExporter_STL : public CMeshExporter {
private:
public:
CMeshExporter_STL();
CMeshExporter_STL(PExportStream pStream);
virtual void exportMeshEx(_In_ CMesh * pMesh, _In_opt_ NMATRIX3 * pmMatrix, _In_opt_ CMeshExportEdgeMap * pExportEdgeMap);
};
}
#endif // __NMR_MESHEXPORTER_STL
@@ -0,0 +1,64 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshImporter.h defines the Mesh Importer Class.
This is an abstract base class for Importing different Mesh Formats.
--*/
#ifndef __NMR_MESHIMPORTER
#define __NMR_MESHIMPORTER
#include "Common/NMR_Types.h"
#include "Common/Math/NMR_Geometry.h"
#include "Common/Mesh/NMR_Mesh.h"
#include "Common/Platform/NMR_ImportStream.h"
#include <vector>
namespace NMR {
class CMeshImporter {
private:
PImportStream m_pStream;
public:
CMeshImporter();
CMeshImporter(_In_ PImportStream pStream);
virtual ~CMeshImporter() = default;
void setStream(_In_ PImportStream pStream);
CImportStream * getStream();
virtual void loadMesh(_In_ CMesh * pMesh, _In_opt_ NMATRIX3 * pMatrix) = 0;
};
typedef std::shared_ptr <CMeshImporter> PMeshImporter;
}
#endif // __NMR_MESHIMPORTER
@@ -0,0 +1,88 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshImporter_STL.h defines the Mesh Importer Class.
This is a derived class for Importing the binary STL and color STL Mesh Format.
--*/
#ifndef __NMR_MESHIMPORTER_STL
#define __NMR_MESHIMPORTER_STL
#include "Common/NMR_Types.h"
#include "Common/Math/NMR_Geometry.h"
#include "Common/Mesh/NMR_Mesh.h"
#include "Common/MeshImport/NMR_MeshImporter.h"
#include "Common/NMR_Architecture_Utils.h"
#include <vector>
namespace NMR {
#pragma pack (1)
typedef struct MESHFORMAT_STL_FACET {
NVEC3 m_normal;
NVEC3 m_vertices[3];
nfUint16 m_attribute;
void swapByteOrder() {
m_attribute = swapBytes(m_attribute);
for (nfUint32 i = 0; i < 3; i++) {
m_normal.m_fields[i] = swapBytes(m_normal.m_fields[i]);
for (nfUint32 j = 0; j < 3; j++) {
m_vertices[i].m_fields[j] = swapBytes(m_vertices[i].m_fields[j]);
}
}
}
} MESHFORMAT_STL_FACET;
#pragma pack()
class CMeshImporter_STL : public CMeshImporter {
private:
nfFloat m_fUnits;
nfBool m_bIgnoreInvalidFaces;
nfBool m_bImportColors;
public:
CMeshImporter_STL();
CMeshImporter_STL(_In_ PImportStream pStream);
CMeshImporter_STL(_In_ PImportStream pStream, _In_ nfFloat fUnits);
CMeshImporter_STL(_In_ PImportStream pStream, _In_ nfFloat fUnits, _In_ nfBool bImportColors);
void setUnits(_In_ nfFloat fUnits);
nfFloat getUnits();
void setIgnoreInvalidFaces(_In_ nfBool bIgnoreInvalidFaces);
nfBool getIgnoreInvalidFaces();
void setImportColors(_In_ nfBool bImportColors);
nfBool getImportColors();
virtual void loadMesh(_In_ CMesh * pMesh, _In_opt_ NMATRIX3 * pmMatrix);
};
}
#endif // __NMR_MESHIMPORTER_STL
@@ -0,0 +1,83 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshInformation.h defines the Mesh Information Class.
This is a base class for handling all the mesh-related linear information (like face colors,
textures, etc...). It provides abstract functions to interpolate and reconstruct informations while
the mesh topology is changing.
--*/
#ifndef __NMR_MESHINFORMATION
#define __NMR_MESHINFORMATION
#include "Common/MeshInformation/NMR_MeshInformationContainer.h"
#include "Common/MeshInformation/NMR_MeshInformationTypes.h"
#include "Common/Math/NMR_Vector.h"
namespace NMR {
class CMeshInformation;
typedef std::shared_ptr <CMeshInformation> PMeshInformation;
class CMeshInformation {
protected:
PMeshInformationContainer m_pContainer;
nfUint64 m_nInternalID;
public:
CMeshInformation();
virtual ~CMeshInformation() = default;
_Ret_notnull_ MESHINFORMATIONFACEDATA * getFaceData(nfUint32 nFaceIndex);
_Ret_notnull_ MESHINFORMATIONFACEDATA * addFaceData(_In_ nfUint32 nNewFaceCount);
void resetFaceInformation(_In_ nfUint32 nFaceIndex);
void resetAllFaceInformation();
virtual void invalidateFace(_In_ MESHINFORMATIONFACEDATA * pData) = 0;
virtual eMeshInformationType getType() = 0;
virtual void cloneDefaultInfosFrom(_In_ CMeshInformation * pOtherInformation) = 0;
virtual void cloneFaceInfosFrom(_In_ nfUint32 nFaceIndex, _In_ CMeshInformation * pOtherInformation, _In_ nfUint32 nOtherFaceIndex) = 0;
virtual PMeshInformation cloneInstance(_In_ nfUint32 nCurrentFaceCount) = 0;
virtual void permuteNodeInformation(_In_ nfUint32 nFaceIndex, _In_ nfUint32 nNodeIndex1, _In_ nfUint32 nNodeIndex2, _In_ nfUint32 nNodeIndex3) = 0;
virtual void mergeInformationFrom (_In_ CMeshInformation * pInformation) = 0;
virtual nfUint32 getBackupSize() = 0;
virtual nfBool faceHasData(_In_ nfUint32 nFaceIndex) = 0;
virtual void setInternalID(nfUint64 nInternalID);
virtual nfUint64 getInternalID();
virtual void setDefaultData(MESHINFORMATIONFACEDATA* pData) = 0;
virtual MESHINFORMATIONFACEDATA* getDefaultData() = 0;
};
}
#endif // __NMR_MESHINFORMATION
@@ -0,0 +1,69 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshInformationContainer.h defines the Mesh Information Container Class.
This class provides a memory container for holding the texture information state of a complete mesh structure.
--*/
#ifndef __NMR_MESHINFORMATIONCONTAINER
#define __NMR_MESHINFORMATIONCONTAINER
#include "Common/MeshInformation/NMR_MeshInformationTypes.h"
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include <vector>
#include <memory>
#define MESHINFORMATIONCOUNTER_BUFFERSIZE 256
namespace NMR {
class CMeshInformationContainer {
private:
nfUint32 m_nFaceCount;
nfUint32 m_nRecordSize;
std::vector<MESHINFORMATIONFACEDATA *> m_DataBlocks;
MESHINFORMATIONFACEDATA * m_CurrentDataBlock;
public:
CMeshInformationContainer();
CMeshInformationContainer(nfUint32 nCurrentFaceCount, nfUint32 nRecordSize);
~CMeshInformationContainer();
_Ret_notnull_ MESHINFORMATIONFACEDATA * addFaceData(nfUint32 nNewFaceCount);
_Ret_notnull_ MESHINFORMATIONFACEDATA * getFaceData(nfUint32 nIdx);
nfUint32 getCurrentFaceCount();
void clear();
};
typedef std::shared_ptr <CMeshInformationContainer> PMeshInformationContainer;
}
#endif // __NMR_MESHINFORMATIONCONTAINER
@@ -0,0 +1,50 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshInformationFactory.h defines the Mesh Information Factory Class.
It allows a dynamic creation of different Classes of Information.
--*/
#ifndef __NMR_MESHINFORMATIONFACTORY
#define __NMR_MESHINFORMATIONFACTORY
#include "Common/MeshInformation/NMR_MeshInformation_Properties.h"
namespace NMR {
class CMeshInformationFactory {
private:
public:
CMeshInformationFactory();
PMeshInformation createMeshInformation(eMeshInformationType eType, nfUint32 nCurrentFaceCount);
};
}
#endif // __NMR_MESHINFORMATIONFACTORY
@@ -0,0 +1,75 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshInformationHandler.h defines the Mesh Information Handler Class.
It allows to include different kinds of information in one mesh (like Textures AND colors).
--*/
#ifndef __NMR_MESHINFORMATIONHANDLER
#define __NMR_MESHINFORMATIONHANDLER
#include "Common/MeshInformation/NMR_MeshInformation.h"
#include <vector>
#include <array>
namespace NMR {
class CMeshInformationHandler {
protected:
std::vector<PMeshInformation> m_pInformations;
std::array<CMeshInformation *, emiLastType> m_pLookup;
nfUint64 m_nInternalIDCounter;
public:
CMeshInformationHandler();
void addInformation(_In_ PMeshInformation pInformation);
void addFace(_In_ nfUint32 nNewFaceCount);
CMeshInformation * getInformationIndexed(_In_ nfUint32 nIdx);
PMeshInformation getPInformationIndexed(_In_ nfUint32 nIdx);
CMeshInformation * getInformationByType(_In_ nfUint32 nChannel, _In_ eMeshInformationType eType);
nfUint32 getInformationCount();
void addInfoTableFrom(_In_ CMeshInformationHandler * pOtherInfoHandler, _In_ nfUint32 nCurrentFaceCount);
void cloneDefaultInfosFrom(_In_ CMeshInformationHandler * pOtherInfoHandler);
void cloneFaceInfosFrom(_In_ nfUint32 nFaceIdx, _In_ CMeshInformationHandler * pOtherInfoHandler, _In_ nfUint32 nOtherFaceIndex);
void permuteNodeInformation(_In_ nfUint32 nFaceIdx, _In_ nfUint32 nNodeIndex1, _In_ nfUint32 nNodeIndex2, _In_ nfUint32 nNodeIndex3);
void resetFaceInformation(_In_ nfUint32 nFaceIdx);
void removeInformation(_In_ eMeshInformationType eType);
void removeInformationIndexed(_In_ nfUint32 nIndex);
};
typedef std::shared_ptr <CMeshInformationHandler> PMeshInformationHandler;
}
#endif // __NMR_MESHINFORMATIONHANDLER
@@ -0,0 +1,63 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshInformationTypes.h defines the basic structs and constants
to contain mesh surface information.
--*/
#ifndef __NMR_MESHINFORMATIONTYPES
#define __NMR_MESHINFORMATIONTYPES
#include "Common/NMR_Types.h"
#include "Common/Math/NMR_Vector.h"
namespace NMR {
#define MESHINFORMATION_MAXINTERNALID 9223372036854775808ULL
typedef enum _eMeshInformationType {
emiAbstract = 0x0000,
emiProperties = 0x0001,
emiLastType
} eMeshInformationType;
typedef nfByte MESHINFORMATIONFACEDATA;
#pragma pack (1)
typedef struct {
nfUint32 m_nUniqueResourceID;
nfUint32 m_nPropertyIDs[3];
} MESHINFORMATION_PROPERTIES;
#pragma pack()
}
#endif // __NMR_MESHINFORMATIONTYPES
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_MeshInformation_Properties.h defines the Property Information Class.
--*/
#ifndef __NMR_MESHINFORMATION_PROPERTIES
#define __NMR_MESHINFORMATION_PROPERTIES
#include "Common/MeshInformation/NMR_MeshInformation.h"
#include "Model/Classes/NMR_ModelTypes.h"
#include <list>
#include <map>
namespace NMR {
class CMeshInformation_PropertyIndexMapping {
private:
std::map<std::pair<UniqueResourceID, ModelPropertyID>, nfUint32> m_IDMap;
public:
CMeshInformation_PropertyIndexMapping();
nfUint32 mapPropertyIDToIndex(UniqueResourceID nUniqueResourceID, ModelPropertyID nPropertyID);
UniqueResourceID getDefaultResourceID();
nfUint32 getDefaultResourceIndex();
nfUint32 registerPropertyID(UniqueResourceID nUniqueResourceID, ModelPropertyID nPropertyID, nfUint32 nResourceIndex);
};
typedef std::shared_ptr <CMeshInformation_PropertyIndexMapping> PMeshInformation_PropertyIndexMapping;
class CMeshInformation_Properties : public CMeshInformation {
private:
std::shared_ptr<MESHINFORMATION_PROPERTIES> m_pDefaultProperty;
protected:
public:
CMeshInformation_Properties();
CMeshInformation_Properties(nfUint32 nCurrentFaceCount);
void invalidateFace(_In_ MESHINFORMATIONFACEDATA * pData) override;
eMeshInformationType getType() override;
void cloneDefaultInfosFrom(_In_ CMeshInformation * pOtherInformation) override;
void cloneFaceInfosFrom(_In_ nfUint32 nFaceIndex, _In_ CMeshInformation * pOtherInformation, _In_ nfUint32 nOtherFaceIndex) override;
PMeshInformation cloneInstance(_In_ nfUint32 nCurrentFaceCount) override;
void permuteNodeInformation(_In_ nfUint32 nFaceIndex, _In_ nfUint32 nNodeIndex1, _In_ nfUint32 nNodeIndex2, _In_ nfUint32 nNodeIndex3) override;
nfUint32 getBackupSize() override;
void mergeInformationFrom(_In_ CMeshInformation * pInformation) override;
nfBool faceHasData(_In_ nfUint32 nFaceIndex) override;
void setDefaultData(MESHINFORMATIONFACEDATA* pData) override;
MESHINFORMATIONFACEDATA* getDefaultData() override;
};
typedef std::shared_ptr <CMeshInformation_Properties> PMeshInformation_Properties;
}
#endif // __NMR_MESHINFORMATION_PROPERTIES
+66
View File
@@ -0,0 +1,66 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Architecture_Utils.h defines helper functions for working on big-endian architecture
--*/
#ifndef __NMR_ARCHITECTURE_UTILS
#define __NMR_ARCHITECTURE_UTILS
#include "NMR_Types.h"
namespace NMR {
template<int N>
void swapBytesArray(unsigned char(&bytes)[N]) {
// Optimize this with a platform-specific API as desired.
for (unsigned char *p = bytes, *end = bytes + N - 1; p < end; ++p, --end) {
unsigned char tmp = *p;
*p = *end;
*end = tmp;
}
}
template<typename T>
T swapBytes(T value) {
swapBytesArray(*reinterpret_cast<unsigned char(*)[sizeof(value)]>(&value));
return value;
}
inline bool isBigEndian(void)
{
union {
nfUint32 i;
char c[4];
} bint = { 0x01020304 };
return bint.c[0] == 1;
}
}
#endif // __NMR_ARCHITECTURE_UTILS
+50
View File
@@ -0,0 +1,50 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Assertion.h defines portable Assertion commands for the
Native Model Repair algorithms and modules.
--*/
#ifndef __NMR_ASSERTION
#define __NMR_ASSERTION
#ifdef NMR_USEASSERTIONS
#ifdef NMR_UNITTESTS
#include "CppUnitTest.h"
#define __NMRASSERT(value) Microsoft::VisualStudio::CppUnitTestFramework::Assert::IsTrue (((uintptr_t) (value)) != 0);
#else
#include <cassert>
#define __NMRASSERT(value) assert(value);
#endif
#else
#define __NMRASSERT(value)
#endif
#endif // __NMR_ASSERTION
File diff suppressed because it is too large Load Diff
+56
View File
@@ -0,0 +1,56 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Exception.h defines the generic Exception Class.
Each exception is identified via a global ErrorCode
(to be looked up in NMR_ErrorConst.h)
--*/
#ifndef __NMR_EXCEPTION
#define __NMR_EXCEPTION
#include "Common/NMR_ErrorConst.h"
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include <exception>
namespace NMR {
class CNMRException : public std::exception {
private:
nfError m_errorcode;
public:
CNMRException(_In_ nfError errorcode);
virtual const char * what() const throw ();
nfError getErrorCode() const;
};
}
#endif // __NMR_EXCEPTION
+59
View File
@@ -0,0 +1,59 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Exception_Windows.h defines the Windows Exception Class.
Each exception is identified via a global ErrorCode, and saves a Win32 HRESULT Error Code
for further information
(ErrorCodes to be looked up in NMR_ErrorConst.h)
--*/
#ifndef __NMR_EXCEPTION_WINDOWS
#define __NMR_EXCEPTION_WINDOWS
#include "Common/NMR_Exception.h"
#ifndef __GNUC__
#include <Windows.h>
#else
#include "Common/Platform/NMR_WinTypes.h"
#endif
namespace NMR {
class CNMRException_Windows : public CNMRException {
private:
HRESULT m_hResult;
public:
CNMRException_Windows(_In_ nfError errorcode, _In_ HRESULT hResult);
HRESULT getHResult();
};
}
#endif // __NMR_EXCEPTION_WINDOWS
+54
View File
@@ -0,0 +1,54 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Local.h includes compiler specific settings and includes.
It should be used in every header file of the project.
--*/
#ifndef __NMR_LOCAL
#define __NMR_LOCAL
#include <memory>
#include "NMR_Assertion.h"
#include "Common/Platform/NMR_SAL.h"
#define __NMR_INLINE __inline
#ifndef __GNUC__
#pragma warning (3:4706)
#endif
#ifndef __GNUC__
#define LIB3MF_CDECL __cdecl
#else
#define LIB3MF_CDECL
#endif
#endif // __NMR_LOCAL
+92
View File
@@ -0,0 +1,92 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ModelReaderWarnings.h defines the Model Reader Warnings Class.
This class collects all import warnings with certain severity levels - in order to allow
a relaxed import policy on the file format.
--*/
#ifndef __NMR_MODELREADERWARNINGS
#define __NMR_MODELREADERWARNINGS
#include "Common/NMR_Types.h"
#include "Common/NMR_Exception.h"
#include <memory>
#include <string>
#include <vector>
#define NMR_MAXWARNINGCOUNT 1000000000
namespace NMR {
typedef enum _eModelWarningLevel {
mrwFatal,
mrwInvalidMandatoryValue,
mrwMissingMandatoryValue,
mrwInvalidOptionalValue
} eModelWarningLevel;
class CModelWarning {
private:
std::string m_sMessage;
eModelWarningLevel m_WarningLevel;
nfError m_nErrorCode;
public:
CModelWarning() = delete;
CModelWarning(std::string sMessage, eModelWarningLevel WarningLevel, nfError nErrorCode);
std::string getMessage();
eModelWarningLevel getWarningLevel();
nfError getErrorCode();
};
typedef std::shared_ptr <CModelWarning> PModelReaderWarning;
class CModelWarnings {
private:
std::vector<PModelReaderWarning> m_Warnings;
eModelWarningLevel m_CriticalWarningLevel;
public:
CModelWarnings();
eModelWarningLevel getCriticalWarningLevel ();
void setCriticalWarningLevel(_In_ eModelWarningLevel WarningLevel);
void addWarning(_In_ nfError nErrorCode, _In_ eModelWarningLevel WarningLevel);
void addException(const _In_ CNMRException & Exception, _In_ eModelWarningLevel WarningLevel);
nfUint32 getWarningCount();
PModelReaderWarning getWarning(_In_ nfUint32 nIndex);
};
typedef std::shared_ptr <CModelWarnings> PModelWarnings;
}
#endif // __NMR_MODELREADERWARNINGS
+148
View File
@@ -0,0 +1,148 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_PagedVector.h defines a vector class which allocates its memory block-wise, leading to
significant performance improvements against a standard template library vector.
--*/
#ifndef __NMR_PAGEDVECTOR
#define __NMR_PAGEDVECTOR
#include "Common/NMR_Local.h"
#include "Common/NMR_Types.h"
#include "Common/NMR_Exception.h"
#include <vector>
#include <array>
namespace NMR {
template <class T, unsigned int DEFAULTBLOCKSIZE = 1024>
class CPagedVector {
nfUint32 m_nBlockSize;
nfUint32 m_nCount;
T * m_pHeadBlock;
std::vector<T *> m_pBlocks;
public:
CPagedVector() {
m_nCount = 0;
m_pHeadBlock = NULL;
m_nBlockSize = DEFAULTBLOCKSIZE;
if (m_nBlockSize == 0)
throw CNMRException(NMR_ERROR_INVALIDBLOCKSIZE);
}
CPagedVector(_In_ nfUint32 nBlockSize) {
m_nCount = 0;
m_pHeadBlock = NULL;
m_nBlockSize = nBlockSize;
if (m_nBlockSize == 0)
throw CNMRException(NMR_ERROR_INVALIDBLOCKSIZE);
}
~CPagedVector() {
clearAllData();
}
nfUint32 getCount() {
return m_nCount;
}
_Ret_notnull_ T * allocData() {
nfUint32 nIdx = (m_nCount % m_nBlockSize);
// Allocate new node block if necessary
if (nIdx == 0) {
m_pHeadBlock = new T[m_nBlockSize];
m_pBlocks.push_back(m_pHeadBlock);
}
T * pResult = &m_pHeadBlock[nIdx];
m_nCount++;
return pResult;
}
_Ret_notnull_ T * allocData(_Out_ nfUint32 & nNewIndex) {
nNewIndex = m_nCount;
return allocData();
}
T& allocDataRef(_Out_ nfUint32& nNewIndex) {
nfUint32 nIdx = (m_nCount % m_nBlockSize);
// Allocate new node block if necessary
if (nIdx == 0) {
m_pHeadBlock = new T[m_nBlockSize];
m_pBlocks.push_back(m_pHeadBlock);
}
nNewIndex = m_nCount;
m_nCount++;
return m_pHeadBlock[nIdx];
}
_Ret_notnull_ T * getData(_In_ nfUint32 nIdx) {
if (nIdx >= m_nCount)
throw CNMRException(NMR_ERROR_INVALIDINDEX);
T * block = m_pBlocks[nIdx / m_nBlockSize];
return &block[nIdx % m_nBlockSize];
}
T& getDataRef(_In_ nfUint32 nIdx) {
if (nIdx >= m_nCount)
throw CNMRException(NMR_ERROR_INVALIDINDEX);
T* block = m_pBlocks[nIdx / m_nBlockSize];
return block[nIdx % m_nBlockSize];
}
void clearAllData() {
for (auto iIterator = m_pBlocks.begin(); iIterator != m_pBlocks.end(); iIterator++)
{
T * pBlock = *iIterator;
delete[] pBlock;
}
m_pBlocks.clear();
m_nCount = 0;
m_pHeadBlock = NULL;
}
nfUint32 getBlockSize() {
return m_nBlockSize;
}
};
}
#endif // __NMR_PAGEDVECTOR
+118
View File
@@ -0,0 +1,118 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--*/
#ifndef NMR_SECURECONTENTTYPES
#define NMR_SECURECONTENTTYPES
#define KEYSTORE_TYPES_MODULUSBUFFERSIZE 257
#define KEYSTORE_TYPES_EXPONENTBUFFERSIZE 5
#define KEYSTORE_TYPES_IVSIZE 12
#define KEYSTORE_TYPES_TAGSIZE 16
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include <vector>
#include <functional>
namespace NMR {
enum eKeyStoreWrapAlgorithm {
RSA_OAEP = 0, // http://www.w3.org/2009/xmlenc11#rsa-oaep, http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p
};
enum eKeyStoreMaskGenerationFunction {
MGF1_SHA1 = 160, // http://www.w3.org/2009/xmlenc11#mgf1sha1
MGF1_SHA224 = 224, // http://www.w3.org/2009/xmlenc11#mgf1sha224
MGF1_SHA256 = 256, // http://www.w3.org/2009/xmlenc11#mgf1sha256
MGF1_SHA384 = 384, // http://www.w3.org/2009/xmlenc11#mgf1sha384
MGF1_SHA512 = 512 // http://www.w3.org/2009/xmlenc11#mgf1sha512
};
enum eKeyStoreMessageDigest {
SHA1 = 160, // http://www.w3.org/2000/09/xmldsig#sha1
SHA256 = 256, // http://www.w3.org/2001/04/xmlenc#sha256
SHA384 = 384, // http://www.w3.org/2001/04/xmlenc#sha384
SHA512 = 512, // http://www.w3.org/2001/04/xmlenc#sha512
};
enum eKeyStoreEncryptAlgorithm {
AES256_GCM = 1 // http://www.w3.org/2009/xmlenc11#aes256-gcm
};
class CKeyStoreContentEncryptionParams;
using PKeyStoreContentEncryptionParams = std::shared_ptr<CKeyStoreContentEncryptionParams>;
struct ContentEncryptionContext {
void * m_pUserData;
PKeyStoreContentEncryptionParams m_sParams;
};
using ContentEncryptionCbType = std::function<nfUint64(nfUint64, nfByte const *, nfByte *, ContentEncryptionContext &)>;
struct ContentEncryptionDescriptor {
ContentEncryptionCbType m_fnCrypt;
ContentEncryptionContext m_sDekDecryptData;
};
class CKeyStoreAccessRight;
using PKeyStoreAccessRight = std::shared_ptr<CKeyStoreAccessRight>;
struct KeyWrappingContext {
void * m_pUserData;
PKeyStoreAccessRight m_pAccessRight;
};
using KeyWrappingCbType = std::function<nfUint64(std::vector<nfByte> const &, std::vector<nfByte> &, KeyWrappingContext &)>;
struct KeyWrappingDescriptor {
KeyWrappingCbType m_fnWrap;
KeyWrappingContext m_sKekDecryptData;
};
using CryptoRandCbType = std::function<nfUint64(nfByte *, nfUint64, void *)>;
struct CryptoRandGenDescriptor {
CryptoRandCbType m_fnRNG;
void * m_pUserData;
};
inline nfUint64 fnGetAlgorithmInitVectorSize(eKeyStoreEncryptAlgorithm ea) {
return 12;
}
inline nfUint64 fnGetAlgorithmKeySize(eKeyStoreEncryptAlgorithm ea) {
return 32;
}
inline nfUint64 fnGetAlgorithmAuthTagSize(eKeyStoreEncryptAlgorithm ea) {
return 16;
}
}
#endif // !NMR_SECURECONTENTTYPES
+34
View File
@@ -0,0 +1,34 @@
#ifndef NMR_SECURECONTEXT
#define NMR_SECURECONTEXT
#include <map>
#include <string>
#include "Common/NMR_SecureContentTypes.h"
namespace NMR {
using ClientConsumerMap = std::map<std::string, KeyWrappingDescriptor>;
class CSecureContext {
private:
ClientConsumerMap m_ConsumerMap;
ContentEncryptionDescriptor m_sDekDescriptor;
bool m_bHasDek = false;
public:
bool hasDekCtx() const;
ContentEncryptionDescriptor getDekCtx() const;
void setDekCtx(ContentEncryptionDescriptor const & descriptor);
ClientConsumerMap::const_iterator kekCtxBegin() const;
ClientConsumerMap::const_iterator kekCtxEnd() const;
void addKekCtx(std::string const & consumerId, KeyWrappingDescriptor const & descriptor);
KeyWrappingDescriptor getKekCtx(std::string const & consumerId) const;
bool emptyKekCtx() const;
};
}
#endif // !NMR_SECURECONTEXT
+150
View File
@@ -0,0 +1,150 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_StringUtils.h defines a few string helper functions that handle strings correctly
and Exception-safe
--*/
#ifndef __NMR_STRINGUTILS
#define __NMR_STRINGUTILS
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include <string>
#include <string.h>
#include <vector>
#define NMR_MAXSTRINGBUFFERSIZE 1073741823 // (2^30-1)
namespace NMR {
template <typename T>
T fnStringToType(_In_z_ const nfChar * pszValue);
template<> float fnStringToType(_In_z_ const nfChar * pszValue);
template<> double fnStringToType(_In_z_ const nfChar * pszValue);
template<> nfInt32 fnStringToType(_In_z_ const nfChar * pszValue);
template<> nfUint32 fnStringToType(_In_z_ const nfChar * pszValue);
template<> unsigned long fnStringToType(_In_z_ const nfChar * pszValue);
template<> std::string fnStringToType(_In_z_ const nfChar * pszValue);
nfInt32 fnStringToInt32(_In_z_ const nfChar * pszValue);
nfUint32 fnStringToUint32(_In_z_ const nfChar * pszValue);
nfFloat fnStringToFloat(_In_z_ const nfChar * pszValue);
nfDouble fnStringToDouble(_In_z_ const nfChar * pszValue);
nfBool fnStringToSRGBColor(_In_z_ const nfChar * pszValue, _Out_ nfColor & cResult);
nfUint32 fnHexStringToUint32(_In_z_ const nfChar * pszValue);
std::string fnInt32ToString(_In_ nfInt32 nValue);
std::string fnUint32ToString(_In_ nfUint32 nValue);
std::string fnFloatToString(_In_ nfFloat fValue, _In_ nfUint32 precision);
std::string fnDoubleToString(_In_ nfFloat dValue, _In_ nfUint32 precision);
std::string fnColorToString(_In_ nfColor cColor);
void fnStringToCommaSeparatedIntegerTriplet(_In_z_ const nfChar * pszValue, _Out_ nfInt32 & nValue1, _Out_ nfInt32 & nValue2, _Out_ nfInt32 & nValue3);
template<typename T>
std::string fnVectorToSpaceDelimitedString(_In_ const std::vector<T> v) {
std::string result = "";
for (auto i = v.begin(); i != v.end(); i++) {
if (i != v.begin())
result += " ";
result += std::to_string(*i);
}
return result;
};
template<> std::string fnVectorToSpaceDelimitedString(_In_ const std::vector<std::string> v);
void fnStringToBufferSafe(_In_ const std::string sString, _Out_opt_ nfChar * pszBuffer, nfUint32 cbBufferSize, _Out_opt_ nfUint32 * pcbNeededChars);
void fnWStringToBufferSafe(_In_ const std::wstring sString, _Out_opt_ nfWChar * pwszBuffer, nfUint32 cbBufferSize, _Out_opt_ nfUint32 * pcbNeededChars);
// UTF8 Functions
nfBool fnUTF16CharIsSurrogate(_In_ nfWChar cChar);
nfBool fnUTF16CharIsHighSurrogate(_In_ nfWChar cChar);
nfBool fnUTF16CharIsLowSurrogate(_In_ nfWChar cChar);
nfUint32 fnUTF16toCharacterID(_In_ nfUint16 nHighSurrogate, _In_ nfUint16 nLowSurrogate);
void fnCharacterIDToUTF16(_In_ nfUint32 nCharacterID, _Out_ nfUint16 & nHighSurrogate, _Out_ nfUint16 & nLowSurrogate);
std::string fnUTF16toUTF8(_In_ const std::wstring sString);
std::wstring fnUTF8toUTF16(_In_ const std::string sString);
// Returns number of converted WChars
// If the input data did contain not enough chars for the last multi-byte characters, pcbNeededCharacters is not equal 0.
// pszLastChar returns the last converted Multibyte character.
nfUint32 fnBufferedUTF8toUTF16(_In_ const nfChar * pszInBuffer, _Out_ nfWChar * pszwOutBuffer, _In_ nfUint32 cbBufferSize, _Out_ nfUint32 * pnLastChar, _Out_ nfUint32 * pcbNeededCharacters);
// Path and File name functions
nfBool fnStartsWithPathDelimiter(_In_ const std::string sPath);
std::string fnRemoveLeadingPathDelimiter(_In_ const std::string sPath);
std::string fnIncludeLeadingPathDelimiter(_In_ const std::string sPath);
std::string fnExtractFileName(_In_ const std::string sFullPath);
std::string fnExtractFileDir(_In_ const std::string sFullPath);
template<typename T>
std::vector<T> fnVctType_fromString(_In_ const std::string sInString)
{
std::string sString = sInString;
std::vector<T> vctValues;
nfChar * pszString = &(sString[0]);
nfChar * pCurrent = pszString;
nfBool bFinished = false;
while (!bFinished) {
// Find next space
const nfChar * pBegin = pCurrent;
while ((*pCurrent != ' ') && (*pCurrent))
pCurrent++;
if (*pCurrent == ' ') {
*pCurrent = 0;
}
else {
bFinished = true;
}
// If we have not found a space, convert value to T
if (pBegin != pCurrent) {
vctValues.push_back(fnStringToType<T>(pBegin));
}
// If we are finished, break, otherwise skip space!
if (!bFinished) {
pCurrent++;
}
}
return vctValues;
}
void decomposeKeyIntoNamespaceAndName(const std::string &sKey, std::string &sNameSpace, std::string &sName);
std::string composeNamespaceAndNameIntoKey(const std::string &sNameSpace, const std::string &sName);
}
#endif // __NMR_STRINGUTILS
+55
View File
@@ -0,0 +1,55 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_Types.h defines portable aliases for all standard data types.
--*/
#ifndef __NMR_TYPES
#define __NMR_TYPES
namespace NMR {
typedef char nfChar;
typedef wchar_t nfWChar;
typedef unsigned char nfByte;
typedef unsigned short nfUint16;
typedef signed short nfInt16;
typedef int nfInt32;
typedef int nfError;
typedef bool nfBool;
typedef float nfFloat;
typedef double nfDouble;
typedef unsigned int nfUint32;
typedef unsigned int nfColor;
typedef long long nfInt64;
typedef unsigned long long nfUint64;
typedef nfUint64 nfTimeStamp;
}
#endif // __NMR_TYPES
+72
View File
@@ -0,0 +1,72 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_UUID.h defines a datatype and functions to handle UUIDs
--*/
#ifndef __NMR_UUID
#define __NMR_UUID
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include <string>
#ifndef _WIN32
#include <random>
#include <mutex>
#endif
namespace NMR
{
class CUUID {
private:
#ifndef _WIN32
static bool S_mtwister_initialised;
static std::mutex S_uuid_gen_mutex;
static std::random_device S_rand_dev;
static std::mt19937 S_mtwister;
#endif
std::string m_sUUID;
public:
CUUID();
CUUID(const nfChar* pString);
CUUID(const std::string & string);
std::string toString() const;
bool set(const nfChar* pString);
CUUID& operator=(const CUUID& uuid);
bool operator==(const CUUID& uuid);
};
typedef std::shared_ptr<CUUID> PUUID;
}
#endif // __NMR_UUID
@@ -0,0 +1,24 @@
#ifndef NMR_IOPCPACKAGEREADER
#define NMR_IOPCPACKAGEREADER
#include <memory>
#include <string>
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
namespace NMR {
class COpcPackageRelationship;
class COpcPackagePart;
using POpcPackagePart = std::shared_ptr<COpcPackagePart>;
class IOpcPackageReader {
public:
virtual _Ret_maybenull_ COpcPackageRelationship * findRootRelation(_In_ std::string sRelationType, _In_ nfBool bMustBeUnique) = 0;
virtual POpcPackagePart createPart(_In_ std::string sPath) = 0;
virtual nfUint64 getPartSize(_In_ std::string sPath) = 0;
virtual void close() {}
};
using PIOpcPackageReader = std::shared_ptr<IOpcPackageReader>;
}
#endif // !NMR_IOPCPACKAGEREADER
@@ -0,0 +1,29 @@
#ifndef NMR_IOPCPACKAGEWRITER
#define NMR_IOPCPACKAGEWRITER
#include <memory>
#include <string>
#include <list>
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
namespace NMR {
class COpcPackageRelationship;
using POpcPackageRelationship = std::shared_ptr<COpcPackageRelationship>;
class COpcPackagePart;
using POpcPackagePart = std::shared_ptr<COpcPackagePart>;
class IOpcPackageWriter {
public:
virtual POpcPackagePart addPart(_In_ std::string sPath) = 0;
virtual void addContentType(_In_ std::string sExtension, _In_ std::string sContentType) = 0;
virtual void addContentType(_In_ POpcPackagePart pOpcPackagePart, _In_ std::string sContentType) = 0;
virtual POpcPackageRelationship addRootRelationship(_In_ std::string sType, _In_ COpcPackagePart * pTargetPart) = 0;
virtual POpcPackageRelationship addPartRelationship(_In_ POpcPackagePart pOpcPackagePart, _In_ std::string sType, _In_ COpcPackagePart * pTargetPart) = 0;
virtual std::list<POpcPackageRelationship> addWriterSpecificRelationships(_In_ POpcPackagePart pOpcPackagePart, _In_ COpcPackagePart* pTargetPart) = 0;
virtual void close() {}
};
using PIOpcPackageWriter = std::shared_ptr<IOpcPackageWriter>;
}
#endif // !NMR_IOPCPACKAGEWRITER
@@ -0,0 +1,87 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_OpcPackageContentTypeReader.h defines a reader for the OPC Package Content Types
--*/
#ifndef __NMR_OPCPACKAGECONTENTTYPESREADER
#define __NMR_OPCPACKAGECONTENTTYPESREADER
#include "Common/3MF_ProgressMonitor.h"
#include "Common/Platform/NMR_ImportStream.h"
#include "Common/Platform/NMR_XmlReader.h"
#include <string>
#include <vector>
#include <map>
namespace NMR {
struct COpcPackageContentType {
std::string m_extension;
std::string m_contentType;
COpcPackageContentType(std::string extension, std::string contentType) {
m_extension = extension;
m_contentType = contentType;
}
};
struct COpcPackageContentType_Override {
std::string m_partName;
std::string m_contentType;
COpcPackageContentType_Override(std::string partName, std::string contentType) {
m_partName = partName;
m_contentType = contentType;
}
};
typedef std::shared_ptr<COpcPackageContentType> POpcPackageContentType;
typedef std::shared_ptr<COpcPackageContentType_Override> POpcPackageContentType_Override;
class COpcPackageContentTypesReader {
private:
std::vector<POpcPackageContentType> m_ContentTypes;
std::vector<POpcPackageContentType_Override> m_Overrides;
void parseRootNode(_In_ CXmlReader * pXMLReader);
void parseChildNode(_In_ CXmlReader * pXMLReader, _In_ bool bOverride);
void parseAttributes(_In_ CXmlReader * pXMLReader);
public:
COpcPackageContentTypesReader(_In_ PImportStream pImportStream, PProgressMonitor pProgressMonitor);
~COpcPackageContentTypesReader();
nfUint32 getCount();
POpcPackageContentType getContentType(_In_ nfUint32 nIndex);
nfUint32 getOverrideCount();
POpcPackageContentType_Override getOverrideContentType(_In_ nfUint32 nIndex);
};
typedef std::shared_ptr<COpcPackageContentTypesReader> POpcPackageContentTypesReader;
}
#endif // __NMR_OPCPACKAGECONTENTTYPESREADER
+77
View File
@@ -0,0 +1,77 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_OpcPackagePart.h defines an OPC Package Part in a portable way.
--*/
#ifndef __NMR_OPCPACKAGEPART
#define __NMR_OPCPACKAGEPART
#include "Common/OPC/NMR_OpcPackageRelationship.h"
#include "Common/OPC/NMR_OpcPackageTypes.h"
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/Platform/NMR_ImportStream.h"
#include <string>
#include <map>
namespace NMR {
class COpcPackageRelationship;
typedef std::shared_ptr<COpcPackageRelationship> POpcPackageRelationship;
class COpcPackagePart {
protected:
std::string m_sURI;
PExportStream m_pExportStream;
PImportStream m_pImportStream;
std::multimap<std::string, POpcPackageRelationship> m_Relationships;
public:
COpcPackagePart(_In_ std::string sURI, _In_ PExportStream pExportStream);
COpcPackagePart(_In_ std::string sURI, _In_ PImportStream pImportStream);
COpcPackagePart(_In_ COpcPackagePart const & cp, _In_ PExportStream pExportStream);
COpcPackagePart(_In_ COpcPackagePart const & cp, _In_ PImportStream pImportStream);
std::string getURI ();
PExportStream getExportStream ();
PImportStream getImportStream();
POpcPackageRelationship addRelationship(_In_ std::string sID, _In_ std::string sType, _In_ std::string sURI);
nfBool hasRelationships();
std::multimap<std::string, POpcPackageRelationship>& getRelationShips();
void writeRelationships(_In_ PExportStream pExportStream);
};
typedef std::shared_ptr<COpcPackagePart> POpcPackagePart;
}
#endif // __NMR_OPCPACKAGEPART
+89
View File
@@ -0,0 +1,89 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_OpcPackageReader.h defines an OPC Package reader in a portable way.
--*/
#ifndef __NMR_OPCPACKAGEREADER
#define __NMR_OPCPACKAGEREADER
#include "Common/OPC/NMR_IOpcPackageReader.h"
#include "Common/Platform/NMR_ImportStream.h"
#include "Common/OPC/NMR_OpcPackagePart.h"
#include "Common/OPC/NMR_OpcPackageTypes.h"
#include "Common/OPC/NMR_OpcPackageRelationship.h"
#include "Common/3MF_ProgressMonitor.h"
#include "Common/NMR_ModelWarnings.h"
#include "Libraries/libzip/zip.h"
#include <list>
#include <vector>
#include <map>
#include <string>
namespace NMR {
class COpcPackageReader: public IOpcPackageReader {
protected:
PModelWarnings m_pWarnings;
PProgressMonitor m_pProgressMonitor;
// ZIP Handling Variables
std::vector<nfByte> m_Buffer;
zip_error_t m_ZIPError;
zip_t * m_ZIParchive;
std::map <std::string, nfUint64> m_ZIPEntries;
std::map <std::string, POpcPackagePart> m_Parts;
std::string m_relationShipExtension;
std::map<std::string, std::string> m_ContentTypes;
std::list<POpcPackageRelationship> m_RootRelationships;
void releaseZIP();
PImportStream openZIPEntry(_In_ std::string sName);
PImportStream openZIPEntryIndexed(_In_ nfUint64 nIndex);
void readContentTypes();
void readRootRelationships();
public:
COpcPackageReader(_In_ PImportStream pImportStream, _In_ PModelWarnings pWarnings, _In_ PProgressMonitor pProgressMonitor);
~COpcPackageReader();
_Ret_maybenull_ COpcPackageRelationship * findRootRelation(_In_ std::string sRelationType, _In_ nfBool bMustBeUnique) override;
POpcPackagePart createPart(_In_ std::string sPath) override;
nfUint64 getPartSize(_In_ std::string sPath) override;
};
typedef std::shared_ptr<COpcPackageReader> POpcPackageReader;
}
#endif // __NMR_OPCPACKAGEREADER
@@ -0,0 +1,67 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_OpcPackageRelationship.h defines an OPC Package Relationship Object.
--*/
#ifndef __NMR_OPCPACKAGERELATIONSHIP
#define __NMR_OPCPACKAGERELATIONSHIP
#include "Common/Platform/NMR_XmlWriter.h"
#include "Common/OPC/NMR_OpcPackagePart.h"
#include <string>
#include <list>
#include <map>
namespace NMR {
class COpcPackagePart;
typedef std::shared_ptr<COpcPackagePart> POpcPackagePart;
class COpcPackageRelationship {
private:
std::string m_sID;
std::string m_sType;
std::string m_sTargetPartURI;
public:
COpcPackageRelationship(_In_ std::string sID, _In_ std::string sType, _In_ std::string sTargetPartURI);
std::string getID ();
std::string getType ();
std::string getTargetPartURI();
void writeToXML(_In_ CXmlWriter * pXMLWriter);
};
typedef std::shared_ptr<COpcPackageRelationship> POpcPackageRelationship;
}
#endif // __NMR_OPCPACKAGERELATIONSHIP
@@ -0,0 +1,66 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_OpcPackageRelationship.h defines an OPC Package Relationship Object.
--*/
#ifndef __NMR_OPCPACKAGERELATIONSHIPREADER
#define __NMR_OPCPACKAGERELATIONSHIPREADER
#include "Common/3MF_ProgressMonitor.h"
#include "Common/Platform/NMR_ImportStream.h"
#include "Common/Platform/NMR_XmlReader.h"
#include "Common/OPC/NMR_OpcPackageRelationship.h"
#include <string>
#include <vector>
#include <map>
namespace NMR {
class COpcPackageRelationshipReader {
private:
std::map<std::string, POpcPackageRelationship> m_IDToRelationShips;
void parseRootNode(_In_ CXmlReader * pXMLReader);
void parseChildNode(_In_ CXmlReader * pXMLReader);
void parseAttributes(_In_ CXmlReader * pXMLReader);
public:
COpcPackageRelationshipReader(_In_ PImportStream pImportStream, _In_ PProgressMonitor);
~COpcPackageRelationshipReader();
nfUint32 getCount();
POpcPackageRelationship getRelationShip(_In_ nfUint32 nIndex);
};
typedef std::shared_ptr<COpcPackageRelationshipReader> POpcPackageRelationshipReader;
}
#endif // __NMR_OPCPACKAGERELATIONSHIPREADER
+56
View File
@@ -0,0 +1,56 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_OpcPackageTypes.h defines an OPC Package types.
--*/
#ifndef __NMR_OPCPACKAGETYPES
#define __NMR_OPCPACKAGETYPES
#define OPCPACKAGE_PATH_CONTENTTYPES "[Content_Types].xml"
#define OPCPACKAGE_PATH_ROOTRELATIONSHIPS "_rels/.rels"
#define OPCPACKAGE_SCHEMA_CONTENTTYPES "http://schemas.openxmlformats.org/package/2006/content-types"
#define OPCPACKAGE_SCHEMA_RELATIONSHIPS "http://schemas.openxmlformats.org/package/2006/relationships"
#define OPC_CONTENTTYPES_CONTAINER "Types"
#define OPC_CONTENTTYPES_NODE "Default"
#define OPC_CONTENTTYPES_NODE_OVERRIDE "Override"
#define OPC_CONTENTTYPES_ATTRIB_EXTENSION "Extension"
#define OPC_CONTENTTYPES_ATTRIB_CONTENTTYPE "ContentType"
#define OPC_CONTENTTYPES_ATTRIB_PARTNAME "PartName"
#define OPC_RELS_RELATIONSHIP_CONTAINER "Relationships"
#define OPC_RELS_RELATIONSHIP_NODE "Relationship"
#define OPC_RELS_ATTRIB_TARGET "Target"
#define OPC_RELS_ATTRIB_TYPE "Type"
#define OPC_RELS_ATTRIB_ID "Id"
#endif // __NMR_OPCPACKAGETYPES
+82
View File
@@ -0,0 +1,82 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_OpcPackageWriter.h defines an OPC Package writer in a portable way.
--*/
#ifndef __NMR_OPCPACKAGEWRITER
#define __NMR_OPCPACKAGEWRITER
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/Platform/NMR_ExportStream_ZIP.h"
#include "Common/Platform/NMR_PortableZIPWriter.h"
#include "Common/OPC/NMR_IOpcPackageWriter.h"
#include "Common/OPC/NMR_OpcPackagePart.h"
#include "Common/OPC/NMR_OpcPackageTypes.h"
#include "Common/OPC/NMR_OpcPackageRelationship.h"
#include <list>
#include <map>
namespace NMR {
class COpcPackageWriter: public IOpcPackageWriter {
protected:
PExportStream m_pExportStream;
std::list <POpcPackagePart> m_Parts;
PPortableZIPWriter m_pZIPWriter;
nfInt32 m_nRelationIDCounter;
// Extension -> ContentType
std::map<std::string, std::string> m_DefaultContentTypes;
// PartName -> ContentType
std::map<std::string, std::string> m_OverrideContentTypes;
std::list<POpcPackageRelationship> m_RootRelationships;
void finishPackage();
void writeContentTypes();
void writeRootRelationships();
std::string generateRelationShipID();
public:
COpcPackageWriter(_In_ PExportStream pExportStream);
~COpcPackageWriter();
POpcPackagePart addPart(_In_ std::string sPath) override;
void addContentType(_In_ std::string sExtension, _In_ std::string sContentType) override;
void addContentType(_In_ POpcPackagePart pOpcPackagePart, _In_ std::string sContentType) override;
POpcPackageRelationship addRootRelationship(_In_ std::string sType, _In_ COpcPackagePart * pTargetPart) override;
POpcPackageRelationship addPartRelationship(_In_ POpcPackagePart pOpcPackagePart, _In_ std::string sType, _In_ COpcPackagePart * pTargetPart) override;
std::list<POpcPackageRelationship> addWriterSpecificRelationships(_In_ POpcPackagePart pOpcPackagePart, _In_ COpcPackagePart* pTargetPart) override;
};
typedef std::shared_ptr<COpcPackageWriter> POpcPackageWriter;
}
#endif // __NMR_XMLWRITER
+38
View File
@@ -0,0 +1,38 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_CComPtr.h defines several COM Classes in a portable way.
--*/
#ifndef __NMR_CCOMPTR
#define __NMR_CCOMPTR
#include <atlbase.h>
#endif // __NMR_CCOMPTR
@@ -0,0 +1,44 @@
#ifndef NMR_ENCRYPTIONHEADER
#define NMR_ENCRYPTIONHEADER
#include <vector>
#include <memory>
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
namespace NMR {
class CImportStream;
using PImportStream = std::shared_ptr<CImportStream>;
class CExportStream;
using PExportStream = std::shared_ptr<CExportStream>;
union uEncryptedFileHeader {
nfByte bytes[12];
struct sHeaderStructure {
union uMagic {
nfByte bytes[5];
} Signature;
nfByte majorVersion;
nfByte minorVersion;
nfByte unused;
union uLength {
nfByte bytes[4];
nfUint32 length;
} Length;
} Header;
};
class CEncryptionHeader {
std::vector<nfByte> m_rgAdditionalData;
nfUint64 m_nfHeaderSize;
public:
CEncryptionHeader(std::vector<nfByte> const & additionalData = std::vector<nfByte>());
size_t readFrom(PImportStream from);
size_t writeTo(PExportStream to);
std::vector<nfByte> const & additionalData() const;
nfUint64 headerSize() const;
};
}
#endif // !NMR_ENCRYPTIONHEADER
@@ -0,0 +1,63 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ExportStream.h defines the ExportStream Class.
This is an abstract base stream class for exporting from various data sources.
--*/
#ifndef __NMR_EXPORTSTREAM
#define __NMR_EXPORTSTREAM
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include "Common/Platform/NMR_ImportStream.h"
#define NMR_EXPORTSTREAM_WRITEBUFFERSIZE (128 * 1024)
namespace NMR {
class CExportStream {
private:
public:
virtual ~CExportStream() = default;
virtual nfBool seekPosition(_In_ nfUint64 position, _In_ nfBool bHasToSucceed) = 0;
virtual nfBool seekForward(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed) = 0;
virtual nfBool seekFromEnd(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed) = 0;
virtual nfUint64 getPosition () = 0;
virtual nfUint64 writeBuffer(_In_ const void * pBuffer, _In_ nfUint64 cbTotalBytesToWrite) = 0;
virtual void close();
void copyFrom(_In_ CImportStream * pImportStream, _In_ nfUint64 cbCount, _In_ nfUint32 cbBufferSize);
};
typedef std::shared_ptr <CExportStream> PExportStream;
}
#endif // __NMR_EXPORTSTREAM
@@ -0,0 +1,73 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ExportStream_Callback.h defines the CExportStream_Callback Class.
This is an abstract base stream class for exporting with a callback to
custom data writer.
--*/
#ifndef __NMR_EXPORTSTREAM_CALLBACK
#define __NMR_EXPORTSTREAM_CALLBACK
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include <iostream>
#include <fstream>
#include <functional>
#define EXPORTSTREAM_CALLBACK_BUFFERSIZE (1024*1024)
namespace NMR {
typedef std::function<nfUint32(nfByte * pData, nfUint64, _In_ void *)> ExportStream_WriteCallbackType;
typedef std::function<nfUint32(nfUint64, _In_ void *)> ExportStream_SeekCallbackType;
class CExportStream_Callback : public CExportStream {
private:
ExportStream_WriteCallbackType m_pWriteCallback;
ExportStream_SeekCallbackType m_pSeekCallback;
void * m_pUserData;
nfUint64 m_nPosition;
nfUint64 m_nSize;
public:
CExportStream_Callback();
CExportStream_Callback(_In_ ExportStream_WriteCallbackType pWriteCallback, _In_ ExportStream_SeekCallbackType pSeekCallback, void * pUserData);
virtual nfBool seekPosition(_In_ nfUint64 position, _In_ nfBool bHasToSucceed);
virtual nfBool seekForward(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfBool seekFromEnd(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfUint64 getPosition();
virtual nfUint64 writeBuffer(_In_ const void * pBuffer, _In_ nfUint64 cbTotalBytesToWrite);
};
}
#endif // __NMR_EXPORTSTREAM_CALLBACK
@@ -0,0 +1,69 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ExportStream_Compressed.h defines a stream to write compressed files
--*/
#ifndef __NMR_EXPORTSTREAM_COMPRESSED
#define __NMR_EXPORTSTREAM_COMPRESSED
#include "Common/NMR_Types.h"
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/Platform/NMR_PortableZIPWriter.h"
#include "Libraries/zlib/zlib.h"
#define EXPORTSTREAM_WRITE_BUFFER_CHUNKSIZE 1024
namespace NMR {
class CExportStream_Compressed: public CExportStream {
private:
z_stream m_strm;
PExportStream m_pUncompressedStream;
nfByte out[EXPORTSTREAM_WRITE_BUFFER_CHUNKSIZE];
nfInt32 compress(nfInt32 flush);
public:
CExportStream_Compressed() = delete;
CExportStream_Compressed(PExportStream pUncompressedStream);
~CExportStream_Compressed();
virtual nfBool seekPosition(_In_ nfUint64 position, _In_ nfBool bHasToSucceed);
virtual nfBool seekForward(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfBool seekFromEnd(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfUint64 getPosition();
virtual nfUint64 writeBuffer(_In_ const void * pBuffer, _In_ nfUint64 cbTotalBytesToWrite);
virtual void close();
};
typedef std::shared_ptr <CExportStream_Compressed> PExportStream_Compressed;
}
#endif // __NMR_EXPORTSTREAM_COMPRESSED
@@ -0,0 +1,67 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ExportStream_Dummy.h defines the ExportStream Dummy class. It will not
store any data written to it, but it will correctly track the seek position and
size of the data. It is designed to be used for measuring the size of the stream.
--*/
#ifndef _NMR_EXPORT_STREAM_DUMMY
#define _NMR_EXPORT_STREAM_DUMMY
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include "Common/Platform/NMR_ImportStream.h"
namespace NMR {
class CExportStreamDummy : public CExportStream {
private:
nfUint64 m_Size;
nfUint64 m_Position;
public:
CExportStreamDummy();
virtual nfBool seekPosition(_In_ nfUint64 position, _In_ nfBool bHasToSucceed);
virtual nfBool seekForward(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfBool seekFromEnd(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfUint64 getPosition();
virtual nfUint64 writeBuffer(_In_ const void * pBuffer, _In_ nfUint64 cbTotalBytesToWrite);
nfUint64 getDataSize();
};
typedef std::shared_ptr <CExportStreamDummy> PExportStreamDummy;
}
#endif // _NMR_EXPORT_STREAM_DUMMY
@@ -0,0 +1,68 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ImportStream_Encrypted.h defines the CImportStream_Encrypted Class.
This is a stream class for importing encrypted resources from the underlying stream and handing them
to the proper callbacks that will decrypt the content before returning back to the consumer.
--*/
#ifndef NMR_EXPORTSTREAM_ENCRYPTED
#define NMR_EXPORTSTREAM_ENCRYPTED
#include "Common/NMR_Types.h"
#include "Common/NMR_SecureContentTypes.h"
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/Platform/NMR_EncryptionHeader.h"
namespace NMR {
class CExportStream_Encrypted : public CExportStream {
PExportStream m_pEncryptedStream;
ContentEncryptionDescriptor m_pDecryptContext;
CEncryptionHeader m_header;
public:
CExportStream_Encrypted(PExportStream pEncryptedStream, ContentEncryptionDescriptor context);
// Inherited via CExportStream
virtual nfBool seekPosition(nfUint64 position, nfBool bHasToSucceed) override;
virtual nfBool seekForward(nfUint64 bytes, nfBool bHasToSucceed) override;
virtual nfBool seekFromEnd(nfUint64 bytes, nfBool bHasToSucceed) override;
virtual nfUint64 getPosition() override;
virtual nfUint64 writeBuffer(const void * pBuffer, nfUint64 cbTotalBytesToWrite) override;
};
}
#endif // !NMR_EXPORTSTREAM_ENCRYPTED
@@ -0,0 +1,67 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ExportStream_Memory.h defines the ExportStream to Memory Class.
--*/
#ifndef _NMR_EXPORT_STREAM_MEMORY
#define _NMR_EXPORT_STREAM_MEMORY
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include "Common/Platform/NMR_ImportStream.h"
#include <vector>
namespace NMR {
class CExportStreamMemory : public CExportStream {
private:
std::vector<nfByte> m_Buffer;
nfUint64 m_Position;
public:
CExportStreamMemory();
virtual nfBool seekPosition(_In_ nfUint64 position, _In_ nfBool bHasToSucceed);
virtual nfBool seekForward(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfBool seekFromEnd(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfUint64 getPosition();
virtual nfUint64 writeBuffer(_In_ const void * pBuffer, _In_ nfUint64 cbTotalBytesToWrite);
nfUint64 getDataSize();
const nfByte *getData();
};
typedef std::shared_ptr <CExportStreamMemory> PExportStreamMemory;
}
#endif // _NMR_EXPORT_STREAM_MEMORY
@@ -0,0 +1,65 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ExportStream_Native.cpp defines the CExportStream_Native Class.
This is an abstract base stream class for exporting with std::streams
Attention: Only use in UTF8-native environments!
--*/
#ifndef __NMR_EXPORTSTREAM_NATIVE
#define __NMR_EXPORTSTREAM_NATIVE
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#include <iostream>
#include <fstream>
namespace NMR {
class CExportStream_Native : public CExportStream {
private:
std::ofstream m_Stream;
public:
CExportStream_Native(_In_ const nfWChar * pwszFileName);
~CExportStream_Native();
virtual nfBool seekPosition(_In_ nfUint64 position, _In_ nfBool bHasToSucceed);
virtual nfBool seekForward(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfBool seekFromEnd(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfUint64 getPosition ();
virtual nfUint64 writeBuffer(_In_ const void * pBuffer, _In_ nfUint64 cbTotalBytesToWrite);
void copyFrom(_In_ CImportStream * pImportStream, _In_ nfUint64 cbCount, _In_ nfUint32 cbBufferSize);
};
}
#endif // __NMR_EXPORTSTREAM_NATIVE
@@ -0,0 +1,77 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_PortableZIPWriter.h defines a portable stream to write into ZIP files
--*/
#ifndef __NMR_EXPORTSTREAM_ZIP
#define __NMR_EXPORTSTREAM_ZIP
#include "Common/NMR_Types.h"
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/Platform/NMR_PortableZIPWriter.h"
#include "Libraries/zlib/zlib.h"
#include <array>
#define ZIPEXPORTBUFFERSIZE 65536
#define ZIPEXPORTWRITECHUNKSIZE 1048576
namespace NMR {
class CExportStream_ZIP : public CExportStream {
private:
CPortableZIPWriter * m_pZIPWriter;
nfUint32 m_nEntryKey;
z_stream m_pStream;
std::array<nfByte, ZIPEXPORTBUFFERSIZE> m_nOutBuffer;
nfBool m_bIsInitialized;
nfUint32 writeChunk(_In_ const nfByte * pData, nfUint32 cbCount);
void finishDeflate();
public:
CExportStream_ZIP() = delete;
CExportStream_ZIP(_In_ CPortableZIPWriter * pZIPWriter, nfUint32 nEntryKey);
~CExportStream_ZIP();
virtual nfBool seekPosition(_In_ nfUint64 position, _In_ nfBool bHasToSucceed);
virtual nfBool seekForward(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfBool seekFromEnd(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed);
virtual nfUint64 getPosition();
virtual nfUint64 writeBuffer(_In_ const void * pBuffer, _In_ nfUint64 cbTotalBytesToWrite);
void flushZIPStream();
};
typedef std::shared_ptr <CExportStream_ZIP> PExportStream_ZIP;
}
#endif // __NMR_EXPORTSTREAM_ZIP
+38
View File
@@ -0,0 +1,38 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_IStream.h defines several COM Classes in a portable way.
--*/
#ifndef __NMR_ISTREAM
#define __NMR_ISTREAM
#include <Objidl.h>
#endif // __NMR_ISTREAM
@@ -0,0 +1,65 @@
/*++
Copyright (C) 2019 3MF Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Abstract:
NMR_ImportStream.h defines the CImportStream Class.
This is an abstract base stream class for importing from various data sources.
--*/
#ifndef __NMR_IMPORTSTREAM
#define __NMR_IMPORTSTREAM
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
#define NMR_IMPORTSTREAM_COPYBUFFERSIZE (128 * 1024)
#define NMR_IMPORTSTREAM_READBUFFERSIZE (128 * 1024)
namespace NMR {
class CImportStream;
typedef std::shared_ptr <CImportStream> PImportStream;
class CImportStream {
private:
public:
virtual ~CImportStream() = default;
virtual nfBool seekPosition(_In_ nfUint64 position, _In_ nfBool bHasToSucceed) = 0;
virtual nfBool seekForward(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed) = 0;
virtual nfBool seekFromEnd(_In_ nfUint64 bytes, _In_ nfBool bHasToSucceed) = 0;
virtual nfUint64 readIntoBuffer(_In_ nfByte * pBuffer, _In_ nfUint64 cbTotalBytesToRead, nfBool bNeedsToReadAll) = 0;
virtual nfUint64 retrieveSize() = 0;
virtual void writeToFile(_In_ const nfWChar * pwszFileName) = 0;
virtual PImportStream copyToMemory() = 0;
virtual nfUint64 getPosition() = 0;
};
}
#endif // __NMR_IMPORTSTREAM

Some files were not shown because too many files have changed in this diff Show More