Skip to content

Commit

Permalink
[CImplicitNode] Explicitly initalizining m_pImplicitNode in derived c…
Browse files Browse the repository at this point in the history
…lasses
  • Loading branch information
3dJan committed Oct 30, 2023
1 parent 8072abe commit 24729d4
Show file tree
Hide file tree
Showing 57 changed files with 295 additions and 106 deletions.
4 changes: 3 additions & 1 deletion Include/API/lib3mf_implicitnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ namespace Lib3MF
*/
NMR::PModelImplicitNode m_pImplicitNode;

IImplicitPort * FindInputOrThrow(const std::string & sIdentifier);
IImplicitPort * FindOutputOrThrow(const std::string & sIdentifier);
public:

CImplicitNode() = default;
CImplicitNode(NMR::PModelImplicitNode pImplicitNode);
explicit CImplicitNode(NMR::PModelImplicitNode pImplicitNode);

/**
* Public member functions to implement.
Expand Down
2 changes: 2 additions & 0 deletions Include/API/lib3mf_implicitport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ namespace Lib3MF
* @param[in] sReference - the reference
*/
void SetReference(const std::string & sReference) override;

NMR::PModelImplicitPort getPort();
};

} // namespace Impl
Expand Down
4 changes: 2 additions & 2 deletions Include/Model/Classes/NMR_ModelImplicitPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include <string>

#include "Model/Classes/NMR_ModelImplicitPortNames.h"

namespace NMR
{

using ImplicitIdentifier = std::string;
class CModelImplicitNode;



class CModelImplicitPort
{
private:
Expand Down
78 changes: 78 additions & 0 deletions Include/Model/Classes/NMR_ModelImplicitPortNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*++
Copyright (C) 2023 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.
--*/

#pragma once


#include <vector>
#include <string>

namespace NMR
{
struct InputNames
{
static auto constexpr A = "A";
static auto constexpr B = "B";
static auto constexpr C = "C";
static auto constexpr D = "D";
static auto constexpr m00 = "m00";
static auto constexpr m01 = "m01";
static auto constexpr m02 = "m02";
static auto constexpr m03 = "m03";
static auto constexpr m10 = "m10";
static auto constexpr m11 = "m11";
static auto constexpr m12 = "m12";
static auto constexpr m13 = "m13";
static auto constexpr m20 = "m20";
static auto constexpr m21 = "m21";
static auto constexpr m22 = "m22";
static auto constexpr m23 = "m23";
static auto constexpr m30 = "m30";
static auto constexpr m31 = "m31";
static auto constexpr m32 = "m32";
static auto constexpr m33 = "m33";
static auto constexpr x = "x";
static auto constexpr y = "y";
static auto constexpr z = "z";
static auto constexpr pos = "pos";
static auto constexpr mesh = "mesh";
static auto constexpr color = "color";
static auto constexpr min = "min";
static auto constexpr max = "max";
};

struct OutputNames
{
static auto constexpr result = "result";
static auto constexpr value = "value";
static auto constexpr vector = "vector";
static auto constexpr matrix = "matrix";
static auto constexpr color = "color";
static auto constexpr distance = "distance";
};
}
3 changes: 2 additions & 1 deletion Source/API/lib3mf_absnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ using namespace Lib3MF::Impl;
**************************************************************************************************************************/

Lib3MF::Impl::CAbsNode::CAbsNode(NMR::PModelImplicitNode pImplicitNode)
: COneInputNode(std::move(pImplicitNode))
: COneInputNode(pImplicitNode)
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
5 changes: 3 additions & 2 deletions Source/API/lib3mf_additionnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ using namespace Lib3MF::Impl;
Class definition of CAdditionNode
**************************************************************************************************************************/

Lib3MF::Impl::CAdditionNode::CAdditionNode(
CAdditionNode::CAdditionNode(
NMR::PModelImplicitNode pImplicitNode)
: CTwoInputNode(std::move(pImplicitNode))
: CTwoInputNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
3 changes: 2 additions & 1 deletion Source/API/lib3mf_arccosnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ using namespace Lib3MF::Impl;
**************************************************************************************************************************/

Lib3MF::Impl::CArcCosNode::CArcCosNode(NMR::PModelImplicitNode pImplicitNode)
: COneInputNode{std::move(pImplicitNode)}
: COneInputNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
3 changes: 2 additions & 1 deletion Source/API/lib3mf_arcsinnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ using namespace Lib3MF::Impl;
**************************************************************************************************************************/

Lib3MF::Impl::CArcSinNode::CArcSinNode(NMR::PModelImplicitNode pImplicitNode)
: COneInputNode{std::move(pImplicitNode)}
: COneInputNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
3 changes: 2 additions & 1 deletion Source/API/lib3mf_arctan2node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ using namespace Lib3MF::Impl;
**************************************************************************************************************************/

Lib3MF::Impl::CArcTan2Node::CArcTan2Node(NMR::PModelImplicitNode pImplicitNode)
: CTwoInputNode{ std::move(pImplicitNode) }
: CTwoInputNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
6 changes: 4 additions & 2 deletions Source/API/lib3mf_arctannode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ using namespace Lib3MF::Impl;
**************************************************************************************************************************/

Lib3MF::Impl::CArcTanNode::CArcTanNode(NMR::PModelImplicitNode pImplicitNode)
: COneInputNode{ std::move(pImplicitNode) }
{}
: COneInputNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
3 changes: 2 additions & 1 deletion Source/API/lib3mf_ceilnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ using namespace Lib3MF::Impl;
**************************************************************************************************************************/

Lib3MF::Impl::CCeilNode::CCeilNode(NMR::PModelImplicitNode pImplicitNode)
: COneInputNode(std::move(pImplicitNode))
: COneInputNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
7 changes: 4 additions & 3 deletions Source/API/lib3mf_clampnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ using namespace Lib3MF::Impl;

IImplicitPort* CClampNode::GetInputMin()
{
return FindInput("min");
return FindInputOrThrow(NMR::InputNames::min);
}

IImplicitPort* CClampNode::GetInputMax()
{
return FindInput("max");
return FindInputOrThrow(NMR::InputNames::max);
}

Lib3MF::Impl::CClampNode::CClampNode(NMR::PModelImplicitNode pImplicitNode)
: COneInputNode(std::move(pImplicitNode))
: COneInputNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
13 changes: 7 additions & 6 deletions Source/API/lib3mf_composematrixfromrowvectorsnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,33 @@ using namespace Lib3MF::Impl;

Lib3MF::Impl::CComposeMatrixFromRowVectorsNode::
CComposeMatrixFromRowVectorsNode(NMR::PModelImplicitNode pImplicitNode)
: CImplicitNode(std::move(pImplicitNode))
: CImplicitNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}

IImplicitPort* CComposeMatrixFromRowVectorsNode::GetInputRow0()
{
return FindInput("A");
return FindInputOrThrow(NMR::InputNames::A);
}

IImplicitPort * CComposeMatrixFromRowVectorsNode::GetInputRow1()
{
return FindInput("B");
return FindInputOrThrow(NMR::InputNames::B);
}

IImplicitPort * CComposeMatrixFromRowVectorsNode::GetInputRow2()
{
return FindInput("C");
return FindInputOrThrow(NMR::InputNames::C);
}

IImplicitPort * CComposeMatrixFromRowVectorsNode::GetInputRow3()
{
return FindInput("D");
return FindInputOrThrow(NMR::InputNames::D);
}

IImplicitPort * CComposeMatrixFromRowVectorsNode::GetOutputMatrix()
{
return FindOutput("matrix");
return FindOutputOrThrow(NMR::OutputNames::matrix);
}

37 changes: 19 additions & 18 deletions Source/API/lib3mf_composematrixnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,91 +42,92 @@ using namespace Lib3MF::Impl;

IImplicitPort * CComposeMatrixNode::GetInputM00()
{
return FindInput("m00");
return FindInputOrThrow(NMR::InputNames::m00);
}

IImplicitPort * CComposeMatrixNode::GetInputM01()
{
return FindInput("m01");
return FindInputOrThrow(NMR::InputNames::m01);
}

IImplicitPort * CComposeMatrixNode::GetInputM02()
{
return FindInput("m02");
return FindInputOrThrow(NMR::InputNames::m02);
}

IImplicitPort * CComposeMatrixNode::GetInputM03()
{
return FindInput("m03");
return FindInputOrThrow(NMR::InputNames::m03);
}

IImplicitPort * CComposeMatrixNode::GetInputM10()
{
return FindInput("m10");
return FindInputOrThrow(NMR::InputNames::m10);
}

IImplicitPort * CComposeMatrixNode::GetInputM11()
{
return FindInput("m11");
return FindInputOrThrow(NMR::InputNames::m11);
}

IImplicitPort * CComposeMatrixNode::GetInputM12()
{
return FindInput("m12");
return FindInputOrThrow(NMR::InputNames::m12);
}

IImplicitPort * CComposeMatrixNode::GetInputM13()
{
return FindInput("m13");
return FindInputOrThrow(NMR::InputNames::m13);
}

IImplicitPort * CComposeMatrixNode::GetInputM20()
{
return FindInput("m20");
return FindInputOrThrow(NMR::InputNames::m20);
}

IImplicitPort * CComposeMatrixNode::GetInputM21()
{
return FindInput("m21");
return FindInputOrThrow(NMR::InputNames::m21);
}

IImplicitPort * CComposeMatrixNode::GetInputM22()
{
return FindInput("m22");
return FindInputOrThrow(NMR::InputNames::m22);
}

IImplicitPort * CComposeMatrixNode::GetInputM23()
{
return FindInput("m23");
return FindInputOrThrow(NMR::InputNames::m23);
}

IImplicitPort * CComposeMatrixNode::GetInputM30()
{
return FindInput("m30");
return FindInputOrThrow(NMR::InputNames::m30);
}

IImplicitPort * CComposeMatrixNode::GetInputM31()
{
return FindInput("m31");
return FindInputOrThrow(NMR::InputNames::m31);
}

IImplicitPort * CComposeMatrixNode::GetInputM32()
{
return FindInput("m32");
return FindInputOrThrow(NMR::InputNames::m32);
}

IImplicitPort * CComposeMatrixNode::GetInputM33()
{
return FindInput("m33");
return FindInputOrThrow(NMR::InputNames::m33);
}

IImplicitPort * CComposeMatrixNode::GetOutputMatrix()
{
return FindOutput("matrix");
return FindInputOrThrow(NMR::OutputNames::matrix);
}

Lib3MF::Impl::CComposeMatrixNode::CComposeMatrixNode(
NMR::PModelImplicitNode pImplicitNode)
: CImplicitNode(pImplicitNode)
: CImplicitNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
11 changes: 6 additions & 5 deletions Source/API/lib3mf_composevectornode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,27 @@ using namespace Lib3MF::Impl;

IImplicitPort * CComposeVectorNode::GetInputX()
{
return FindInput("x");
return FindInputOrThrow(NMR::InputNames::x);
}

IImplicitPort * CComposeVectorNode::GetInputY()
{
return FindInput("y");
return FindInputOrThrow(NMR::InputNames::y);
}

IImplicitPort * CComposeVectorNode::GetInputZ()
{
return FindInput("z");
return FindInputOrThrow(NMR::InputNames::z);
}

IImplicitPort * CComposeVectorNode::GetOutputVector()
{
return FindOutput("vector");
return FindOutputOrThrow(NMR::OutputNames::vector);
}

Lib3MF::Impl::CComposeVectorNode::CComposeVectorNode(
NMR::PModelImplicitNode pImplicitNode)
: CImplicitNode(std::move(pImplicitNode))
: CImplicitNode{pImplicitNode}
{
CImplicitNode::m_pImplicitNode = pImplicitNode;
}
Loading

0 comments on commit 24729d4

Please sign in to comment.