| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Tuple.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_TUPLE_H
2 #define GAUDIALG_TUPLE_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <string>
9
10 // ============================================================================
18 // ============================================================================
19
20 // ============================================================================
28 // ============================================================================
29
30 #include "GaudiKernel/SmartIF.h"
31 #include "GaudiAlg/TupleObj.h"
32
33 namespace Tuples
34 {
35
36 template <class ITEM> class TupleItem ;
37
116 class GAUDI_API Tuple
117 {
118
121 // Tuple() = delete;
122 Tuple();
123
124 public :
129 Tuple ( TupleObj* ) ;
130
132 Tuple ( const Tuple& ) = default;
133
135 virtual ~Tuple() = default;
136
141 Tuple& operator=( const Tuple& ) = default;
142
146 TupleObj* operator-> () const { return tuple () ; }
147
149 bool valid () const { return tuple () ; }
150
151 protected:
152
154 TupleObj* tuple() const { return m_tuple.get() ; }
155
156 private:
157
159 SmartIF<TupleObj> m_tuple;
160
161 };
162
275 template<class ITEM>
276 class TupleColumn
277 {
278 public:
279 TupleColumn() = delete;
280 TupleColumn ( std::string name ,
281 ITEM value )
282 : m_name ( std::move(name) ) , m_value ( std::move(value) ) {}
283
285 const std::string& name () const { return m_name ; }
287 const ITEM& value () const { return m_value ; }
288 private:
289 std::string m_name ;
290 ITEM m_value ;
291 };
292
296 template<class ITEM>
297 inline TupleColumn<ITEM>
298 make_column ( std::string name , const ITEM& item )
299 { return TupleColumn<ITEM> ( std::move(name) , item ) ; }
300
304 template<class ITEM>
305 inline TupleColumn<const ITEM*>
306 make_column ( std::string name , const ITEM* item )
307 { return TupleColumn<const ITEM*>( std::move(name) , item ) ; }
308
312 template<class ITEM>
313 inline TupleColumn<ITEM*>
314 make_column ( std::string name , ITEM* item )
315 { return TupleColumn<ITEM*> ( std::move(name) , item ) ; }
316
317 template<class ITEM>
318 inline TupleColumn<ITEM>
319 Column ( std::string name , const ITEM& item )
320 { return make_column ( std::move(name) , item ) ; }
321
322 template<class ITEM>
323 inline TupleColumn<const ITEM*>
324 Column ( std::string name , const ITEM* item )
325 { return make_column ( std::move(name) , item ) ; }
326
327 template<class ITEM>
328 inline TupleColumn<ITEM*>
329 Column ( std::string name , ITEM* item )
330 { return make_column ( std::move(name) , item ) ; }
331
332 } // end of the namespace Tuples
333
334 // ============================================================================
336 // ============================================================================
337 template <class ITEM>
338 inline Tuples::Tuple& operator<<
339 ( Tuples::Tuple& tuple ,
340 const Tuples::TupleColumn<ITEM>& item )
341 {
342 if ( !tuple.valid() ) { return tuple ; } // no action for invalid tuple
343 tuple->column( item.name() , item.value () ) ;
344 return tuple ;
345 }
346 // ============================================================================
347
348
349
350 // ============================================================================
351 // THe END
352 // ============================================================================
353 #endif // GAUDIALG_TUPLE_H
354 // ============================================================================
SmartIF
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
TupleObj.h
Header file for class TupleObj.
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:285
std
STL namespace.
Tuples::TupleColumn::value
const ITEM & value() const
Return the column value.
Definition: Tuple.h:287
operator=
PropertyMgr & operator=(const PropertyMgr &)=delete
std::string
STL class.
Tuples::Tuple
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: Tuple.h:116
Tuples::TupleColumn::name
const std::string & name() const
Return the column name.
Definition: Tuple.h:285
Tuples::TupleObj
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: TupleObj.h:196
Tuples::make_column
TupleColumn< ITEM > make_column(std::string name, const ITEM &item)
helper function to create &#39;on-the-fly&#39; the helper object Tuples::TupleColumn
Definition: Tuple.h:298
Tuples::TupleColumn::m_value
ITEM m_value
The column value.
Definition: Tuple.h:290
Tuples::Tuple::valid
bool valid() const
check the validity of the tuple object
Definition: Tuple.h:149
SmartIF.h
std::move
T move(T...args)
Tuples::TupleColumn
Helper class which allows to extend the functionality of Tuple with possibility to use your own repre...
Definition: Tuple.h:276
Tuples::Tuple::m_tuple
SmartIF< TupleObj > m_tuple
The tuple object.
Definition: Tuple.h:159
Tuples::TupleItem
Definition: Tuple.h:36
Tuples::Tuple::tuple
TupleObj * tuple() const
Return the underlying tuple object.
Definition: Tuple.h:154
Tuples::TupleColumn::m_name
std::string m_name
The column name.
Definition: Tuple.h:289
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
Tuples::TupleColumn::TupleColumn
TupleColumn(std::string name, ITEM value)
Definition: Tuple.h:280
Tuples::Column
TupleColumn< ITEM > Column(std::string name, const ITEM &item)
Definition: Tuple.h:319
GaudiPython.GaudiAlgs.Tuple
Tuple
Definition: GaudiAlgs.py:1041
Tuples
General namespace for Tuple properties.
Definition: Maps.h:34