70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
#pragma once
|
|
|
|
|
|
#include <SimCore/SimCore.hpp>
|
|
#include <SimCore/UtilFunctions.hpp>
|
|
#include <iterator>
|
|
#include <utility>
|
|
#include <loguru.hpp>
|
|
namespace SimCore {
|
|
|
|
class Identifier{
|
|
public:
|
|
|
|
Identifier() ;
|
|
|
|
|
|
/**
|
|
* @brief constructs an object
|
|
*
|
|
*/
|
|
Identifier(std::uint32_t parent,std::uint32_t number,bool external) ;
|
|
|
|
/**
|
|
* @brief constructs the ID out of an string
|
|
*
|
|
*/
|
|
Identifier(std::string str);
|
|
|
|
/**
|
|
* @brief returns the number of the object, this plus the number of the parent make it unique
|
|
* @return uint32_t
|
|
*/
|
|
std::uint32_t getNumber();
|
|
|
|
/**
|
|
* @brief return the number of the parent, if 0 the parent is the Sim Manager
|
|
* @return uint32_t
|
|
*/
|
|
std::uint32_t getParentNumber();
|
|
|
|
/**
|
|
* @brief returns true if the ID belongs to an external ofject
|
|
* @return bool
|
|
*/
|
|
bool isExternal();
|
|
|
|
/**
|
|
* @brief return true if the number is bigger than 0
|
|
*
|
|
*/
|
|
bool isValid();
|
|
|
|
/**
|
|
* @brief returns the serilaized string of the ID
|
|
* @brief string
|
|
*/
|
|
std::string serialize();
|
|
|
|
friend bool operator==(const Identifier &lhs,const Identifier &rhs);
|
|
|
|
private:
|
|
/// indicates if ID is from an external source
|
|
bool external_ = false;
|
|
/// the number of the object related to his parent object
|
|
std::uint32_t number_ = 0;
|
|
/// the number of the parent, all ID from an external source the parent is the same
|
|
std::uint32_t parent_ = 0;
|
|
};
|
|
}
|