This file is indexed.

/usr/include/KWWidgets/vtkKWStateMachine.h is in libkwwidgets1-dev 1.0.0~cvs20100930-8.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/*=========================================================================

  Module:    $RCSfile: vtkKWStateMachine.h,v $

  Copyright (c) Kitware, Inc.
  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.

=========================================================================*/
// .NAME vtkKWStateMachine - a state machine.
// .SECTION Description
// This class is the basis for a state machine framework. 
// A state machine is defined by a set of states, a set of inputs and a
// transition matrix that defines for each pair of (state,input) what is
// the next state to assume.
// .SECTION Thanks
// This work is part of the National Alliance for Medical Image
// Computing (NAMIC), funded by the National Institutes of Health
// through the NIH Roadmap for Medical Research, Grant U54 EB005149.
// Information on the National Centers for Biomedical Computing
// can be obtained from http://nihroadmap.nih.gov/bioinformatics.
// .SECTION See Also
// vtkKWStateMachineInput vtkKWStateMachineState vtkKWStateMachineTransition

#ifndef __vtkKWStateMachine_h
#define __vtkKWStateMachine_h

#include "vtkKWObject.h"

class vtkKWStateMachineState;
class vtkKWStateMachineTransition;
class vtkKWStateMachineInput;
class vtkKWStateMachineInternals;
class vtkKWStateMachineCluster;

class KWWidgets_EXPORT vtkKWStateMachine : public vtkKWObject
{
public:
  static vtkKWStateMachine* New();
  vtkTypeRevisionMacro(vtkKWStateMachine, vtkKWObject);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Add a state.
  // Return 1 on success, 0 otherwise.
  virtual int AddState(vtkKWStateMachineState *state);
  virtual int HasState(vtkKWStateMachineState *state);
  virtual int GetNumberOfStates();
  virtual vtkKWStateMachineState* GetNthState(int rank);

  // Description:
  // Add an input.
  // Return 1 on success, 0 otherwise.
  virtual int AddInput(vtkKWStateMachineInput *input);
  virtual int HasInput(vtkKWStateMachineInput *input);
  virtual int GetNumberOfInputs();
  virtual vtkKWStateMachineInput* GetNthInput(int rank);

  // Description:
  // Add a transition. The transition must be complete, i.e. its originating
  // and destination states must be set, as well as its input. Furthermore,
  // said parameters must be known to the state machine, i.e. one should
  // make sure the states and input have been added to the state machine first.
  // Return 1 on success, 0 otherwise.
  virtual int AddTransition(vtkKWStateMachineTransition *transition);
  virtual int HasTransition(vtkKWStateMachineTransition *transition);
  virtual int GetNumberOfTransitions();
  virtual vtkKWStateMachineTransition* GetNthTransition(int rank);

  // Description:
  // Create and add a new transition. If a transition object has already
  // been added with the same parameters, it will be used instead.
  // Return transition on success, NULL otherwise.
  virtual vtkKWStateMachineTransition* CreateTransition(
    vtkKWStateMachineState *origin,
    vtkKWStateMachineInput *input,
    vtkKWStateMachineState *destination);

  // Description:
  // Find a transition.
  // Return transition on success, NULL otherwise.
  virtual vtkKWStateMachineTransition* FindTransition(
    vtkKWStateMachineState *origin,
    vtkKWStateMachineInput *input);
  virtual vtkKWStateMachineTransition* FindTransition(
    vtkKWStateMachineState *origin,
    vtkKWStateMachineInput *input,
    vtkKWStateMachineState *destination);
  
  // Description:
  // Set/Get the initial state.
  // IMPORTANT: This call bootstraps/starts the state machine, it should
  // therefore be the *last* method you call after setting up the whole state
  // machine. No input, state or transition can be added afterwards.
  // Note that the initial state can not be reset.
  // Note that setting the initial state is actually the same as entering
  // it (i.e. the state's Enter() method will be called).
  // Return 1 on success, 0 otherwise.
  vtkGetObjectMacro(InitialState, vtkKWStateMachineState);
  virtual int SetInitialState(vtkKWStateMachineState*);

  // Description:
  // Get if the state machine is actually running.
  // At the moment, this is done by checking if InitialState has been set.
  virtual int IsRunning();

  // Description:
  // Get the current and previous state.
  vtkGetObjectMacro(CurrentState, vtkKWStateMachineState);
  vtkKWStateMachineState* GetPreviousState();

  // Description:
  // Push a new input in the queue of inputs to be processed. 
  virtual void PushInput(vtkKWStateMachineInput *input);

  // Description:
  // Perform the state transition and invoke the corresponding action for
  // every pending input stored in the input queue.
  // For each input in the queue:
  // - a transition T is searched accepting the current state C and the input,
  // - if found:
  //    - T's Start() method is triggered,
  //    - C's Leave() method is triggered,
  //    - T is pushed to the history (see GetNthTransitionInHistory),
  //    - C becomes T's DestinationState (i.e. current state = new state),
  //    - CurrentStateChangedCommand and CurrentStateChangedEvent are invoked,
  //    - C (i.e. T's DestinationState)'s Enter() method is triggered,
  //    - T's End() method is triggered.
  virtual void ProcessInputs();

  // Description:
  // The state machine keeps an history of all the transitions that were 
  // applied so far.
  virtual int GetNumberOfTransitionsInHistory();
  virtual vtkKWStateMachineTransition* GetNthTransitionInHistory(int rank);

  // Description:
  // Add a cluster. Clusters are not used by the state machine per se, they
  // are just a convenient way to group states logically together, and can
  // be used by state machine writers (see vtkKWStateMachineDOTWriter)
  // to display clusters as groups.
  // Return 1 on success, 0 otherwise.
  virtual int AddCluster(vtkKWStateMachineCluster *cluster);
  virtual int HasCluster(vtkKWStateMachineCluster *cluster);
  virtual int GetNumberOfClusters();
  virtual vtkKWStateMachineCluster* GetNthCluster(int rank);

  // Description:
  // Specifies a command to associate with this state machine. This command is 
  // invoked when the state machine current state has changed.
  // The 'object' argument is the object that will have the method called on
  // it. The 'method' argument is the name of the method to be called and any
  // arguments in string form. If the object is NULL, the method is still
  // evaluated as a simple command. 
  virtual void SetCurrentStateChangedCommand(
    vtkObject *object, const char *method);
  virtual void InvokeCurrentStateChangedCommand();
  virtual int HasCurrentStateChangedCommand();

  // Description:
  // Events. The CurrentStateChangedCommand is invoked when the state machine 
  // current state has changed.
  //BTX
  enum
  {
    CurrentStateChangedEvent = 10000
  };
  //ETX

protected:
  vtkKWStateMachine();
  ~vtkKWStateMachine();

  vtkKWStateMachineState *InitialState;
  vtkKWStateMachineState *CurrentState;

  // Description:
  // Remove state(s).
  virtual void RemoveState(vtkKWStateMachineState *state);
  virtual void RemoveAllStates();

  // Description:
  // Remove input(s).
  virtual void RemoveInput(vtkKWStateMachineInput *input);
  virtual void RemoveAllInputs();

  // Description:
  // Remove transition(s).
  virtual void RemoveTransition(vtkKWStateMachineTransition *transition);
  virtual void RemoveAllTransitions();

  // Description:
  // Remove cluster(s).
  virtual void RemoveCluster(vtkKWStateMachineCluster *cluster);
  virtual void RemoveAllClusters();

  // PIMPL Encapsulation for STL containers
  //BTX
  vtkKWStateMachineInternals *Internals;
  //ETX

  // Description:
  // Process one input.
  virtual void ProcessInput(vtkKWStateMachineInput *input);

  char *CurrentStateChangedCommand;

  // Description:
  // Push transition to the history.
  virtual void PushTransitionToHistory(vtkKWStateMachineTransition*);

private:

  vtkKWStateMachine(const vtkKWStateMachine&); // Not implemented
  void operator=(const vtkKWStateMachine&); // Not implemented
};

#endif