Utility class for parsing a type ID that follows the NT type ID conventions.
More...
#include "ntid.h"
Utility class for parsing a type ID that follows the NT type ID conventions.
An NT type ID will be of the from
e.g.
- Author
- dgh
Definition at line 28 of file ntid.h.
epics::nt::NTID::NTID |
( |
const std::string & |
id | ) |
|
Creates an NTID from the specified type ID.
- Parameters
-
id | the the ID to be parsed. |
- Returns
- NTNDArray instance on success, null otherwise.
Definition at line 16 of file ntid.cpp.
18 qualifiedName(BAD_NAME),
19 namespaceStr(BAD_NAME),
22 nsSepIndex(std::string::npos),
23 versionSepIndex(std::string::npos),
27 majorVersionStr(BAD_NAME),
28 majorVersionParsed(
false),
33 minorVersionStr(BAD_NAME),
34 minorVersionParsed(
false),
38 nsSepIndex =
id.find(
'/');
39 nsQualified = nsSepIndex != std::string::npos;
40 size_t startIndex = nsQualified ? nsSepIndex+1 : 0;
41 versionSepIndex =
id.find(
':', startIndex);
42 hasVersion = versionSepIndex != std::string::npos;
std::string epics::nt::NTID::getFullName |
( |
| ) |
|
Returns the full name of the id, i.e. the original ID
For example above returns "epics:nt/NTNDArray:1.2".
- Returns
- the full name
Definition at line 45 of file ntid.cpp.
int epics::nt::NTID::getMajorVersion |
( |
| ) |
|
Returns the Major version as an integer.
For example above return 1.
- Returns
- the Major string
Definition at line 135 of file ntid.cpp.
std::string epics::nt::NTID::getMajorVersionString |
( |
| ) |
|
Returns the Major version as a string.
For example above return "1".
- Returns
- the Major string
Definition at line 100 of file ntid.cpp.
102 if (majorVersionStr == BAD_NAME)
106 endMajorIndex = fullName.find(
'.', versionSepIndex+1);
107 majorVersionStr = (endMajorIndex != std::string::npos)
108 ? fullName.substr(versionSepIndex+1, endMajorIndex-(versionSepIndex+1)) :
109 fullName.substr(versionSepIndex+1);
112 majorVersionStr =
"";
114 return majorVersionStr;
int epics::nt::NTID::getMinorVersion |
( |
| ) |
|
Returns the Minor version as an integer.
For example above return 1.
- Returns
- the Minor string
Definition at line 180 of file ntid.cpp.
std::string epics::nt::NTID::getMinorVersionString |
( |
| ) |
|
Returns the Major version as a string.
For example above return "1".
- Returns
- the Major string
Definition at line 143 of file ntid.cpp.
147 if (minorVersionStr == BAD_NAME)
149 if (hasVersion && endMajorIndex != std::string::npos)
151 endMinorIndex = fullName.find(
'.', endMajorIndex+1);
152 minorVersionStr = (endMinorIndex != std::string::npos)
153 ? fullName.substr(endMajorIndex+1, endMinorIndex-(endMajorIndex+1)) :
154 fullName.substr(endMajorIndex+1);
157 minorVersionStr =
"";
159 return minorVersionStr;
std::string getMajorVersionString()
std::string epics::nt::NTID::getName |
( |
| ) |
|
Returns the unqualified name, without namespace or version.
For example above return "NTNDArray".
- Returns
- the unqualified name
Definition at line 68 of file ntid.cpp.
74 size_t startIndex = nsQualified ? nsSepIndex+1 : 0;
75 name = fullName.substr(startIndex, versionSepIndex);
79 name = fullName.substr(nsSepIndex+1);
std::string epics::nt::NTID::getNamespace |
( |
| ) |
|
Returns the namespace
For example above return "epics:nt".
- Returns
- the namespace
Definition at line 58 of file ntid.cpp.
60 if (namespaceStr == BAD_NAME)
62 namespaceStr = nsQualified ?
63 fullName.substr(0, nsSepIndex) :
"";
std::string epics::nt::NTID::getQualifiedName |
( |
| ) |
|
Returns the fully qualified name including namespaces, but excluding version numbers.
For example above return "epics:nt/NTNDArray"
- Returns
- the fully qualified name
Definition at line 47 of file ntid.cpp.
49 if (qualifiedName == BAD_NAME)
51 qualifiedName = hasVersion ?
52 fullName.substr(0, versionSepIndex) : fullName;
std::string epics::nt::NTID::getVersion |
( |
| ) |
|
Returns the version as a string.
For example above return "NTNDArray".
- Returns
- the the version string
Definition at line 90 of file ntid.cpp.
92 if (version == BAD_NAME)
94 version = (hasVersion) ? fullName.substr(versionSepIndex+1) :
"";
bool epics::nt::NTID::hasMajorVersion |
( |
| ) |
|
Does the ID contain a major version and is it a number.
- Returns
- true if it contains a major version number
Definition at line 118 of file ntid.cpp.
120 if (hasVersion && !majorVersionParsed)
126 majorVersion =
static_cast<int>(mv);
129 majorVersionParsed =
true;
void parseToPOD(const char *in, boolean *out)
std::string getMajorVersionString()
bool epics::nt::NTID::hasMinorVersion |
( |
| ) |
|
Does the ID contain a minor version and is it a number.
- Returns
- true if it contains a minor version number
Definition at line 163 of file ntid.cpp.
165 if (hasVersion && !minorVersionParsed)
171 minorVersion =
static_cast<int>(mv);
174 minorVersionParsed =
true;
std::string getMinorVersionString()
void parseToPOD(const char *in, boolean *out)
The documentation for this class was generated from the following files:
- modules/normativeTypes/src/pv/ntid.h
- modules/normativeTypes/src/ntid.cpp