Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
813ae317
Commit
813ae317
authored
Mar 31, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PS establishment over CLI
parent
e52975bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
23 deletions
+21
-23
src/utils/common.cpp
src/utils/common.cpp
+21
-23
No files found.
src/utils/common.cpp
View file @
813ae317
...
@@ -221,6 +221,24 @@ std::string utils::VectorToHexString(const std::vector<uint8_t> &hex)
...
@@ -221,6 +221,24 @@ std::string utils::VectorToHexString(const std::vector<uint8_t> &hex)
return
str
;
return
str
;
}
}
bool
utils
::
TryParseInt
(
const
std
::
string
&
str
,
int
&
output
)
{
return
TryParseInt
(
str
.
c_str
(),
output
);
}
bool
utils
::
TryParseInt
(
const
char
*
str
,
int
&
output
)
{
try
{
output
=
std
::
stoi
(
str
);
return
true
;
}
catch
(...)
{
return
false
;
}
}
int
utils
::
ParseInt
(
const
std
::
string
&
str
)
int
utils
::
ParseInt
(
const
std
::
string
&
str
)
{
{
return
ParseInt
(
str
.
c_str
());
return
ParseInt
(
str
.
c_str
());
...
@@ -228,11 +246,9 @@ int utils::ParseInt(const std::string &str)
...
@@ -228,11 +246,9 @@ int utils::ParseInt(const std::string &str)
int
utils
::
ParseInt
(
const
char
*
str
)
int
utils
::
ParseInt
(
const
char
*
str
)
{
{
std
::
stringstream
ss
(
""
);
int
n
=
0
;
ss
<<
str
;
TryParseInt
(
str
,
n
);
int
i
;
return
n
;
ss
>>
i
;
return
i
;
}
}
uint64_t
utils
::
Random64
()
uint64_t
utils
::
Random64
()
...
@@ -319,21 +335,3 @@ void utils::Trim(std::stringstream &s)
...
@@ -319,21 +335,3 @@ void utils::Trim(std::stringstream &s)
Trim
(
str
);
Trim
(
str
);
s
.
str
(
str
);
s
.
str
(
str
);
}
}
bool
utils
::
TryParseInt
(
const
std
::
string
&
str
,
int
&
output
)
{
return
TryParseInt
(
str
.
c_str
(),
output
);
}
bool
utils
::
TryParseInt
(
const
char
*
str
,
int
&
output
)
{
try
{
output
=
std
::
stoi
(
str
);
return
true
;
}
catch
(...)
{
return
false
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment