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,7 +1085,13 @@ public:
1085 return dst; 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 protected: 1096 protected:
1091 Transform(bool independent = true, bool trainable = true); /*!< \brief Construct a transform. */ 1097 Transform(bool independent = true, bool trainable = true); /*!< \brief Construct a transform. */
openbr/plugins/meta.cpp
@@ -600,7 +600,7 @@ public: @@ -600,7 +600,7 @@ public:
600 600
601 virtual Transform *make() const 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,13 +647,13 @@ class DistributeTemplateTransform : public MetaTransform
647 647
648 public: 648 public:
649 649
650 - Transform * pseudoCopy() 650 + Transform * smartCopy()
651 { 651 {
652 if (!transform->timeVarying()) 652 if (!transform->timeVarying())
653 return this; 653 return this;
654 654
655 DistributeTemplateTransform * output = new DistributeTemplateTransform; 655 DistributeTemplateTransform * output = new DistributeTemplateTransform;
656 - output->transform = transform->pseudoCopy(); 656 + output->transform = transform->smartCopy();
657 return output; 657 return output;
658 } 658 }
659 659
openbr/plugins/openbr_internal.h
@@ -72,7 +72,11 @@ public: @@ -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 return this->clone(); 81 return this->clone();
78 } 82 }
@@ -128,7 +132,13 @@ public: @@ -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 if (!timeVarying()) 143 if (!timeVarying())
134 return this; 144 return this;
@@ -144,10 +154,10 @@ public: @@ -144,10 +154,10 @@ public:
144 154
145 foreach(Transform* t, transforms ) 155 foreach(Transform* t, transforms )
146 { 156 {
147 - Transform * maybe_copy = t->pseudoCopy(); 157 + Transform * maybe_copy = t->smartCopy();
148 if (maybe_copy->parent() == NULL) 158 if (maybe_copy->parent() == NULL)
149 maybe_copy->setParent(output); 159 maybe_copy->setParent(output);
150 - output->transforms.append(t->pseudoCopy()); 160 + output->transforms.append(t->smartCopy());
151 } 161 }
152 162
153 output->file = this->file; 163 output->file = this->file;