1 #ifndef SEAMSTRESS_PINCUSHION_H
2 #define SEAMSTRESS_PINCUSHION_H
9 template <
class TClass>
27 void sew(
void (TClass::*design)(
void*), std::vector<void*> threads)
30 unsigned long int ntot = threads.size();
32 for(
unsigned long int i=0;i<ntot;i++)
34 (*seamstresses)[i]->needle =
this;
35 (*seamstresses)[i]->thread = threads[i];
36 (*seamstresses)[i]->sew();
38 for(
unsigned long int i=0;i<ntot;i++)
40 (*seamstresses)[i]->rest();
50 (*seamstresses)[i]->needle =
this;
51 (*seamstresses)[i]->thread = NULL;
52 (*seamstresses)[i]->sew();
56 (*seamstresses)[i]->rest();
61 void sewSoftly(
void (TClass::*design)(
void*),
unsigned long int N)
64 for(
unsigned long int i=0;i<
N;i++)
66 (*seamstresses)[i]->needle =
this;
67 (*seamstresses)[i]->thread = NULL;
68 (*seamstresses)[i]->sew();
70 for(
unsigned long int i=0;i<
N;i++)
72 (*seamstresses)[i]->rest();
80 std::vector<unsigned long int> quilt;
81 for(
unsigned long int i=0;i<
seamstresses->size();i++){quilt.push_back(i);}
84 (*seamstresses)[i]->needle =
this;
85 (*seamstresses)[i]->thread = &(quilt[i]);
86 (*seamstresses)[i]->sew();
90 (*seamstresses)[i]->rest();
95 void sewStraight(
void (TClass::*design)(
void*),
unsigned long int N)
98 std::vector<unsigned long int> quilt;
99 for(
unsigned long int i=0;i<
N;i++){quilt.push_back(i);}
100 for(
unsigned long int i=0;i<
N;i++)
102 (*seamstresses)[i]->needle =
this;
103 (*seamstresses)[i]->thread = &(quilt[i]);
104 (*seamstresses)[i]->sew();
106 for(
unsigned long int i=0;i<
N;i++)
108 (*seamstresses)[i]->rest();
116 std::vector<unsigned long int> quilt;
117 for(
unsigned long int i=0;i<
seamstresses->size();i++){quilt.push_back(i);}
120 (*seamstresses)[i]->needle =
this;
121 (*seamstresses)[i]->thread = &(quilt[i]);
122 (*seamstresses)[i]->sew();
130 std::vector<unsigned long int> quilt;
131 for(
unsigned long int i=0;i<
N;i++){quilt.push_back(i);}
132 for(
unsigned long int i=0;i<
N;i++)
134 (*seamstresses)[i]->needle =
this;
135 (*seamstresses)[i]->thread = &(quilt[i]);
136 (*seamstresses)[i]->sew();
146 (*seamstresses)[i]->needle =
this;
147 (*seamstresses)[i]->thread = NULL;
148 (*seamstresses)[i]->sew();
156 for(
unsigned long int i=0;i<
N;i++)
158 (*seamstresses)[i]->needle =
this;
159 (*seamstresses)[i]->thread = NULL;
160 (*seamstresses)[i]->sew();
169 (*seamstresses)[i]->rest();
176 for(
unsigned long int i=0;i<
N;i++)
178 (*seamstresses)[i]->rest();