All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataHandle.cpp
Go to the documentation of this file.
1 #include "GaudiKernel/DataHandle.h"
2 
3 #include <sstream>
4 #include <map>
5 #include <boost/tokenizer.hpp>
6 #include <boost/algorithm/string.hpp>
7 
8 using namespace Gaudi;
9 
10 namespace Gaudi {
11  namespace Parsers {
12 
13  StatusCode
14  parse(DataHandle& v, const std::string& s)
15  {
16  // Just a placeholder: currently the properties only contain
17  // the key
18 
19  std::string k(s);
20  boost::erase_all(k,"'");
21 
22  v.updateKey( k );
23 
24  return StatusCode::SUCCESS;
25  }
26 
27  } //> ns Parsers
28 
29  namespace Utils {
30 
31  std::ostream&
32  toStream(const DataHandle& v, std::ostream& o)
33  {
34  o << "'" << v.objKey() << "'";
35  return o;
36  }
37 
38  } //> ns Utils
39 
40 } //> ns Gaudi
41 
43  DataHandle& ref )
44  : Property( name, typeid( DataHandle ) ),
45  m_pValue( &ref )
46 {}
47 
49 {}
50 
52 DataHandleProperty::fromString(const std::string& s)
53 {
54  if (!Gaudi::Parsers::parse(*m_pValue, s).isSuccess()) {
55  return StatusCode::FAILURE;
56  }
57  return useUpdateHandler()
60 }
61 
62 bool
64 {
65  m_pValue->operator=(value);
66  return useUpdateHandler();
67 }
68 
69 std::string
71 {
73  std::ostringstream o;
75  return o.str();
76 }
77 
78 void
79 DataHandleProperty::toStream(std::ostream& out) const
80 {
82  out << this->toString();
83 }
84 
const Gaudi::DataHandle & value() const
Definition: DataHandle.h:151
virtual void toStream(std::ostream &out) const
value -> stream
Definition: DataHandle.cpp:79
virtual void useReadHandler() const
use the call-back function at reading
Definition: Property.cpp:80
virtual const std::string & objKey() const
Definition: DataHandle.h:40
bool setValue(const Gaudi::DataHandle &value)
Definition: DataHandle.cpp:63
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
virtual std::string toString() const
value -> string
Definition: DataHandle.cpp:70
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
Definition: ToStream.h:319
virtual ~DataHandleProperty()
Destructor:
Definition: DataHandle.cpp:48
virtual bool useUpdateHandler()
use the call-back function at update
Definition: Property.cpp:92
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
DataHandleProperty(const std::string &name, Gaudi::DataHandle &ref)
Constructor with parameters:
Definition: DataHandle.cpp:42
virtual void updateKey(const std::string &key)
Definition: DataHandle.h:38
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
string s
Definition: gaudirun.py:245
virtual StatusCode fromString(const std::string &s)
string -> value
Definition: DataHandle.cpp:52
Gaudi::DataHandle * m_pValue
Pointer to the real property.
Definition: DataHandle.h:117
Helper functions to set/get the application return code.
Definition: __init__.py:1