Gaudi Framework, version v22r1

Home   Generated: Mon Feb 28 2011
Public Member Functions | Private Attributes

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.

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

Constructor.

Parameters:
nameName of property
valueString value of property.

Definition at line 26 of file PropertyEntry.cpp.

{
   m_name = name;
   m_value.push_back(value);
   m_isVector = false;
}
Gaudi::Parsers::PropertyEntry::PropertyEntry ( const std::string name,
const std::vector< std::string > &  value 
)

Creator.

Parameters:
nameName of property
valueVector value of property

Definition at line 42 of file PropertyEntry.cpp.

{
   m_name = name;
   m_value = value;
   m_isVector = true;
   if ( 1 == m_value.size() && "" == m_value[0] ) { clear(); }
}
Gaudi::Parsers::PropertyEntry::PropertyEntry ( const std::string name,
const std::string value,
const Position pos 
)

Constructor.

Parameters:
nameName of property
valueString value of property.
posProperty position in file

Definition at line 60 of file PropertyEntry.cpp.

{
   m_name = name;
   m_value.push_back(value);
   m_position = pos;
   m_isVector = false;
}
Gaudi::Parsers::PropertyEntry::PropertyEntry ( const std::string name,
const std::vector< std::string > &  value,
const Position pos 
)

Creator.

Parameters:
nameName of property
valueVector value of property
posProperty position in file

Definition at line 80 of file PropertyEntry.cpp.

{
   m_name = name;
   m_value = value;
   m_position = pos;
   m_isVector = true;
   if ( 1 == m_value.size() && "" == m_value[0] ) { clear(); }
}

Member Function Documentation

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:
valuesValues to add

Definition at line 125 of file PropertyEntry.cpp.

{
   if(!m_isVector) return StatusCode::FAILURE;
   for(std::vector<std::string>::const_iterator cur = values.begin();
    cur!=values.end();cur++){
      m_value.push_back(*cur);
    }
   return StatusCode::SUCCESS;   
}
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.

{
   if(!m_isVector) return StatusCode::FAILURE;
   m_value.clear();
   return StatusCode::SUCCESS;
}
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.

{return m_name;};
Position Gaudi::Parsers::PropertyEntry::position ( void   ) const [inline]

Property position.

Definition at line 145 of file Catalogue.h.

{return m_position;}  
StatusCode Gaudi::Parsers::PropertyEntry::removeEnv (  )

remove environment variables

Definition at line 176 of file PropertyEntry.cpp.

{
  for ( std::vector<std::string>::iterator item = 
          m_value.begin() ; m_value.end() != item ; ++item ) 
  { *item = Gaudi::Parsers::Utils::removeEnvironment ( *item ) ; }
  return StatusCode::SUCCESS ;
}
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
countCount of removed items

Definition at line 145 of file PropertyEntry.cpp.

{
   if(!m_isVector) return StatusCode::FAILURE;
   for(std::vector<std::string>::const_iterator
      cur = values.begin();cur!=values.end();cur++){
      std::vector<std::string>::iterator item = std::find(m_value.begin(),
        m_value.end(),*cur);
      if(item!=m_value.end()){
         m_value.erase(item);
         count++;
      }
    }
    return StatusCode::SUCCESS;
}
void Gaudi::Parsers::PropertyEntry::setName ( const std::string name ) [inline]

Set name.

Definition at line 137 of file Catalogue.h.

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

Value of property.

Returns:
Value of property

Definition at line 96 of file PropertyEntry.cpp.

{
   std::string result="";
   if(m_isVector){
      result = "[";
      std::string delim="";
      for(std::vector<std::string>::const_iterator cur=m_value.begin();
         cur!=m_value.end();cur++){
            result+=delim+*cur;
            delim=",";
      }
      result+="]";
   }else{
      if(m_value.size()>0){
         result = m_value[0];
        }
   }
   return result;
}

Member Data Documentation

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

Definition at line 176 of file Catalogue.h.

std::string Gaudi::Parsers::PropertyEntry::m_name [private]

Definition at line 173 of file Catalogue.h.

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

Definition at line 175 of file Catalogue.h.

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

Definition at line 174 of file Catalogue.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Feb 28 2011 18:28:39 for Gaudi Framework, version v22r1 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004