@@ -72,11 +72,24 @@ void WsjcppObjTreeNode::setId(uint32_t nId) {
7272
7373WsjcppObjTree::WsjcppObjTree () {
7474 m_nLastId = 0 ;
75+ m_nUserVersion = 0 ;
7576 TAG = " WsjcppObjTree" ;
7677}
7778
7879// ---------------------------------------------------------------------
7980
81+ void WsjcppObjTree::setUserVersionOfTree (uint32_t nUserVersion) {
82+ m_nUserVersion = nUserVersion;
83+ }
84+
85+ // ---------------------------------------------------------------------
86+
87+ uint32_t WsjcppObjTree::getUserVersionOfTree () {
88+ return m_nUserVersion;
89+ }
90+
91+ // ---------------------------------------------------------------------
92+
8093WsjcppObjTree::~WsjcppObjTree () {
8194 clearNodes ();
8295 std::map<uint16_t , IFabricWsjcppObjTreeNode*>::iterator it;
@@ -111,6 +124,11 @@ bool WsjcppObjTree::readTreeFromFile(const std::string &sFilename, std::string &
111124 return false ;
112125 }
113126
127+ // just a user version for usebillity
128+ if (!this ->readUInt32 (f, m_nUserVersion, sError )) {
129+ return false ;
130+ }
131+
114132 uint32_t nTreeSize = 0 ;
115133 if (!this ->readUInt32 (f, nTreeSize, sError )) {
116134 return false ;
@@ -182,7 +200,9 @@ bool WsjcppObjTree::writeTreeToFile(const std::string &sFilename, std::string &s
182200 static const std::string sFileHeader = " WSJCPP-OBJ-TREE-FILE" ;
183201 f.write (sFileHeader .c_str (), sFileHeader .length ());
184202
185- // m_nLastId
203+ // just a user version for usebillity
204+ this ->writeUInt32 (f, m_nUserVersion);
205+
186206 int nTreeSize = m_vNodes.size ();
187207 this ->writeUInt32 (f, nTreeSize);
188208 this ->writeUInt32 (f, m_nLastId);
@@ -292,7 +312,7 @@ int WsjcppObjTree::getRoots(std::vector<WsjcppObjTreeNode *> &vRoots) {
292312
293313std::string WsjcppObjTree::toString () { // for printing
294314 std::string sIntent = " " ;
295- return toStringRecoursiveChilds (nullptr , sIntent );
315+ return " Root (ver: " + std::to_string (m_nUserVersion) + " ) \n " + toStringRecoursiveChilds (nullptr , sIntent );
296316}
297317
298318// ---------------------------------------------------------------------
0 commit comments