|
|
Go to the documentation of this file. 1 #ifndef DataFormats_NanoAOD_FlatTable_h
2 #define DataFormats_NanoAOD_FlatTable_h
7 #include <boost/range/sub_range.hpp>
15 namespace flatTableHelper {
20 inline void bulk(boost::sub_range<std::vector<T>>
data)
const {}
26 inline float one(
const float &
val)
const {
29 inline void bulk(boost::sub_range<std::vector<float>>
data)
const {
68 boost::sub_range<const std::vector<T>>
columnData(
unsigned int column)
const {
69 auto begin = beginData<T>(column);
75 boost::sub_range<std::vector<T>>
columnData(
unsigned int column) {
76 auto begin = beginData<T>(column);
84 throw cms::Exception(
"LogicError",
"columnValue works only for singleton tables");
85 return *beginData<T>(column);
107 template <
typename T,
typename C = std::vector<T>>
118 auto &vec = bigVector<T>();
125 template <
typename T,
typename C>
132 throw cms::Exception(
"LogicError",
"addColumnValue works only for singleton tables");
136 auto &vec = bigVector<T>();
141 vec.push_back(
value);
147 template <
typename T>
163 template <
typename T>
164 typename std::vector<T>::const_iterator
beginData(
unsigned int column)
const {
166 check_type<T>(
col.type);
167 return bigVector<T>().begin() +
col.firstIndex;
169 template <
typename T>
170 typename std::vector<T>::iterator
beginData(
unsigned int column) {
172 check_type<T>(
col.type);
173 return bigVector<T>().begin() +
col.firstIndex;
176 template <
typename T>
180 template <
typename T>
193 template <
typename T>
216 inline const std::vector<float> &FlatTable::bigVector<float>()
const {
220 inline const std::vector<int> &FlatTable::bigVector<int>()
const {
224 inline const std::vector<uint8_t> &FlatTable::bigVector<uint8_t>()
const {
228 inline std::vector<float> &FlatTable::bigVector<float>() {
232 inline std::vector<int> &FlatTable::bigVector<int>() {
236 inline std::vector<uint8_t> &FlatTable::bigVector<uint8_t>() {
Column(const std::string &aname, const std::string &docString, ColumnType atype, unsigned int anIndex)
boost::sub_range< std::vector< T > > columnData(unsigned int column)
get a column by index (non-const)
RowView(const FlatTable &table, unsigned int row)
void bulk(boost::sub_range< std::vector< T >> data) const
void setDoc(const std::string &doc)
MaybeMantissaReduce(int mantissaBits)
RowView row(unsigned int row) const
const std::string & doc() const
void addColumnValue(const std::string &name, const C &value, const std::string &docString, ColumnType type=defaultColumnType< T >(), int mantissaBits=-1)
void addColumn(const std::string &name, const C &values, const std::string &docString, ColumnType type=defaultColumnType< T >(), int mantissaBits=-1)
T one(const T &val) const
const std::string & columnDoc(unsigned int col) const
MaybeMantissaReduce(int mantissaBits)
ColumnType columnType(unsigned int col) const
const FlatTable & table() const
void addExtension(const FlatTable &extension)
int columnIndex(const std::string &name) const
static float reduceMantissaToNbitsRounding(const float &f)
std::vector< uint8_t > uint8s_
std::vector< T >::const_iterator beginData(unsigned int column) const
float one(const float &val) const
unsigned int nRows() const
static void check_type(FlatTable::ColumnType type)
const std::vector< T > & bigVector() const
std::vector< Column > columns_
void bulk(boost::sub_range< std::vector< float >> data) const
const std::string & name() const
static ColumnType defaultColumnType()
const T & columValue(unsigned int column) const
get a column value for singleton (const)
std::vector< float > floats_
double getAnyValue(const std::string &column) const
boost::sub_range< const std::vector< T > > columnData(unsigned int column) const
get a column by index (const)
const std::string & columnName(unsigned int col) const
std::vector< T > & bigVector()
unsigned int nColumns() const
double getAnyValue(unsigned int row, unsigned int column) const
char data[epos_bytes_allocation]
double getAnyValue(unsigned int column) const
std::vector< T >::iterator beginData(unsigned int column)
FlatTable(unsigned int size, const std::string &name, bool singleton, bool extension=false)
unsigned int size() const