[vtkusers] Accessing keys in vtkInformation without having key pointers at first

Sunrise helios.corona at gmail.com
Wed Apr 24 16:29:16 EDT 2013


Sorry if the question that I asked was not clear. I would like to ask a
similar question:

Given a vtkInformation object, how can we know what key-value pairs are
appended into it?

Thanks.

On 04/21/2013 08:09 PM, Sunrise wrote:
> I would like to find /search for keys appended in vtkInformation object
> and then access their values. But, it seems that if we do not have key
> pointers, we can not inquiry the vtkInformaton that which key-pairs it
> contains!
>
> Assume I have vtkInformation *inputInfo object in Filter2, that coming
> from previous filter (Filter1) in a pipeline. Filter1 added some
> key/value pairs of type vtkInformationDoubleVectorkey into outputInfo
> object. Now, in the new filter (Filter2) I want to access DoubleVector key.
>
> In Filter1 header, a key is defined with a static function:
> static vtkInformationDoubleVectorKey * MyKey();
>
> key-value pair is appended to outputInfo with:
> outputInfo->Set(Filter1::MyKey(),someValues,someLength);
>
> So in Filter2 by calling Filter1::MyKey(), I can access the key values via:
> values = inputInfo->Get(Filter1::MyKey());
>
> But, the problem is that Filter1 could be one of more general filters
> that create their own key. Filter2 is not restricted to be connected
> just to Filter1, downstream of Filter2 can be FilterX. So I do not know
> which FilterX generated key for DoubleVector type in inputInfo. "All the
> Filter2 should know is that in inputInfo there is a key-value pair with
> DoubleVector type".
>
> Also I don't want to create a superclass for my filters and generate
> keys at there (something that vtkStreamingDemandDrivenPipeline does for
> its keys).
>
> I looked at this thread
>
> http://vtk.1045678.n5.nabble.com/vtkInformation-access-with-equivalent-keys-td5545920.html
>
> to figure out how can I access keys with other similar key-types. The
> answer suggests to use CopyEntries method. If you look at source code
> for vtkInformation::CopyEntries(...), you will see that keys in info
> should be know again in order to use CopyEntries.
>
> Any idea would be appreciated.




More information about the vtkusers mailing list