BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
NotAlignedIssue.cxx
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file NotAlignedIssue.cxx
5 * @author <a href="mailto:Andre.dos.Anjos@cern.ch">Andre DOS ANJOS</a>
6 * $Author: zhangy $
7 * $Revision: 1.1.1.1 $
8 * $Date: 2009/06/19 07:35:41 $
9 *
10 * Implements the not-aligned exception.
11 */
12
13#include "eformat/NotAlignedIssue.h"
14#include <sstream>
15#include <string>
16
17/**
18 * Strings to identify keys in ERS
19 */
20static const char* BASE_ADDRESS_KEY = "Base address";
21static const char* SIZE_KEY = "Total block size";
22
24 ers::severity_t severity, const void* base,
25 size_t size )
26 : eformat::Issue( context, severity ) {
27 std::ostringstream oss;
28 oss << base;
29 set_value( BASE_ADDRESS_KEY, oss.str() );
30 set_value( SIZE_KEY, size );
31 finish_setup( "Misaligned data block" );
32}
33
34const void* eformat::NotAlignedIssue::base() const {
35 std::istringstream iss;
36 iss.str( get_value( BASE_ADDRESS_KEY ) );
37 size_t x;
38 iss >> x;
39 return (void*)x; // nasty cast
40}
41
42size_t eformat::NotAlignedIssue::size() const { return get_int_value( SIZE_KEY ); }
Issue(const ers::Context &context, ers::severity_t severity)
NotAlignedIssue(const ers::Context &context, ers::severity_t severity, const void *base, size_t size)
const void * base() const
Source context for Issue.
const std::string & get_value(const std::string &key, const std::string &def) const
Reads the property list.
void set_value(const std::string &key, uint8_t value)
Sets a value 8 bit unsigned.
severity_t severity() const
severity_t of the issue
int get_int_value(const std::string &key, int def=0) const
Get a value of the table as an integer.
void finish_setup(const std::string &message)
Finishes the setup of the Issue.
enum ers::_severity_t severity_t