SNAP Library 4.0, User Reference  2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
attr.cpp
Go to the documentation of this file.
1 // Add functions
2 int TAttr::AddSAttrDat(const TInt& Id, const TStr& AttrName, const TInt& Val) {
3  TInt AttrId;
4  if (!AttrNameToId.IsKey(AttrName)) {
5  AddSAttr(AttrName, atInt, AttrId);
6  } else {
7  AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
8  }
9  return AddSAttrDat(Id, AttrId, Val);
10 }
11 int TAttr::AddSAttrDat(const TInt& Id, const TInt& AttrId, const TInt& Val) {
12  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
13  if (AttrIdToName.GetDat(AttrId).GetVal1() != atInt) { return -2; }
14  TIntPr Key(AttrId, Id);
15  IntAttrVals.AddDat(Key, Val);
16  return 0;
17 }
18 
19 int TAttr::AddSAttrDat(const TInt& Id, const TStr& AttrName, const TFlt& Val) {
20  TInt AttrId;
21  if (!AttrNameToId.IsKey(AttrName)) {
22  AddSAttr(AttrName, atFlt, AttrId);
23  } else {
24  AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
25  }
26  return AddSAttrDat(Id, AttrId, Val);
27 }
28 int TAttr::AddSAttrDat(const TInt& Id, const TInt& AttrId, const TFlt& Val) {
29  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
30  if (AttrIdToName.GetDat(AttrId).GetVal1() != atFlt) { return -2; }
31  TIntPr Key(AttrId, Id);
32  FltAttrVals.AddDat(Key, Val);
33  return 0;
34 }
35 
36 int TAttr::AddSAttrDat(const TInt& Id, const TStr& AttrName, const TStr& Val) {
37  TInt AttrId;
38  if (!AttrNameToId.IsKey(AttrName)) {
39  AddSAttr(AttrName, atStr, AttrId);
40  } else {
41  AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
42  }
43  return AddSAttrDat(Id, AttrId, Val);
44 }
45 int TAttr::AddSAttrDat(const TInt& Id, const TInt& AttrId, const TStr& Val) {
46  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
47  if (AttrIdToName.GetDat(AttrId).GetVal1() != atStr) { return -2; }
48  TIntPr Key(AttrId, Id);
49  StrAttrVals.AddDat(Key, Val);
50  return 0;
51 }
52 
53 // Get functions
54 int TAttr::GetSAttrDat(const TInt& Id, const TStr& AttrName, TInt& Val) const {
55  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
56  TInt AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
57  return GetSAttrDat(Id, AttrId, Val);
58 }
59 int TAttr::GetSAttrDat(const TInt& Id, const TInt& AttrId, TInt& Val) const {
60  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
61  if (AttrIdToName.GetDat(AttrId).GetVal1() != atInt) { return -2; }
62  TIntPr Key(AttrId, Id);
63  if (IntAttrVals.IsKey(Key)) {
64  Val = IntAttrVals.GetDat(Key);
65  return 0;
66  }
67  return -1;
68 }
69 
70 int TAttr::GetSAttrDat(const TInt& Id, const TStr& AttrName, TFlt& Val) const {
71  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
72  TInt AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
73  return GetSAttrDat(Id, AttrId, Val);
74 }
75 int TAttr::GetSAttrDat(const TInt& Id, const TInt& AttrId, TFlt& Val) const {
76  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
77  if (AttrIdToName.GetDat(AttrId).GetVal1() != atFlt) { return -2; }
78  TIntPr Key(AttrId, Id);
79  if (FltAttrVals.IsKey(Key)) {
80  Val = FltAttrVals.GetDat(Key);
81  return 0;
82  }
83  return -1;
84 }
85 
86 int TAttr::GetSAttrDat(const TInt& Id, const TStr& AttrName, TStr& Val) const {
87  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
88  TInt AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
89  return GetSAttrDat(Id, AttrId, Val);
90 }
91 int TAttr::GetSAttrDat(const TInt& Id, const TInt& AttrId, TStr& Val) const {
92  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
93  if (AttrIdToName.GetDat(AttrId).GetVal1() != atStr) { return -2; }
94  TIntPr Key(AttrId, Id);
95  if (StrAttrVals.IsKey(Key)) {
96  Val = StrAttrVals.GetDat(Key);
97  return 0;
98  }
99  return -1;
100 }
101 
102 // Del functions
103 int TAttr::DelSAttrDat(const TInt& Id, const TStr& AttrName) {
104  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
105  TInt AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
106  return DelSAttrDat(Id, AttrId);
107 }
108 int TAttr::DelSAttrDat(const TInt& Id, const TInt& AttrId) {
109  TIntPr Key(AttrId, Id);
110  if (IntAttrVals.IsKey(Key)) {
111  IntAttrVals.DelKey(Key);
112  return 0;
113  } else if (FltAttrVals.IsKey(Key)) {
114  FltAttrVals.DelKey(Key);
115  return 0;
116  } else if (StrAttrVals.IsKey(Key)) {
117  StrAttrVals.DelKey(Key);
118  return 0;
119  }
120  return -1;
121 }
122 
123 // Delete all attributes for an id
124 void TAttr::DelSAttrId(const TInt& Id) {
125  for (TStrIntPrH::TIter it = AttrNameToId.BegI(); it < AttrNameToId.EndI(); it++) {
126  TAttrType CurType = static_cast<TAttrType>(it.GetDat().GetVal1().Val);
127  TIntPr AttrKey(it.GetDat().GetVal2(), Id);
128  if (CurType == atInt) {
129  IntAttrVals.DelIfKey(AttrKey);
130  } else if (CurType == atFlt) {
131  FltAttrVals.DelIfKey(AttrKey);
132  } else if (CurType == atStr) {
133  StrAttrVals.DelIfKey(AttrKey);
134  }
135  }
136 }
137 
138 // GetNames
139 void TAttr::GetSAttrV(const TInt& Id, const TAttrType AttrType, TAttrPrV& AttrV) const {
140  AttrV = TAttrPrV();
141  for (TStrIntPrH::TIter it = AttrNameToId.BegI(); it < AttrNameToId.EndI(); it++) {
142  TAttrType CurType = static_cast<TAttrType>(it.GetDat().GetVal1().Val);
143  if (CurType == AttrType) {
144  TIntPr AttrKey(it.GetDat().GetVal2(), Id);
145  if (CurType == atInt) {
146  if (IntAttrVals.IsKey(AttrKey)) {
147  TAttrPr Dat(it.GetKey(), CurType);
148  AttrV.Add(Dat);
149  }
150 
151  } else if (CurType == atFlt) {
152  if (FltAttrVals.IsKey(AttrKey)) {
153  TAttrPr Dat(it.GetKey(), CurType);
154  AttrV.Add(Dat);
155  }
156  } else if (CurType == atStr) {
157  if (StrAttrVals.IsKey(AttrKey)) {
158  TAttrPr Dat(it.GetKey(), CurType);
159  AttrV.Add(Dat);
160  }
161  }
162  }
163  }
164 }
165 
166 // Get ids of all items with given attribute
167 int TAttr::GetIdVSAttr(const TInt& AttrId, const TAttrType Type, TIntV& IdV) const {
168  if (Type == atInt) {
169  for (TIntPrIntH::TIter it = IntAttrVals.BegI(); it < IntAttrVals.EndI(); it++) {
170  if (it.GetKey().GetVal1() == AttrId) {
171  IdV.Add(it.GetKey().GetVal2());
172  }
173  }
174  } else if (Type == atFlt) {
175  for (TIntPrFltH::TIter it = FltAttrVals.BegI(); it < FltAttrVals.EndI(); it++) {
176  if (it.GetKey().GetVal1() == AttrId) {
177  IdV.Add(it.GetKey().GetVal2());
178  }
179  }
180  } else if (Type == atStr) {
181  for (TIntPrStrH::TIter it = StrAttrVals.BegI(); it < StrAttrVals.EndI(); it++) {
182  if (it.GetKey().GetVal1() == AttrId) {
183  IdV.Add(it.GetKey().GetVal2());
184  }
185  }
186  } else {
187  return -1;
188  }
189  return 0;
190 }
191 
192 int TAttr::GetIdVSAttr(const TInt& AttrId, TIntV& IdV) const {
193  IdV = TIntV();
194  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
195  TIntStrPr TypeAndName = AttrIdToName.GetDat(AttrId);
196  TAttrType Type = static_cast<TAttrType>(TypeAndName.GetVal1().Val);
197  return GetIdVSAttr(AttrId, Type, IdV);
198 }
199 
200 int TAttr::GetIdVSAttr(const TStr& AttrName, TIntV& IdV) const {
201  IdV = TIntV();
202  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
203  TIntPr TypeAndId = AttrNameToId.GetDat(AttrName);
204  TAttrType Type = static_cast<TAttrType>(TypeAndId.GetVal1().Val);
205  TInt AttrId = TypeAndId.GetVal2();
206  return GetIdVSAttr(AttrId, Type, IdV);
207 }
208 
209 // Add Attribute mapping
210 int TAttr::AddSAttr(const TStr& Name, const TAttrType& AttrType, TInt& AttrId) {
211  if (AttrType != atInt && AttrType != atFlt && AttrType != atStr) {
212  return -1; // type must be defined and can only have a single type
213  }
214  if (AttrNameToId.IsKey(Name)) { return -1; }
215  AttrId = AttrNameToId.GetMxKeyIds();
216  TIntPr TypeAndId(AttrType, AttrId);
217  AttrNameToId.AddDat(Name, TypeAndId);
218  TIntStrPr TypeAndName(AttrType, Name);
219  AttrIdToName.AddDat(AttrId, TypeAndName);
220  return 0;
221 }
222 
223 // Attribute Name to ID conversion and vice versa
224 int TAttr::GetSAttrId(const TStr& Name, TInt& AttrId, TAttrType& AttrType) const {
225  if (!AttrNameToId.IsKey(Name)) {
226  return -1;
227  }
228  TIntPr TypeAndId = AttrNameToId.GetDat(Name);
229  AttrType = static_cast<TAttrType>(TypeAndId.GetVal1().Val);
230  AttrId = TypeAndId.GetVal2();
231  return 0;
232 }
233 int TAttr::GetSAttrName(const TInt& AttrId, TStr& Name, TAttrType& AttrType) const {
234  if (!AttrIdToName.IsKey(AttrId)) {
235  return -1;
236  }
237  TIntStrPr TypeAndName = AttrIdToName.GetDat(AttrId);
238  AttrType = static_cast<TAttrType>(TypeAndName.GetVal1().Val);
239  Name = TypeAndName.GetVal2();
240  return 0;
241 }
242 
243 
244 
245 // Add functions
246 int TAttrPair::AddSAttrDat(const TIntPr& Id, const TStr& AttrName, const TInt& Val) {
247  TInt AttrId;
248  if (!AttrNameToId.IsKey(AttrName)) {
249  AddSAttr(AttrName, atInt, AttrId);
250  } else {
251  AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
252  }
253  return AddSAttrDat(Id, AttrId, Val);
254 }
255 int TAttrPair::AddSAttrDat(const TIntPr& Id, const TInt& AttrId, const TInt& Val) {
256  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
257  if (AttrIdToName.GetDat(AttrId).GetVal1() != atInt) { return -2; }
258  TIntIntPrPr Key(AttrId, Id);
259  IntAttrVals.AddDat(Key, Val);
260  return 0;
261 }
262 
263 int TAttrPair::AddSAttrDat(const TIntPr& Id, const TStr& AttrName, const TFlt& Val) {
264  TInt AttrId;
265  if (!AttrNameToId.IsKey(AttrName)) {
266  AddSAttr(AttrName, atFlt, AttrId);
267  } else {
268  AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
269  }
270  return AddSAttrDat(Id, AttrId, Val);
271 }
272 int TAttrPair::AddSAttrDat(const TIntPr& Id, const TInt& AttrId, const TFlt& Val) {
273  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
274  if (AttrIdToName.GetDat(AttrId).GetVal1() != atFlt) { return -2; }
275  TIntIntPrPr Key(AttrId, Id);
276  FltAttrVals.AddDat(Key, Val);
277  return 0;
278 }
279 
280 int TAttrPair::AddSAttrDat(const TIntPr& Id, const TStr& AttrName, const TStr& Val) {
281  TInt AttrId;
282  if (!AttrNameToId.IsKey(AttrName)) {
283  AddSAttr(AttrName, atStr, AttrId);
284  } else {
285  AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
286  }
287  return AddSAttrDat(Id, AttrId, Val);
288 }
289 int TAttrPair::AddSAttrDat(const TIntPr& Id, const TInt& AttrId, const TStr& Val) {
290  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
291  if (AttrIdToName.GetDat(AttrId).GetVal1() != atStr) { return -2; }
292  TIntIntPrPr Key(AttrId, Id);
293  StrAttrVals.AddDat(Key, Val);
294  return 0;
295 }
296 
297 // Get functions
298 int TAttrPair::GetSAttrDat(const TIntPr& Id, const TStr& AttrName, TInt& Val) const {
299  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
300  TInt AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
301  return GetSAttrDat(Id, AttrId, Val);
302 }
303 int TAttrPair::GetSAttrDat(const TIntPr& Id, const TInt& AttrId, TInt& Val) const {
304  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
305  if (AttrIdToName.GetDat(AttrId).GetVal1() != atInt) { return -2; }
306  TIntIntPrPr Key(AttrId, Id);
307  if (IntAttrVals.IsKey(Key)) {
308  Val = IntAttrVals.GetDat(Key);
309  return 0;
310  }
311  return -1;
312 }
313 
314 int TAttrPair::GetSAttrDat(const TIntPr& Id, const TStr& AttrName, TFlt& Val) const {
315  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
316  TInt AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
317  return GetSAttrDat(Id, AttrId, Val);
318 }
319 int TAttrPair::GetSAttrDat(const TIntPr& Id, const TInt& AttrId, TFlt& Val) const {
320  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
321  if (AttrIdToName.GetDat(AttrId).GetVal1() != atFlt) { return -2; }
322  TIntIntPrPr Key(AttrId, Id);
323  if (FltAttrVals.IsKey(Key)) {
324  Val = FltAttrVals.GetDat(Key);
325  return 0;
326  }
327  return -1;
328 }
329 
330 int TAttrPair::GetSAttrDat(const TIntPr& Id, const TStr& AttrName, TStr& Val) const {
331  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
332  TInt AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
333  return GetSAttrDat(Id, AttrId, Val);
334 }
335 int TAttrPair::GetSAttrDat(const TIntPr& Id, const TInt& AttrId, TStr& Val) const {
336  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
337  if (AttrIdToName.GetDat(AttrId).GetVal1() != atStr) { return -2; }
338  TIntIntPrPr Key(AttrId, Id);
339  if (StrAttrVals.IsKey(Key)) {
340  Val = StrAttrVals.GetDat(Key);
341  return 0;
342  }
343  return -1;
344 }
345 
346 // Del functions
347 int TAttrPair::DelSAttrDat(const TIntPr& Id, const TStr& AttrName) {
348  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
349  TInt AttrId = AttrNameToId.GetDat(AttrName).GetVal2();
350  return DelSAttrDat(Id, AttrId);
351 }
352 int TAttrPair::DelSAttrDat(const TIntPr& Id, const TInt& AttrId) {
353  TIntIntPrPr Key(AttrId, Id);
354  if (IntAttrVals.IsKey(Key)) {
355  IntAttrVals.DelKey(Key);
356  return 0;
357  } else if (FltAttrVals.IsKey(Key)) {
358  FltAttrVals.DelKey(Key);
359  return 0;
360  } else if (StrAttrVals.IsKey(Key)) {
361  StrAttrVals.DelKey(Key);
362  return 0;
363  }
364  return -1;
365 }
366 
367 // Delete all attributes for an id
368 void TAttrPair::DelSAttrId(const TIntPr& Id) {
369  for (TStrIntPrH::TIter it = AttrNameToId.BegI(); it < AttrNameToId.EndI(); it++) {
370  TAttrType CurType = static_cast<TAttrType>(it.GetDat().GetVal1().Val);
371  TIntIntPrPr AttrKey(it.GetDat().GetVal2(), Id);
372  if (CurType == atInt) {
373  IntAttrVals.DelIfKey(AttrKey);
374  } else if (CurType == atFlt) {
375  FltAttrVals.DelIfKey(AttrKey);
376  } else if (CurType == atStr) {
377  StrAttrVals.DelIfKey(AttrKey);
378  }
379  }
380 }
381 
382 // GetNames
383 void TAttrPair::GetSAttrV(const TIntPr& Id, const TAttrType AttrType, TAttrPrV& AttrV) const {
384  AttrV = TAttrPrV();
385  for (TStrIntPrH::TIter it = AttrNameToId.BegI(); it < AttrNameToId.EndI(); it++) {
386  TAttrType CurType = static_cast<TAttrType>(it.GetDat().GetVal1().Val);
387  if (CurType == AttrType) {
388  TIntIntPrPr AttrKey(it.GetDat().GetVal2(), Id);
389  if (CurType == atInt) {
390  if (IntAttrVals.IsKey(AttrKey)) {
391  TAttrPr Dat(it.GetKey(), CurType);
392  AttrV.Add(Dat);
393  }
394 
395  } else if (CurType == atFlt) {
396  if (FltAttrVals.IsKey(AttrKey)) {
397  TAttrPr Dat(it.GetKey(), CurType);
398  AttrV.Add(Dat);
399  }
400  } else if (CurType == atStr) {
401  if (StrAttrVals.IsKey(AttrKey)) {
402  TAttrPr Dat(it.GetKey(), CurType);
403  AttrV.Add(Dat);
404  }
405  }
406  }
407  }
408 }
409 
410 // Get ids of all items with given attribute
411 int TAttrPair::GetIdVSAttr(const TInt& AttrId, const TAttrType Type, TIntPrV& IdV) const {
412  if (Type == atInt) {
413  for (TIntIntPrPrIntH::TIter it = IntAttrVals.BegI(); it < IntAttrVals.EndI(); it++) {
414  if (it.GetKey().GetVal1() == AttrId) {
415  IdV.Add(it.GetKey().GetVal2());
416  }
417  }
418  } else if (Type == atFlt) {
419  for (TIntIntPrPrFltH::TIter it = FltAttrVals.BegI(); it < FltAttrVals.EndI(); it++) {
420  if (it.GetKey().GetVal1() == AttrId) {
421  IdV.Add(it.GetKey().GetVal2());
422  }
423  }
424  } else if (Type == atStr) {
425  for (TIntIntPrPrStrH::TIter it = StrAttrVals.BegI(); it < StrAttrVals.EndI(); it++) {
426  if (it.GetKey().GetVal1() == AttrId) {
427  IdV.Add(it.GetKey().GetVal2());
428  }
429  }
430  } else {
431  return -1;
432  }
433  return 0;
434 }
435 
436 int TAttrPair::GetIdVSAttr(const TStr& AttrName, TIntPrV& IdV) const {
437  IdV = TIntPrV();
438  if (!AttrNameToId.IsKey(AttrName)) { return -1; }
439  TIntPr TypeAndId = AttrNameToId.GetDat(AttrName);
440  TAttrType Type = static_cast<TAttrType>(TypeAndId.GetVal1().Val);
441  TInt AttrId = TypeAndId.GetVal2();
442  return GetIdVSAttr(AttrId, Type, IdV);
443 }
444 
445 int TAttrPair::GetIdVSAttr(const TInt& AttrId, TIntPrV& IdV) const {
446  IdV = TIntPrV();
447  if (!AttrIdToName.IsKey(AttrId)) { return -1; }
448  TIntStrPr TypeAndName = AttrIdToName.GetDat(AttrId);
449  TAttrType Type = static_cast<TAttrType>(TypeAndName.GetVal1().Val);
450  return GetIdVSAttr(AttrId, Type, IdV);
451 }
452 
453 // Add Attribute mapping
454 int TAttrPair::AddSAttr(const TStr& Name, const TAttrType& AttrType, TInt& AttrId) {
455  if (AttrType != atInt && AttrType != atFlt && AttrType != atStr) {
456  return -1; // type must be defined and can only have a single type
457  }
458  AttrId = AttrNameToId.GetMxKeyIds();
459  TIntPr TypeAndId(AttrType, AttrId);
460  AttrNameToId.AddDat(Name, TypeAndId);
461  TIntStrPr TypeAndName(AttrType, Name);
462  AttrIdToName.AddDat(AttrId, TypeAndName);
463  return 0;
464 }
465 
466 // Attribute Name to ID conversion and vice versa
467 int TAttrPair::GetSAttrId(const TStr& Name, TInt& AttrId, TAttrType& AttrType) const {
468  if (!AttrNameToId.IsKey(Name)) {
469  return -1;
470  }
471  TIntPr TypeAndId = AttrNameToId.GetDat(Name);
472  AttrType = static_cast<TAttrType>(TypeAndId.GetVal1().Val);
473  AttrId = TypeAndId.GetVal2();
474  return 0;
475 }
476 
477 int TAttrPair::GetSAttrName(const TInt& AttrId, TStr& Name, TAttrType& AttrType) const {
478  if (!AttrIdToName.IsKey(AttrId)) {
479  return -1;
480  }
481  TIntStrPr TypeAndName = AttrIdToName.GetDat(AttrId);
482  AttrType = static_cast<TAttrType>(TypeAndName.GetVal1().Val);
483  Name = TypeAndName.GetVal2();
484  return 0;
485 }
int DelSAttrDat(const TInt &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:103
int GetSAttrDat(const TIntPr &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:298
enum TAttrType_ TAttrType
Types for tables, sparse and dense attributes.
int AddSAttrDat(const TInt &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:2
void DelSAttrId(const TIntPr &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:368
const TVal1 & GetVal1() const
Definition: ds.h:60
TIter BegI() const
Definition: hash.h:213
int GetSAttrName(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Given the attribute id AttrId, get the attribute name.
Definition: attr.cpp:233
TIntIntStrPrH AttrIdToName
Definition: attr.h:101
const TVal2 & GetVal2() const
Definition: ds.h:61
const TDat & GetDat(const TKey &Key) const
Definition: hash.h:262
TIter EndI() const
Definition: hash.h:218
int GetSAttrName(const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const
Given the attribute id AttrId, get the attribute name and type.
Definition: attr.cpp:477
void DelSAttrId(const TInt &Id)
Delete all attributes for the given id Id.
Definition: attr.cpp:124
Definition: gbase.h:23
Definition: dt.h:1383
TIntIntPrPrIntH IntAttrVals
Definition: attr.h:103
void DelKey(const TKey &Key)
Definition: hash.h:404
TVec< TIntPr > TIntPrV
Definition: ds.h:1601
TIntIntStrPrH AttrIdToName
Definition: attr.h:8
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntV &IdV) const
Definition: attr.cpp:167
TIntIntPrPrFltH FltAttrVals
Definition: attr.h:104
TStrIntPrH AttrNameToId
Definition: attr.h:100
int GetMxKeyIds() const
Definition: hash.h:231
void GetSAttrV(const TInt &Id, const TAttrType AttrType, TAttrPrV &AttrV) const
Get a list of all attributes of type AttrType for the given id Id.
Definition: attr.cpp:139
TIntIntPrPrStrH StrAttrVals
Definition: attr.h:105
Definition: dt.h:1134
int GetSAttrId(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Given the attribute name Name, get the attribute id and type.
Definition: attr.cpp:467
TIntPrStrH StrAttrVals
Definition: attr.h:12
int GetIdVSAttr(const TInt &AttrId, const TAttrType Type, TIntPrV &IdV) const
Definition: attr.cpp:411
int GetSAttrDat(const TInt &Id, const TStr &AttrName, TInt &ValX) const
Get Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:54
int AddSAttr(const TStr &Name, const TAttrType &AttrType, TInt &AttrIdX)
Adds a mapping for an attribute with name Name and type AttrType.
Definition: attr.cpp:454
TVec< TAttrPr > TAttrPrV
Definition: attr.h:2
Definition: ds.h:32
int AddSAttrDat(const TIntPr &Id, const TStr &AttrName, const TInt &Val)
Add Int attribute with name AttrName for the given id Id.
Definition: attr.cpp:246
Definition: dt.h:412
Definition: gbase.h:23
int DelSAttrDat(const TIntPr &Id, const TStr &AttrName)
Delete attribute with name AttrName for the given id Id.
Definition: attr.cpp:347
void GetSAttrV(const TIntPr &Id, const TAttrType AttrType, TAttrPrV &AttrV) const
Get a list of all attributes of the given type AttrType for the given id Id.
Definition: attr.cpp:383
bool DelIfKey(const TKey &Key)
Definition: hash.h:243
TIntPrFltH FltAttrVals
Definition: attr.h:11
TVec< TInt > TIntV
Definition: ds.h:1594
int GetSAttrId(const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const
Given the attribute name Name, get the attribute id.
Definition: attr.cpp:224
Definition: gbase.h:23
TIntPrIntH IntAttrVals
Definition: attr.h:10
bool IsKey(const TKey &Key) const
Definition: hash.h:258
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
TDat & AddDat(const TKey &Key)
Definition: hash.h:238
int AddSAttr(const TStr &Name, const TAttrType &AttrType, TInt &AttrIdX)
Adds a mapping for an attribute with name Name and type AttrType.
Definition: attr.cpp:210
Vector is a sequence TVal objects representing an array that can change in size.
Definition: ds.h:430
TStrIntPrH AttrNameToId
Definition: attr.h:7