Skip to content

Commit 1c2d90c

Browse files
fixes
1 parent 79080d0 commit 1c2d90c

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

include/fields/abstract_function_definition.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#ifndef ABSTRACT_FUNCTION_DEFINITION_H
22
#define ABSTRACT_FUNCTION_DEFINITION_H
33

4+
#include "fields/field_definition.h"
45
#include "fields/type.h"
56
#include "fields/obj.h"
67
#include "fields/field.h"
78

89
class AbstractFunctionDefinition : public FieldDefinition {
910
public:
1011
// Constructors
11-
AbstractFunctionDefinition(Type* objectType, const std::string& name, int numArgs);
12-
AbstractFunctionDefinition(Type* objectType, const std::string& name, int numArgs, double tolerance);
12+
AbstractFunctionDefinition(Type* objectType, const std::string& name, int* numArgs, double tolerance);
1313

1414
// Destructor
1515
virtual ~AbstractFunctionDefinition() = default;

include/fields/field_definition.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class FieldDefinition {
2424
protected:
2525
int fieldId;
2626
std::string name;
27+
std::vector<FieldLinkDefinition*> inputs;
2728
std::vector<FieldLinkDefinition*> outputs;
2829
FieldDefinition* parent;
2930
std::vector<FieldDefinition*> children;
@@ -33,8 +34,8 @@ class FieldDefinition {
3334
bool isNextRound;
3435

3536
public:
36-
FieldDefinition(Type* objectType, const std::string& name);
37-
FieldDefinition(Type* objectType, const std::string& name, double tolerance);
37+
38+
FieldDefinition(Type* objectType, const std::string& name, int* numArgs, double tolerance);
3839

3940
void setFieldId(int fieldId);
4041
virtual void transmit(Field* targetField, FieldLinkDefinition* fieldLink, double update);

src/fields/abstract_function_definition.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
#include "fields/abstract_function_definition.h"
22

3-
// Constructor with 3 arguments
4-
AbstractFunctionDefinition::AbstractFunctionDefinition(Type* objectType, const std::string& name, int numArgs)
5-
: FieldDefinition(objectType, name, numArgs) {}
63

74
// Constructor with 4 arguments
8-
AbstractFunctionDefinition::AbstractFunctionDefinition(Type* objectType, const std::string& name, int numArgs, double tolerance)
5+
AbstractFunctionDefinition::AbstractFunctionDefinition(Type* objectType, const std::string& name, int* numArgs, double tolerance)
96
: FieldDefinition(objectType, name, numArgs, tolerance) {}
107

118
// Transmit method

src/fields/field_definition.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
#include "fields/obj.h"
99

1010

11-
FieldDefinition::FieldDefinition(Type* objectType, const std::string& name)
11+
FieldDefinition::FieldDefinition(Type* objectType, const std::string& name, int* numArgs, double tolerance)
1212
: objectType(objectType), name(name), isNextRound(false) {
13+
this->tolerance = tolerance;
1314
objectType->setFieldDefinition(this);
14-
}
1515

16-
FieldDefinition::FieldDefinition(Type* objectType, const std::string& name, double tolerance)
17-
: FieldDefinition(objectType, name) {
18-
this->tolerance = tolerance;
16+
if (numArgs != nullptr) {
17+
inputs.reserve(*numArgs);
18+
}
1919
}
2020

2121
void FieldDefinition::setFieldId(int fieldId) {

src/fields/utils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
int convertSortValue(double newSortValue) {
55
return static_cast<int>(PRECISION * newSortValue); // Equivalent of type casting in Java
66
}
7+

0 commit comments

Comments
 (0)