<commit_before>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPushPipeline.cxx
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 1993-2002 <NAME>, <NAME>, <NAME> 
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#include "vtkPushPipeline.h"

#include "vtkAbstractMapper.h"
#include "vtkCommand.h"
#include "vtkImageActor.h"
#include "vtkImageData.h"
#include "vtkObjectFactory.h"
#include "vtkPushImageReader.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkRendererCollection.h"
#include "vtkSmartPointer.h"
#include "vtkSource.h"
#include "vtkVolumeMapper.h"

#ifdef _MSC_VER
#pragma warning (push, 2)
#endif
#include <vector>
#include <map>
#include <algorithm>
#ifdef _MSC_VER
#pragma warning(pop)
#endif

typedef vtkstd::vector< vtkSmartPointer<vtkRenderWindow> > WindowsTypeBase;
typedef vtkstd::map< vtkSmartPointer<vtkProcessObject>,
                     vtkPushPipelineProcessInfo*> ProcessMapTypeBase;
typedef vtkstd::map< vtkSmartPointer<vtkDataObject>,
                     vtkPushPipelineDataInfo* > DataMapTypeBase;
class vtkPushPipelineWindowsType: public WindowsTypeBase {};
class vtkPushPipelineProcessMapType: public ProcessMapTypeBase {};
class vtkPushPipelineDataMapType: public DataMapTypeBase {};

class vtkPushPipelineProcessInfo {
public:
  // an input is ready if it has new data
  int AreAllInputsReady(vtkPushPipeline *pp);
  int IsInputReady(int i, vtkPushPipeline *pp);
  // an output is ready if its last results were consumed
  int AreAllOutputsReady(vtkPushPipeline *pp);
  int IsOutputReady(int o, vtkPushPipeline *pp);
  void ConsumeAllInputs(vtkPushPipeline *pp);
  void ConsumeInput(int i, vtkPushPipeline *pp);    
  void ProduceOutputs(vtkPushPipeline *);
  vtkPushPipelineProcessInfo();
  int ExecutionToOutputRatio;
  int NumberProcessed;
  void ProcessSomeData(vtkPushPipeline *);
  int Marked;
  int InputToExecutionRatio[VTK_PP_MAX_INPUTS];
  vtkProcessObject *ProcessObject;
};
  
class vtkPushPipelineDataInfo {
public:
  int IsConsumerLeft(vtkProcessObject *);
  int IsWindowConsumerLeft(vtkRenderWindow *);
  void ConsumeData(vtkProcessObject *);
  void ConsumeWindow(vtkRenderWindow *);
  void FillConsumersLeft();
  vtkPushPipelineDataInfo();
  ~vtkPushPipelineDataInfo();
  vtkstd::vector< vtkSmartPointer<vtkProcessObject> > ConsumersLeft;
  vtkstd::vector< vtkSmartPointer<vtkRenderWindow> > WindowConsumersLeft;
  int Marked;
  vtkDataObject *DataObject;
  vtkstd::vector< vtkSmartPointer<vtkRenderWindow> > WindowConsumers;
};

class vtkPushPipelineConsumeCommand : public vtkCommand
{
public:
  static vtkPushPipelineConsumeCommand *New() { return new vtkPushPipelineConsumeCommand;}
  virtual void Execute(vtkObject *caller, unsigned long, void *)
    {
      vtkProcessObject *po = vtkProcessObject::SafeDownCast(caller);
      if (po && this->PushPipeline)
        {
        vtkPushPipelineProcessInfo *ppi =
          this->PushPipeline->GetPushProcessInfo(po);
        ppi->NumberProcessed++;              
        ppi->ConsumeAllInputs(this->PushPipeline);
        ppi->ProduceOutputs(this->PushPipeline);
        }
    }
  void SetPushPipeline(vtkPushPipeline *p) {
    this->PushPipeline = p; }
  
  vtkPushPipeline *PushPipeline;
};

class vtkPushPipelineEndRunCommand : public vtkCommand
{
public:
  static vtkPushPipelineEndRunCommand *New() { return new vtkPushPipelineEndRunCommand;}
  virtual void Execute(vtkObject *, unsigned long, void *)
    {
      if (this->PushPipeline)
        {
        this->PushPipeline->SetRunState(2);
        }
    }
  void SetPushPipeline(vtkPushPipeline *p) {
    this->PushPipeline = p; }
  
  vtkPushPipeline *PushPipeline;
};

vtkCxxRevisionMacro(vtkPushPipeline, "1.13");
vtkStandardNewMacro(vtkPushPipeline);
<commit_msg>Clean preprocessor stuff<commit_after>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPushPipeline.cxx
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) 1993-2002 <NAME>, <NAME>, <NAME> 
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#include "vtkPushPipeline.h"

#include "vtkAbstractMapper.h"
#include "vtkCommand.h"
#include "vtkImageActor.h"
#include "vtkImageData.h"
#include "vtkObjectFactory.h"
#include "vtkPushImageReader.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkRendererCollection.h"
#include "vtkSmartPointer.h"
#include "vtkSource.h"
#include "vtkVolumeMapper.h"

#ifdef _MSC_VER
#pragma warning (push, 2)
#endif

#include <vector>
#include <map>
#include <algorithm>

#ifdef _MSC_VER
#pragma warning(pop)
#endif

typedef vtkstd::vector< vtkSmartPointer<vtkRenderWindow> > WindowsTypeBase;
typedef vtkstd::map< vtkSmartPointer<vtkProcessObject>,
                     vtkPushPipelineProcessInfo*> ProcessMapTypeBase;
typedef vtkstd::map< vtkSmartPointer<vtkDataObject>,
                     vtkPushPipelineDataInfo* > DataMapTypeBase;
class vtkPushPipelineWindowsType: public WindowsTypeBase {};
class vtkPushPipelineProcessMapType: public ProcessMapTypeBase {};
class vtkPushPipelineDataMapType: public DataMapTypeBase {};

class vtkPushPipelineProcessInfo {
public:
  // an input is ready if it has new data
  int AreAllInputsReady(vtkPushPipeline *pp);
  int IsInputReady(int i, vtkPushPipeline *pp);
  // an output is ready if its last results were consumed
  int AreAllOutputsReady(vtkPushPipeline *pp);
  int IsOutputReady(int o, vtkPushPipeline *pp);
  void ConsumeAllInputs(vtkPushPipeline *pp);
  void ConsumeInput(int i, vtkPushPipeline *pp);    
  void ProduceOutputs(vtkPushPipeline *);
  vtkPushPipelineProcessInfo();
  int ExecutionToOutputRatio;
  int NumberProcessed;
  void ProcessSomeData(vtkPushPipeline *);
  int Marked;
  int InputToExecutionRatio[VTK_PP_MAX_INPUTS];
  vtkProcessObject *ProcessObject;
};
  
class vtkPushPipelineDataInfo {
public:
  int IsConsumerLeft(vtkProcessObject *);
  int IsWindowConsumerLeft(vtkRenderWindow *);
  void ConsumeData(vtkProcessObject *);
  void ConsumeWindow(vtkRenderWindow *);
  void FillConsumersLeft();
  vtkPushPipelineDataInfo();
  ~vtkPushPipelineDataInfo();
  vtkstd::vector< vtkSmartPointer<vtkProcessObject> > ConsumersLeft;
  vtkstd::vector< vtkSmartPointer<vtkRenderWindow> > WindowConsumersLeft;
  int Marked;
  vtkDataObject *DataObject;
  vtkstd::vector< vtkSmartPointer<vtkRenderWindow> > WindowConsumers;
};

class vtkPushPipelineConsumeCommand : public vtkCommand
{
public:
  static vtkPushPipelineConsumeCommand *New() { return new vtkPushPipelineConsumeCommand;}
  virtual void Execute(vtkObject *caller, unsigned long, void *)
    {
      vtkProcessObject *po = vtkProcessObject::SafeDownCast(caller);
      if (po && this->PushPipeline)
        {
        vtkPushPipelineProcessInfo *ppi =
          this->PushPipeline->GetPushProcessInfo(po);
        ppi->NumberProcessed++;              
        ppi->ConsumeAllInputs(this->PushPipeline);
        ppi->ProduceOutputs(this->PushPipeline);
        }
    }
  void SetPushPipeline(vtkPushPipeline *p) {
    this->PushPipeline = p; }
  
  vtkPushPipeline *PushPipeline;
};

class vtkPushPipelineEndRunCommand : public vtkCommand
{
public:
  static vtkPushPipelineEndRunCommand *New() { return new vtkPushPipelineEndRunCommand;}
  virtual void Execute(vtkObject *, unsigned long, void *)
    {
      if (this->PushPipeline)
        {
        this->PushPipeline->SetRunState(2);
        }
    }
  void SetPushPipeline(vtkPushPipeline *p) {
    this->PushPipeline = p; }
  
  vtkPushPipeline *PushPipeline;
};

vtkCxxRevisionMacro(vtkPushPipeline, "1.14");
vtkStandardNewMacro(vtkPushPipeline);

{'fraction_non_alphanumeric': 0.12662144472212306, 'fraction_numerical': 0.003094133047721052, 'mean_word_length': 4.981494661921708, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4861291', 'n_tokens_mistral': 2614, 'n_tokens_neox': 2527, 'n_words': 564}