This file is indexed.

/usr/include/BALL/CONCEPT/property.h is in libball1.4-dev 1.4.1+20111206-3.

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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: property.h,v 1.40 2005/12/23 17:01:41 amoll Exp $
//

#ifndef BALL_CONCEPT_PROPERTY_H
#define BALL_CONCEPT_PROPERTY_H

#ifndef BALL_COMMON_H
#	include <BALL/common.h>
#endif

#ifndef BALL_DATATYPE_BITVECTOR_H
#	include <BALL/DATATYPE/bitVector.h>
#endif

#ifndef BALL_CONCEPT_PERSISTENTOBJECT_H
#	include <BALL/CONCEPT/persistentObject.h>
#endif

#include <iostream>

#include <boost/shared_ptr.hpp>
#include <boost/any.hpp>

namespace BALL 
{

	/**	@name	Properties
	 	 \ingroup ConceptsMiscellaneous
	*/
	//@{
	
	/** Named Property Class.
			
	*/
	class BALL_EXPORT NamedProperty
		:	public PersistentObject
	{
		public:

		BALL_CREATE(NamedProperty)

		/**	@name Enums
		*/
		//@{
		/**	The different types of data a NamedProperty may contain.
				
		*/
		enum Type
		{
			/**	Bool-type properties can have the value <b>true</b> or 
					<b>false</b>.
			*/
			BOOL,

			/** Int-type properties contain a variable of type <b>int</b>
			*/
			INT,

			/** Unsigned-int-type properties contain a variable of type 
					<b>unsigned int</b>
			*/
			UNSIGNED_INT,

			/**	Float-type properties contain a variable of type <b>double</b>
			*/
			FLOAT,

			/**	Double-type properties contain a variable of type <b>double</b>
			*/
			DOUBLE,

			/** String-type properties contain a pointer to a string.
					When destructing the property, the string is destructed, too.
			*/
			STRING,

			/**	Object-type properties contain a pointer to a PersistentObject.
					Remember to destruct the objects if they are not needed any more!
					the Destructor of NamedProperty will not delete this object!
			*/
			OBJECT,

			/** Properties of this type do not contain any data.
					Use this type to indicate that an object has a certain property.
					The type can be seen as an extension of the bit properties 
					used in PropertyManager except for the user-defined name.
			*/
			NONE,

			/**	Object-type properties contain a smart pointer to a PersistentObject.
			    Here, destruction will autmatically be handled by the smart pointer
					implementation.
			 */
			SMART_OBJECT
		};
		
		//@}
		/**	@name	Constructors and Destructors 
		*/
		//@{

		/*	The default constructor
		*/
		NamedProperty();

		/**	Standard constructor.
				Creates an object of type NONE. Use this constructor to create
				it properties with user defined names.
				The <tt>Type</tt> is set to  \link OBJECT OBJECT \endlink .
				@param	name the propertie's name
		*/
		NamedProperty(const string& name);

		/**	Constructor for bool-type properties.
				Creates a NamedProperty object containing a boolean value.
				The <tt>Type</tt> is set to  \link BOOL BOOL \endlink .
				@param	name the property's name
				@param	value the boolean value stored in the property
		*/	
		NamedProperty(const string& name, bool value);

		/**	Constructor for int-type properties.
				Creates a NamedProperty object containing a signed int value.
				The <tt>Type</tt> is set to  \link INT INT \endlink .
				@param	name the property's name
				@param	value the int value stored in the property
		*/
		NamedProperty(const string& name, int value);

		/** Constructor for unsigned int-type properties.
				Creates a NamedProperty object containing an unsigned int value.
				The <tt>Type</tt> is set to  \link UNSIGNED_INT UNSIGNED_INT \endlink .
				@param	name the property's name
				@param	value the int value stored in the property
		*/
		NamedProperty(const string& name, unsigned int value);

		/** Constructor for float-type properties.
				Creates a NamedProperty object containing a float value.
				The <tt>Type</tt> is set to  \link FLOAT FLOAT \endlink .
				@param	name the property's name
				@param	value the float value stored in the property
		*/
		NamedProperty(const string& name, float value);

		/** Constructor for double-type properties.
				Creates a NamedProperty object containing a double value.
				The <tt>Type</tt> is set to  \link DOUBLE DOUBLE \endlink .
				@param	name the property's name
				@param	value the double value stored in the property
		*/
		NamedProperty(const string& name, double value);

		/** Constructor for string-type properties.
				Objects of type STRING contain a pointer to a string
				object. This object is constructed as a copy of <tt>str</tt>
				The <tt>Type</tt> is set to  \link STRING STRING \endlink .
				@param	name the property's name
				@param	str the string stored in the property
		*/
		NamedProperty(const string& name, const string& str);

		/**	Constructor for object-type properties.
				Creates a NamedProperty object containing a 
				pointer to a persistent object.
				The <tt>Type</tt> is set to  \link OBJECT OBJECT \endlink .
				@param	name the property's name
				@param	po a reference to the persistent object stored in the property
		*/
		NamedProperty(const string& name, PersistentObject& po);

		/**	Constructor for smart-pointer handled object-type properties.
				Creates a NamedProperty object containing a 
				smart pointer to a persistent object.
				The <tt>Type</tt> is set to  \link SMART_OBJECT SMART_OBJECT \endlink .
				@param	name the property's name
				@param	ptr a smart pointer to the persistent object
		*/
		NamedProperty(const string& name, boost::shared_ptr<PersistentObject>& po);

		/**	Copy constructor
		*/
		NamedProperty(const NamedProperty&);

		/**
		 * Copy constructor with renaming
		 */
		NamedProperty(const NamedProperty&, const string& name);

		/**	Destructor .
				The destructor destructs the contained data in the case of STRING-type 
				properties only.
		*/
		~NamedProperty();

		/** Clear method
		*/
		virtual void clear();
		
		//@}	
		/**	@name Persistence
		*/
		//@{
			
		/**	Write a persistent copy of the object.
				\throws Exception::GeneralException
		*/
    virtual void persistentWrite(PersistenceManager& pm, const char* name = "") const;

		/**	Retrieve a persistent copy of the object
			  \throws Exception::GeneralException
		*/
    virtual void persistentRead(PersistenceManager& pm);
		
		//@}
		/**	@name	 Accessors 
		*/
		//@{

		/// Return the type of the data stored in the property object
		Type getType() const;
		
		/// Return the name of the property
		const string& getName() const;

		/** Return the data of the property object as bool.
				If the property object is not of BOOL type, <b>false</b>
				is returned.
		*/
		bool getBool() const;

		/** Return the data of the property object as int.
				If the property object is not of INT type, <b>0</b>
				is returned.
		*/
		int getInt() const;
			
		/** Return the data of the property object as float.
				If the property object is not of FLOAT type, <b>0.0</b>
				is returned.
		*/
		float getFloat() const;
			
		/** Return the data of the property object as double.
				If the property object is not of DOUBLE type, <b>0.0</b>
				is returned.
		*/
		double getDouble() const;
			
		/** Return the data of the property object as unsigned int.
				If the property object is not of UNSIGNED_INT type, <b>0</b>
				is returned.
		*/
		unsigned int getUnsignedInt() const;

		/** Return the data of the property object as a pointer to a PersistentObject.
				If the property object is not of OBJECT type, <b>0</b>
				is returned.
		*/
		PersistentObject* getObject() const;

		/** Return the data of the property object as a smart pointer to a PersistentObject.
				If the property object is not of SMART_OBJECT type, <b>0</b>
				is returned.
		*/
		boost::shared_ptr<PersistentObject> getSmartObject() const;

		/** Return the data of the property object as a string.
				If the property object is not of STRING type, <b>""</b>
				is returned.
		*/
		String getString() const;
		
		/** Converts the data contained in this NamedProperty to a string and returns it. \n
		Note that this function is intended as a convenience and does NOT depend on the type of the data (in constrast to getString()). */
		String toString() const;

		//@}

		/**	@name	Predicates */
		//@{

		/** Equality operator
				Two instances are equal if they have the same name and the same value.
		*/
		bool operator == (const NamedProperty& np) const;

		/** Inequality operator
				@see operator ==
		*/
		bool operator != (const NamedProperty& np) const;

		/** copy operator */
		void operator = (const NamedProperty& np);

		//@}

		private:

		/*_	The kind of information contained in the NamedProperty
		*/
		Type type_;

		/*_	The name of the property object 
		*/
		string name_;
		
		/*_	The data
		*/
		boost::any data_;

	};

	typedef std::vector<NamedProperty>::iterator NamedPropertyIterator;

	/**	Property Manager class.
			This class manages properties of a class.
			A property can be seen as easy way to extend the
			class BALL_EXPORT' attributes without changing its interface.
			There are different types of properties defined depending 
			on the kind of data stored. The simplest kind of property 
			is just stored as a boolean information: Either an object <b>  has </b>
			a certain property, or it does not. These properties are obviously coded 
			as a BitVector. However the meaning of the different bits has to be
			defined and the uniqueness of this meaning has to be guaranteed. In
			order to avoid this, all kernel classes derived from PropertyManager
			contain a public enum that defines a value NUMBER_OF_PROPERTIES. All
			user defined properties should	refer to this constant (e.g. by
			defining <tt>MY_PROPERTY = Molecule::NUMBER_OF_PROPERTIES + 1</tt>).
			 \par
			The second way of storing properties is much more flexible, but less
			efficient.  It uses the class NamedProperty that also allows to store
			additional information along with the property. In this case, each
			property is accessed via a unique name.
			 \par
			<b>Interface:</b> Storable
			 \par
			
	*/
	class BALL_EXPORT PropertyManager
	{
		public:
		
		BALL_CREATE(PropertyManager)

		/**	@name	Constructors and Destructors */
		//@{

		BALL_INLINE 

		/// Default constructor
		PropertyManager();

		BALL_INLINE
		/// Copy constructor
		PropertyManager(const PropertyManager& property_manager);

		/// Destructor
		virtual ~PropertyManager();

		/// Clears all properties
		virtual void clear();

		/// Clears all properties
		virtual void destroy();

		//@}
		/**	@name	Assignment 
		*/
		//@{

		/** Assign properties from another property manager
				@param property_manager the PropertyManager object to copy from
		*/
		void set(const PropertyManager& property_manager);

		/** Assignment operator.
				This operator calls <tt>set(property_manager)</tt> to assign
				a new object.
				@param property_manager the PropertyManager object to copy from
				@return PropertyManager <tt>*this</tt>
		*/
		const PropertyManager& operator = (const PropertyManager& property_manager);

		/** Assign properties to another property manager.
				This method copies the contents of the PropertyManager object
				to the given <tt>property_manager</tt>.
				@param	property_manager the target object
		*/
		void get(PropertyManager& property_manager) const;

		/** Swap the properties with another property manager.
				@param property_manager the PropertyManager object to swap the properties with
		*/
		void swap(PropertyManager& property_manager);

		//@}
		/**	@name	Accessors 
		*/
		//@{
			 
		/** Return a mutable reference to the bit vector.
				This method returns the bit vector containing the unnamed properties
				of the property manager.
				@return BitVector& a mutable reference to the (private) BitVector containing 
					the unnamed properties
		*/
		BitVector& getBitVector();

		/** Return a const reference to the bit vector containing the unnamed properties.
				This method returns the bit vector containing the unnamed properties
				of the property manager.
				@return BitVector& a const reference to the (private) BitVector containing 
					the unnamed properties
		*/
		const BitVector& getBitVector() const;
			
		//@}
		/**	@name Converters 
		*/
		//@{

		/** Converter to BitVector.	
				This operator converts a PropertyManager object to a BitVector
				object containing the unnamed properties.
				@return BitVector& a reference to the BitVector containing the
					unnamed properties of the property manager
		*/
		operator BitVector& ();

		//@}
		/**	@name	Handling unnamed bit properties 
		*/
		//@{

		/** Set a property.
				This method sets an unnamed property of a PropertyManager object by
				calling <tt>BitVector::setBit(property)</tt> for the private bit vector.
				@param property the number of the property to be set
		*/
		void setProperty(Property property);

		/** Clear a property.
				This method clears an unnamed property of a PropertyManager object by
				calling <tt>BitVector::clearBit(property)</tt> for the private bit vector.
				@param property the number of the property to be cleared
		*/
		void clearProperty(Property property);

		/** Toggle (invert) a property.
				This method clears an unnamed property of a PropertyManager object by
				calling <tt>BitVector::toggleBit(property)</tt> for the private bit vector.
				@param property the number of the property to be toggled
		*/
		void toggleProperty(Property property);

		/** Count all properties.
				This method returns the sum of unnamed and named properties.
				It counts the number of <b>  ones </b> in the bit vector
				and the number of properties stored in the named property vector.
		*/
		Size countProperties() const;
	
		//@}

		/**	@name	Handling named properties 
				PropertyManager contains an vector of  \link NamedProperty NamedProperty \endlink  objects.
				Each of the NamedProeprty objects has to have a <b>  unique </b> name.
				The setProperty methods ensure the uniqueness of this name.
				If a setProperty method is called for an existing name, the
				existing object is destructed prior to the insertion of the new object.
		*/
		//@{

		/**	Non-mutable access to a named property by its index.
				\throws Exception::IndexOverflow
		*/
		const NamedProperty& getNamedProperty(Position index) const;

		/**	Mutable access to a named property by its index.
				\throws Exception::IndexOverflow
		*/
		NamedProperty& getNamedProperty(Position index);

		/**	Set a named property.
				This method adds a new named property to the property manager's 
				array of named properties or substitutes an already existing
				named property by <tt>property</tt>. If a property with the same name as 
				<tt>property</tt> already exists, it is destructed.
				@param	property the new property to be set
		*/
		void setProperty(const NamedProperty& property);

		/**	Set a named property without any data.
				This method creates a new named property not containing any data
				(<tt>NamedProperty::Type == NONE</tt>).
				Already existing data using the same <tt>name</tt> is overwritten.
				@param	name the name to be used for the new property
		*/
		void setProperty(const string& name);

		/**	Set a named property containing boolean data.
				This method creates a new named property containing boolean
				data (<tt>NamedProperty::Type == BOOL</tt>).
				Already existing data using the same <tt>name</tt> is overwritten.
				@param	name the name to be used for the new property
				@param	value the boolean value 
		*/
		void setProperty(const string& name, bool value);

		/**	Set a named property containing a signed integer number.
				This method creates a new named property containing an 
				int (<tt>NamedProperty::Type == INT</tt>).
				Already existing data using the same <tt>name</tt> is overwritten.
				@param	name the name to be used for the new property
				@param	value the data 
		*/
		void setProperty(const string& name, int value);

		/**	Set a named property containing an unsigned integer number.
				This method creates a new named property containing an 
				unsigned int (<tt>NamedProperty::Type == UNSIGNED_INT</tt>).
				Already existing data using the same <tt>name</tt> is overwritten.
				@param	name the name to be used for the new property
				@param	value the data 
		*/
		void setProperty(const string& name, unsigned int value);

		/**	Set a named property containing a floating point number.
				This method creates a new named property containing a
				floating point number (<tt>NamedProperty::Type == FLOAT</tt>).
				Already existing data using the same <tt>name</tt> is overwritten.
				@param	name the name to be used for the new property
				@param	value the data 
		*/
		void setProperty(const string& name, float value);

		/**	Set a named property containing a double-precision floating point number.
				This method creates a new named property containing a
				floating point number (<tt>NamedProperty::Type == DOUBLE</tt>).
				Already existing data using the same <tt>name</tt> is overwritten.
				@param	name the name to be used for the new property
				@param	value the data 
		*/
		void setProperty(const string& name, double value);

		/**	Set a named property containing a string.
				This method creates a new named property containing a
				string (<tt>NamedProperty::Type == STRING</tt>).
				Already existing data using the same <tt>name</tt> is overwritten.
				@param	name the name to be used for the new property
				@param	value the data 
		*/
		void setProperty(const string& name, const string& value);

		/**	Set a named property containing a PersistentObject.
				This method creates a new named property containing a
				string (<tt>NamedProperty::Type == OBJECT</tt>).
				Already existing data using the same <tt>name</tt> is overwritten.
				@param	name the name to be used for the new property
				@param	value the data 
		*/
		void setProperty(const string& name, const PersistentObject& value);

		/**	Retrieve a named property.
				If the property manager contains a property named <tt>name</tt>
				this property is returned. An empty property is returned
				otherwise.
				@param	name the name of the proeprty to be retrieved
		*/
		const NamedProperty& getProperty(const string& name) const;

		/** Return an iterator to the first NamedProperty stored in this container. */
		NamedPropertyIterator beginNamedProperty();

		/** Return an iterator past the last NamedProperty stored in this container. */
		NamedPropertyIterator endNamedProperty();

		/**	Remove a named property.
				If the named property <tt>name</tt> does exist, it is remove from
				the array of properties.
				@param name the name of the property to be removed
		*/
		void clearProperty(const string& name);

		/**	Return the number of named properties.
				@return Size the number of named properties stored in the ProprtyManager object
		*/
		Size countNamedProperties() const;
		//@}

		/**	@name	Predicates 
		*/
		//@{
		/// Query for an unnamed property
		bool hasProperty(Property property) const;

		/// Query for a named property
		bool hasProperty(const string& name) const;

		/** Equality operator
				Two instances are equal if they have the same named and unnamed properties.
		*/
		bool operator == (const PropertyManager& pm) const;

		/// Inequality operator
		bool operator != (const PropertyManager& pm) const;

		//@}


		/**	@name Storable Interface
		*/
		//@{
		///	Persistent stream writing.
		void write(PersistenceManager& pm) const;

		///	Persistent stream reading.
		bool read(PersistenceManager& pm);
		//@}

		/**	@name	Debugging and Diagnostics 
		 */
		//@{

		/**	Test if instance is valid.
				Returns true if the bitvector is valid.
				@return bool <b>true</b>
		*/
		bool isValid() const;
	
		/** Internal state dump.
				Dump the current internal state of {\em *this} to 
				the output ostream <b>  s </b> with dumping depth <b>  depth </b>.
				@param   s - output stream where to output the internal state of {\em *this}
				@param   depth - the dumping depth
		*/
		void dump(std::ostream& s = std::cout, Size depth = 0) const;
		
		//@}

		private:

		BitVector bitvector_;
		std::vector<NamedProperty> named_properties_;
	};

	//@}

#	ifndef BALL_NO_INLINE_FUNCTIONS
#		include <BALL/CONCEPT/property.iC>
#	endif

} // namespace BALL

#endif // BALL_CONCEPT_PROPERTY_H