<div dir="ltr">It does a shallow copy. The information object holds a strong reference to the data object so<div><br></div><div><span style="font-family:&#39;Courier New&#39;,Courier,monospace;font-size:13px">outputInfo-&gt;Set(</span><span style="font-family:&#39;Courier New&#39;,Courier,monospace;font-size:13px">vtkDataObject::DATA_OBJECT(),</span><span style="font-family:&#39;Courier New&#39;,Courier,monospace;font-size:13px">MyDataSet);</span><br>

</div><div><span style="font-family:&#39;Courier New&#39;,Courier,monospace;font-size:13px"><br></span></div><div style><font face="arial, helvetica, sans-serif">so it will increment the reference count of MyDataSet preventing it from going out of scope.</font></div>

<div style><font face="arial, helvetica, sans-serif"><br></font></div><div style><font face="arial, helvetica, sans-serif">-berk</font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 28, 2013 at 11:41 AM, Sunrise <span dir="ltr">&lt;<a href="mailto:helios.corona@gmail.com" target="_blank">helios.corona@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    I am wondering if the &quot;<font face="Courier New, Courier, monospace">Set</font>&quot;
    method in <font face="Courier New, Courier, monospace">vtkInformation</font>
    class performs a deep-copy or shallow-copy when I set a <font face="Courier New, Courier, monospace">DATA_OBJECT</font> into it?<br>
    <br>
    Suppose I have some <font face="Courier New, Courier, monospace">vtkDataSet</font>
    and I want to append them into <font face="Courier New, Courier,
      monospace">outputInfo</font> of a filter inside its <font face="Courier New, Courier, monospace">RequestData</font> method.
    <br>
    <br>
    <font face="Courier New, Courier, monospace">int
      Filter1::RequestData(...)<br>
      {<br>
          vtkSmartPointer&lt;vtkSomeReader&gt; myreader =
      vtkSmartPointer&lt;vtkSomeReader&gt;::New();<br>
          ...<br>
          vtkDataSet *MyDataSet = Reader-&gt;GetOutput();<br>
          outputInfo-&gt;Set(vtkDataObject::DATA_OBJECT(),MyDataSet);<br>
          ...<br>
      }</font><br>
    <br>
    at the end of <font face="Courier New, Courier, monospace">RequestData</font>,
    both the pointer <font face="Courier New, Courier, monospace">myreader</font>
    and its data on the heap would be out of scope. Since I made them
    smart pointers, both pointer &quot;myreader&quot; and the data on the heap
    will be deleted (right?).<br>
    <br>
    But in the next filter of the pipeline (say Filter2 is connected to
    Filter1), I can receive the data in <font face="Courier New,
      Courier, monospace">inputInfo</font><br>
    <br>
    <font face="Courier New, Courier, monospace">int
      Filter2::RequestData(...)<br>
      {<br>
          ...<br>
          ... inputInfo-&gt;Get(vtkDataObject::DATA_OBJECT());<br>
      }</font><br>
    <br>
    I am wondering why still I can get the data, since data deferenced
    by <font face="Courier New, Courier, monospace">MyDataSet</font> in
    previous filter no longer exists?<br>
    <br>
    Does <font face="Courier New, Courier, monospace">vtkInformation::Set</font>
    perform a deep copy?<br>
    <br>
    Thank you.<br>
  </div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>