Go to the documentation of this file.
4 #include <SimoxUtility/algorithm/string/string_tools.h>
13 ObjectID::ObjectID(
const std::string& dataset,
const std::string& className,
const std::string& instancName) :
14 _dataset(dataset), _className(className), _instanceName(instancName)
20 if (nameOrID.find(
"/") != nameOrID.npos)
27 _className = nameOrID;
42 <<
"Expected ID of format 'Dataset/ClassName' or 'Dataset/ClassName/InstanceName'"
43 <<
", but got: '" << idString <<
"' "
44 <<
"(expected 2 or 3 '/'s, but found " <<
split.size() <<
").";
47 _className =
split[1];
49 if (
split.size() == 3)
51 _instanceName =
split[2];
57 std::string _str = _dataset +
"/" + _className;
58 if (!_instanceName.empty())
60 _str +=
"/" + _instanceName;
67 return ObjectID(_dataset, _className);
72 return _className == rhs._className && _dataset == rhs._dataset;
82 return _className == rhs._className
83 && _dataset == rhs._dataset
84 && _instanceName == rhs._instanceName;
89 int c = _dataset.compare(rhs._dataset);
95 c = _className.compare(rhs._className);
101 return _instanceName < rhs._instanceName;
109 return os <<
"'" <<
id.str() <<
"'";
A known object ID of the form "Dataset/ClassName" or "Dataset/ClassName/InstanceName".
ObjectID withInstanceName(const std::string &instanceName) const
static ObjectID FromString(const std::string &idString)
Construct from a string produced by str(), e.g. ("mydataset/myobject", "mydataset/myclass/myinstance"...
ObjectID getClassID() const
Return just the class ID without an intance name.
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
void setFromString(const std::string &idString)
bool equalClass(const ObjectID &rhs) const
Indicates whether dataset and class name are equal.
std::string instanceName() const
bool operator==(const ObjectID &rhs) const
Indicates whether dataset, class name and instance name are equal.
bool operator<(const ObjectID &rhs) const
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::string str() const
Return "dataset/className" or "dataset/className/instanceName".
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)