76 ~HDF5Hierarchy() { clear(); }
78 H5Node createNode( hid_t iId );
80 void build( hid_t iFile );
82 bool isEnabled() {
return m_enabled; }
83 void setEnabled(
bool iEnabled ) { m_enabled = iEnabled; }
85 hobj_ref_t getChildRef( hobj_ref_t iParentRef,
const std::string &iName );
86 bool childExists( hobj_ref_t iParentRef,
const std::string &iName );
87 bool attrExists( hobj_ref_t iParentRef,
const std::string &iName );
89 void readMetaDataString( hobj_ref_t iParentRef,
90 const std::string &iMetaDataName,
91 std::string &oMetaDataString );
93 void readMaskInfo( hobj_ref_t iParentRef,
94 const std::string &iPropName,
99 void visitAllChildObjects(
H5Node iParent,
100 const std::string &iName,
103 hobj_ref_t objectRef = getChildRef( iParent.getRef(), iName );
104 ChildInfoArray& children = m_objectMap[objectRef].m_children;
106 for( ChildInfoArray::iterator it = children.begin();
107 it != children.end(); ++it )
109 iVisitor( it->m_name );
114 void visitAllAttributes( hobj_ref_t iParentRef,
115 const std::string &iName,
118 hobj_ref_t objectRef = getChildRef( iParentRef, iName );
119 AttrInfoArray& attrs = m_objectMap[objectRef].m_attrs;
121 for( AttrInfoArray::iterator it = attrs.begin();
122 it != attrs.end(); ++it )
124 std::string attrName( it->m_name );
125 size_t attrNameLen = attrName.size();
126 if ( attrNameLen < 6 )
132 std::string suffix( attrName, attrNameLen-5 );
133 if ( suffix ==
".info" )
135 std::string propertyName( attrName, 0, attrNameLen-5 );
136 iVisitor( propertyName );
141 void makeCompactObjectHierarchy(
142 std::vector<hobj_ref_t> &oObjectRefs,
143 std::vector<uint32_t> &oChildrenSizes,
144 std::vector<std::string> &oChildrenNames,
145 std::vector<hobj_ref_t> &oChildrenRefs,
146 std::vector<uint32_t> &oAttrSizes,
147 std::vector<std::string> &oAttrNames,
148 std::vector<char> &oHasMask,
149 std::vector<uint32_t> &oMaskBits,
150 std::vector<char> &oHasMeta,
151 std::vector<std::string> &oMetaStrs );
153 void extractFromCompactObjectHierarchy(
155 std::vector<hobj_ref_t> &iObjectRefs,
156 std::vector<uint32_t> &iChildrenSizes,
157 std::vector<std::string> &iChildrenNames,
158 std::vector<hobj_ref_t> &iChildrenRefs,
159 std::vector<uint32_t> &iAttrSizes,
160 std::vector<std::string> &iAttrNames,
161 std::vector<char> &iHasMask,
162 std::vector<uint32_t> &iMaskBits,
163 std::vector<char> &iHasMeta,
164 std::vector<std::string> &iMetaStrs );
167 void addObject( hid_t iParent,
const char *iName );
168 void addAttr( hid_t iParent,
const char *iName );
170 friend class ObjectVisitor;
174 ChildInfo(
const string &iName, hobj_ref_t iRef = 0 )
175 : m_name( iName ), m_ref( iRef ) {}
180 friend inline bool operator<(
const ChildInfo &x,
const ChildInfo &y )
182 return x.m_name < y.m_name;
194 AttrInfo(
const string &iName ) : m_name( iName ), m_mask( NULL ) {}
206 friend inline bool operator<(
const AttrInfo &x,
const AttrInfo &y )
208 return x.m_name < y.m_name;
212 typedef std::vector<ChildInfo> ChildInfoArray;
213 typedef std::vector<AttrInfo> AttrInfoArray;
217 ChildInfoArray m_children;
218 AttrInfoArray m_attrs;
221 typedef std::map<hobj_ref_t, ObjectInfo> ObjectMap;
223 ObjectMap m_objectMap;