Gaudi Framework, version v21r7

Home   Generated: 22 Jan 2010

Gaudi::Parsers::PropertyEntry Class Reference

#include <Catalogue.h>

Collaboration diagram for Gaudi::Parsers::PropertyEntry:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 PropertyEntry ()
 Constructor.
 PropertyEntry (const std::string &name, const std::string &value)
 Constructor.
 PropertyEntry (const std::string &name, const std::vector< std::string > &value)
 Creator.
 PropertyEntry (const std::string &name, const std::string &value, const Position &pos)
 Constructor.
 PropertyEntry (const std::string &name, const std::vector< std::string > &value, const Position &pos)
 Creator.
const std::stringname (void) const
 Name of property.
void setName (const std::string &name)
 Set name.
std::string value (void) const
 Value of property.
Position position (void) const
 Property position.
StatusCode addValues (const std::vector< std::string > &values)
 Add values to vector value.
StatusCode removeValues (const std::vector< std::string > &values, int &count)
 Remove values from property value.
StatusCode clear (void)
 Clear property vector value.
StatusCode removeEnv ()
 remove environment variables

Private Attributes

std::string m_name
std::vector< std::stringm_value
Position m_position
bool m_isVector


Detailed Description

Definition at line 98 of file Catalogue.h.


Constructor & Destructor Documentation

Gaudi::Parsers::PropertyEntry::PropertyEntry (  )  [inline]

Constructor.

Definition at line 102 of file Catalogue.h.

00102 {}

Gaudi::Parsers::PropertyEntry::PropertyEntry ( const std::string name,
const std::string value 
)

Constructor.

Parameters:
name Name of property
value String value of property.

Definition at line 26 of file PropertyEntry.cpp.

00028 {
00029    m_name = name;
00030    m_value.push_back(value);
00031    m_isVector = false;
00032 }

Gaudi::Parsers::PropertyEntry::PropertyEntry ( const std::string name,
const std::vector< std::string > &  value 
)

Creator.

Parameters:
name Name of property
value Vector value of property

Definition at line 42 of file PropertyEntry.cpp.

00044 {
00045    m_name = name;
00046    m_value = value;
00047    m_isVector = true;
00048    if ( 1 == m_value.size() && "" == m_value[0] ) { clear(); }
00049 }

Gaudi::Parsers::PropertyEntry::PropertyEntry ( const std::string name,
const std::string value,
const Position pos 
)

Constructor.

Parameters:
name Name of property
value String value of property.
pos Property position in file

Definition at line 60 of file PropertyEntry.cpp.

00063 {
00064    m_name = name;
00065    m_value.push_back(value);
00066    m_position = pos;
00067    m_isVector = false;
00068 }

Gaudi::Parsers::PropertyEntry::PropertyEntry ( const std::string name,
const std::vector< std::string > &  value,
const Position pos 
)

Creator.

Parameters:
name Name of property
value Vector value of property
pos Property position in file

Definition at line 80 of file PropertyEntry.cpp.

00083 {
00084    m_name = name;
00085    m_value = value;
00086    m_position = pos;
00087    m_isVector = true;
00088    if ( 1 == m_value.size() && "" == m_value[0] ) { clear(); }
00089 }


Member Function Documentation

const std::string& Gaudi::Parsers::PropertyEntry::name ( void   )  const [inline]

Name of property.

Returns:
Name of property

Definition at line 134 of file Catalogue.h.

00134 {return m_name;};

void Gaudi::Parsers::PropertyEntry::setName ( const std::string name  )  [inline]

Set name.

Definition at line 137 of file Catalogue.h.

00137 {m_name=name;};   

std::string Gaudi::Parsers::PropertyEntry::value ( void   )  const

Value of property.

Returns:
Value of property

Definition at line 96 of file PropertyEntry.cpp.

00097 {
00098    std::string result="";
00099    if(m_isVector){
00100       result = "[";
00101       std::string delim="";
00102       for(std::vector<std::string>::const_iterator cur=m_value.begin();
00103          cur!=m_value.end();cur++){
00104             result+=delim+*cur;
00105             delim=",";
00106       }
00107       result+="]";
00108    }else{
00109       if(m_value.size()>0){
00110          result = m_value[0];
00111         }
00112    }
00113    return result;
00114 }

Position Gaudi::Parsers::PropertyEntry::position ( void   )  const [inline]

Property position.

Definition at line 145 of file Catalogue.h.

00145 {return m_position;}  

StatusCode Gaudi::Parsers::PropertyEntry::addValues ( const std::vector< std::string > &  values  ) 

Add values to vector value.

Returns:
StatusCode::SUCCESS if property value is vector (and we can add values)
Parameters:
values Values to add

Definition at line 125 of file PropertyEntry.cpp.

00126 {
00127    if(!m_isVector) return StatusCode::FAILURE;
00128    for(std::vector<std::string>::const_iterator cur = values.begin();
00129     cur!=values.end();cur++){
00130       m_value.push_back(*cur);
00131     }
00132    return StatusCode::SUCCESS;   
00133 }

StatusCode Gaudi::Parsers::PropertyEntry::removeValues ( const std::vector< std::string > &  values,
int &  count 
)

Remove values from property value.

Returns:
StatusCode::SUCCESS if property value is vector (and we can remove values)
Parameters:
values 
count Count of removed items

Definition at line 145 of file PropertyEntry.cpp.

00147 {
00148    if(!m_isVector) return StatusCode::FAILURE;
00149    for(std::vector<std::string>::const_iterator
00150       cur = values.begin();cur!=values.end();cur++){
00151       std::vector<std::string>::iterator item = std::find(m_value.begin(),
00152         m_value.end(),*cur);
00153       if(item!=m_value.end()){
00154          m_value.erase(item);
00155          count++;
00156       }
00157     }
00158     return StatusCode::SUCCESS;
00159 }

StatusCode Gaudi::Parsers::PropertyEntry::clear ( void   ) 

Clear property vector value.

Returns:
StatusCode::SUCCESS if property value is vector (and we can clear values)

Definition at line 167 of file PropertyEntry.cpp.

00168 {
00169    if(!m_isVector) return StatusCode::FAILURE;
00170    m_value.clear();
00171    return StatusCode::SUCCESS;
00172 }

StatusCode Gaudi::Parsers::PropertyEntry::removeEnv (  ) 

remove environment variables

Definition at line 176 of file PropertyEntry.cpp.

00177 {
00178   for ( std::vector<std::string>::iterator item = 
00179           m_value.begin() ; m_value.end() != item ; ++item ) 
00180   { *item = Gaudi::Parsers::Utils::removeEnvironment ( *item ) ; }
00181   return StatusCode::SUCCESS ;
00182 }


Member Data Documentation

Definition at line 173 of file Catalogue.h.

std::vector<std::string> Gaudi::Parsers::PropertyEntry::m_value [private]

Definition at line 174 of file Catalogue.h.

Position Gaudi::Parsers::PropertyEntry::m_position [private]

Definition at line 175 of file Catalogue.h.

bool Gaudi::Parsers::PropertyEntry::m_isVector [private]

Definition at line 176 of file Catalogue.h.


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

Generated at Fri Jan 22 20:44:31 2010 for Gaudi Framework, version v21r7 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004