MCPcopy Create free account
hub / github.com/ARM-software/armnn / getSubstring

Function getSubstring

include/armnn/Numpy.hpp:125–145  ·  view source on GitHub ↗

Primarily used to isolate values from header dictionary

Source from the content-addressed store, hash-verified

123
124 /// Primarily used to isolate values from header dictionary
125 inline std::string getSubstring(std::string fullString,
126 std::string substringStart,
127 std::string substringEnd,
128 bool removeStartChar = 0,
129 bool includeEndChar = 0)
130 {
131 size_t startPos = fullString.find(substringStart);
132 size_t endPos = fullString.find(substringEnd, startPos);
133 if (startPos == std::string::npos || endPos == std::string::npos)
134 {
135 throw armnn::ParseException(fmt::format("Unable to find {} in numpy file.",
136 CHECK_LOCATION().AsString()));
137 }
138
139 // std::string.substr takes the starting position and the length of the substring.
140 // To calculate the length we subtract the start position from the end position.
141 // We also add a boolean on whether or not we want to include the character used to find endPos
142 startPos+= removeStartChar;
143 endPos += includeEndChar;
144 return fullString.substr(startPos, endPos - startPos);
145 }
146
147 inline void parseShape(Header& header, std::string& shapeString)
148 {

Callers 1

CreateHeaderFunction · 0.85

Calls 3

ParseExceptionClass · 0.85
formatEnum · 0.85
AsStringMethod · 0.45

Tested by

no test coverage detected