Author Topic: virtual bool IsHistoryUpdater(const View& v) const  (Read 4883 times)

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
virtual bool IsHistoryUpdater(const View& v) const
« on: 2016 January 27 02:16:39 »
Hi,
As you know there are two type of modules:
type 1: create new image (for example Debayer ), which not compatible with ImageContainer
type 2: modify image (for example Crop ), which compatible with ImageContainer
I try to write some module, where user can choose where save result: to new image or to processed image.

My question: what should i do with PCL function:
Code: [Select]
    bool MyModule_Instance::IsHistoryUpdater(const View& view) const
    {
        return true; // we are change source image, it's good for type 2 strategy
    }
But, what about type 1? How to reset modification flag in source View?

PS or, can: return myModificationFlag;
« Last Edit: 2016 January 27 02:48:02 by NKV »

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: virtual bool IsHistoryUpdater(const View& v) const
« Reply #1 on: 2016 January 27 03:46:52 »
Your reimplementation of ProcessImplementation::IsHistoryUpdater() should tell the core what happens to an image's history if a particular instance (the instance pointed to by this) is executed on the image, so,

Quote
PS or, can: return myModificationFlag;

is correct. More explicitly:

class MyInstance : public ProcessImplementation
{
public:
   
   MyInstance();
   
   virtual void Assign( const ProcessImplementation& );
   
   virtual bool IsHistoryUpdater( const View& ) const
   {
      return !p_createNewImage;
   }

   ...
   
private:
   
   pcl_bool p_createNewImage;
   
   ...
};
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: virtual bool IsHistoryUpdater(const View& v) const
« Reply #2 on: 2016 January 27 19:00:37 »
Thank you!