Robot Raconteur Companion C++ Library
Loading...
Searching...
No Matches
IdentifierUtil.h File Reference

Go to the source code of this file.

Functions

bool RobotRaconteur::Companion::Util::IsIdentifierAnyUuid (const com::robotraconteur::identifier::IdentifierPtr &identifier)
 Check if an identifier is "any" (UUID is all zeros).
bool RobotRaconteur::Companion::Util::IsIdentifierAnyName (const com::robotraconteur::identifier::IdentifierPtr &identifier)
 Check if an identifier is "any" name (Name is empty).
bool RobotRaconteur::Companion::Util::IsIdentifierAny (const com::robotraconteur::identifier::IdentifierPtr &identifier)
 Check if an identifier is "any" (UUID is all zeros and name is empty).
bool RobotRaconteur::Companion::Util::IsIdentifierMatch (const com::robotraconteur::identifier::IdentifierPtr &expected, const com::robotraconteur::identifier::IdentifierPtr &test)
 Check if two identifiers match.
com::robotraconteur::identifier::IdentifierPtr RobotRaconteur::Companion::Util::CreateIdentifier (const std::string &name, const std::string &uuid)
 Create an identifier from a name and UUID.
com::robotraconteur::identifier::IdentifierPtr RobotRaconteur::Companion::Util::CreateIdentifier (const std::string &name, const boost::uuids::uuid &boost_uuid)
 Create an identifier from a name and UUID.
com::robotraconteur::identifier::IdentifierPtr RobotRaconteur::Companion::Util::CreateIdentifierFromName (const std::string &name)
 Create a Identifier From Name object.
std::string RobotRaconteur::Companion::Util::IdentifierToString (const com::robotraconteur::identifier::IdentifierPtr &id)
 Convert an identifier to a string.
com::robotraconteur::identifier::IdentifierPtr RobotRaconteur::Companion::Util::StringToIdentifier (const std::string &string_id)
 Convert a string to an identifier.

Detailed Description

Author
John Wason, PhD
License
Software License Agreement (Apache License)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ CreateIdentifier() [1/2]

com::robotraconteur::identifier::IdentifierPtr RobotRaconteur::Companion::Util::CreateIdentifier ( const std::string & name,
const boost::uuids::uuid & boost_uuid )

Create an identifier from a name and UUID.

Parameters
nameThe name
boost_uuidThe UUID
Returns
com::robotraconteur::identifier::IdentifierPtr

◆ CreateIdentifier() [2/2]

com::robotraconteur::identifier::IdentifierPtr RobotRaconteur::Companion::Util::CreateIdentifier ( const std::string & name,
const std::string & uuid )

Create an identifier from a name and UUID.

Parameters
nameThe name
uuidThe UUID
Returns
com::robotraconteur::identifier::IdentifierPtr

◆ CreateIdentifierFromName()

com::robotraconteur::identifier::IdentifierPtr RobotRaconteur::Companion::Util::CreateIdentifierFromName ( const std::string & name)

Create a Identifier From Name object.

The UUID will be set to all zeros

Parameters
nameThe name
Returns
com::robotraconteur::identifier::IdentifierPtr

◆ IdentifierToString()

std::string RobotRaconteur::Companion::Util::IdentifierToString ( const com::robotraconteur::identifier::IdentifierPtr & id)

Convert an identifier to a string.

The string format is "name|uuid". If the name is empty, it is omitted. If the UUID is all zeros, it is omitted.

Parameters
idThe identifier to convert
Returns
std::string The string representation of the identifier

◆ IsIdentifierAny()

bool RobotRaconteur::Companion::Util::IsIdentifierAny ( const com::robotraconteur::identifier::IdentifierPtr & identifier)

Check if an identifier is "any" (UUID is all zeros and name is empty).

Parameters
identifierThe identifier to check
Returns
true
false

◆ IsIdentifierAnyName()

bool RobotRaconteur::Companion::Util::IsIdentifierAnyName ( const com::robotraconteur::identifier::IdentifierPtr & identifier)

Check if an identifier is "any" name (Name is empty).

Parameters
identifierThe identifier to check
Returns
true
false

◆ IsIdentifierAnyUuid()

bool RobotRaconteur::Companion::Util::IsIdentifierAnyUuid ( const com::robotraconteur::identifier::IdentifierPtr & identifier)

Check if an identifier is "any" (UUID is all zeros).

Parameters
identifierThe identifier to check
Returns
true
false

◆ IsIdentifierMatch()

bool RobotRaconteur::Companion::Util::IsIdentifierMatch ( const com::robotraconteur::identifier::IdentifierPtr & expected,
const com::robotraconteur::identifier::IdentifierPtr & test )

Check if two identifiers match.

Identifiers have a complex matching rules:

  • If both identifiers are "any", they match
  • If either identifier is "any", they match
  • If both identifiers have the same name and UUID, they match
  • If the name is Any for either identifier and UUID matches, they match
  • If the UUID is Any for either identifier and name matches, they match
  • Otherwise, they do not match
Parameters
expectedThe expected identifier
testThe identifier to test
Returns
true
false

◆ StringToIdentifier()

com::robotraconteur::identifier::IdentifierPtr RobotRaconteur::Companion::Util::StringToIdentifier ( const std::string & string_id)

Convert a string to an identifier.

The string format is "name|uuid". If the name is empty, it is omitted. If the UUID is all zeros, it is omitted.

Parameters
string_idThe string representation of the identifier
Returns
com::robotraconteur::identifier::IdentifierPtr The identifier