Commit 8ff480b0de728d03f2a61f73fd9b05a3f19c8622

Authored by Charles Otto
1 parent ba990be3

Rename pseudoCopy to smartCopy, add additional comments

openbr/openbr_plugin.h
... ... @@ -1085,7 +1085,13 @@ public:
1085 1085 return dst;
1086 1086 }
1087 1087  
1088   - virtual Transform * pseudoCopy() { return this;}
  1088 + /*!
  1089 + * \brief Perform the minimum amount of work necessary to make a
  1090 + * transform that can be used safely from a different thread than this
  1091 + * transform. For transforms that aren't time-varying, nothing needs to be
  1092 + * done, returning this is sufficient.
  1093 + */
  1094 + virtual Transform * smartCopy() { return this;}
1089 1095  
1090 1096 protected:
1091 1097 Transform(bool independent = true, bool trainable = true); /*!< \brief Construct a transform. */
... ...
openbr/plugins/meta.cpp
... ... @@ -600,7 +600,7 @@ public:
600 600  
601 601 virtual Transform *make() const
602 602 {
603   - return basis->pseudoCopy();
  603 + return basis->smartCopy();
604 604 }
605 605  
606 606 };
... ... @@ -647,13 +647,13 @@ class DistributeTemplateTransform : public MetaTransform
647 647  
648 648 public:
649 649  
650   - Transform * pseudoCopy()
  650 + Transform * smartCopy()
651 651 {
652 652 if (!transform->timeVarying())
653 653 return this;
654 654  
655 655 DistributeTemplateTransform * output = new DistributeTemplateTransform;
656   - output->transform = transform->pseudoCopy();
  656 + output->transform = transform->smartCopy();
657 657 return output;
658 658 }
659 659  
... ...
openbr/plugins/openbr_internal.h
... ... @@ -72,7 +72,11 @@ public:
72 72 }
73 73 }
74 74  
75   - virtual Transform * pseudoCopy()
  75 + /*!
  76 + *\brief For transforms that don't do any training, this default implementation
  77 + * which creates a new copy of the Transform from its description string is sufficient.
  78 + */
  79 + virtual Transform * smartCopy()
76 80 {
77 81 return this->clone();
78 82 }
... ... @@ -128,7 +132,13 @@ public:
128 132 }
129 133 }
130 134  
131   - Transform * pseudoCopy()
  135 + /*!
  136 + * \brief Composite transforms need to create a copy of themselves if they
  137 + * have any time-varying children. If this object is flagged as time-varying,
  138 + * it creates a new copy of its own class, and gives that copy the child transforms
  139 + * returned by calling smartCopy on this transforms children
  140 + */
  141 + Transform * smartCopy()
132 142 {
133 143 if (!timeVarying())
134 144 return this;
... ... @@ -144,10 +154,10 @@ public:
144 154  
145 155 foreach(Transform* t, transforms )
146 156 {
147   - Transform * maybe_copy = t->pseudoCopy();
  157 + Transform * maybe_copy = t->smartCopy();
148 158 if (maybe_copy->parent() == NULL)
149 159 maybe_copy->setParent(output);
150   - output->transforms.append(t->pseudoCopy());
  160 + output->transforms.append(t->smartCopy());
151 161 }
152 162  
153 163 output->file = this->file;
... ...