ATLAS Offline Software
Loading...
Searching...
No Matches
CollectionColumn.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef COLLECTIONSVC_COLLECTIONCOLUMN_H
6#define COLLECTIONSVC_COLLECTIONCOLUMN_H
7
8#include "ICollectionColumn.h"
9
10#include "CoralBase/AttributeSpecification.h"
11
12#include <typeinfo>
13
14
15namespace pool {
16
24 {
25 public:
28 : m_name( "" ),
29 m_type( "" ),
30 m_maxSize( 0 ),
31 m_sizeIsFixed( true ),
32 m_id( 0 ) {}
33
42 CollectionColumn( const std::string& name,
43 const std::string& type,
44 int maxSize = 0,
45 bool sizeIsFixed = true )
46 : m_name( name ),
47 m_type( type ),
50 m_id( 0 ) {}
51
55 m_name( rhs.m_name ),
56 m_type( rhs.m_type ),
57 m_maxSize( rhs.m_maxSize ),
59 m_id( rhs.m_id )
60 {}
61
64
67 {
68 m_name = rhs.m_name;
69 m_type = rhs.m_type;
70 m_maxSize = rhs.m_maxSize;
72 m_id = rhs.m_id;
73
74 return *this;
75 }
76
78 bool operator==( const CollectionColumn& rhs ) const
79 {
80 return
81 m_name == rhs.m_name &&
82 m_type == rhs.m_type &&
83 m_maxSize == rhs.m_maxSize &&
85 // && m_id == rhs.m_id //MN - does not matter?
86 ;
87 }
88
90 bool operator!=( const CollectionColumn& rhs ) const
91 {
92 return !( *this == rhs );
93 }
94
100 virtual void setName( const std::string& name ) { m_name = name; }
101
107 virtual void setType( const std::string& type ) { m_type = type; }
108
114 virtual void setType( const std::type_info& type )
115 { m_type = coral::AttributeSpecification::typeNameForId( type ); }
116
123 virtual void setMaxSize( int maxSize ) { m_maxSize = maxSize; }
124
132
134 virtual void setId( int id ) { m_id = id; }
135
137 virtual const std::string& name() const { return m_name; }
138
140 virtual const std::string& type() const { return m_type; }
141
146 virtual int maxSize() const { return m_maxSize; }
147
152 virtual bool sizeIsFixed() const { return m_sizeIsFixed; }
153
155 virtual int id() const { return m_id; }
156
157 private:
159 std::string m_name;
160
162 std::string m_type;
163
166
169
171 int m_id;
172 };
173
174}
175
176#endif
177
178
CollectionColumn()
Default constructor.
~CollectionColumn()
Default destructor.
virtual bool sizeIsFixed() const
Indicates whether the data type of the column can vary in size.
CollectionColumn(const CollectionColumn &rhs)
Copy constructor.
CollectionColumn(const std::string &name, const std::string &type, int maxSize=0, bool sizeIsFixed=true)
Constructor that takes the column properties as input.
CollectionColumn & operator=(const CollectionColumn &rhs)
Assignment operator.
virtual int id() const
Returns the position of the column in its associated collection fragment.
virtual int maxSize() const
Returns the maximum size of the column data type.
virtual void setType(const std::type_info &type)
Sets the data type of the column.
virtual const std::string & name() const
Returns the name of the column.
bool m_sizeIsFixed
Flag indicating whether data type of column can vary in size.
virtual const std::string & type() const
Returns the data type of the column.
virtual void setSizeIsFixed(bool sizeIsFixed)
Sets a flag indicating whether the size of the column data type may vary.
std::string m_name
Name of column.
virtual void setName(const std::string &name)
Sets the name of the column.
virtual void setId(int id)
Sets the position of the column in its associated collection fragment.
bool operator==(const CollectionColumn &rhs) const
Equality operator.
std::string m_type
Data type of column.
int m_id
Position of column in associated collection fragment.
bool operator!=(const CollectionColumn &rhs) const
Inequality operator.
int m_maxSize
Maximum size of column data type.
virtual void setMaxSize(int maxSize)
Sets the maximum size of the column data type.
virtual void setType(const std::string &type)
Sets the data type of the column.
An interface for retrieving a description of a column of a collection.
pool namespace
Definition libname.h:15