CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

L1GtPatternLine Class Reference

#include <L1GtPatternLine.h>

List of all members.

Public Member Functions

boost::uint32_t get (const std::string &name) const
bool has (const std::string &colname) const
std::string name (const std::string &prefix, unsigned int i) const
std::string nextName (const std::string &prefix)
void print (std::ostream &out) const
void push (const std::string &prefix, boost::uint32_t value)
void set (const std::string &name, boost::uint32_t value)

Private Types

typedef std::map< std::string,
boost::uint32_t > 
ColumnMap

Private Attributes

ColumnMap m_columns

Detailed Description

A class representing the contents of one line in a pattern file. The contents are represented as (name, value) pairs. Column ids are also enumerated so that multiple columns with identical names end up with consecutive names ("muon" becomes "muon1", "muon2" etc).

Description: A representation of a of pattern file line for L1 GT hardware testing.

Implementation: <TODO: enter implementation details>

Author:
: Thomas Themel - HEPHY Vienna

$Date$ $Revision$

Description: see header file.

Implementation: <TODO: enter implementation details>

Author:
: Thomas Themel - HEPHY Vienna

$Date$ $Revision$

Definition at line 30 of file L1GtPatternLine.h.


Member Typedef Documentation

typedef std::map<std::string, boost::uint32_t> L1GtPatternLine::ColumnMap [private]

Definition at line 65 of file L1GtPatternLine.h.


Member Function Documentation

uint32_t L1GtPatternLine::get ( const std::string &  name) const

Accessor.

See also:
has

Definition at line 79 of file L1GtPatternLine.cc.

References m_columns.

Referenced by L1GtPatternWriter::writePatternLine().

                                                         {
    ColumnMap::const_iterator it = m_columns.find(name);
    if(it != m_columns.end()) { 
      return it->second;
    }
    return 0;
}
bool L1GtPatternLine::has ( const std::string &  colname) const

Returns true iff a column of the given name exists.

Parameters:
colnameColumn name to look for. Beware: This has to include the number appended by push!

Definition at line 58 of file L1GtPatternLine.cc.

References m_columns.

Referenced by nextName(), and L1GtPatternWriter::writePatternLine().

                                                        { 
    return m_columns.find(colname) != m_columns.end();
}
std::string L1GtPatternLine::name ( const std::string &  prefix,
unsigned int  i 
) const

Forms a column name from a prefix and a number.

Definition at line 73 of file L1GtPatternLine.cc.

References i.

Referenced by nextName().

                                                                             { 
    std::ostringstream ss;
    ss << prefix << i;
    return ss.str();
}
std::string L1GtPatternLine::nextName ( const std::string &  prefix)

Returns the next free column name for a given prefix.

Definition at line 62 of file L1GtPatternLine.cc.

References has(), i, name(), and query::result.

                                                           {    
    int i = 1 ;
    std::string result;
    do
    {
      result = name(prefix, i++);
    } while(has(result));

    return result;
}
void L1GtPatternLine::print ( std::ostream &  out) const

Debug dump of contents

Definition at line 49 of file L1GtPatternLine.cc.

References m_columns.

                                                 { 
    out << "BEGIN Columns: " << std::endl ; 
    for(L1GtPatternLine::ColumnMap::const_iterator it = m_columns.begin(); 
        it != m_columns.end() ; ++it) { 
      out << it->first << ": " << std::hex << it->second << std::endl;
    }
    out << "END Columns." << std::endl ; 
}
void L1GtPatternLine::push ( const std::string &  prefix,
boost::uint32_t  value 
)

Add a new column with the specified name prefix and value.

Parameters:
prefixThe name prefix of the new column. The final column name consists of prefix + the lowest free number (starting at 1)
valueThe actual data content of the column.

Referenced by L1GtPatternGenerator::extractGlobalTriggerData(), extractGlobalTriggerWord(), and extractRecordData().

void L1GtPatternLine::set ( const std::string &  name,
boost::uint32_t  value 
)

Manipulate an existing value.

Parameters:
namethe name (prefix + no) of the column to set. Do not use _h or _l values here!
valuethe new value for the column.

Member Data Documentation

Definition at line 66 of file L1GtPatternLine.h.

Referenced by get(), has(), and print().