Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
bda766ab
Commit
bda766ab
authored
Aug 09, 2009
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redundant interface (i_api) removed
parent
9f1f823b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
104 deletions
+57
-104
Makefile.am
src/Makefile.am
+0
-2
app_thread.cpp
src/app_thread.cpp
+2
-3
app_thread.hpp
src/app_thread.hpp
+3
-3
dispatcher.cpp
src/dispatcher.cpp
+1
-2
dispatcher.hpp
src/dispatcher.hpp
+1
-1
i_api.hpp
src/i_api.hpp
+0
-43
i_poll_events.hpp
src/i_poll_events.hpp
+30
-30
socket_base.hpp
src/socket_base.hpp
+10
-11
zmq.cpp
src/zmq.cpp
+10
-9
No files found.
src/Makefile.am
View file @
bda766ab
...
...
@@ -18,11 +18,9 @@ libzmq_la_SOURCES = \
io_object.hpp
\
io_thread.hpp
\
ip.hpp
\
i_api.hpp
\
i_poller.hpp
\
i_poll_events.hpp
\
i_signaler.hpp
\
i_socket.hpp
\
kqueue.hpp
\
msg.hpp
\
mutex.hpp
\
...
...
src/app_thread.cpp
View file @
bda766ab
...
...
@@ -28,7 +28,6 @@
#endif
#include "app_thread.hpp"
#include "i_api.hpp"
#include "dispatcher.hpp"
#include "err.hpp"
#include "pipe.hpp"
...
...
@@ -130,7 +129,7 @@ void zmq::app_thread_t::process_commands (bool block_)
}
}
zmq
::
i_api
*
zmq
::
app_thread_t
::
create_socket
(
int
type_
)
zmq
::
socket_base_t
*
zmq
::
app_thread_t
::
create_socket
(
int
type_
)
{
// TODO: type is ignored for the time being.
socket_base_t
*
s
=
new
socket_base_t
(
this
);
...
...
@@ -139,7 +138,7 @@ zmq::i_api *zmq::app_thread_t::create_socket (int type_)
return
s
;
}
void
zmq
::
app_thread_t
::
remove_socket
(
i_api
*
socket_
)
void
zmq
::
app_thread_t
::
remove_socket
(
socket_base_t
*
socket_
)
{
// TODO: To speed this up we can possibly use the system where each socket
// holds its index (see I/O scheduler implementation).
...
...
src/app_thread.hpp
View file @
bda766ab
...
...
@@ -56,15 +56,15 @@ namespace zmq
void
process_commands
(
bool
block_
);
// Create a socket of a specified type.
struct
i_api
*
create_socket
(
int
type_
);
class
socket_base_t
*
create_socket
(
int
type_
);
// Unregister the socket from the app_thread (called by socket itself).
void
remove_socket
(
struct
i_api
*
socket_
);
void
remove_socket
(
class
socket_base_t
*
socket_
);
private
:
// All the sockets created from this application thread.
typedef
std
::
vector
<
struct
i_api
*>
sockets_t
;
typedef
std
::
vector
<
class
socket_base_t
*>
sockets_t
;
sockets_t
sockets
;
// Thread ID associated with this slot.
...
...
src/dispatcher.cpp
View file @
bda766ab
...
...
@@ -20,7 +20,6 @@
#include "../include/zmq.h"
#include "dispatcher.hpp"
#include "i_api.hpp"
#include "app_thread.hpp"
#include "io_thread.hpp"
#include "platform.hpp"
...
...
@@ -98,7 +97,7 @@ int zmq::dispatcher_t::thread_slot_count ()
return
signalers
.
size
();
}
zmq
::
i_api
*
zmq
::
dispatcher_t
::
create_socket
(
int
type_
)
zmq
::
socket_base_t
*
zmq
::
dispatcher_t
::
create_socket
(
int
type_
)
{
threads_sync
.
lock
();
app_thread_t
*
thread
=
choose_app_thread
();
...
...
src/dispatcher.hpp
View file @
bda766ab
...
...
@@ -55,7 +55,7 @@ namespace zmq
~
dispatcher_t
();
// Create a socket.
struct
i_api
*
create_socket
(
int
type_
);
class
socket_base_t
*
create_socket
(
int
type_
);
// Returns number of thread slots in the dispatcher. To be used by
// individual threads to find out how many distinct signals can be
...
...
src/i_api.hpp
deleted
100644 → 0
View file @
9f1f823b
/*
Copyright (c) 2007-2009 FastMQ Inc.
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the Lesser GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Lesser GNU General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ZMQ_I_API_HPP_INCLUDED__
#define __ZMQ_I_API_HPP_INCLUDED__
namespace
zmq
{
struct
i_api
{
virtual
~
i_api
()
{}
virtual
int
setsockopt
(
int
option_
,
void
*
optval_
,
size_t
optvallen_
)
=
0
;
virtual
int
bind
(
const
char
*
addr_
)
=
0
;
virtual
int
connect
(
const
char
*
addr_
)
=
0
;
virtual
int
subscribe
(
const
char
*
criteria_
)
=
0
;
virtual
int
send
(
struct
zmq_msg
*
msg_
,
int
flags_
)
=
0
;
virtual
int
flush
()
=
0
;
virtual
int
recv
(
struct
zmq_msg
*
msg_
,
int
flags_
)
=
0
;
virtual
int
close
()
=
0
;
};
}
#endif
src/i_poll_events.hpp
View file @
bda766ab
/*
Copyright (c) 2007-2009 FastMQ Inc.
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the Lesser GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the
Lesser GNU General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with this program.
If not, see <http://www.gnu.org/licenses/>.
Copyright (c) 2007-2009 FastMQ Inc.
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the Lesser GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the
Lesser GNU General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with this program.
If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
#define __ZMQ_I_POLL_EVENTS_HPP_INCLUDED__
namespace
zmq
{
//
Virtual interface to be exposed by object that want to be notified
//
about events on file descriptors.
// Virtual interface to be exposed by object that want to be notified
// about events on file descriptors.
struct
i_poll_events
{
virtual
~
i_poll_events
()
{};
//
Called by I/O thread when file descriptor is ready for reading.
// Called by I/O thread when file descriptor is ready for reading.
virtual
void
in_event
()
=
0
;
//
Called by I/O thread when file descriptor is ready for writing.
// Called by I/O thread when file descriptor is ready for writing.
virtual
void
out_event
()
=
0
;
//
Called when timer expires.
// Called when timer expires.
virtual
void
timer_event
()
=
0
;
};
}
#endif
src/socket_base.hpp
View file @
bda766ab
...
...
@@ -23,29 +23,28 @@
#include <set>
#include <string>
#include "i_api.hpp"
#include "object.hpp"
#include "stdint.hpp"
namespace
zmq
{
class
socket_base_t
:
public
object_t
,
public
i_api
class
socket_base_t
:
public
object_t
{
public
:
socket_base_t
(
class
app_thread_t
*
parent_
);
~
socket_base_t
();
//
i_api interface implementation
.
int
setsockopt
(
int
option_
,
void
*
optval_
,
size_t
optvallen_
);
int
bind
(
const
char
*
addr_
);
int
connect
(
const
char
*
addr_
);
int
subscribe
(
const
char
*
criteria_
);
int
send
(
struct
zmq_msg
*
msg_
,
int
flags_
);
int
flush
();
int
recv
(
struct
zmq_msg
*
msg_
,
int
flags_
);
int
close
();
//
Interface for communication with the API layer
.
virtual
int
setsockopt
(
int
option_
,
void
*
optval_
,
size_t
optvallen_
);
virtual
int
bind
(
const
char
*
addr_
);
virtual
int
connect
(
const
char
*
addr_
);
virtual
int
subscribe
(
const
char
*
criteria_
);
virtual
int
send
(
struct
zmq_msg
*
msg_
,
int
flags_
);
virtual
int
flush
();
virtual
int
recv
(
struct
zmq_msg
*
msg_
,
int
flags_
);
virtual
int
close
();
private
:
...
...
src/zmq.cpp
View file @
bda766ab
...
...
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <new>
#include "
i_api
.hpp"
#include "
socket_base
.hpp"
#include "err.hpp"
#include "dispatcher.hpp"
#include "msg.hpp"
...
...
@@ -188,41 +188,42 @@ void *zmq_socket (void *dispatcher_, int type_)
int
zmq_close
(
void
*
s_
)
{
((
zmq
::
i_api
*
)
s_
)
->
close
();
((
zmq
::
socket_base_t
*
)
s_
)
->
close
();
return
0
;
}
int
zmq_setsockopt
(
void
*
s_
,
int
option_
,
void
*
optval_
,
size_t
optvallen_
)
{
return
(((
zmq
::
i_api
*
)
s_
)
->
setsockopt
(
option_
,
optval_
,
optvallen_
));
return
(((
zmq
::
socket_base_t
*
)
s_
)
->
setsockopt
(
option_
,
optval_
,
optvallen_
));
}
int
zmq_bind
(
void
*
s_
,
const
char
*
addr_
)
{
return
(((
zmq
::
i_api
*
)
s_
)
->
bind
(
addr_
));
return
(((
zmq
::
socket_base_t
*
)
s_
)
->
bind
(
addr_
));
}
int
zmq_connect
(
void
*
s_
,
const
char
*
addr_
)
{
return
(((
zmq
::
i_api
*
)
s_
)
->
connect
(
addr_
));
return
(((
zmq
::
socket_base_t
*
)
s_
)
->
connect
(
addr_
));
}
int
zmq_subscribe
(
void
*
s_
,
const
char
*
criteria_
)
{
return
(((
zmq
::
i_api
*
)
s_
)
->
subscribe
(
criteria_
));
return
(((
zmq
::
socket_base_t
*
)
s_
)
->
subscribe
(
criteria_
));
}
int
zmq_send
(
void
*
s_
,
zmq_msg
*
msg_
,
int
flags_
)
{
return
(((
zmq
::
i_api
*
)
s_
)
->
send
(
msg_
,
flags_
));
return
(((
zmq
::
socket_base_t
*
)
s_
)
->
send
(
msg_
,
flags_
));
}
int
zmq_flush
(
void
*
s_
)
{
return
(((
zmq
::
i_api
*
)
s_
)
->
flush
());
return
(((
zmq
::
socket_base_t
*
)
s_
)
->
flush
());
}
int
zmq_recv
(
void
*
s_
,
zmq_msg
*
msg_
,
int
flags_
)
{
return
(((
zmq
::
i_api
*
)
s_
)
->
recv
(
msg_
,
flags_
));
return
(((
zmq
::
socket_base_t
*
)
s_
)
->
recv
(
msg_
,
flags_
));
}
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