Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
509c1305
Commit
509c1305
authored
May 19, 2011
by
Davis King
Browse files
Added some requirements and asserts.
parent
84e0f0e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
dlib/bridge/bridge.h
dlib/bridge/bridge.h
+20
-2
dlib/bridge/bridge_abstract.h
dlib/bridge/bridge_abstract.h
+5
-0
No files found.
dlib/bridge/bridge.h
View file @
509c1305
...
@@ -26,7 +26,16 @@ namespace dlib
...
@@ -26,7 +26,16 @@ namespace dlib
const
std
::
string
&
ip_
,
const
std
::
string
&
ip_
,
unsigned
short
port_
unsigned
short
port_
)
:
ip
(
ip_
),
port
(
port_
)
)
:
ip
(
ip_
),
port
(
port_
)
{}
{
// make sure requires clause is not broken
DLIB_ASSERT
(
is_ip_address
(
ip
)
&&
port
!=
0
,
"
\t
connect_to_ip_and_port()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
ip: "
<<
ip
<<
"
\n\t
port: "
<<
port
<<
"
\n\t
this: "
<<
this
);
}
private:
private:
friend
class
bridge
;
friend
class
bridge
;
...
@@ -38,7 +47,16 @@ namespace dlib
...
@@ -38,7 +47,16 @@ namespace dlib
{
{
listen_on_port
(
listen_on_port
(
unsigned
short
port_
unsigned
short
port_
)
:
port
(
port_
)
{}
)
:
port
(
port_
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
port
!=
0
,
"
\t
listen_on_port()"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
port: "
<<
port
<<
"
\n\t
this: "
<<
this
);
}
private:
private:
friend
class
bridge
;
friend
class
bridge
;
...
...
dlib/bridge/bridge_abstract.h
View file @
509c1305
...
@@ -18,6 +18,9 @@ namespace dlib
...
@@ -18,6 +18,9 @@ namespace dlib
unsigned
short
port
unsigned
short
port
);
);
/*!
/*!
requires
- is_ip_address(ip) == true
- port != 0
ensures
ensures
- this object will represent a request to make a TCP connection
- this object will represent a request to make a TCP connection
to the given IP address and port number.
to the given IP address and port number.
...
@@ -30,6 +33,8 @@ namespace dlib
...
@@ -30,6 +33,8 @@ namespace dlib
unsigned
short
port
unsigned
short
port
);
);
/*!
/*!
requires
- port != 0
ensures
ensures
- this object will represent a request to listen on the given
- this object will represent a request to listen on the given
port number for incoming TCP connections.
port number for incoming TCP connections.
...
...
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