Skip to content

Commit 60d0dab

Browse files
iscgarruevs
authored andcommitted
general: use the ParamList and EntityList type aliases
They are easier to read, and this makes the code more consistent.
1 parent 2602edc commit 60d0dab

File tree

9 files changed

+25
-27
lines changed

9 files changed

+25
-27
lines changed

src/constrainteq.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void ConstraintBase::AddEq(IdList<Equation,hEquation> *l, const ExprVector &v,
247247
}
248248
}
249249

250-
void ConstraintBase::Generate(IdList<Param,hParam> *l) {
250+
void ConstraintBase::Generate(ParamList *l) {
251251
switch(type) {
252252
case Type::PARALLEL:
253253
case Type::CUBIC_LINE_TANGENT:

src/expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ Expr *Expr::DeepCopy() const {
307307
return n;
308308
}
309309

310-
Expr *Expr::DeepCopyWithParamsAsPointers(IdList<Param,hParam> *firstTry,
311-
IdList<Param, hParam> *thenTry, bool foldConstants) const {
310+
Expr *Expr::DeepCopyWithParamsAsPointers(ParamList *firstTry, ParamList *thenTry,
311+
bool foldConstants) const {
312312
Expr *n = AllocExpr();
313313
if(op == Op::PARAM) {
314314
// A param that is referenced by its hParam gets rewritten to go

src/file.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,8 @@ void SolveSpaceUI::UpgradeLegacyData() {
581581
// at workplane origin, and the solver will mess up the sketch if
582582
// it is not fully constrained.
583583
case Request::Type::TTF_TEXT: {
584-
IdList<Entity,hEntity> entity = {};
585-
IdList<Param,hParam> param = {};
584+
EntityList entity = {};
585+
ParamList param = {};
586586
r.Generate(&entity, &param);
587587

588588
// If we didn't load all of the entities and params that this
@@ -621,12 +621,12 @@ void SolveSpaceUI::UpgradeLegacyData() {
621621
// Constraints saved in versions prior to 3.0 never had any params;
622622
// version 3.0 introduced params to constraints to avoid the hairy ball problem,
623623
// so force them where they belong.
624-
IdList<Param,hParam> oldParam = {};
624+
ParamList oldParam = {};
625625
SK.param.DeepCopyInto(&oldParam);
626626
SS.GenerateAll(SolveSpaceUI::Generate::REGEN);
627627

628628
auto AllParamsExistFor = [&](Constraint &c) {
629-
IdList<Param,hParam> param = {};
629+
ParamList param = {};
630630
c.Generate(&param);
631631
bool allParamsExist = true;
632632
for(Param &p : param) {

src/generate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
225225
PruneOrphans();
226226

227227
// Don't lose our numerical guesses when we regenerate.
228-
IdList<Param,hParam> prev = {};
228+
ParamList prev = {};
229229
SK.param.MoveSelfInto(&prev);
230230
SK.param.ReserveMore(prev.n);
231231
int oldEntityCount = SK.entity.n;

src/group.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void Group::Clear() {
3434
remap.clear();
3535
}
3636

37-
void Group::AddParam(IdList<Param,hParam> *param, hParam hp, double v) {
37+
void Group::AddParam(ParamList *param, hParam hp, double v) {
3838
Param pa = {};
3939
pa.h = hp;
4040
pa.val = v;
@@ -435,8 +435,7 @@ void Group::Activate() {
435435
SS.ScheduleShowTW();
436436
}
437437

438-
void Group::Generate(IdList<Entity,hEntity> *entity,
439-
IdList<Param,hParam> *param)
438+
void Group::Generate(EntityList *entity, ParamList *param)
440439
{
441440
Vector gn = (SS.GW.projRight).Cross(SS.GW.projUp);
442441
Vector gp = SS.GW.projRight.Plus(SS.GW.projUp);
@@ -868,7 +867,7 @@ hEntity Group::Remap(hEntity in, int copyNumber) {
868867
return h.entity(it->second.v);
869868
}
870869

871-
void Group::MakeExtrusionLines(IdList<Entity,hEntity> *el, hEntity in) {
870+
void Group::MakeExtrusionLines(EntityList *el, hEntity in) {
872871
Entity *ep = SK.GetEntity(in);
873872

874873
Entity en = {};
@@ -904,7 +903,7 @@ void Group::MakeExtrusionLines(IdList<Entity,hEntity> *el, hEntity in) {
904903
}
905904
}
906905

907-
void Group::MakeLatheCircles(IdList<Entity,hEntity> *el, IdList<Param,hParam> *param, hEntity in, Vector pt, Vector axis) {
906+
void Group::MakeLatheCircles(EntityList *el, ParamList *param, hEntity in, Vector pt, Vector axis) {
908907
Entity *ep = SK.GetEntity(in);
909908

910909
Entity en = {};
@@ -951,7 +950,7 @@ void Group::MakeLatheCircles(IdList<Entity,hEntity> *el, IdList<Param,hParam> *p
951950
}
952951
}
953952

954-
void Group::MakeLatheSurfacesSelectable(IdList<Entity, hEntity> *el, hEntity in, Vector axis) {
953+
void Group::MakeLatheSurfacesSelectable(EntityList *el, hEntity in, Vector axis) {
955954
Entity *ep = SK.GetEntity(in);
956955

957956
Entity en = {};
@@ -986,7 +985,7 @@ void Group::MakeLatheSurfacesSelectable(IdList<Entity, hEntity> *el, hEntity in,
986985
// For Revolve and Helix groups the end faces are remapped from an arbitrary
987986
// point on the sketch. We reference the transformed point but there is
988987
// no existing normal so we need to define the rotation and timesApplied.
989-
void Group::MakeRevolveEndFaces(IdList<Entity,hEntity> *el, hEntity pt, int ai, int af)
988+
void Group::MakeRevolveEndFaces(EntityList *el, hEntity pt, int ai, int af)
990989
{
991990
if(pt.v == 0) return;
992991
Group *src = SK.GetGroup(opA);
@@ -1023,7 +1022,7 @@ void Group::MakeRevolveEndFaces(IdList<Entity,hEntity> *el, hEntity pt, int ai,
10231022
el->Add(&en);
10241023
}
10251024

1026-
void Group::MakeExtrusionTopBottomFaces(IdList<Entity,hEntity> *el, hEntity pt)
1025+
void Group::MakeExtrusionTopBottomFaces(EntityList *el, hEntity pt)
10271026
{
10281027
if(pt.v == 0) return;
10291028
Group *src = SK.GetGroup(opA);
@@ -1049,7 +1048,7 @@ void Group::MakeExtrusionTopBottomFaces(IdList<Entity,hEntity> *el, hEntity pt)
10491048
el->Add(&en);
10501049
}
10511050

1052-
void Group::CopyEntity(IdList<Entity,hEntity> *el,
1051+
void Group::CopyEntity(EntityList *el,
10531052
Entity *ep, int timesApplied, int remap,
10541053
hParam dx, hParam dy, hParam dz,
10551054
hParam qw, hParam qvx, hParam qvy, hParam qvz, hParam dist,

src/request.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ Request::Type EntReqTable::GetRequestForEntity(Entity::Type ent) {
7878
return req;
7979
}
8080

81-
void Request::Generate(IdList<Entity,hEntity> *entity,
82-
IdList<Param,hParam> *param)
81+
void Request::Generate(EntityList *entity, ParamList *param)
8382
{
8483
int points = 0;
8584
Entity::Type et = (Entity::Type)0;
@@ -239,7 +238,7 @@ int Request::IndexOfPoint(hEntity he) const {
239238
return -1;
240239
}
241240

242-
hParam Request::AddParam(IdList<Param,hParam> *param, hParam hp) {
241+
hParam Request::AddParam(ParamList *param, hParam hp) {
243242
Param pa = {};
244243
pa.h = hp;
245244
param->Add(&pa);

src/sketch.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,9 @@ class Group {
293293
};
294294
hEntity Remap(hEntity in, int copyNumber);
295295
void MakeExtrusionLines(EntityList *el, hEntity in);
296-
void MakeLatheCircles(IdList<Entity,hEntity> *el, IdList<Param,hParam> *param, hEntity in, Vector pt, Vector axis);
297-
void MakeLatheSurfacesSelectable(IdList<Entity, hEntity> *el, hEntity in, Vector axis);
298-
void MakeRevolveEndFaces(IdList<Entity,hEntity> *el, hEntity pt, int ai, int af);
296+
void MakeLatheCircles(EntityList *el, ParamList *param, hEntity in, Vector pt, Vector axis);
297+
void MakeLatheSurfacesSelectable(EntityList *el, hEntity in, Vector axis);
298+
void MakeRevolveEndFaces(EntityList *el, hEntity pt, int ai, int af);
299299
void MakeExtrusionTopBottomFaces(EntityList *el, hEntity pt);
300300
void CopyEntity(EntityList *el,
301301
Entity *ep, int timesApplied, int remap,
@@ -722,7 +722,7 @@ class ConstraintBase {
722722
bool HasLabel() const;
723723
bool IsProjectible() const;
724724

725-
void Generate(IdList<Param, hParam> *param);
725+
void Generate(ParamList *param);
726726

727727
void GenerateEquations(IdList<Equation,hEquation> *entity,
728728
bool forReference = false) const;

src/slvs/lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ void Slvs_Solve(Slvs_System *ssys, uint32_t shg)
10001000

10011001
SK.entity.Add(&e);
10021002
}
1003-
IdList<Param, hParam> params = {};
1003+
ParamList params = {};
10041004
for(i = 0; i < ssys->constraints; i++) {
10051005
Slvs_Constraint *sc = &(ssys->constraint[i]);
10061006
ConstraintBase c = {};

src/solvespace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ class Sketch {
495495

496496
// These are generated from the above.
497497
IdList<ENTITY,hEntity> entity;
498-
IdList<Param,hParam> param;
498+
ParamList param;
499499

500500
inline CONSTRAINT *GetConstraint(hConstraint h)
501501
{ return constraint.FindById(h); }
@@ -525,7 +525,7 @@ class SolveSpaceUI {
525525
List<hGroup> groupOrder;
526526
IdList<Request,hRequest> request;
527527
IdList<Constraint,hConstraint> constraint;
528-
IdList<Param,hParam> param;
528+
ParamList param;
529529
IdList<Style,hStyle> style;
530530
hGroup activeGroup;
531531

0 commit comments

Comments
 (0)