This file is indexed.

/usr/include/classad/operators.h is in libclassad-dev 8.4.2~dfsg.1-1build1.

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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
/***************************************************************
 *
 * Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
 * University of Wisconsin-Madison, WI.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License.  You may
 * obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************/


#ifndef __CLASSAD_OPERATORS_H__
#define __CLASSAD_OPERATORS_H__

#include "classad/exprTree.h"

namespace classad {

/** Represents a node of the expression tree which is an operation applied to
	expression operands, like 3 + 2
*/
class Operation : public ExprTree
{
  	public:
		/// List of supported operators 
		enum OpKind
		{
			/** No op */ __NO_OP__,              // convenience

			__FIRST_OP__,

			__COMPARISON_START__    = __FIRST_OP__,
			/** @name Strict comparison operators */
			//@{
			/** Less than operator  */ LESS_THAN_OP = __COMPARISON_START__,
			/** Less or equal       */  LESS_OR_EQUAL_OP,       // (comparison)
			/** Not equal           */  NOT_EQUAL_OP,           // (comparison)
			/** Equal               */  EQUAL_OP,               // (comparison)
			/** Greater or equal    */  GREATER_OR_EQUAL_OP,    // (comparison)
			/** Greater than        */  GREATER_THAN_OP,        // (comparison)
			//@}

			/** @name Non-strict comparison operators */
			//@{
			/** Meta-equal (same as IS)*/ META_EQUAL_OP,        // (comparison)
			/** Is                  */  IS_OP= META_EQUAL_OP,   // (comparison)
			/** Meta-not-equal (same as ISNT) */META_NOT_EQUAL_OP,//(comparison)
			/** Isnt                */  ISNT_OP=META_NOT_EQUAL_OP,//(comparison)
			//@}
			__COMPARISON_END__      = ISNT_OP,

			__ARITHMETIC_START__,
			/** @name Arithmetic operators */
			//@{
			/** Unary plus          */  UNARY_PLUS_OP = __ARITHMETIC_START__,
			/** Unary minus         */  UNARY_MINUS_OP,         // (arithmetic)
			/** Addition            */  ADDITION_OP,            // (arithmetic)
			/** Subtraction         */  SUBTRACTION_OP,         // (arithmetic)
			/** Multiplication      */  MULTIPLICATION_OP,      // (arithmetic)
			/** Division            */  DIVISION_OP,            // (arithmetic)
			/** Modulus             */  MODULUS_OP,             // (arithmetic)
			//@}
			__ARITHMETIC_END__      = MODULUS_OP,

			__LOGIC_START__,
			/** @name Logical operators */
			//@{
			/** Logical not         */  LOGICAL_NOT_OP = __LOGIC_START__,
			/** Logical or          */  LOGICAL_OR_OP,          // (logical)
			/** Logical and         */  LOGICAL_AND_OP,         // (logical)
			//@}
			__LOGIC_END__           = LOGICAL_AND_OP,

			__BITWISE_START__,
			/** @name Bitwise operators */
			//@{
			/** Bitwise not         */  BITWISE_NOT_OP = __BITWISE_START__,
			/** Bitwise or          */  BITWISE_OR_OP,          // (bitwise)
			/** Bitwise xor         */  BITWISE_XOR_OP,         // (bitwise)
			/** Bitwise and         */  BITWISE_AND_OP,         // (bitwise)
			/** Left shift          */  LEFT_SHIFT_OP,          // (bitwise)
			/** Right shift         */  RIGHT_SHIFT_OP,         // (bitwise)
			/** Unsigned right shift */ URIGHT_SHIFT_OP,        // (bitwise)
			//@}
			__BITWISE_END__         = URIGHT_SHIFT_OP,

			__MISC_START__,
			/** @name Miscellaneous operators */
			//@{
			/** Parentheses         */  PARENTHESES_OP = __MISC_START__,
			/** Subscript           */  SUBSCRIPT_OP,           // (misc)
			/** Conditional op      */  TERNARY_OP,             // (misc)
			//@}
			__MISC_END__            = TERNARY_OP,

			__LAST_OP__             = __MISC_END__
		};

#ifdef TJ_REFACTOR
        /// Copy Constructor
        Operation(const Operation &op);
#endif

		/// Destructor
		virtual ~Operation ();

#ifdef TJ_REFACTOR
        /// Assignment operator
        Operation &operator=(const Operation &op);
#endif

		/// node type
		virtual NodeKind GetKind (void) const { return OP_NODE; }
#ifdef TJ_REFACTOR
#else
		virtual OpKind GetOpKind(void) const { return __NO_OP__; }
#endif

		/** Factory method to create an operation expression node
			@param kind The kind of operation.
			@param e1 The first sub-expression child of the node.
			@param e2 The second sub-expression child of the node (if any).
			@param e3 The third sub-expression child of the node (if any).
			@return The constructed operation
		*/
		static Operation *MakeOperation(OpKind kind,ExprTree*e1=NULL,
					ExprTree*e2=NULL, ExprTree*e3=NULL);

		/** Deconstructor to obtain the components of an operation node
			@param kind The kind of operation.
			@param e1 The first sub-expression child of the node.
			@param e2 The second sub-expression child of the node (if any).
			@param e3 The third sub-expression child of the node (if any).
		*/
#ifdef TJ_REFACTOR
		void GetComponents( OpKind&, ExprTree*&, ExprTree*&, ExprTree *& )const;
#else
		virtual void GetComponents( OpKind&, ExprTree*&, ExprTree*&, ExprTree *& )const;
#endif

		// public access to operation function
		/** Convenience method which operates on binary operators.
			@param op The kind of operation.
			@param op1 The first operand.
			@param op2 The second operand.
			@param result The result of the operation.
			@see OpKind, Value
		*/
		static void Operate (OpKind op, Value &op1, Value &op2, Value &result);

		/** Convenience method which operates on ternary operators.
			@param op The kind of operation.
			@param op1 The first operand.
			@param op2 The second operand.
			@param op3 The third operand.
			@param result The result of the operation.
			@see OpKind, Value
		*/
		static void Operate (OpKind op, Value &op1, Value &op2, Value &op3, 
			Value &result);

		/** Predicate which tests if an operator is strict.
			@param op The operator to be tested.
			@return true if the operator is strict, false otherwise.
		*/
		static bool IsStrictOperator( OpKind );

		/** Gets the precedence level of an operator.  Higher precedences
		 * 	get higher values.  (See K&R, p.53)
		 * 	@param op The operator to get the precedence of
		 * 	@return The precedence level of the operator.
		 */
		static int PrecedenceLevel( OpKind );

		/// Make a deep copy of the expression
		virtual ExprTree* Copy( ) const;

#ifdef TJ_REFACTOR
        bool CopyFrom(const Operation &op);
#endif

        virtual bool SameAs(const ExprTree *tree) const;

        friend bool operator==(const Operation &op1, const Operation &op2);

	protected:
		/// Constructor
#ifdef TJ_REFACTOR
		Operation ();
#else
		Operation() {};
#endif

  	private:
#ifdef TJ_REFACTOR
        bool SameChild(const ExprTree *tree1, const ExprTree *tree2) const;
#else
        static bool SameChild(const ExprTree *tree1, const ExprTree *tree2);
        static bool SameChildren(const Operation * op1, const Operation * op2);
#endif

		virtual void _SetParentScope( const ClassAd* );
		virtual bool _Evaluate( EvalState &, Value &) const;
		virtual bool _Evaluate( EvalState &, Value &, ExprTree*& ) const;
		virtual bool _Flatten( EvalState&, Value&, ExprTree*&, int* ) const;

			// returns true if result is determined for this operation
			// based on the evaluated arg1
		bool shortCircuit( EvalState &state, Value const &arg1, Value &result ) const;

		// auxillary functionms
		bool combine( OpKind&, Value&, ExprTree*&, 
				int, Value&, ExprTree*, int, Value&, ExprTree* ) const;
		bool flattenSpecials( EvalState &, Value &, ExprTree *& ) const;

		static Operation* MakeOperation( OpKind, Value&, ExprTree* );
		static Operation* MakeOperation( OpKind, ExprTree*, Value& );
		static Value::ValueType coerceToNumber (Value&, Value &);

		enum SigValues { SIG_NONE=0, SIG_CHLD1=1 , SIG_CHLD2=2 , SIG_CHLD3=4 };

		static int _doOperation(OpKind,Value&,Value&,Value&,
								bool,bool,bool,  Value&, EvalState* = NULL);
		static int 	doComparison		(OpKind, Value&, Value&, Value&);
		static int 	doArithmetic		(OpKind, Value&, Value&, Value&);
		static int 	doLogical 			(OpKind, Value&, Value&, Value&);
		static int 	doBitwise 			(OpKind, Value&, Value&, Value&); 
		static int 	doRealArithmetic	(OpKind, Value&, Value&, Value&);
		static int 	doTimeArithmetic	(OpKind, Value&, Value&, Value&);
		static void compareStrings		(OpKind, Value&, Value&, Value&);
		static void compareReals		(OpKind, Value&, Value&, Value&);
		static void compareBools		(OpKind, Value&, Value&, Value&);
		static void compareIntegers		(OpKind, Value&, Value&, Value&);
		static void compareAbsoluteTimes(OpKind, Value&, Value&, Value&);
		static void compareRelativeTimes(OpKind, Value&, Value&, Value&);

		// operation specific information
#ifdef TJ_REFACTOR
		OpKind		operation;
		ExprTree 	*child1;
		ExprTree	*child2;
		ExprTree	*child3;
#else
		//ExprTree 	*child1;
		friend class Operation1;
		friend class OperationParens;
		friend class Operation2;
		friend class Operation3;
#endif
};

#ifdef TJ_REFACTOR
#else

class Operation1 : public Operation
{
	public:
        /// Copy Constructor
		Operation1(const Operation1 &op);

		/// Destructor
		virtual ~Operation1 ();

        /// Assignment operator
        Operation1 &operator=(const Operation1 &op);

		virtual OpKind GetOpKind(void) const { return operation; }

		/** Deconstructor to obtain the components of an operation node
			@param kind The kind of operation.
			@param e1 The first sub-expression child of the node.
			@param e2 The second sub-expression child of the node (if any).
			@param e3 The third sub-expression child of the node (if any).
		*/
		virtual void GetComponents( OpKind&, ExprTree*&, ExprTree*&, ExprTree *& )const;

		/// Make a deep copy of the expression
		virtual ExprTree* Copy( ) const;

	protected:
		/// Constructor
		Operation1 (OpKind op=__NO_OP__, ExprTree *c1=NULL) : child1(c1), operation(op) {};
		friend class Operation;

	private:
		bool flatten( EvalState &, Value &, ExprTree *& ) const;
		ExprTree	*child1;
		OpKind		operation;
};

class OperationParens : public Operation
{
	public:
        /// Copy Constructor
		OperationParens(const Operation1 &op);

		/// Destructor
		virtual ~OperationParens ();

        /// Assignment operator
        OperationParens &operator=(const OperationParens &op);

		virtual OpKind GetOpKind(void) const { return PARENTHESES_OP; }

		/** Deconstructor to obtain the components of an operation node
			@param kind The kind of operation.
			@param e1 The first sub-expression child of the node.
			@param e2 The second sub-expression child of the node (if any).
			@param e3 The third sub-expression child of the node (if any).
		*/
		virtual void GetComponents( OpKind&, ExprTree*&, ExprTree*&, ExprTree *& )const;

		/// Make a deep copy of the expression
		virtual ExprTree* Copy( ) const;

	protected:
		/// Constructor
		OperationParens (ExprTree *c1=NULL) : child1(c1) {};
		friend class Operation;

	private:
		bool flatten( EvalState &, Value &, ExprTree *& ) const;
		ExprTree	*child1;
};

class Operation2 : public Operation
{
	public:
        /// Copy Constructor
		Operation2(const Operation2 &op);

		/// Destructor
		virtual ~Operation2 ();

        /// Assignment operator
        Operation2 &operator=(const Operation2 &op);

		virtual OpKind GetOpKind(void) const { return operation; }

		/** Deconstructor to obtain the components of an operation node
			@param kind The kind of operation.
			@param e1 The first sub-expression child of the node.
			@param e2 The second sub-expression child of the node (if any).
			@param e3 The third sub-expression child of the node (if any).
		*/
		virtual void GetComponents( OpKind&, ExprTree*&, ExprTree*&, ExprTree *& )const;

		/// Make a deep copy of the expression
		virtual ExprTree* Copy( ) const;

	protected:
		/// Constructor
		Operation2 (OpKind op=__NO_OP__, ExprTree *c1=NULL, ExprTree *c2=NULL) : child1(c1), child2(c2), operation(op) {};
		friend class Operation;

	private:
		//virtual bool _Evaluate( EvalState &, Value &) const;
		//virtual bool _Evaluate( EvalState &, Value &, ExprTree*& ) const;
		//virtual bool _Flatten( EvalState&, Value&, ExprTree*&, int* ) const;
		bool flatten( EvalState &, Value &, ExprTree *& ) const;

			// returns true if result is determined for this operation
			// based on the evaluated arg1
		bool shortCircuit( EvalState &state, Value const &arg1, Value &result ) const;

		// auxillary functionms
		bool combine( OpKind&, Value&, ExprTree*&,
				int, Value&, ExprTree*, int, Value&, ExprTree* ) const;
		bool flattenSpecials( EvalState &, Value &, ExprTree *& ) const;

		ExprTree	*child1;
		ExprTree	*child2;
		OpKind		operation;
};

class Operation3 : public Operation
{
	public:
        /// Copy Constructor
		Operation3(const Operation3 &op);

		/// Destructor
		virtual ~Operation3 ();

        /// Assignment operator
        Operation3 &operator=(const Operation3 &op);

		virtual OpKind GetOpKind(void) const { return TERNARY_OP; }

		/** Deconstructor to obtain the components of an operation node
			@param kind The kind of operation.
			@param e1 The first sub-expression child of the node.
			@param e2 The second sub-expression child of the node (if any).
			@param e3 The third sub-expression child of the node (if any).
		*/
		virtual void GetComponents( OpKind&, ExprTree*&, ExprTree*&, ExprTree *& )const;

		/// Make a deep copy of the expression
		virtual ExprTree* Copy( ) const;

			// returns true if result is determined for this operation
			// based on the evaluated arg1
		bool shortCircuit( EvalState &state, Value const &arg1, Value &result ) const;

	protected:
		/// Constructor
		Operation3 (ExprTree *c1=NULL, ExprTree* c2 = NULL, ExprTree *c3 = NULL) : child1(c1), child2(c2), child3(c3) {};
		friend class Operation;

	private:
		//virtual bool _Evaluate( EvalState &, Value &) const;
		//virtual bool _Evaluate( EvalState &, Value &, ExprTree*& ) const;
		//virtual bool _Flatten( EvalState&, Value&, ExprTree*&, int* ) const;
		bool flatten( EvalState &, Value &, ExprTree *& ) const;

		// auxillary functionms
		bool combine( OpKind&, Value&, ExprTree*&,
				int, Value&, ExprTree*, int, Value&, ExprTree* ) const;
		bool flattenSpecials( EvalState &, Value &, ExprTree *& ) const;

		ExprTree	*child1;
		ExprTree	*child2;
		ExprTree	*child3;
};

#endif // TJ_REFACTOR

} // classad

#endif//__CLASSAD_OPERATORS_H__