00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DBCNV_DBCOLUMN_H
00009 #define DBCNV_DBCOLUMN_H 1
00010
00011
00012 #include "GaudiDb/DbOOMs.h"
00013 #include "GaudiKernel/DataTypeInfo.h"
00014
00015
00016 #include <string>
00017 #include <vector>
00018
00040 class DbColumn {
00041 public:
00042 enum Options {PRIMARY_KEY = 1 << 0,
00043 NOT_NULL = 1 << 1,
00044 UNIQUE = 1 << 2,
00045 CLUSTERED = 1 << 3,
00046 NONCLUSTERED= 1 << 4
00047 };
00049 typedef std::vector<DbColumn*> Container;
00051 typedef Container::iterator iterator;
00053 typedef Container::const_iterator const_iterator;
00054 protected:
00056 std::string m_name;
00058 std::string m_typeName;
00060 const std::type_info& m_type;
00062 unsigned long m_opt;
00064 long m_offset;
00066 long m_typeID;
00068 mutable char* m_address;
00069 protected:
00071 DbColumn* i_check(bool flag = true);
00072
00073 public:
00075 DbColumn(const std::string& nam, long offset, const long typ, unsigned long opt=0);
00077 DbColumn(const std::string& nam, long offset, const std::type_info& typ, unsigned long opt=0);
00079 virtual ~DbColumn();
00081 bool isValid() const {
00082 return typeName() != "";
00083 }
00085 const std::string& name() const {
00086 return m_name;
00087 }
00089 const std::string& typeName() const {
00090 return m_typeName;
00091 }
00093 const std::type_info& type() const {
00094 return m_type;
00095 }
00097 unsigned long options() const {
00098 return m_opt;
00099 }
00101 long typeID() const {
00102 return m_typeID;
00103 }
00105 long offset() const {
00106 return m_offset;
00107 }
00109 void setOffset(unsigned long off) {
00110 m_offset = off;
00111 }
00113 void setAddress(char* address) const {
00114 m_address = address;
00115 }
00117 const char* address() const {
00118 return m_address;
00119 }
00121 char* address() {
00122 return m_address;
00123 }
00125 char* data() const {
00126 return m_address+m_offset;
00127 }
00129 char* data(char* ptr) const {
00130 return ptr+m_offset;
00131 }
00132 };
00133 #endif // DBCNV_DBCOLUMN_H