Added ai command setEquipment
[ryzomcore.git] / ryzom / server / src / persistant_data_service / pds_column.h
blob9b49e9df98ccf59083d705a0bef1000a3ba578b8
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef NL_PDS_COLUMN_H
18 #define NL_PDS_COLUMN_H
21 // NeL includes
23 #include "nel/misc/types_nl.h"
24 #include <nel/misc/i_xml.h>
27 // PDS includes
29 #include "../pd_lib/pd_server_utils.h"
30 #include "../pd_lib/pds_types.h"
32 class IDbFileStream;
33 class CAttribute;
34 class CDatabase;
36 /**
37 * A column definition.
38 * Defines the kind of data stored at this place and the type of data
39 * \author Benjamin Legros
40 * \author Nevrax France
41 * \date 2004
43 class CColumn : public CPDSLogger
45 public:
47 /// Constructor
48 CColumn() :
49 _Init(false),
50 _MetaType(PDS_UnknownMetaType),
51 _DataType(PDS_UnknownDataType),
52 _TypeId(INVALID_TYPE_ID),
53 //_ReferencedAttribute(0),
54 _Id(0),
55 _ByteSize(0),
56 _ByteOffset(0),
57 _Root(NULL),
58 _Parent(NULL)
62 /// Destructor
63 ~CColumn();
65 /**
66 * Initialize column
68 bool init(CAttribute* parent, CDatabase *root);
70 /// Initialized yet?
71 bool initialised() const { return _Init; }
73 /// Get meta type of column
74 TMetaType getMetaType() const { return _MetaType; }
76 /// Get data type of column
77 TDataType getDataType() const { return _DataType; }
79 /// Get Class descriptor
80 TTypeId getTypeId() const { return _TypeId; }
82 /// Get C++ descriptor
83 //uint32 getReferencedAttribute() const { return _ReferencedAttribute; }
85 /// Get Row order
86 uint32 getId() const { return _Id; }
88 /// Get Column byte size
89 uint32 getByteSize() const { return _ByteSize; }
91 /// Get Byte Offset
92 uint32 getByteOffset() const { return _ByteOffset; }
94 /// Get column name
95 const std::string& getName() const { return _Name; }
97 /// Get parent attribute
98 const CAttribute* getParent() const { return _Parent; }
100 /// Get Root
101 const CDatabase* getRoot() const { return _Root; }
104 /// Set byte offset
105 void setByteOffset(uint32 offset) { _ByteOffset = offset; }
108 /// Critical message
109 void warning(const std::string &msg) const;
111 /// Debug message
112 void debug(const std::string &msg) const;
115 protected:
117 virtual std::string getLoggerIdentifier() const { return NLMISC::toString("col:%s", (_Name.empty() ? "<unnamed>" : _Name.c_str())); }
120 private:
122 /// Initialized yet?
123 bool _Init;
125 /// Root Database
126 CDatabase* _Root;
128 /// Parent attribute
129 CAttribute* _Parent;
131 /// Name of the column
132 std::string _Name;
134 /// Id of column in row
135 uint32 _Id;
138 /// Metatype of column, can only be PDS_Type, PDS_BackRef, PDS_ForwardRef, PDS_Set
139 TMetaType _MetaType;
141 /// Data type of attribute
142 TDataType _DataType;
144 /// Type descriptor of the column
145 TTypeId _TypeId;
148 /// Back/Forward referenced attribute in the parent class
149 //uint32 _ReferencedAttribute;
152 /// Column size in byte
153 uint32 _ByteSize;
155 /// Byte offset from row start
156 uint32 _ByteOffset;
159 friend class CAttribute;
164 #endif // NL_PDS_COLUMN_H
166 /* End of pds_column.h */