ADD: added cost do serialize function in Identifier
This commit is contained in:
@@ -62,7 +62,7 @@ namespace SimCore {
|
|||||||
* @brief returns the serilaized string of the ID
|
* @brief returns the serilaized string of the ID
|
||||||
* @brief string
|
* @brief string
|
||||||
*/
|
*/
|
||||||
std::string serialize();
|
std::string serialize() const;
|
||||||
|
|
||||||
std::string getUUID() const;
|
std::string getUUID() const;
|
||||||
|
|
||||||
@@ -76,6 +76,6 @@ namespace SimCore {
|
|||||||
/// the number of the parent, all ID from an external source the parent is the same
|
/// the number of the parent, all ID from an external source the parent is the same
|
||||||
std::uint32_t parent_ = 0;
|
std::uint32_t parent_ = 0;
|
||||||
|
|
||||||
std::string uuid_ = "";
|
std::string uuid_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,8 @@ Identifier::Identifier(std::uint32_t parent,std::uint32_t number, std::string uu
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Identifier::Identifier(std::uint32_t parent,std::uint32_t number,bool external):parent_(parent),number_(number),external_(external)
|
Identifier::Identifier(std::uint32_t parent,std::uint32_t number,bool external):parent_(parent),number_(number),external_(external),uuid_(xg::newGuid().str())
|
||||||
{
|
{
|
||||||
xg::Guid g = xg::newGuid();
|
|
||||||
uuid_ = g.str();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,14 +37,15 @@ Identifier::Identifier(std::string str)
|
|||||||
}
|
}
|
||||||
if (UtilFunctions::isNumber(var[2])) {
|
if (UtilFunctions::isNumber(var[2])) {
|
||||||
external_ = (bool)stoi(var[2]);
|
external_ = (bool)stoi(var[2]);
|
||||||
|
}
|
||||||
|
if (var[3] != "") {
|
||||||
|
uuid_ = var[3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Identifier::serialize()
|
std::string Identifier::serialize() const
|
||||||
{
|
{
|
||||||
return std::to_string(parent_) + StringDelimiter + std::to_string(number_) + StringDelimiter + std::to_string(external_) + StringDelimiter + uuid_;
|
return std::to_string(parent_) + StringDelimiter + std::to_string(number_) + StringDelimiter + std::to_string(external_) + StringDelimiter + uuid_;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user