SNAP Library 4.0, Developer Reference
2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <attr.h>
Public Member Functions | |
TAttr () | |
TAttr (const TAttr &Attrs) | |
TAttr (TSIn &SIn) | |
Constructor for loading attributes from a (binary) stream SIn. More... | |
void | Load (TSIn &SIn) |
Load attribute from input stream. More... | |
void | Save (TSOut &SOut) const |
Saves the attributes to a (binary) stream SOut. More... | |
void | Clr () |
Clears the contents of the attribute map. More... | |
size_t | GetMemUsed () const |
Returns the amount of memory used by sparse attributes. More... | |
int | AddSAttrDat (const TInt &Id, const TStr &AttrName, const TInt &Val) |
Add Int attribute with name AttrName for the given id Id . More... | |
int | AddSAttrDat (const TInt &Id, const TInt &AttrId, const TInt &Val) |
Add Int attribute with attribute id AttrId for the given id Id . More... | |
int | AddSAttrDat (const TInt &Id, const TStr &AttrName, const TFlt &Val) |
Add Flt attribute with name AttrName for the given id Id . More... | |
int | AddSAttrDat (const TInt &Id, const TInt &AttrId, const TFlt &Val) |
Add Flt attribute with attribute id AttrId for the given id Id . More... | |
int | AddSAttrDat (const TInt &Id, const TStr &AttrName, const TStr &Val) |
Add Str attribute with name AttrName for the given id Id . More... | |
int | AddSAttrDat (const TInt &Id, const TInt &AttrId, const TStr &Val) |
Add Str attribute with attribute id AttrId for the given id Id . More... | |
int | GetSAttrDat (const TInt &Id, const TStr &AttrName, TInt &ValX) const |
Get Int attribute with name AttrName for the given id Id . More... | |
int | GetSAttrDat (const TInt &Id, const TInt &AttrId, TInt &ValX) const |
Get Int attribute with attribute id AttrId for the given id Id . More... | |
int | GetSAttrDat (const TInt &Id, const TStr &AttrName, TFlt &ValX) const |
Get Flt attribute with name AttrName for the given id Id . More... | |
int | GetSAttrDat (const TInt &Id, const TInt &AttrId, TFlt &ValX) const |
Get Flt attribute with attribute id AttrId for the given id Id . More... | |
int | GetSAttrDat (const TInt &Id, const TStr &AttrName, TStr &ValX) const |
Get Str attribute with name AttrName for the given id Id . More... | |
int | GetSAttrDat (const TInt &Id, const TInt &AttrId, TStr &ValX) const |
Get Str attribute with attribute id AttrId for the given id Id . More... | |
int | DelSAttrDat (const TInt &Id, const TStr &AttrName) |
Delete attribute with name AttrName for the given id Id . More... | |
int | DelSAttrDat (const TInt &Id, const TInt &AttrId) |
Delete attribute with attribute id AttrId for the given id Id . More... | |
void | DelSAttrId (const TInt &Id) |
Delete all attributes for the given id Id . More... | |
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 . More... | |
int | GetIdVSAttr (const TStr &AttrName, TIntV &IdV) const |
Get a list of all ids that have an attribute with name AttrName . More... | |
int | GetIdVSAttr (const TInt &AttrId, TIntV &IdV) const |
Get a list of all ids that have an attribute with attribute id AttrId . More... | |
int | AddSAttr (const TStr &Name, const TAttrType &AttrType, TInt &AttrIdX) |
Adds a mapping for an attribute with name Name and type AttrType . More... | |
int | GetSAttrId (const TStr &Name, TInt &AttrIdX, TAttrType &AttrTypeX) const |
Given the attribute name Name , get the attribute id. More... | |
int | GetSAttrName (const TInt &AttrId, TStr &NameX, TAttrType &AttrTypeX) const |
Given the attribute id AttrId , get the attribute name. More... | |
Private Member Functions | |
int | GetIdVSAttr (const TInt &AttrId, const TAttrType Type, TIntV &IdV) const |
Private Attributes | |
TStrIntPrH | AttrNameToId |
TIntIntStrPrH | AttrIdToName |
TIntPrIntH | IntAttrVals |
TIntPrFltH | FltAttrVals |
TIntPrStrH | StrAttrVals |
|
inline |
Adds a mapping for an attribute with name Name
and type AttrType
.
Definition at line 210 of file attr.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), atFlt, atInt, atStr, AttrIdToName, AttrNameToId, THash< TKey, TDat, THashFunc >::GetMxKeyIds(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by AddSAttrDat(), TNEANet::AddSAttrE(), TUndirNet::AddSAttrE(), TDirNet::AddSAttrE(), TNEANet::AddSAttrN(), TUndirNet::AddSAttrN(), and TDirNet::AddSAttrN().
Add Int attribute with name AttrName
for the given id Id
.
Definition at line 2 of file attr.cpp.
References AddSAttr(), atInt, AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by AddSAttrDat(), TNEANet::AddSAttrDatE(), TUndirNet::AddSAttrDatE(), TDirNet::AddSAttrDatE(), TNEANet::AddSAttrDatN(), TUndirNet::AddSAttrDatN(), and TDirNet::AddSAttrDatN().
Add Int attribute with attribute id AttrId
for the given id Id
.
Definition at line 11 of file attr.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), atInt, AttrIdToName, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal1(), IntAttrVals, and THash< TKey, TDat, THashFunc >::IsKey().
Add Flt attribute with name AttrName
for the given id Id
.
Definition at line 19 of file attr.cpp.
References AddSAttr(), AddSAttrDat(), atFlt, AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Add Flt attribute with attribute id AttrId
for the given id Id
.
Definition at line 28 of file attr.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), atFlt, AttrIdToName, FltAttrVals, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal1(), and THash< TKey, TDat, THashFunc >::IsKey().
Add Str attribute with name AttrName
for the given id Id
.
Definition at line 36 of file attr.cpp.
References AddSAttr(), AddSAttrDat(), atStr, AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Add Str attribute with attribute id AttrId
for the given id Id
.
Definition at line 45 of file attr.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), atStr, AttrIdToName, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal1(), THash< TKey, TDat, THashFunc >::IsKey(), and StrAttrVals.
|
inline |
Clears the contents of the attribute map.
Definition at line 37 of file attr.h.
References AttrIdToName, AttrNameToId, THash< TKey, TDat, THashFunc >::Clr(), FltAttrVals, IntAttrVals, and StrAttrVals.
Delete attribute with name AttrName
for the given id Id
.
Definition at line 103 of file attr.cpp.
References AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by TNEANet::DelSAttrDatE(), TUndirNet::DelSAttrDatE(), TDirNet::DelSAttrDatE(), TNEANet::DelSAttrDatN(), TUndirNet::DelSAttrDatN(), and TDirNet::DelSAttrDatN().
Delete attribute with attribute id AttrId
for the given id Id
.
Definition at line 108 of file attr.cpp.
References THash< TKey, TDat, THashFunc >::DelKey(), FltAttrVals, IntAttrVals, THash< TKey, TDat, THashFunc >::IsKey(), and StrAttrVals.
void TAttr::DelSAttrId | ( | const TInt & | Id | ) |
Delete all attributes for the given id Id
.
Definition at line 124 of file attr.cpp.
References atFlt, atInt, atStr, AttrNameToId, THash< TKey, TDat, THashFunc >::BegI(), THash< TKey, TDat, THashFunc >::DelIfKey(), THash< TKey, TDat, THashFunc >::EndI(), FltAttrVals, IntAttrVals, and StrAttrVals.
Referenced by TNEANet::DelEdge(), TUndirNet::DelEdge(), TDirNet::DelEdge(), TNEANet::DelNode(), TUndirNet::DelNode(), and TDirNet::DelNode().
Definition at line 167 of file attr.cpp.
References TVec< TVal, TSizeTy >::Add(), atFlt, atInt, atStr, THash< TKey, TDat, THashFunc >::BegI(), THash< TKey, TDat, THashFunc >::EndI(), FltAttrVals, IntAttrVals, and StrAttrVals.
Referenced by GetIdVSAttr(), TNEANet::GetIdVSAttrE(), TUndirNet::GetIdVSAttrE(), TDirNet::GetIdVSAttrE(), TNEANet::GetIdVSAttrN(), TUndirNet::GetIdVSAttrN(), and TDirNet::GetIdVSAttrN().
Get a list of all ids that have an attribute with name AttrName
.
Definition at line 200 of file attr.cpp.
References AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), GetIdVSAttr(), TPair< TVal1, TVal2 >::GetVal1(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Get a list of all ids that have an attribute with attribute id AttrId
.
Definition at line 192 of file attr.cpp.
References AttrIdToName, THash< TKey, TDat, THashFunc >::GetDat(), GetIdVSAttr(), TPair< TVal1, TVal2 >::GetVal1(), and THash< TKey, TDat, THashFunc >::IsKey().
|
inline |
Returns the amount of memory used by sparse attributes.
Definition at line 40 of file attr.h.
References AttrIdToName, AttrNameToId, FltAttrVals, THash< TKey, TDat, THashFunc >::GetMemUsed(), IntAttrVals, and StrAttrVals.
Get Int attribute with name AttrName
for the given id Id
.
Definition at line 54 of file attr.cpp.
References AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by GetSAttrDat(), TNEANet::GetSAttrDatE(), TUndirNet::GetSAttrDatE(), TDirNet::GetSAttrDatE(), TNEANet::GetSAttrDatN(), TUndirNet::GetSAttrDatN(), and TDirNet::GetSAttrDatN().
Get Int attribute with attribute id AttrId
for the given id Id
.
Definition at line 59 of file attr.cpp.
References atInt, AttrIdToName, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal1(), IntAttrVals, and THash< TKey, TDat, THashFunc >::IsKey().
Get Flt attribute with name AttrName
for the given id Id
.
Definition at line 70 of file attr.cpp.
References AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), GetSAttrDat(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Get Flt attribute with attribute id AttrId
for the given id Id
.
Definition at line 75 of file attr.cpp.
References atFlt, AttrIdToName, FltAttrVals, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal1(), and THash< TKey, TDat, THashFunc >::IsKey().
Get Str attribute with name AttrName
for the given id Id
.
Definition at line 86 of file attr.cpp.
References AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), GetSAttrDat(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Get Str attribute with attribute id AttrId
for the given id Id
.
Definition at line 91 of file attr.cpp.
References atStr, AttrIdToName, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal1(), THash< TKey, TDat, THashFunc >::IsKey(), and StrAttrVals.
Given the attribute name Name
, get the attribute id.
Definition at line 224 of file attr.cpp.
References AttrNameToId, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal1(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by TNEANet::GetSAttrIdE(), TUndirNet::GetSAttrIdE(), TDirNet::GetSAttrIdE(), TNEANet::GetSAttrIdN(), TUndirNet::GetSAttrIdN(), and TDirNet::GetSAttrIdN().
Given the attribute id AttrId
, get the attribute name.
Definition at line 233 of file attr.cpp.
References AttrIdToName, THash< TKey, TDat, THashFunc >::GetDat(), TPair< TVal1, TVal2 >::GetVal1(), TPair< TVal1, TVal2 >::GetVal2(), and THash< TKey, TDat, THashFunc >::IsKey().
Referenced by TNEANet::GetSAttrNameE(), TUndirNet::GetSAttrNameE(), TDirNet::GetSAttrNameE(), TNEANet::GetSAttrNameN(), TUndirNet::GetSAttrNameN(), and TDirNet::GetSAttrNameN().
Get a list of all attributes of type AttrType
for the given id Id
.
Definition at line 139 of file attr.cpp.
References TVec< TVal, TSizeTy >::Add(), atFlt, atInt, atStr, AttrNameToId, THash< TKey, TDat, THashFunc >::BegI(), THash< TKey, TDat, THashFunc >::EndI(), FltAttrVals, IntAttrVals, THash< TKey, TDat, THashFunc >::IsKey(), and StrAttrVals.
Referenced by TNEANet::GetSAttrVE(), TUndirNet::GetSAttrVE(), TDirNet::GetSAttrVE(), TNEANet::GetSAttrVN(), TUndirNet::GetSAttrVN(), and TDirNet::GetSAttrVN().
|
inline |
Load attribute from input stream.
Definition at line 25 of file attr.h.
References AttrIdToName, AttrNameToId, FltAttrVals, IntAttrVals, THash< TKey, TDat, THashFunc >::Load(), and StrAttrVals.
|
inline |
Saves the attributes to a (binary) stream SOut.
Definition at line 33 of file attr.h.
References AttrIdToName, AttrNameToId, FltAttrVals, IntAttrVals, THash< TKey, TDat, THashFunc >::Save(), and StrAttrVals.
|
private |
Definition at line 8 of file attr.h.
Referenced by AddSAttr(), AddSAttrDat(), Clr(), GetIdVSAttr(), GetMemUsed(), GetSAttrDat(), GetSAttrName(), Load(), and Save().
|
private |
Definition at line 7 of file attr.h.
Referenced by AddSAttr(), AddSAttrDat(), Clr(), DelSAttrDat(), DelSAttrId(), GetIdVSAttr(), GetMemUsed(), GetSAttrDat(), GetSAttrId(), GetSAttrV(), Load(), and Save().
|
private |
Definition at line 11 of file attr.h.
Referenced by AddSAttrDat(), Clr(), DelSAttrDat(), DelSAttrId(), GetIdVSAttr(), GetMemUsed(), GetSAttrDat(), GetSAttrV(), Load(), and Save().
|
private |
Definition at line 10 of file attr.h.
Referenced by AddSAttrDat(), Clr(), DelSAttrDat(), DelSAttrId(), GetIdVSAttr(), GetMemUsed(), GetSAttrDat(), GetSAttrV(), Load(), and Save().
|
private |
Definition at line 12 of file attr.h.
Referenced by AddSAttrDat(), Clr(), DelSAttrDat(), DelSAttrId(), GetIdVSAttr(), GetMemUsed(), GetSAttrDat(), GetSAttrV(), Load(), and Save().