UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RecList.hpp
1 /* RecList.hpp */
2 /* $Id: RecList.hpp,v 1.7 2004/06/04 12:52:17 vlad Exp $ */
3 #ifndef __RecList_hpp
4 #define __RecList_hpp
5 
6 #include <mix/DynAr.H>
7 #include <mix/RecItem.hpp>
8 
9 
10 /***********************************************************************
11  ** List of records.
12  **
13  ** Each row has the same structure - record definition. The class
14  ** allows access to each row and each cell in it in arbitrary ways.
15  ***********************************************************************/
16 
17 class RecList : public RecDef
18 {
19 public:
20 
22  RecList (const RecDef& rdef,
23  unsigned quant = DEFAULT_QUANT,
24  unsigned volume = START_VOLUME);
25 
27  RecList (const RecList& r);
28 
30  RecList (InputStream& ist);
31 
33  virtual ~RecList ();
34 
36  RecList& operator= (const RecList& r);
37 
38 
40  virtual int count () const;
41 
42  /*
43  * Access to record data
44  */
45 
49  virtual AnyValue& value (int dmn_i, int row_i);
50 
51  /* Call the value(n2i(dname), row_i) */
52  AnyValue& value (const char* dname, int row_i);
53 
57  virtual const AnyValue& get_value (int dmn_i,
58  int row_i) const;
59 
61  const AnyValue& get_value (const char* dname,
62  int row_i) const;
63 
65  virtual void get_value (int dmn_i, int row_i,
66  AnyValue& av) const;
67 
69  void get_value (const char* dname, int row_i,
70  AnyValue& av) const;
71 
73  virtual void set_value (int dmn_i, int row_i,
74  const AnyValue& av);
75 
77  void set_value (const char* dname, int row_i,
78  const AnyValue& av);
79 
83  virtual RecItem& item (int row_i);
84 
86  virtual void get_item (int row_i, RecItem& rec) const;
87 
91  virtual void attach_item (int row_i, RecItem& rec) const;
92 
93 
94 
95  /*
96  * Enlarge/shrink the list of records
97  */
98 
100  virtual void add_record (int rows = 1);
101 
103  virtual void add_item (const RecItem& recit);
104 
106  virtual void add_list (const RecList& reclist);
107 
109  virtual void insert_record (int at_row_i, int rows = 1);
110 
112  virtual void insert_item (int at_row_i,
113  const RecItem& recit);
114 
116  virtual void insert_list (int at_row_i,
117  const RecList& reclist);
118 
120  virtual void remove_record (int at_row_i, int rows = 1);
121 
123  virtual void clean ();
124 
125 
128  virtual void add_domain (const DomainDef& dmn);
129 
130 
149  virtual void serialize (OutputStream& ost) const;
150 
153  virtual void deserialize (InputStream& ist);
154 
157 protected:
158 
161 
165 
168 
169 };
170 
171 
172 /*
173  * INLINE IMPLEMENTATIONS
174  */
175 
176 inline AnyValue&
177 RecList::value (const char* dname, int row_i)
178 {
179  return value(n2i(dname), row_i);
180 }
181 
182 
183 inline const AnyValue&
184 RecList::get_value (const char* dname, int row_i) const
185 {
186  return get_value(n2i(dname), row_i);
187 }
188 
189 
190 inline void
191 RecList::get_value (const char* dname, int row_i, AnyValue& av) const
192 {
193  get_value(n2i(dname), row_i, av);
194 }
195 
196 
197 inline void
198 RecList::set_value (const char* dname, int row_i, const AnyValue& av)
199 {
200  set_value(n2i(dname), row_i, av);
201 }
202 
203 
204 #endif /* RecList.hpp */
virtual void add_domain(const DomainDef &dmn)
virtual void attach_item(int row_i, RecItem &rec) const
virtual void set_value(int dmn_i, int row_i, const AnyValue &av)
Definition: AnyValue.hpp:23
virtual const AnyValue & get_value(int dmn_i, int row_i) const
Definition: DynAr.H:22
RecItem * cur_item
Definition: RecList.hpp:164
virtual void add_record(int rows=1)
virtual void deserialize(InputStream &ist)
Definition: Serial.hpp:22
virtual void remove_record(int at_row_i, int rows=1)
RecList & operator=(const RecList &r)
Definition: RecList.hpp:17
Definition: RecItem.hpp:20
virtual void serialize(OutputStream &ost) const
virtual void add_item(const RecItem &recit)
virtual void insert_item(int at_row_i, const RecItem &recit)
Definition: DmnDef.h:25
Definition: Serial.hpp:69
RecList(const RecDef &rdef, unsigned quant=DEFAULT_QUANT, unsigned volume=START_VOLUME)
virtual void insert_list(int at_row_i, const RecList &reclist)
virtual void get_item(int row_i, RecItem &rec) const
DynAr * datar
Definition: RecList.hpp:160
virtual RecItem & item(int row_i)
virtual void add_list(const RecList &reclist)
virtual int count() const
int n2i(const char *dname) const
virtual AnyValue & value(int dmn_i, int row_i)
Definition: RecDef.hpp:19
AnyValue ** av
Definition: RecList.hpp:167
virtual void insert_record(int at_row_i, int rows=1)
virtual void clean()
virtual ~RecList()