diff options
author | Josh Blum | 2013-06-01 22:46:29 -0700 |
---|---|---|
committer | Josh Blum | 2013-06-01 22:46:29 -0700 |
commit | d15ca88acfbd71c5d4f8ab3dabe0f4fbde205985 (patch) | |
tree | e0ba8437cf65503fa05197e774024da4f9b54230 /include | |
parent | 40af24eb55d2d43f51d7ada30566d5203f0fef8c (diff) | |
download | sandhi-d15ca88acfbd71c5d4f8ab3dabe0f4fbde205985.tar.gz sandhi-d15ca88acfbd71c5d4f8ab3dabe0f4fbde205985.tar.bz2 sandhi-d15ca88acfbd71c5d4f8ab3dabe0f4fbde205985.zip |
gras: created uid API - replaces name and unique_id
Diffstat (limited to 'include')
-rw-r--r-- | include/gras/element.hpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/include/gras/element.hpp b/include/gras/element.hpp index 0aed924..47fbae6 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -56,18 +56,37 @@ struct GRAS_API Element : boost::shared_ptr<ElementImpl> */ bool equals(const Element &rhs); + /*! + * Get a canonical name for this element. + * This is used for printing elements for debug purposes. + * Do not rely on the string to have any specific formatting. + * \return a canonical string representation + */ + std::string to_string(void) const; + /******************************************************************* * identification interface ******************************************************************/ - //! An integer ID that is unique across the process - long unique_id(void) const; - - //! Get the name of this element - std::string name(void) const; + /*! + * Set the unique identifier of this element. + * The UID must be unique across the process. + * Typically the user will set a UID so an element + * will have a known indentification for the query client. + * This call will throw if UID is not process-unique. + * \param uid a new unique identifier for this element + */ + void set_uid(const std::string &uid); - //! get a canonical name for this element - std::string to_string(void) const; + /*! + * Get the unique identifier of this element. + * Typically, a name is given to an element on construction. + * By default UID will be the name or name + some hash + * when there is more than one element of the same name. + * Otherwise UID is set the by the set_uid API call. + * \return the element's unique identifier as a string + */ + std::string get_uid(void) const; /******************************************************************* * element tree interface |