XRootD
XrdCl::PropertyList Class Reference

A key-value pair map storing both keys and values as strings. More...

#include <XrdClPropertyList.hh>

+ Collaboration diagram for XrdCl::PropertyList:

Public Types

typedef std::map< std::string, std::string > PropertyMap
 

Public Member Functions

PropertyMap::const_iterator begin () const
 Get the begin iterator. More...
 
void Clear ()
 Clear the property list. More...
 
PropertyMap::const_iterator end () const
 Get the end iterator. More...
 
template<typename Item >
Item Get (const std::string &name) const
 
template<>
XRootDStatus Get (const std::string &name) const
 
template<typename Item >
bool Get (const std::string &name, Item &item) const
 
template<typename Item >
Item Get (const std::string &name, uint32_t index) const
 
template<typename Item >
bool Get (const std::string &name, uint32_t index, Item &item) const
 
template<>
bool Get (const std::string &name, URL &item) const
 
template<>
bool Get (const std::string &name, XRootDStatus &item) const
 
bool HasProperty (const std::string &name) const
 Check if we now about the given name. More...
 
bool HasProperty (const std::string &name, uint32_t index) const
 Check if we know about the given name and index. More...
 
template<typename Item >
void Set (const std::string &name, const Item &value)
 
template<>
void Set (const std::string &name, const URL &item)
 
template<>
void Set (const std::string &name, const XRootDStatus &item)
 
template<typename Item >
void Set (const std::string &name, uint32_t index, const Item &value)
 

Detailed Description

A key-value pair map storing both keys and values as strings.

Definition at line 40 of file XrdClPropertyList.hh.

Member Typedef Documentation

◆ PropertyMap

typedef std::map<std::string, std::string> XrdCl::PropertyList::PropertyMap

Definition at line 43 of file XrdClPropertyList.hh.

Member Function Documentation

◆ begin()

PropertyMap::const_iterator XrdCl::PropertyList::begin ( ) const
inline

Get the begin iterator.

Definition at line 160 of file XrdClPropertyList.hh.

161  {
162  return pProperties.begin();
163  }

Referenced by XrdCl::CopyProcess::AddJob(), and XrdCl::Utils::LogPropertyList().

+ Here is the caller graph for this function:

◆ Clear()

void XrdCl::PropertyList::Clear ( )
inline

Clear the property list.

Definition at line 176 of file XrdClPropertyList.hh.

177  {
178  pProperties.clear();
179  }

◆ end()

PropertyMap::const_iterator XrdCl::PropertyList::end ( ) const
inline

Get the end iterator.

Definition at line 168 of file XrdClPropertyList.hh.

169  {
170  return pProperties.end();
171  }

Referenced by XrdCl::CopyProcess::AddJob(), and XrdCl::Utils::LogPropertyList().

+ Here is the caller graph for this function:

◆ Get() [1/7]

template<typename Item >
Item XrdCl::PropertyList::Get ( const std::string &  name) const
inline

Get the value associated with a name

Returns
the value or Item() if the key does not exist

Definition at line 84 of file XrdClPropertyList.hh.

85  {
86  PropertyMap::const_iterator it;
87  it = pProperties.find( name );
88  if( it == pProperties.end() )
89  return Item();
90  std::istringstream i; i.str( it->second );
91  Item item;
92  i >> item;
93  if( i.bad() )
94  return Item();
95  return item;
96  }

◆ Get() [2/7]

template<>
XRootDStatus XrdCl::PropertyList::Get ( const std::string &  name) const
inline

Definition at line 249 of file XrdClPropertyList.hh.

251  {
252  XRootDStatus st;
253  if( !Get( name, st ) )
254  return XRootDStatus();
255  return st;
256  }
bool Get(const std::string &name, Item &item) const

References Get().

+ Here is the call graph for this function:

◆ Get() [3/7]

template<typename Item >
bool XrdCl::PropertyList::Get ( const std::string &  name,
Item &  item 
) const
inline

Get the value associated with a name

Returns
true if the name was found, false otherwise

Definition at line 65 of file XrdClPropertyList.hh.

66  {
67  PropertyMap::const_iterator it;
68  it = pProperties.find( name );
69  if( it == pProperties.end() )
70  return false;
71  std::istringstream i; i.str( it->second );
72  i >> item;
73  if( i.bad() )
74  return false;
75  return true;
76  }

Referenced by XrdCl::CopyProcess::AddJob(), ProgressDisplay::EndJob(), Get(), XrdCl::CopyJob::Init(), XrdCl::CopyProcess::Prepare(), XrdCl::CopyProcess::Run(), XrdCl::ClassicCopyJob::Run(), and XrdCl::TPFallBackCopyJob::Run().

+ Here is the caller graph for this function:

◆ Get() [4/7]

template<typename Item >
Item XrdCl::PropertyList::Get ( const std::string &  name,
uint32_t  index 
) const
inline

Get the value associated with a key and an index

Returns
the value or Item() if the key does not exist

Definition at line 132 of file XrdClPropertyList.hh.

133  {
134  std::ostringstream o;
135  o << name << " " << index;
136  return Get<Item>( o.str() );
137  }

◆ Get() [5/7]

template<typename Item >
bool XrdCl::PropertyList::Get ( const std::string &  name,
uint32_t  index,
Item &  item 
) const
inline

Get the value associated with a key and an index

Returns
true if the key and index were found, false otherwise

Definition at line 119 of file XrdClPropertyList.hh.

120  {
121  std::ostringstream o;
122  o << name << " " << index;
123  return Get( o.str(), item );
124  }

References Get().

+ Here is the call graph for this function:

◆ Get() [6/7]

template<>
bool XrdCl::PropertyList::Get ( const std::string &  name,
URL item 
) const
inline

Definition at line 272 of file XrdClPropertyList.hh.

274  {
275  std::string tmp;
276  if( !Get( name, tmp ) )
277  return false;
278 
279  item = tmp;
280  return true;
281  }

References Get().

+ Here is the call graph for this function:

◆ Get() [7/7]

template<>
bool XrdCl::PropertyList::Get ( const std::string &  name,
XRootDStatus item 
) const
inline

Definition at line 227 of file XrdClPropertyList.hh.

229  {
230  std::string str, msg, tmp;
231  if( !Get( name, str ) )
232  return false;
233 
234  std::string::size_type i;
235  i = str.find( '#' );
236  if( i == std::string::npos )
237  return false;
238  item.SetErrorMessage( str.substr( i+1, str.length()-i-1 ) );
239  str.erase( i, str.length()-i );
240  std::replace( str.begin(), str.end(), ';', ' ' );
241  std::istringstream is; is.str( str );
242  is >> item.status; if( is.bad() ) return false;
243  is >> item.code; if( is.bad() ) return false;
244  is >> item.errNo; if( is.bad() ) return false;
245  return true;
246  }

References XrdCl::Status::code, XrdCl::Status::errNo, Get(), XrdCl::XRootDStatus::SetErrorMessage(), and XrdCl::Status::status.

+ Here is the call graph for this function:

◆ HasProperty() [1/2]

bool XrdCl::PropertyList::HasProperty ( const std::string &  name) const
inline

Check if we now about the given name.

Definition at line 142 of file XrdClPropertyList.hh.

143  {
144  return pProperties.find( name ) != pProperties.end();
145  }

Referenced by XrdCl::CopyProcess::AddJob(), HasProperty(), XrdCl::CopyProcess::Prepare(), and XrdCl::CopyProcess::Run().

+ Here is the caller graph for this function:

◆ HasProperty() [2/2]

bool XrdCl::PropertyList::HasProperty ( const std::string &  name,
uint32_t  index 
) const
inline

Check if we know about the given name and index.

Definition at line 150 of file XrdClPropertyList.hh.

151  {
152  std::ostringstream o;
153  o << name << " " << index;
154  return HasProperty( o.str() );
155  }
bool HasProperty(const std::string &name) const
Check if we now about the given name.

References HasProperty().

+ Here is the call graph for this function:

◆ Set() [1/4]

template<typename Item >
void XrdCl::PropertyList::Set ( const std::string &  name,
const Item &  value 
)
inline

Associate a value with a key

Parameters
namemust not contain spaces
valueneeds to be convertible to std::string

Definition at line 52 of file XrdClPropertyList.hh.

53  {
54  std::ostringstream o;
55  o << value;
56  pProperties[name] = o.str();
57  }

Referenced by XrdCl::CopyProcess::AddJob(), main(), XrdCl::CopyProcess::Prepare(), XrdCl::ClassicCopyJob::Run(), XrdCl::ThirdPartyCopyJob::Run(), and Set().

+ Here is the caller graph for this function:

◆ Set() [2/4]

template<>
void XrdCl::PropertyList::Set ( const std::string &  name,
const URL item 
)
inline

Definition at line 262 of file XrdClPropertyList.hh.

264  {
265  Set( name, item.GetURL() );
266  }
void Set(const std::string &name, const Item &value)

References XrdCl::URL::GetURL(), and Set().

+ Here is the call graph for this function:

◆ Set() [3/4]

template<>
void XrdCl::PropertyList::Set ( const std::string &  name,
const XRootDStatus item 
)
inline

Definition at line 214 of file XrdClPropertyList.hh.

216  {
217  std::ostringstream o;
218  o << item.status << ";" << item.code << ";" << item.errNo << "#";
219  o << item.GetErrorMessage();
220  Set( name, o.str() );
221  }

References XrdCl::Status::code, XrdCl::Status::errNo, XrdCl::XRootDStatus::GetErrorMessage(), Set(), and XrdCl::Status::status.

+ Here is the call graph for this function:

◆ Set() [4/4]

template<typename Item >
void XrdCl::PropertyList::Set ( const std::string &  name,
uint32_t  index,
const Item &  value 
)
inline

Set a value with a name and an index

Parameters
namemust not contain spaces
index
valuemust be convertible to std::string

Definition at line 106 of file XrdClPropertyList.hh.

107  {
108  std::ostringstream o;
109  o << name << " " << index;
110  Set( o.str(), value );
111  }

References Set().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: