*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)

*Fix a possible crash in Spell::DoAllEffectOnTarget

--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-17 15:35:07 -07:00
parent f21f47005d
commit 26b5e033ff
2257 changed files with 750 additions and 103852 deletions

53
COPYING
View File

@@ -1,13 +1,10 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
@@ -17,48 +14,40 @@ Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
@@ -68,14 +57,12 @@ that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
@@ -83,23 +70,18 @@ copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
@@ -120,38 +102,31 @@ distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
@@ -162,7 +137,6 @@ anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
@@ -176,7 +150,6 @@ void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
@@ -185,7 +158,6 @@ modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
@@ -193,7 +165,6 @@ these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@@ -206,12 +177,10 @@ license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
@@ -222,7 +191,6 @@ through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
@@ -233,12 +201,10 @@ may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
@@ -246,7 +212,6 @@ either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
@@ -254,9 +219,7 @@ Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
@@ -266,7 +229,6 @@ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
@@ -276,63 +238,48 @@ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the

10
README
View File

@@ -1,21 +1,16 @@
= TrinityCore -- General information =
Copyright (C) TrinityCore (http://www.trinitycore.org)
Trinity Core is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
In addition, as a special exception, the Trinity Core project
gives permission to link the code of its release of Trinity Core with
the OpenSSL project's "OpenSSL" library (or with modified versions of
@@ -25,19 +20,14 @@ Copyright (C) TrinityCore (http://www.trinitycore.org)
modify this file, you may extend this exception to your version of the
file, but you are not obligated to do so. If you do not wish to do
so, delete this exception statement from your version.
TrinityCore is a World of Warcraft game server emulator. It is derived
from MaNGOS, the Massive Network Game Object Server, and is based on the
code of that project.
For further information on the TrinityCore project, please visit our
project website at http://www.trinitycore.org.
API documentation can be obtained by running the "make doc" command inside
the doc directory.
SQL files to create the database can be found in the sql directory. Files
to update your database from an older revision/version can be found in the
sql/updates directory.
See the INSTALL.linux file for installation instructions on Linux.

5
THANKS
View File

@@ -1,18 +1,13 @@
= TrinityCore -- Thanks/credits file =
TrinityCore is a derivation/rewrite of MaNGOS, which was originally written
by Team Python and the WoW Daemon Team. Many people further helped Trinity Core
by submitting bug reports, code patches, and suggestions. Thanks to the
community!
Special thanks should go out to the WowwoW team. We have gained help from
them many times in the creation of this project. Keep up the good work guys.
Thanks to the ScriptDev2 team (http://www.scriptdev2.com) for scripts.
Thanks to the WCell team (especially Ralek) for research on realm reconnect
sequence, item scaling stats algorithm, gameobject rotation issues.
Thanks go out to the following people for various patches/code (listed in the
order they were added): w12x, dythzer, XEQT, death420, balrok, TOM_RUS,
runningnak3d, Seline, KingPin, raczman, bogie, Neo2003, NoFantasy, Derex,

View File

@@ -1,18 +1,11 @@
This document is also available at the following URL:
http://www.cs.wustl.edu/~schmidt/ACE.html
All software and documentation is available via both anonymous ftp and
the World Wide Web.]
THE ADAPTIVE COMMUNICATION ENVIRONMENT (ACE)
An Object-Oriented Network Programming Toolkit
----------------------------------------
Overview of ACE
The ADAPTIVE Communication Environment (ACE) is an object-oriented
(OO) toolkit that implements fundamental design patterns for
communication software. ACE provides a rich set of reusable C++
@@ -22,14 +15,12 @@ versions of UNIX (e.g., SunOS, HP-UX , AIX, Linux, NetBSD, and FreeBSD),
real-time operating systems (e.g., VxWorks, Chorus, LynxOS, and QNX),
OpenVMS, and MVS OpenEdition. A single source tree is used for all
these platforms and porting ACE to other platforms is relatively easy.
The communication software components provided by ACE include event
demultiplexing and event handler dispatching, service initialization,
interprocess communication, shared memory management, message routing,
dynamic (re)configuration of distributed services, multi-threading,
and concurrency control. There are both C++ and Java versions of ACE
available.
ACE is targeted for developers of high-performance and real-time
communication services and applications on UNIX, POSIX, and Win32
platforms. ACE simplifies the development of OO network applications
@@ -38,115 +29,83 @@ demultiplexing, explicit dynamic linking, and concurrency. ACE
automates system configuration and reconfiguration by dynamically
linking services into applications at run-time and executing these
services in one or more processes or threads.
ACE is currently used in commercial projects and products by dozens of
companies including Ericsson, Bellcore, Siemens, Motorola, Kodak,
Boeing, Lucent, DEC, Lockheed Martin, and SAIC. Commercial support
for ACE is available from several companies as listed at
http://www.cs.wustl.edu/~schmidt/commercial-support.html
----------------------------------------
C++ Wrappers for OS Interfaces
The lower-level portions of ACE provide a set of portable and
type-secure C++ wrappers that encapsulate the following C language OS
interfaces:
. IPC mechanisms
-- e.g., Internet- and UNIX-domain sockets, TLI, Named
Pipes (for UNIX and Win32) and STREAM pipes;
. Event demultiplexing
-- e.g., select(), poll(), and Win32
WaitForMultipleObjects and I/O completion ports;
. Multi-threading and synchronization
-- e.g., Solaris threads, POSIX Pthreads, and Win32
threads;
. Explicit dynamic linking
-- e.g., dlopen/dlsym on UNIX and LoadLibrary/GetProc
on Win32;
. Memory-mapped files and shared memory management
-- e.g., BSD mmap(), SYSV shared memory, and Win32
shared memory;
. System V IPC
-- e.g., shared memory, semaphores, message queues.
The OS Adaptation Layer shields the upper levels of ACE from platform
dependencies associated with the underlying OS interfaces.
----------------------------------------
Frameworks and Class Categories
ACE also contains a higher-level network programming framework that
integrates and enhances the lower-level C++ wrappers. This framework
supports the dynamic configuration of concurrent distributed services
into applications. The framework portion of ACE contains the
following class categories:
. The Reactor
-- Supports both Reactive and Proactive I/O;
. The Service Configurator
-- Support dynamic (re)configuration of objects;
. The ADAPTIVE Service Executive
-- A user-level implementation of System V STREAMS,
that supports modular integration of
hierarchically-related communicaion services;
. Concurrency
-- Various types of higher-level concurrency
control and synchronization patterns (such as
Polymorphic Futures and Active Objects);
. Shared Malloc
-- Components for managing dynamically allocation
of shared and local memory;
----------------------------------------
Distributed Services and Components
Finally, ACE provides a standard library of distributed services that
are packaged as components. These service components play two roles
in ACE:
1. They provide reusable components for common distributed
system tasks such as logging, naming, locking, and time
synchronization.
2. They illustrate how to utilize ACE features such as the
Reactor, Service Configurator, Service Initialization,
Concurrency, and IPC components.
----------------------------------------
Middleware Applications
ACE has been used in research and development projects at many
universities and companies. For instance, it has been used to build
avionics systems at Boeing, telecommunication systems at Bellcore,
Ericsson, Motorola, and Lucent; medical imaging systems at Siemens and
Kodak; and many academic research projects. Two example middleware
applications provided with the ACE release include:
1. The ACE ORB (TAO) -- TAO is a real-time implementation of
CORBA built using the framework components and patterns
provided by ACE.
2. JAWS -- JAWS is a high-performance, adaptive Web server
built using the components in ACE.
----------------------------------------
OBTAINING ACE
The current ACE release is provided as a tar file that is around 3 Meg
compressed using GNU gzip. ACE may be obtained electronically from
http://www.cs.wustl.edu/~schmidt/ACE-obtain.html. This release
@@ -155,36 +114,25 @@ contains the source code, test drivers, and example applications
network programming framework developed as part of the ADAPTIVE
project at the University of California, Irvine and at Washington
University, St. Louis.
You can get The ACE ORB (TAO) in a companion release at
http://www.cs.wustl.edu/~schmidt/TAO.html.
----------------------------------------
ACE DOCUMENTATION AND TUTORIALS
Many of the C++ wrappers and higher-level components have been
described in issues of the C++ Report, as well as in proceedings of
many journals, conferences, and workshops.
A collection of white papers and tutorial handouts are included at
ftp://wuarchive.wustl.edu/languages/c++/ACE/ACE-documentation. This
directory contains postscript versions of various papers that describe
different aspects of ACE.
I update these papers periodically to reflect changes to the ACE
architecture. Therefore, you might want to check the date on the
files to make sure that you have read the most recent versions of
these papers.
This material is also available available via the WWW at URL:
http://www.cs.wustl.edu/~schmidt/ACE.html
----------------------------------------
ACE MAILING LIST AND NEWSGROUP
A mailing list, ace-users@list.isis.vanderbilt.edu, is available for discussing
bug fixes, enhancements, and porting issues regarding ACE. Please
send mail to me at the ace-users-request@list.isis.vanderbilt.edu
@@ -192,31 +140,22 @@ if you'd like to join the mailing list. There is also a USENET newsgroup
called comp.soft-sys.ace. Please see
http://www.cs.wustl.edu/~schmidt/ACE-mail.html for details on how to
subscribe to the mailing list.
----------------------------------------
BUILDING AND INSTALLING ACE
Please refer to the http://www.cs.wustl.edu/~schmidt/ACE-install.html
file for information on how to build and test the ACE wrappers. The
BIBLIOGRAPHY file contains information on where to obtain articles
that describe the ACE wrappers and the ADAPTIVE system in more detail.
The current release has been tested extensively, but if you find any
bugs, please report them to the ACE mailing list
ace-users@cs.wustl.edu using the $ACE_ROOT/PROBLEM-REPORT-FORM.
Please use the same form to submit questions, comments, etc.
To ensure that you see responses, please do one of the following:
1) Subscribe to the ace-users mail list, by sending email with
contents "subscribe ace-users" to
ace-users-request@list.isis.vanderbilt.edu.
2) Or, monitor the comp.soft-sys.ace newsgroup for responses.
----------------------------------------
ACKNOWLEDGEMENTS
Please see the file `$ACE_ROOT/THANKS' for a list of the thousands of
people who've contributed to ACE and TAO over the years.

View File

@@ -1,11 +1,8 @@
This is ACE version 5.6.6, released Mon Sep 15 06:08:04 CDT 2008
If you have any problems with or questions about ACE, please send
email to the ACE mailing list (ace-users@cs.wustl.edu), using the form
found in the file PROBLEM-REPORT-FORM. To ensure that you see responses,
please do one of the following:
1) Subscribe to the ace-users mail list, by sending email with
contents "subscribe ace-users" to majordomo@cs.wustl.edu.
2) Or, monitor the comp.soft-sys.ace newsgroup for responses.

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ACE.h
@@ -16,18 +15,13 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_ACE_H
#define ACE_ACE_H
#include /**/ "ace/pre.h"
#include "ace/config-lite.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/OS_NS_math.h"
#include "ace/Flag_Manip.h"
#include "ace/Handle_Ops.h"
@@ -35,20 +29,16 @@
#include "ace/Init_ACE.h"
#include "ace/Sock_Connect.h"
#include "ace/Default_Constants.h"
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Forward declarations.
class ACE_Time_Value;
class ACE_Message_Block;
class ACE_Handle_Set;
/**
* @namespace ACE
*
@@ -63,35 +53,26 @@ namespace ACE
// = ACE version information.
/// e.g., the "5" in ACE 5.1.12.
extern ACE_Export u_int major_version (void);
/// e.g., the "1" in ACE 5.1.12.
extern ACE_Export u_int minor_version (void);
/// e.g., the "12" in ACE 5.1.12.
/// Returns 0 for "stable" (non-beta) releases.
extern ACE_Export u_int beta_version (void);
// = C++ compiler version information.
/// E.g., the "SunPro C++" in SunPro C++ 4.32.0
extern ACE_Export const ACE_TCHAR * compiler_name (void);
/// E.g., the "4" in SunPro C++ 4.32.0
extern ACE_Export u_int compiler_major_version (void);
/// E.g., the "32" in SunPro C++ 4.32.0
extern ACE_Export u_int compiler_minor_version (void);
/// E.g., the "0" in SunPro C++ 4.32.0
extern ACE_Export u_int compiler_beta_version (void);
/// Check if error indicates the process being out of handles (file
/// descriptors).
extern ACE_Export int out_of_handles (int error);
/// Simple wildcard matching function supporting '*' and '?'
/// return true if string s matches pattern.
extern ACE_Export bool wild_match(const char* s, const char* pattern, bool case_sensitive = true);
/**
* @name I/O operations
*
@@ -146,27 +127,21 @@ namespace ACE
size_t len,
int flags,
const ACE_Time_Value *timeout = 0);
#if defined (ACE_HAS_TLI)
extern ACE_Export ssize_t t_rcv (ACE_HANDLE handle,
void *buf,
size_t len,
int *flags,
const ACE_Time_Value *timeout = 0);
#endif /* ACE_HAS_TLI */
extern ACE_Export ssize_t recv (ACE_HANDLE handle,
void *buf,
size_t len,
const ACE_Time_Value *timeout = 0);
extern ACE_Export ssize_t recvmsg (ACE_HANDLE handle,
struct msghdr *msg,
int flags,
const ACE_Time_Value *timeout = 0);
extern ACE_Export ssize_t recvfrom (ACE_HANDLE handle,
char *buf,
int len,
@@ -174,7 +149,6 @@ namespace ACE
struct sockaddr *addr,
int *addrlen,
const ACE_Time_Value *timeout = 0);
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recv_n (ACE_HANDLE handle,
void *buf,
@@ -182,9 +156,7 @@ namespace ACE
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
#if defined (ACE_HAS_TLI)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t t_rcv_n (ACE_HANDLE handle,
void *buf,
@@ -192,16 +164,13 @@ namespace ACE
int *flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
#endif /* ACE_HAS_TLI */
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recv_n (ACE_HANDLE handle,
void *buf,
size_t len,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
/// Receive into a variable number of pieces.
/**
* Accepts a variable, caller-specified, number of pointer/length
@@ -213,50 +182,40 @@ namespace ACE
* @return -1 on error, else total number of bytes received.
*/
extern ACE_Export ssize_t recv (ACE_HANDLE handle, size_t n, ...);
extern ACE_Export ssize_t recvv (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout = 0);
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t recvv_n (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
extern ACE_Export ssize_t recv_n (ACE_HANDLE handle,
ACE_Message_Block *message_block,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
extern ACE_Export ssize_t send (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout = 0);
#if defined (ACE_HAS_TLI)
extern ACE_Export ssize_t t_snd (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout = 0);
#endif /* ACE_HAS_TLI */
extern ACE_Export ssize_t send (ACE_HANDLE handle,
const void *buf,
size_t len,
const ACE_Time_Value *timeout = 0);
extern ACE_Export ssize_t sendmsg (ACE_HANDLE handle,
const struct msghdr *msg,
int flags,
const ACE_Time_Value *timeout = 0);
extern ACE_Export ssize_t sendto (ACE_HANDLE handle,
const char *buf,
int len,
@@ -264,7 +223,6 @@ namespace ACE
const struct sockaddr *addr,
int addrlen,
const ACE_Time_Value *timeout = 0);
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t send_n (ACE_HANDLE handle,
const void *buf,
@@ -272,9 +230,7 @@ namespace ACE
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
#if defined (ACE_HAS_TLI)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t t_snd_n (ACE_HANDLE handle,
const void *buf,
@@ -282,31 +238,25 @@ namespace ACE
int flags,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
#endif /* ACE_HAS_TLI */
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t send_n (ACE_HANDLE handle,
const void *buf,
size_t len,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
/// Varargs variant.
extern ACE_Export ssize_t send (ACE_HANDLE handle, size_t n, ...);
extern ACE_Export ssize_t sendv (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout = 0);
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t sendv_n (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
/// Send all the @a message_blocks chained through their @c next and
/// @c cont pointers. This call uses the underlying OS gather-write
/// operation to reduce the domain-crossing penalty.
@@ -314,39 +264,32 @@ namespace ACE
const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout = 0,
size_t *bytes_transferred = 0);
// = File system I/O functions (these don't support timeouts).
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t read_n (ACE_HANDLE handle,
void *buf,
size_t len,
size_t *bytes_transferred = 0);
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t write_n (ACE_HANDLE handle,
const void *buf,
size_t len,
size_t *bytes_transferred = 0);
/// Write all the @a message_blocks chained through their @c next
/// and @c cont pointers. This call uses the underlying OS
/// gather-write operation to reduce the domain-crossing penalty.
extern ACE_Export ssize_t write_n (ACE_HANDLE handle,
const ACE_Message_Block *message_block,
size_t *bytes_transferred = 0);
extern ACE_Export ssize_t readv_n (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
size_t *bytes_transferred = 0);
extern ACE_Export ssize_t writev_n (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
size_t *bytes_transferred = 0);
//@}
/**
* Wait up to @a timeout amount of time to passively establish a
* connection. This method doesn't perform the @c accept, it just
@@ -355,7 +298,6 @@ namespace ACE
extern ACE_Export int handle_timed_accept (ACE_HANDLE listener,
ACE_Time_Value *timeout,
int restart);
/**
* Wait up to @a timeout amount of time to complete an actively
* established non-blocking connection. If @a is_tli is non-0 then
@@ -366,7 +308,6 @@ namespace ACE
ACE_HANDLE listener,
const ACE_Time_Value *timeout,
int is_tli = 0);
/**
* Reset the limit on the number of open handles. If @a new_limit
* == -1 set the limit to the maximum allowable. Otherwise, set
@@ -375,14 +316,12 @@ namespace ACE
*/
extern ACE_Export int set_handle_limit (int new_limit = -1,
int increase_limit_only = 0);
/**
* Returns the maximum number of open handles currently permitted in
* this process. This maximum may be extended using
* @c ACE::set_handle_limit.
*/
extern ACE_Export int max_handles (void);
// = String functions
#if !defined (ACE_HAS_WINCE)
/**
@@ -393,40 +332,28 @@ namespace ACE
*/
extern ACE_Export ACE_TCHAR *strenvdup (const ACE_TCHAR *str);
#endif /* ACE_HAS_WINCE */
/// Returns a pointer to the "end" of the string, i.e., the character
/// past the '\0'.
extern ACE_Export const char *strend (const char *s);
/// This method is just like @c strdup, except that it uses
/// @c operator @c new rather than @c malloc. If @a s is NULL
/// returns NULL rather than segfaulting.
extern ACE_Export char *strnew (const char *s);
/// Delete the memory allocated by @c strnew.
ACE_NAMESPACE_INLINE_FUNCTION void strdelete (char *s);
/// Create a fresh new copy of @a str, up to @a n chars long. Uses
/// @c ACE_OS::malloc to allocate the new string.
extern ACE_Export char *strndup (const char *str, size_t n);
/// Create a fresh new copy of @a str, up to @a n chars long. Uses
/// @c ACE_OS::malloc to allocate the new string.
extern ACE_Export char *strnnew (const char *str, size_t n);
#if defined (ACE_HAS_WCHAR)
extern ACE_Export const wchar_t *strend (const wchar_t *s);
extern ACE_Export wchar_t *strnew (const wchar_t *s);
ACE_NAMESPACE_INLINE_FUNCTION void strdelete (wchar_t *s);
extern ACE_Export wchar_t *strndup (const wchar_t *str, size_t n);
extern ACE_Export wchar_t *strnnew (const wchar_t *str, size_t n);
#endif /* ACE_HAS_WCHAR */
/**
* On Windows, determines if a specified pathname ends with ".exe"
* (not case sensitive). If on Windows and there is no ".exe" suffix,
@@ -444,7 +371,6 @@ namespace ACE
* memory using delete [].
*/
extern ACE_Export const ACE_TCHAR *execname (const ACE_TCHAR *pathname);
/**
* Returns the "basename" of a @a pathname separated by @a delim.
* For instance, the basename of "/tmp/foo.cpp" is "foo.cpp" when
@@ -453,7 +379,6 @@ namespace ACE
extern ACE_Export const ACE_TCHAR *basename (const ACE_TCHAR *pathname,
ACE_TCHAR delim =
ACE_DIRECTORY_SEPARATOR_CHAR);
/**
* Returns the "dirname" of a @a pathname. For instance, the
* dirname of "/tmp/foo.cpp" is "/tmp" when @a delim is @a '/'. If
@@ -463,7 +388,6 @@ namespace ACE
extern ACE_Export const ACE_TCHAR *dirname (const ACE_TCHAR *pathname,
ACE_TCHAR delim =
ACE_DIRECTORY_SEPARATOR_CHAR);
/**
* Returns the current timestamp in the form
* "hour:minute:second:microsecond." The month, day, and year are
@@ -478,7 +402,6 @@ namespace ACE
extern ACE_Export ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[],
size_t time_len,
bool return_pointer_to_first_digit = false);
/**
* if @a avoid_zombies == 0 call @c ACE_OS::fork directly, else
* create an orphan process that's inherited by the init process;
@@ -491,7 +414,6 @@ namespace ACE
extern ACE_Export pid_t fork (
const ACE_TCHAR *program_name = ACE_TEXT ("<unknown>"),
int avoid_zombies = 0);
/**
* Become a daemon process using the algorithm in Richard Stevens
* "Advanced Programming in the UNIX Environment." If
@@ -502,63 +424,47 @@ namespace ACE
const ACE_TCHAR pathname[] = ACE_TEXT ("/"),
bool close_all_handles = ACE_DEFAULT_CLOSE_ALL_HANDLES,
const ACE_TCHAR program_name[] = ACE_TEXT ("<unknown>"));
// = Miscellaneous functions.
/// Rounds the request to a multiple of the page size.
extern ACE_Export size_t round_to_pagesize (size_t len);
/// Rounds the request to a multiple of the allocation granularity.
extern ACE_Export size_t round_to_allocation_granularity (size_t len);
// @@ UNICODE what about buffer?
/// Format buffer into printable format. This is useful for
/// debugging.
extern ACE_Export size_t format_hexdump (const char *buffer, size_t size,
ACE_TCHAR *obuf, size_t obuf_sz);
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const char *str);
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const char *str, size_t len);
#if defined (ACE_HAS_WCHAR)
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const wchar_t *str);
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len);
#endif /* ACE_HAS_WCHAR */
/// Computes CRC-CCITT for the string.
extern ACE_Export ACE_UINT16 crc_ccitt(const char *str);
/// Computes CRC-CCITT for the buffer.
extern ACE_Export ACE_UINT16 crc_ccitt(const void *buf, size_t len,
ACE_UINT16 crc = 0);
/// Computes CRC-CCITT for the @ len iovec buffers.
extern ACE_Export ACE_UINT16 crc_ccitt(const iovec *iov, int len,
ACE_UINT16 crc = 0);
/// Computes the ISO 8802-3 standard 32 bits CRC for the string.
extern ACE_Export ACE_UINT32 crc32 (const char *str);
/// Computes the ISO 8802-3 standard 32 bits CRC for the buffer.
extern ACE_Export ACE_UINT32 crc32 (const void *buf, size_t len,
ACE_UINT32 crc = 0);
/// Computes the ISO 8802-3 standard 32 bits CRC for the
/// @ len iovec buffers.
extern ACE_Export ACE_UINT32 crc32 (const iovec *iov, int len,
ACE_UINT32 crc = 0);
/// Euclid's greatest common divisor algorithm.
extern ACE_Export u_long gcd (u_long x, u_long y);
/// Calculates the minimum enclosing frame size for the given values.
extern ACE_Export u_long minimum_frame_size (u_long period1, u_long period2);
/**
* Function that can burn up noticeable CPU time: brute-force
* determination of whether number @a n is prime. Returns 0 if
@@ -570,28 +476,23 @@ namespace ACE
extern ACE_Export u_long is_prime (const u_long n,
const u_long min_factor,
const u_long max_factor);
/// Map troublesome win32 errno values to values that standard C
/// strerr function understands. Thank you Microsoft.
extern ACE_Export int map_errno (int error);
/// Returns a string containing the error message corresponding to a
/// WinSock error. This works around an omission in the Win32 API.
/// @internal
extern ACE_Export const ACE_TCHAR * sock_error (int error);
/// Determins whether the given error code corresponds to to a
/// WinSock error. If so returns true, false otherwise.
/// @internal
extern ACE_Export bool is_sock_error (int error);
/**
* Checks if process with {pid} is still alive. Returns 1 if it is
* still alive, 0 if it isn't alive, and -1 if something weird
* happened.
*/
extern ACE_Export int process_active (pid_t pid);
/**
* Terminate the process abruptly with id @a pid. On Win32 platforms
* this uses {TerminateProcess} and on POSIX platforms is uses
@@ -601,7 +502,6 @@ namespace ACE
* cleanup before it shuts down.
*/
extern ACE_Export int terminate_process (pid_t pid);
/**
* This method uses process id and object pointer to come up with a
* machine wide unique name. The process ID will provide uniqueness
@@ -613,213 +513,169 @@ namespace ACE
ACE_NAMESPACE_INLINE_FUNCTION void unique_name (const void *object,
ACE_TCHAR *name,
size_t length);
/// Computes the base 2 logarithm of {num}.
ACE_NAMESPACE_INLINE_FUNCTION u_long log2 (u_long num);
/// Hex conversion utility.
ACE_NAMESPACE_INLINE_FUNCTION ACE_TCHAR nibble2hex (u_int n);
/// Convert a hex character to its byte representation.
ACE_NAMESPACE_INLINE_FUNCTION u_char hex2byte (ACE_TCHAR c);
// = Set/get the debug level.
extern ACE_Export bool debug (void);
extern ACE_Export void debug (bool onoff);
/// Wrapper facade for @c select that uses @c ACE_Handle_Sets.
extern ACE_Export int select (int width,
ACE_Handle_Set *readfds,
ACE_Handle_Set *writefds = 0,
ACE_Handle_Set *exceptfds = 0,
const ACE_Time_Value *timeout = 0);
/// Wrapper facade for the most common use of @c select that uses
/// @c ACE_Handle_Sets.
extern ACE_Export int select (int width,
ACE_Handle_Set &readfds,
const ACE_Time_Value *timeout = 0);
/// Timed wait for handle to get read ready.
ACE_NAMESPACE_INLINE_FUNCTION
int handle_read_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout);
/// Timed wait for handle to get write ready.
ACE_NAMESPACE_INLINE_FUNCTION
int handle_write_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout);
/// Timed wait for handle to get exception ready.
ACE_NAMESPACE_INLINE_FUNCTION
int handle_exception_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout);
/// Timed wait for handle to get read, write, or exception ready.
extern ACE_Export int handle_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
int read_ready,
int write_ready,
int exception_ready);
/// Wait for @a timeout before proceeding to a @c recv operation.
/// @a val keeps track of whether we're in non-blocking mode or
/// not.
extern ACE_Export int enter_recv_timedwait (ACE_HANDLE handle,
const ACE_Time_Value *timeout,
int &val);
/// Wait for @a timeout before proceeding to a @c send operation.
/// @a val keeps track of whether we're in non-blocking mode or
/// not.
extern ACE_Export int enter_send_timedwait (ACE_HANDLE handle,
const ACE_Time_Value* timeout,
int &val);
/// This makes sure that @a handle is set into non-blocking mode.
/// @a val keeps track of whether were in non-blocking mode or not.
extern ACE_Export void record_and_set_non_blocking_mode (ACE_HANDLE handle,
int &val);
/// Cleanup after a timed operation, restore the appropriate
/// non-blocking status of @a handle.
extern ACE_Export void restore_non_blocking_mode (ACE_HANDLE handle,
int val);
// private:
// These functions aren't meant to be used internally, so they are
// not exported.
//
// = Recv_n helpers
//
ACE_NAMESPACE_INLINE_FUNCTION ssize_t recv_i (ACE_HANDLE handle,
void *buf,
size_t len);
extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
int flags,
size_t *bytes_transferred);
extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
#if defined (ACE_HAS_TLI)
extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
int *flags,
size_t *bytes_transferred);
extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
int *flags,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
#endif /* ACE_HAS_TLI */
extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
size_t *bytes_transferred);
extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle,
void *buf,
size_t len,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
size_t *bytes_transferred);
extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
//
// = Send_n helpers
//
ACE_NAMESPACE_INLINE_FUNCTION ssize_t send_i (ACE_HANDLE handle,
const void *buf,
size_t len);
extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
size_t *bytes_transferred);
extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
#if defined (ACE_HAS_TLI)
extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
size_t *bytes_transferred);
extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
int flags,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
#endif /* ACE_HAS_TLI */
extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
size_t *bytes_transferred);
extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle,
const void *buf,
size_t len,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
size_t *bytes_transferred);
extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle,
const iovec *iov,
int iovcnt,
const ACE_Time_Value *timeout,
size_t *bytes_transferred);
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ACE.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_ACE_H */

View File

@@ -1,18 +1,14 @@
// -*- C++ -*-
//
// $Id: ACE.inl 80826 2008-03-04 14:51:23Z wotte $
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_Thread.h"
#include "ace/OS_NS_ctype.h"
#include "ace/OS_NS_sys_socket.h"
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Wrappers for methods that have been moved to ACE_OS.
ACE_INLINE ssize_t
ACE::read_n (ACE_HANDLE handle,
void *buf,
@@ -24,7 +20,6 @@ ACE::read_n (ACE_HANDLE handle,
len,
bytes_transferred);
}
ACE_INLINE ssize_t
ACE::write_n (ACE_HANDLE handle,
const void *buf,
@@ -36,7 +31,6 @@ ACE::write_n (ACE_HANDLE handle,
len,
bytes_transferred);
}
ACE_INLINE ssize_t
ACE::recv_n (ACE_HANDLE handle,
void *buf,
@@ -59,9 +53,7 @@ ACE::recv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
#if defined (ACE_HAS_TLI)
ACE_INLINE ssize_t
ACE::t_rcv_n (ACE_HANDLE handle,
void *buf,
@@ -84,9 +76,7 @@ ACE::t_rcv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
#endif /* ACE_HAS_TLI */
ACE_INLINE ssize_t
ACE::recv_n (ACE_HANDLE handle,
void *buf,
@@ -106,7 +96,6 @@ ACE::recv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
ACE_INLINE ssize_t
ACE::recvv_n (ACE_HANDLE handle,
iovec *iov,
@@ -126,7 +115,6 @@ ACE::recvv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
ACE_INLINE ssize_t
ACE::send_n (ACE_HANDLE handle,
const void *buf,
@@ -149,9 +137,7 @@ ACE::send_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
#if defined (ACE_HAS_TLI)
ACE_INLINE ssize_t
ACE::t_snd_n (ACE_HANDLE handle,
const void *buf,
@@ -174,9 +160,7 @@ ACE::t_snd_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
#endif /* ACE_HAS_TLI */
ACE_INLINE ssize_t
ACE::send_n (ACE_HANDLE handle,
const void *buf,
@@ -196,7 +180,6 @@ ACE::send_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
ACE_INLINE ssize_t
ACE::sendv_n (ACE_HANDLE handle,
const iovec *iov,
@@ -216,7 +199,6 @@ ACE::sendv_n (ACE_HANDLE handle,
timeout,
bytes_transferred);
}
ACE_INLINE ssize_t
ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len)
{
@@ -226,7 +208,6 @@ ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len)
return ACE_OS::write (handle, (const char *) buf, len);
#endif /* ACE_WIN32 */
}
ACE_INLINE ssize_t
ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len)
{
@@ -236,7 +217,6 @@ ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len)
return ACE_OS::read (handle, (char *) buf, len);
#endif /* ACE_WIN32 */
}
ACE_INLINE int
ACE::handle_read_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout)
@@ -247,7 +227,6 @@ ACE::handle_read_ready (ACE_HANDLE handle,
0,
0);
}
ACE_INLINE int
ACE::handle_write_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout)
@@ -258,7 +237,6 @@ ACE::handle_write_ready (ACE_HANDLE handle,
1,
0);
}
ACE_INLINE int
ACE::handle_exception_ready (ACE_HANDLE handle,
const ACE_Time_Value *timeout)
@@ -269,13 +247,11 @@ ACE::handle_exception_ready (ACE_HANDLE handle,
0,
1);
}
ACE_INLINE void
ACE::strdelete (char *s)
{
delete [] s;
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE void
ACE::strdelete (wchar_t *s)
@@ -283,7 +259,6 @@ ACE::strdelete (wchar_t *s)
delete [] s;
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE void
ACE::unique_name (const void *object,
ACE_TCHAR *name,
@@ -291,18 +266,14 @@ ACE::unique_name (const void *object,
{
ACE_OS::unique_name (object, name, length);
}
ACE_INLINE u_long
ACE::log2 (u_long num)
{
u_long log = 0;
for (; num > 1; ++log)
num >>= 1;
return log;
}
ACE_INLINE ACE_TCHAR
ACE::nibble2hex (u_int n)
{
@@ -316,11 +287,9 @@ ACE::nibble2hex (u_int n)
#else
static const ACE_TCHAR hex_chars[] = ACE_TEXT ("0123456789abcdef");
#endif
// Yes, this works for UNICODE
return hex_chars[n & 0x0f];
}
ACE_INLINE int
ACE::map_errno (int error)
{
@@ -331,10 +300,8 @@ ACE::map_errno (int error)
return EAGAIN; // Same as UNIX errno EWOULDBLOCK.
}
#endif /* ACE_WIN32 */
return error;
}
ACE_INLINE u_char
ACE::hex2byte (ACE_TCHAR c)
{
@@ -345,6 +312,5 @@ ACE::hex2byte (ACE_TCHAR c)
else
return (u_char) (10 + c - ACE_TEXT ('A'));
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,12 +1,9 @@
// $Id: ACE_crc32.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/ACE.h"
ACE_RCSID (ace,
ACE_crc32,
"$Id: ACE_crc32.cpp 80826 2008-03-04 14:51:23Z wotte $")
namespace
{
/*****************************************************************/
@@ -28,7 +25,6 @@ namespace
/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */
/* */
/*****************************************************************/
const ACE_UINT32 crc_table[] =
{
0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL,
@@ -96,37 +92,29 @@ namespace
0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L,
0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL
};
/*****************************************************************/
/* End of CRC Lookup Table */
/*****************************************************************/
}
#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8))
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_UINT32
ACE::crc32 (const char *string)
{
ACE_UINT32 crc = 0xFFFFFFFF;
for (const char *p = string;
*p != 0;
++p)
{
COMPUTE (crc, *p);
}
return ~crc;
}
ACE_UINT32
ACE::crc32 (const void *buffer, size_t len, ACE_UINT32 crc)
{
crc = ~crc;
for (const char *p = (const char *) buffer,
*e = (const char *) buffer + len;
p != e;
@@ -134,15 +122,12 @@ ACE::crc32 (const void *buffer, size_t len, ACE_UINT32 crc)
{
COMPUTE (crc, *p);
}
return ~crc;
}
ACE_UINT32
ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc)
{
crc = ~crc;
for (int i = 0; i < len; ++i)
{
for (const char *p = (const char *) iov[i].iov_base,
@@ -151,12 +136,9 @@ ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc)
++p)
COMPUTE (crc, *p);
}
return ~crc;
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#undef COMPUTE

View File

@@ -1,11 +1,8 @@
// $Id: ACE_crc_ccitt.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/ACE.h"
ACE_RCSID (ace,
ACE_crc_ccitt,
"$Id: ACE_crc_ccitt.cpp 80826 2008-03-04 14:51:23Z wotte $")
namespace
{
/*****************************************************************/
@@ -27,7 +24,6 @@ namespace
/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */
/* */
/*****************************************************************/
const ACE_UINT16 crc_table[] =
{
0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
@@ -63,37 +59,29 @@ namespace
0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
};
/*****************************************************************/
/* End of CRC Lookup Table */
/*****************************************************************/
}
#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8))
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_UINT16
ACE::crc_ccitt (const char *string)
{
ACE_UINT16 crc = 0xFFFF;
for (const char *p = string;
*p != 0;
++p)
{
COMPUTE (crc, *p);
}
return ~crc;
}
ACE_UINT16
ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc)
{
crc = ~crc;
for (const char *p = (const char *) buffer,
*e = (const char *) buffer + len;
p != e;
@@ -101,15 +89,12 @@ ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc)
{
COMPUTE (crc, *p);
}
return ~crc;
}
ACE_UINT16
ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc)
{
crc = ~crc;
for (int i = 0; i < len; ++i)
{
for (const char *p = (const char *) iov[i].iov_base,
@@ -118,12 +103,9 @@ ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc)
++p)
COMPUTE (crc, *p);
}
return ~crc;
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#undef COMPUTE

View File

@@ -4,14 +4,10 @@
// This file is generated automatically by
// generate_export_file.pl
// ------------------------------
#ifndef ACE_EXPORT_H
#define ACE_EXPORT_H
#include "ace/config-lite.h"
#if defined (ACE_AS_STATIC_LIBS)
# if !defined (ACE_HAS_DLL)
# define ACE_HAS_DLL 0
# endif /* ! ACE_HAS_DLL */
@@ -20,7 +16,6 @@
# define ACE_HAS_DLL 1
# endif /* ! ACE_HAS_DLL */
#endif /* ACE_AS_STATIC_LIB */
#if defined (ACE_HAS_DLL)
# if (ACE_HAS_DLL == 1)
# if defined (ACE_BUILD_DLL)
@@ -42,14 +37,12 @@
# define ACE_SINGLETON_DECLARATION(T)
# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* ACE_HAS_DLL */
// Added by hand to help with ACE_OS namespace
#if defined (__TANDEM) && defined (USE_EXPLICIT_EXPORT)
#define ACE_NAMESPACE_STORAGE_CLASS ACE_EXPORT_MACRO extern
#else
#define ACE_NAMESPACE_STORAGE_CLASS extern ACE_EXPORT_MACRO
#endif
#if defined (__ACE_INLINE__)
# if defined (_MSC_VER) || defined (__MINGW32__) || defined (CYGWIN32) || \
(defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x560) || \
@@ -70,8 +63,6 @@
# define ACE_INLINE_TEMPLATE_FUNCTION
# endif
#endif
#endif /* ACE_EXPORT_H */
// End of auto generated file.

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//==========================================================================
/**
* @file ARGV.h
@@ -10,23 +9,17 @@
* @author Everett Anderson <eea1@cs.wustl.edu>
*/
//==========================================================================
#ifndef ACE_ARGUMENT_VECTOR_H
#define ACE_ARGUMENT_VECTOR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Global_Macros.h"
#include "ace/Unbounded_Queue.h"
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_ARGV_Queue_Entry_T
*
@@ -39,7 +32,6 @@ public:
// = Initialization and termination.
/// Initialize a ACE_ARGV_Queue_Entry_T.
ACE_ARGV_Queue_Entry_T (void);
/**
* Initialize a ACE_ARGV_Queue_Entry_T.
*
@@ -50,31 +42,24 @@ public:
*/
ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg,
bool quote_arg);
/**
* Initialize a ACE_ARGV_Queue_Entry_T.
*
* @param entry Pointer to a queue entry
*/
ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T<CHAR_TYPE> &entry);
/// We need this destructor to keep some compilers from complaining.
/// It's just a no-op, however.
~ACE_ARGV_Queue_Entry_T (void);
/// Dump the state of this object.
void dump (void) const;
// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
/// Pointer to the argument.
const CHAR_TYPE * arg_;
/// The argument need to be quoted while adding to the vector.
bool quote_arg_;
};
/**
* @class ACE_ARGV_T
*
@@ -112,7 +97,6 @@ public:
*/
explicit ACE_ARGV_T (const CHAR_TYPE buf[],
bool substitute_env_args = true);
/**
* Initializes the argument vector from a set of arguments. Any environment
* variable references are translated (if applicable) during execution of
@@ -139,7 +123,6 @@ public:
CHAR_TYPE *argv[],
bool substitute_env_args = true,
bool quote_args = false);
/**
* Initializes the argument vector from a set of arguments. Any environment
* variable references are translated (if applicable) during execution of
@@ -162,7 +145,6 @@ public:
explicit ACE_ARGV_T (CHAR_TYPE *argv[],
bool substitute_env_args = true,
bool quote_args = false);
/**
* Initializes the argument vector from two combined argument vectors.
*
@@ -185,17 +167,14 @@ public:
CHAR_TYPE *second_argv[],
bool substitute_env_args = true,
bool quote_args = false);
/**
* Initialize this object so arguments can be added later using one
* of the add methods. This is referred to as the @i iterative method
* of adding arguments to this object.
*/
explicit ACE_ARGV_T (bool substitute_env_args = true);
/// Destructor.
~ACE_ARGV_T (void);
/** @name Accessor methods
*
* These methods access the argument vector contained in this object.
@@ -210,32 +189,25 @@ public:
* @retval 0 if @a index is out of bounds.
*/
const CHAR_TYPE *operator[] (size_t index);
/**
* Returns the current argument vector. The returned pointers are to data
* maintained internally to this class. Do not change or delete either the
* pointers or the memory to which they refer.
*/
CHAR_TYPE **argv (void);
/// Returns the current number of arguments.
int argc (void) const;
/**
* Returns a single string form of the current arguments. The returned
* pointer refers to memory maintained internally to this class. Do not
* change or delete it.
*/
const CHAR_TYPE *buf (void);
//@}
/// Dump the state of this object.
void dump (void) const;
// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
/**
* Add another argument. This only works in the iterative mode.
*
@@ -254,7 +226,6 @@ public:
* - ENOMEM: Not enough memory available to save @a next_arg.
*/
int add (const CHAR_TYPE *next_arg, bool quote_arg = false);
/**
* Add an array of arguments. This only works in the iterative mode.
*
@@ -274,61 +245,44 @@ public:
* - ENOMEM: Not enough memory available to save @a next_arg.
*/
int add (CHAR_TYPE *argv[], bool quote_args = false);
private:
/// Copy constructor not implemented.
ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T (const ACE_ARGV_T<CHAR_TYPE>&))
/// Assignment operator not implemented.
ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T operator= (const ACE_ARGV_T<CHAR_TYPE>&))
/// Creates buf_ from the queue of added args, deletes previous buf_.
int create_buf_from_queue (void);
/// Converts buf_ into the CHAR_TYPE *argv[] format.
int string_to_argv (void);
/// Replace args with environment variable values?
bool substitute_env_args_;
bool iterative_;
/// Number of arguments in the ARGV array.
int argc_;
/// The array of string arguments.
CHAR_TYPE **argv_;
/// Buffer containing the <argv> contents.
CHAR_TYPE *buf_;
/// Total length of the arguments in the queue, not counting
/// separating spaces
size_t length_;
/// Queue which keeps user supplied arguments. This is only
/// active in the "iterative" mode.
ACE_Unbounded_Queue<ACE_ARGV_Queue_Entry_T<CHAR_TYPE> > queue_;
};
typedef ACE_ARGV_Queue_Entry_T<ACE_TCHAR> ACE_ARGV_Queue_Entry;
typedef ACE_ARGV_T<ACE_TCHAR> ACE_ARGV;
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ARGV.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/ARGV.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("ARGV.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_ARGUMENT_VECTOR_H */

View File

@@ -1,11 +1,8 @@
/* -*- C++ -*- */
// $Id: ARGV.inl 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Global_Macros.h"
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <typename CHAR_TYPE> ACE_INLINE
ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (void)
: arg_(0),
@@ -13,7 +10,6 @@ ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (void)
{
// No-op
}
template <typename CHAR_TYPE> ACE_INLINE
ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg,
bool quote_arg)
@@ -22,7 +18,6 @@ ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg,
{
// No-op
}
template <typename CHAR_TYPE> ACE_INLINE
ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T<CHAR_TYPE> &entry)
: arg_(entry.arg_),
@@ -30,13 +25,11 @@ ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_
{
// No-op
}
template <typename CHAR_TYPE> ACE_INLINE
ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::~ACE_ARGV_Queue_Entry_T (void)
{
// No-op just to keep some compilers happy...
}
// Return the number of args
template <typename CHAR_TYPE>
ACE_INLINE int
@@ -49,56 +42,43 @@ ACE_ARGV_T<CHAR_TYPE>::argc (void) const
(void) nonconst_this->argv ();
return this->argc_;
}
// Return the arguments in a space-separated string
template <typename CHAR_TYPE>
ACE_INLINE const CHAR_TYPE *
ACE_ARGV_T<CHAR_TYPE>::buf (void)
{
ACE_TRACE ("ACE_ARGV_T::buf");
if (this->buf_ == 0 && this->iterative_)
this->create_buf_from_queue ();
return (const CHAR_TYPE *) this->buf_;
}
// Return the arguments in an entry-per-argument array
template <typename CHAR_TYPE>
ACE_INLINE CHAR_TYPE **
ACE_ARGV_T<CHAR_TYPE>::argv (void)
{
ACE_TRACE ("ACE_ARGV_T::argv");
// Try to create the argv_ if it isn't there
if (this->argv_ == 0)
{
if (this->iterative_ && this->buf_ == 0)
this->create_buf_from_queue ();
// Convert buf_ to argv_
if (this->string_to_argv () == -1)
return (CHAR_TYPE **) 0;
}
return (CHAR_TYPE **) this->argv_;
}
// Subscript operator.
template <typename CHAR_TYPE>
ACE_INLINE const CHAR_TYPE *
ACE_ARGV_T<CHAR_TYPE>::operator[] (size_t i)
{
ACE_TRACE ("ACE_ARGV_T::operator[]");
// Don't go out of bounds.
if (i >= static_cast<size_t> (this->argc_))
return 0;
return (const CHAR_TYPE *) this->argv ()[i];
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,49 +1,36 @@
// $Id: ATM_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/ATM_Acceptor.h"
ACE_RCSID(ace, ATM_Acceptor, "$Id: ATM_Acceptor.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if defined (ACE_HAS_ATM)
#if defined (ACE_HAS_LINUX_ATM)
#include /**/ "linux/atmdev.h"
#endif /* ACE_HAS_LINUX_ATM */
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Acceptor.inl"
#endif /* __ACE_INLINE__ */
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Put the actual definitions of the ACE_ATM_Request and
// ACE_ATM_Request_Queue classes here to hide them from clients...
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Acceptor)
ACE_ATM_Acceptor::ACE_ATM_Acceptor (void)
{
ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor");
}
ACE_ATM_Acceptor::~ACE_ATM_Acceptor (void)
{
ACE_TRACE ("ACE_ATM_Acceptor::~ACE_ATM_Acceptor");
}
int
ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr)
{
ACE_TRACE ("ACE_ATM_Acceptor::get_local_addr");
#if defined (ACE_HAS_FORE_ATM_WS2)
unsigned long ret = 0;
DWORD deviceID = 0;
ATM_ADDRESS addr;
struct sockaddr_atm *laddr;
if (::WSAIoctl ((int) ((ACE_SOCK_Acceptor *)this) -> get_handle (),
SIO_GET_ATM_ADDRESS,
(LPVOID) &deviceID,
@@ -57,21 +44,17 @@ ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr)
::WSAGetLastError ());
return -1;
}
laddr = (struct sockaddr_atm *)local_addr.get_addr ();
ACE_OS::memcpy ((void *)& (laddr -> satm_number),
(void *)&addr,
ATM_ADDR_SIZE - 1);
return 0;
#elif defined (ACE_HAS_FORE_ATM_XTI)
ACE_UNUSED_ARG (local_addr);
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
ATM_Addr *myaddr = (ATM_Addr *)local_addr.get_addr ();
int addrlen = sizeof (myaddr->sockaddratmsvc);
if (ACE_OS::getsockname (acceptor_.get_handle (),
(struct sockaddr *) & (myaddr->sockaddratmsvc),
&addrlen) < 0) {
@@ -80,15 +63,12 @@ ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr)
errno));
return -1;
}
return (0);
#else
ACE_UNUSED_ARG (local_addr);
return 0;
#endif /* ACE_HAS_FORE_ATM_WS2 && ACE_HAS_FORE_ATM_XTI */
}
ACE_HANDLE
ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
int backlog,
@@ -107,12 +87,9 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
struct sockaddr_atm local_atm_addr;
ACE_HANDLE ret;
DWORD flags = 0;
/* Create a local endpoint of communication */
// Only leaves can listen.
flags = ACE_FLAG_MULTIPOINT_C_LEAF | ACE_FLAG_MULTIPOINT_D_LEAF;
if ((ret = ACE_OS::socket (AF_ATM,
SOCK_RAW,
ATMPROTO_AAL5,
@@ -124,9 +101,7 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
::WSAGetLastError ());
return (ret);
}
((ACE_SOCK_Acceptor *)this) -> set_handle (ret);
/* Set up the address information to become a server */
ACE_OS::memset ((void *) &local_atm_addr, 0, sizeof local_atm_addr);
local_atm_addr.satm_family = AF_ATM;
@@ -136,7 +111,6 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
local_atm_addr.satm_blli.Layer2Protocol = SAP_FIELD_ANY;
local_atm_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT;
local_atm_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;
/* Associate address with endpoint */
if (ACE_OS::bind (((ACE_SOCK_Acceptor *)this) -> get_handle (),
reinterpret_cast<struct sockaddr *> (&local_atm_addr),
@@ -144,7 +118,6 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
ACE_OS::printf ("Acceptor (open): bind %d\n", ::WSAGetLastError ());
return (ACE_INVALID_HANDLE);
}
/* Make endpoint listen for service requests */
if (ACE_OS::listen (( (ACE_SOCK_Acceptor *)this) -> get_handle (),
backlog)
@@ -152,17 +125,14 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
ACE_OS::printf ("Acceptor (open): listen %d\n", ::WSAGetLastError ());
return (ACE_INVALID_HANDLE);
}
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
//we need to set the qos before binding to the socket
//use remote_sap as local_sap
ACE_ATM_Addr local_sap;
ATM_Addr *local_sap_addr = (ATM_Addr*)local_sap.get_addr ();
ACE_ATM_QoS def_qos;
ATM_QoS qos = def_qos.get_qos ();
ACE_HANDLE handle;
if ((handle = ACE_OS::socket (params.get_protocol_family (),
params.get_type (),
@@ -177,7 +147,6 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
errno);
return (ACE_INVALID_HANDLE);
}
((ACE_SOCK_Acceptor *)this) -> set_handle (handle);
if (ACE_OS::setsockopt (handle,
SOL_ATM,
@@ -187,10 +156,8 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
ACE_OS::printf ("Acceptor (setsockopt): setsockopt:%d\n",
errno);
}
struct atmif_sioc req;
struct sockaddr_atmsvc aux_addr[1024];
req.number = 0;
req.arg = aux_addr;
req.length = sizeof (aux_addr);
@@ -203,7 +170,6 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
local_sap_addr->sockaddratmsvc = aux_addr[0];
}
local_sap.set_selector (( (ACE_ATM_Addr*)&remote_sap)->get_selector ());
if (ACE_OS::bind (handle,
reinterpret_cast<struct sockaddr *> (
&(local_sap_addr->sockaddratmsvc)),
@@ -223,7 +189,6 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
errno);
return -1;
}
return 0;
#else
ACE_UNUSED_ARG (remote_sap);
@@ -231,7 +196,6 @@ ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap,
ACE_UNUSED_ARG (params);
#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */
}
int
ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
ACE_Addr *remote_addr,
@@ -244,7 +208,6 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
ACE_TRACE ("ACE_ATM_Acceptor::accept");
#if defined (ACE_HAS_FORE_ATM_XTI)
ATM_QoS optbuf = qos.get_qos ();
return (acceptor_.accept (new_sap.get_stream (),
remote_addr,
timeout,
@@ -259,24 +222,19 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
struct sockaddr_atm *cli_addr
= (struct sockaddr_atm *)remote_addr -> get_addr ();
int caddr_len = sizeof (struct sockaddr_atm);
do {
n_handle = ACE_OS::accept (s_handle,
reinterpret_cast<struct sockaddr *> (cli_addr),
&caddr_len);
} while (n_handle == ACE_INVALID_HANDLE && errno == EINTR);
((ACE_ATM_Addr *)remote_addr) -> set (cli_addr,
((ACE_ATM_Addr *)remote_addr) -> get_selector ());
((ACE_IPC_SAP *)&new_sap) -> set_handle (n_handle);
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
ACE_UNUSED_ARG (params);
ACE_HANDLE s_handle = ((ACE_SOCK_Acceptor *) this) -> get_handle ();
struct atm_qos accept_qos = qos.get_qos ();
if (ACE_OS::setsockopt (s_handle,
SOL_ATM,
SO_ATMQOS,
@@ -284,7 +242,6 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
sizeof (accept_qos)) < 0) {
ACE_OS::printf ("Acceptor (accept): error setting Qos");
}
return (acceptor_.accept (new_sap.get_stream (),
remote_addr,
timeout,
@@ -301,10 +258,8 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap,
return (0);
#endif /* ACE_HAS_FORE_ATM_XTI */
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_ATM */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ATM_Acceptor.h
@@ -10,27 +9,20 @@
*/
//=============================================================================
#ifndef ACE_ATM_ACCEPTOR_H
#define ACE_ATM_ACCEPTOR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_ATM)
#include "ace/ATM_Stream.h"
#include "ace/ATM_Params.h"
#include "ace/ATM_QoS.h"
#if defined (ACE_HAS_LINUX_ATM)
#include /**/ "atm.h"
#endif /* ACE_HAS_LINUX_ATM */
#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM)
#include "ace/SOCK_Acceptor.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -42,13 +34,10 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ACE_TLI_Acceptor ATM_Acceptor;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif // ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Forward declarations.
class ACE_Time_Value;
/**
* @class ACE_ATM_Acceptor
*
@@ -59,29 +48,22 @@ class ACE_Time_Value;
*/
class ACE_Export ACE_ATM_Acceptor
{
public:
// = Initialization and termination methods.
/// Default constructor.
ACE_ATM_Acceptor (void);
~ACE_ATM_Acceptor ();
/// Initiate a passive mode connection.
ACE_ATM_Acceptor (const ACE_Addr &remote_sap,
int backlog = ACE_DEFAULT_BACKLOG,
ACE_ATM_Params params = ACE_ATM_Params());
/// Initiate a passive mode socket.
ACE_HANDLE open (const ACE_Addr &remote_sap,
int backlog = ACE_DEFAULT_BACKLOG,
ACE_ATM_Params params = ACE_ATM_Params());
/// Close down the acceptor and release resources.
int close (void);
// = Passive connection acceptance method.
/// Accept a new data transfer connection. A @a timeout of 0 means
/// block forever, a @a timeout of {0, 0} means poll. @a restart == 1
/// means "restart if interrupted."
@@ -92,32 +74,24 @@ public:
int reset_new_handle = 0,
ACE_ATM_Params params = ACE_ATM_Params(),
ACE_ATM_QoS qos = ACE_ATM_QoS());
/// Get the local address currently listening on
int get_local_addr( ACE_ATM_Addr &local_addr );
// = Meta-type info
typedef ACE_ATM_Addr PEER_ADDR;
typedef ACE_ATM_Stream PEER_STREAM;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
ATM_Acceptor acceptor_;
};
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ATM_Acceptor.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_ACCEPTOR_H */

View File

@@ -1,10 +1,8 @@
// -*- C++ -*-
//
// $Id: ATM_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
ACE_ATM_Acceptor::dump (void) const
{
@@ -12,14 +10,12 @@ ACE_ATM_Acceptor::dump (void) const
ACE_TRACE ("ACE_ATM_Acceptor::dump");
#endif /* ACE_HAS_DUMP */
}
ACE_INLINE
ACE_ATM_Acceptor::ACE_ATM_Acceptor (const ACE_Addr &remote_sap,
int backlog,
ACE_ATM_Params params)
{
ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor");
//FUZZ: disable check_for_lack_ACE_OS
if (open (remote_sap, backlog, params) < 0)
//FUZZ: enable check_for_lack_ACE_OS
@@ -27,7 +23,6 @@ ACE_ATM_Acceptor::ACE_ATM_Acceptor (const ACE_Addr &remote_sap,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_ATM_Acceptor::ACE_ATM_Acceptor")));
}
ACE_INLINE
int
ACE_ATM_Acceptor::close (void)
@@ -38,6 +33,5 @@ ACE_ATM_Acceptor::close (void)
return 0;
#endif // ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,26 +1,17 @@
// $Id: ATM_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
// Defines the Internet domain address family address format.
#include "ace/ATM_Addr.h"
#if defined (ACE_HAS_ATM)
#include "ace/Log_Msg.h"
#if defined (ACE_HAS_FORE_ATM_WS2)
#include /**/ "forews2.h"
#endif /* ACE_HAS_FORE_ATM_WS2 */
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Addr.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID(ace, ATM_Addr, "$Id: ATM_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Addr)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
#define BHLI_MAGIC "FORE_ATM"
// This is line rate in cells/s for an OC-3 MM interface.
@@ -42,9 +33,7 @@ const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0;
const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0;
const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
// Default constructor
ACE_ATM_Addr::ACE_ATM_Addr (u_char selector)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
: ACE_Addr (AF_ATM,
@@ -61,9 +50,7 @@ ACE_ATM_Addr::ACE_ATM_Addr (u_char selector)
sizeof this->atm_addr_);
this->init (selector);
}
// Copy constructor.
ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap,
u_char selector)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
@@ -84,7 +71,6 @@ ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap,
this->atm_addr_.atmsap.bhli.hl_type = ATM_HL_NONE;
#endif /* ACE_HAS_LINUX_ATM */
}
ACE_ATM_Addr::ACE_ATM_Addr (const ATM_Addr *sap,
u_char selector)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
@@ -100,7 +86,6 @@ ACE_ATM_Addr::ACE_ATM_Addr (const ATM_Addr *sap,
this->set (sap, selector);
}
ACE_ATM_Addr::ACE_ATM_Addr (const ACE_TCHAR sap[],
u_char selector)
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
@@ -115,20 +100,16 @@ ACE_ATM_Addr::ACE_ATM_Addr (const ACE_TCHAR sap[],
ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr");
this->set (sap, selector);
}
ACE_ATM_Addr::~ACE_ATM_Addr (void)
{
}
// Return the address.
void *
ACE_ATM_Addr::get_addr (void) const
{
ACE_TRACE ("ACE_ATM_Addr::get_addr");
return (void *) &this->atm_addr_;
}
void
ACE_ATM_Addr::init (u_char selector)
{
@@ -138,22 +119,16 @@ ACE_ATM_Addr::init (u_char selector)
// selector (i.e. address[19]) is used by the TP. The rest of the
// local address is filled in by the TP and can be obtained via the
// 'ret' parameter or with t_getname ()/t_getprotaddr ().
atm_addr_.addressType = (u_int16_t) AF_ATM;
atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr = (int8_t) T_ATM_ABSENT;
atm_addr_.sap.t_atm_sap_addr.SVE_tag_selector = (int8_t) T_ATM_PRESENT;
atm_addr_.sap.t_atm_sap_addr.address_format = (u_int8_t) T_ATM_ENDSYS_ADDR;
atm_addr_.sap.t_atm_sap_addr.address_length = ATMNSAP_ADDR_LEN;
atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector;
atm_addr_.sap.t_atm_sap_layer2.SVE_tag = (int8_t) T_ATM_ABSENT;
atm_addr_.sap.t_atm_sap_layer3.SVE_tag = (int8_t) T_ATM_ABSENT;
atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT;
atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID;
ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID,
BHLI_MAGIC,
sizeof atm_addr_.sap.t_atm_sap_appl.ID);
@@ -166,7 +141,6 @@ ACE_ATM_Addr::init (u_char selector)
atm_addr_.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT;
atm_addr_.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT;
atm_addr_.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;
// Need to know the correspondence.
//atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT;
//atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID;
@@ -183,38 +157,30 @@ ACE_ATM_Addr::init (u_char selector)
ACE_UNUSED_ARG (selector);
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
int
ACE_ATM_Addr::set (const ACE_ATM_Addr &sap,
u_char selector)
{
ACE_TRACE ("ACE_ATM_Addr::set");
this->init (selector);
this->ACE_Addr::base_set (sap.get_type (),
sap.get_size ());
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
ACE_ASSERT (sap.get_type () == AF_ATM);
#elif defined (ACE_HAS_LINUX_ATM)
ACE_ASSERT (sap.get_type () == PF_ATMSVC);
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
(void) ACE_OS::memcpy ((void *) &this->atm_addr_,
(void *) &sap.atm_addr_,
sizeof this->atm_addr_);
return 0;
}
int
ACE_ATM_Addr::set (const ATM_Addr *sap,
u_char selector)
{
ACE_TRACE ("ACE_ATM_Addr::set");
this->init (selector);
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
this->ACE_Addr::base_set (AF_ATM,
#elif defined (ACE_HAS_LINUX_ATM)
@@ -223,39 +189,31 @@ ACE_ATM_Addr::set (const ATM_Addr *sap,
this->ACE_Addr::base_set (AF_UNSPEC,
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
sizeof (*sap));
(void) ACE_OS::memcpy ((void *) &this->atm_addr_,
(void *) sap,
sizeof this->atm_addr_);
return 0;
}
int
ACE_ATM_Addr::set (const ACE_TCHAR address[],
u_char selector)
{
ACE_TRACE ("ACE_ATM_Addr::set");
int ret;
this->init (selector);
#if defined (ACE_HAS_FORE_ATM_XTI)
atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr =
(int8_t) T_ATM_PRESENT;
#endif /* ACE_HAS_FORE_ATM_XTI */
ret = this -> string_to_addr (address);
this -> set_selector (selector);
return ret;
}
// Transform the string into the current addressing format.
int
ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
{
ACE_TRACE ("ACE_ATM_Addr::string_to_addr");
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
this->ACE_Addr::base_set (AF_ATM,
#elif defined (ACE_HAS_LINUX_ATM)
@@ -267,7 +225,6 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
#if defined (ACE_HAS_FORE_ATM_XTI)
struct hostent *entry;
struct atmnsap_addr *nsap;
// Yow, someone gave us a NULL ATM address!
if (sap == 0)
{
@@ -296,14 +253,11 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
WSAQUERYSETW qsRestrictions;
CSADDR_INFO csaBuffer;
WCHAR tmpWStr[100];
MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, sap, -1, tmpWStr, 100);
csaBuffer.LocalAddr.iSockaddrLength = sizeof (struct sockaddr_atm);
csaBuffer.LocalAddr.lpSockaddr = (struct sockaddr *)&atm_addr_;
csaBuffer.RemoteAddr.iSockaddrLength = sizeof (struct sockaddr_atm);
csaBuffer.RemoteAddr.lpSockaddr = (struct sockaddr *)&atm_addr_;
qsRestrictions.dwSize = sizeof (WSAQUERYSETW);
qsRestrictions.lpszServiceInstanceName = 0;
qsRestrictions.lpServiceClassId = &FORE_NAME_CLASS;
@@ -318,16 +272,13 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
qsRestrictions.dwNumberOfCsAddrs = 1;
qsRestrictions.lpcsaBuffer = &csaBuffer;
qsRestrictions.lpBlob = 0; //&blob;
if (::WSALookupServiceBeginW (&qsRestrictions, LUP_RETURN_ALL, &hLookup)
== SOCKET_ERROR) {
ACE_OS::printf ("Error: WSALookupServiceBeginW failed! %d\n",
::WSAGetLastError ());
return -1;
}
dwValue = sizeof (WSAQUERYSETW);
if (::WSALookupServiceNextW (hLookup, 0, &dwValue, &qsRestrictions)
== SOCKET_ERROR) {
if (WSAGetLastError () != WSA_E_NO_MORE) {
@@ -336,7 +287,6 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
return -1;
}
}
if (WSALookupServiceEnd (hLookup) == SOCKET_ERROR) {
ACE_OS::printf ("Error : WSALookupServiceEnd failed! %d \n",
::WSAGetLastError ());
@@ -348,7 +298,6 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
errno = EINVAL;
return -1;
}
if (text2atm ((ACE_TCHAR *)sap,
(struct sockaddr *)& (atm_addr_.sockaddratmsvc),
sizeof (atm_addr_.sockaddratmsvc),
@@ -360,23 +309,18 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[])
}
#else
ACE_UNUSED_ARG (sap);
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM)
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
}
// Transform the current address into string format.
int
ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[],
size_t addrlen) const
{
ACE_TRACE ("ACE_ATM_Addr::addr_to_string");
#if defined (ACE_HAS_FORE_ATM_XTI)
ACE_TCHAR buffer[MAXNAMELEN + 1];
struct atmnsap_addr nsap;
@@ -386,32 +330,25 @@ ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[],
ACE_OS::sprintf (buffer,
ACE_TEXT ("%s"),
atmnsap_ntoa (nsap));
size_t total_len = ACE_OS::strlen (buffer) + sizeof ('\0');
if (addrlen < total_len)
return -1;
else
ACE_OS::strcpy (addr, buffer);
return 0;
#elif defined (ACE_HAS_FORE_ATM_WS2)
ACE_TCHAR buffer[MAXNAMELEN + 1];
int i;
if (addrlen < ATM_ADDR_SIZE + 1)
return -1;
for (i = 0; i < ATM_ADDR_SIZE; i++) {
buffer[ i * 3 ] = '\0';
ACE_OS::sprintf (buffer, ACE_TEXT ("%s%02x."),
buffer,
atm_addr_.satm_number.Addr[ i ]);
}
buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0';
ACE_OS::strcpy (addr, buffer);
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1];
@@ -428,7 +365,6 @@ ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[],
else
ACE_OS::strcpy (addr,
buffer);
return 0;
#else
ACE_UNUSED_ARG (addr);
@@ -436,26 +372,21 @@ ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[],
return -1;
#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */
}
const ACE_TCHAR *
ACE_ATM_Addr::addr_to_string (void) const
{
ACE_TRACE ("ACE_ATM_Addr::addr_to_string");
static ACE_TCHAR addr[MAXHOSTNAMELEN + 1];
if (this->addr_to_string (addr,
MAXHOSTNAMELEN + 1) < 0)
return 0;
return addr;
}
// Set a pointer to the address.
void
ACE_ATM_Addr::set_addr (void *addr, int len)
{
ACE_TRACE ("ACE_ATM_Addr::set_addr");
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
this->ACE_Addr::base_set (AF_ATM,
#elif defined (ACE_HAS_LINUX_ATM)
@@ -467,23 +398,18 @@ ACE_ATM_Addr::set_addr (void *addr, int len)
ACE_OS::memcpy ((void *) &this->atm_addr_,
(void *) addr, len);
}
// Compare two addresses for inequality.
bool
ACE_ATM_Addr::operator != (const ACE_ATM_Addr &sap) const
{
ACE_TRACE ("ACE_ATM_Addr::operator !=");
return ! ((*this) == sap);
}
// Compare two addresses for equality.
bool
ACE_ATM_Addr::operator == (const ACE_ATM_Addr &sap) const
{
ACE_TRACE ("ACE_ATM_Addr::operator ==");
#if defined (ACE_HAS_LINUX_ATM)
return (atm_equal ((const struct sockaddr *)& (this->atm_addr_.sockaddratmsvc),
(const struct sockaddr *)& (sap.atm_addr_.sockaddratmsvc),
@@ -499,15 +425,12 @@ ACE_ATM_Addr::operator == (const ACE_ATM_Addr &sap) const
sizeof (ATM_Addr)) == 0;
#endif /* ACE_HAS_LINUX_ATM */
}
void
ACE_ATM_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_ATM_Addr::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_TCHAR s[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16];
ACE_OS::sprintf (s,
ACE_TEXT ("%s"),
@@ -516,8 +439,6 @@ ACE_ATM_Addr::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_ATM */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//==========================================================================
/**
* @file ATM_Addr.h
@@ -9,22 +8,16 @@
* @author Joe Hoffert <joeh@cs.wustl.edu>
*/
//==========================================================================
#ifndef ACE_ATM_ADDR_H
#define ACE_ATM_ADDR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_ATM)
#include /**/ "ace/ACE_export.h"
#include "ace/Addr.h"
#if defined (ACE_HAS_FORE_ATM_XTI)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ATMSAPAddress ATM_Addr;
@@ -35,12 +28,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef struct sockaddr_atm ATM_Addr;
ACE_END_VERSIONED_NAMESPACE_DECL
#elif defined (ACE_HAS_LINUX_ATM)
#include /**/ "atm.h"
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
//pbrandao:as Linux has this 2 structs separeted we "link it" here
typedef struct _linux_atm_addr
{
@@ -50,7 +40,6 @@ typedef struct _linux_atm_addr
#else
typedef int ATM_Addr;
#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */
/**
* @class ACE_ATM_Addr
*
@@ -64,15 +53,12 @@ public:
static const int OPT_FLAGS_CPID;
static const int OPT_FLAGS_PMP;
static const int DEFAULT_SELECTOR;
// = Initialization methods.
/// Default constructor.
ACE_ATM_Addr (u_char selector = DEFAULT_SELECTOR);
/// Copy constructor.
ACE_ATM_Addr (const ACE_ATM_Addr &,
u_char selector = DEFAULT_SELECTOR);
/**
* Creates an ACE_ATM_Addr from an ATMSAPAddress structure. This
* is vendor specific (FORE systems). May need to change when other
@@ -80,7 +66,6 @@ public:
*/
ACE_ATM_Addr (const ATM_Addr *,
u_char selector = DEFAULT_SELECTOR);
/**
* Initializes an ACE_ATM_Addr from the <sap> which can be
* "atm-address" (e.g.,
@@ -89,19 +74,15 @@ public:
*/
ACE_ATM_Addr (const ACE_TCHAR sap[],
u_char selector = DEFAULT_SELECTOR);
/// Default dtor.
~ACE_ATM_Addr (void);
// = Initialization methods (useful after object construction).
/// Default initialization for non-address values (e.g.,
/// t_atm_sap_addr.SVE_tag_addr, t_atm_sap_addr.SVE_tag_selector)
void init (u_char selector = DEFAULT_SELECTOR);
/// Initializes from another ACE_ATM_Addr.
int set (const ACE_ATM_Addr &,
u_char selector = DEFAULT_SELECTOR);
/**
* Initializes an ACE_ATM_Addr from an ATMSAPAddress/sockaddr_atm
* structure. This is vendor specific (FORE systems). May need to
@@ -109,7 +90,6 @@ public:
*/
int set (const ATM_Addr *,
u_char selector = DEFAULT_SELECTOR);
/**
* Initializes an ACE_ATM_Addr from the <sap> which can be
* "atm-address" (e.g.,
@@ -118,7 +98,6 @@ public:
*/
int set (const ACE_TCHAR sap[],
u_char selector = DEFAULT_SELECTOR);
/**
* Initializes an ACE_ATM_Addr from the <sap> which can be
* "atm-address" (e.g.,
@@ -126,7 +105,6 @@ public:
* (e.g., "frisbee.cs.wustl.edu").
*/
virtual int string_to_addr (const ACE_TCHAR sap[]);
/**
* Return the character representation of the ATM address (e.g.,
* "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") storing it in
@@ -136,7 +114,6 @@ public:
*/
virtual int addr_to_string (ACE_TCHAR addr[],
size_t addrlen) const;
/**
* Return the character representation of the ATM address (e.g.,
* "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00"). Returns -1
@@ -145,53 +122,40 @@ public:
* area.)
*/
const ACE_TCHAR *addr_to_string (void) const;
/// Return a pointer to the underlying network address.
virtual void *get_addr (void) const;
/// Set a pointer to the address.
virtual void set_addr (void *, int);
/// Return the selector for network address.
u_char get_selector (void) const;
/// Set the selector for the network address.
void set_selector (u_char selector);
/**
* Compare two addresses for equality. The addresses are considered
* equal if they contain the same ATM address. Q: Is there any
* other check for equality needed for ATM?
*/
bool operator == (const ACE_ATM_Addr &SAP) const;
/// Compare two addresses for inequality.
bool operator != (const ACE_ATM_Addr &SAP) const;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
// char *construct_options (ACE_HANDLE fd,
// int qos_kb,
// int flags,
// long *optsize);
// // Construct options for ATM connections
private:
ATM_Addr atm_addr_;
};
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ATM_Addr.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_ADDR_H */

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: ATM_Addr.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE u_char
ACE_ATM_Addr::get_selector (void) const
{
@@ -18,7 +16,6 @@ ACE_ATM_Addr::get_selector (void) const
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
ACE_INLINE void
ACE_ATM_Addr::set_selector (u_char selector)
{
@@ -33,5 +30,4 @@ ACE_ATM_Addr::set_selector (u_char selector)
ACE_UNUSED_ARG (selector);
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,31 +1,22 @@
// ATM_Connector.cpp
// $Id: ATM_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/ATM_Connector.h"
#if defined (ACE_HAS_ATM)
#include "ace/Handle_Set.h"
ACE_RCSID(ace, ATM_Connector, "$Id: ATM_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Connector.inl"
#endif /* __ACE_INLINE__ */
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Connector)
ACE_ATM_Connector::ACE_ATM_Connector (void)
{
ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector");
}
// Actively connect and produce a new ACE_ATM_Stream if things go well...
// Connect the <new_stream> to the <remote_sap>, waiting up to
// <timeout> amount of time if necessary.
int
ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
const ACE_ATM_Addr &remote_sap,
@@ -54,29 +45,23 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
#elif defined (ACE_HAS_FORE_ATM_WS2)
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): set QoS parameters\n" ));
ACE_HANDLE s = new_stream.get_handle();
struct sockaddr_atm *saddr = ( struct sockaddr_atm *)remote_sap.get_addr();
ACE_QoS cqos = options.get_qos();
ACE_QoS_Params qos_params = ACE_QoS_Params(0,
0,
&cqos,
0,
0);
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): connecting...\n"));
int result = ACE_OS::connect( s,
( struct sockaddr *)saddr,
sizeof( struct sockaddr_atm ),
qos_params );
if ( result != 0 )
ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n",
::WSAGetLastError());
return result;
#elif defined (ACE_HAS_LINUX_ATM)
ACE_UNUSED_ARG (params);
@@ -84,12 +69,10 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
ACE_UNUSED_ARG (reuse_addr);
ACE_UNUSED_ARG (perms);
ACE_UNUSED_ARG (flags);
ACE_HANDLE handle = new_stream.get_handle();
ATM_QoS qos =options.get_qos();
ATM_Addr *local_addr=(ATM_Addr*)local_sap.get_addr(),
*remote_addr=(ATM_Addr*)remote_sap.get_addr();
if (ACE_OS::setsockopt(handle,
SOL_ATM,
SO_ATMSAP,
@@ -107,16 +90,13 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
errno));
return -1;
}
int result = ACE_OS::connect(handle,
(struct sockaddr *)&(remote_addr->sockaddratmsvc),
sizeof( remote_addr->sockaddratmsvc));
if ( result != 0 )
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): connection failed, %d\n"),
errno);
return result;
#else
ACE_UNUSED_ARG (new_stream);
@@ -131,9 +111,7 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_ATM */

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file ATM_Connector.h
@@ -9,23 +8,17 @@
* @author Joe Hoffert <joeh@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_ATM_CONNECTOR_H
#define ACE_ATM_CONNECTOR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_ATM)
#include "ace/ATM_Stream.h"
#include "ace/ATM_Params.h"
#include "ace/ATM_QoS.h"
#if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM)
#include "ace/SOCK_Connector.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -38,10 +31,8 @@ typedef ACE_XTI_ATM_Mcast ATM_Connector;
// Open versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#endif
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_ATM_Connector
*
@@ -54,7 +45,6 @@ public:
// = Initialization methods.
/// Default constructor.
ACE_ATM_Connector (void);
/**
* Actively connect and produce a @a new_stream if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -84,7 +74,6 @@ public:
int flags = O_RDWR,
#endif /* ACE_WIN32 */
int perms = 0);
/**
* Actively connect and produce a @a new_stream if things go well.
* The @a remote_sap is the address that we are trying to connect
@@ -115,7 +104,6 @@ public:
int flags = O_RDWR,
#endif /* ACE_WIN32 */
int perms = 0);
/**
* Try to complete a non-blocking connection.
* If connection completion is successful then @a new_stream contains
@@ -125,7 +113,6 @@ public:
int complete (ACE_ATM_Stream &new_stream,
ACE_ATM_Addr *remote_sap,
ACE_Time_Value *tv);
/**
* Actively add a leaf to the root (i.e., point-to-multipoint). The
* @a remote_sap is the address of the leaf that we
@@ -134,31 +121,23 @@ public:
int add_leaf (ACE_ATM_Stream &current_stream,
const ACE_Addr &remote_sap,
ACE_ATM_QoS &qos);
/// Resets any event associations on this handle
int reset_new_handle (ACE_HANDLE handle);
// = Meta-type info
typedef ACE_ATM_Addr PEER_ADDR;
typedef ACE_ATM_Stream PEER_STREAM;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
ATM_Connector connector_;
};
// Open versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ATM_Connector.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_CONNECTOR_H */

View File

@@ -1,10 +1,8 @@
// -*- C++ -*-
//
// $Id: ATM_Connector.inl 80826 2008-03-04 14:51:23Z wotte $
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
ACE_ATM_Connector::dump (void) const
{
@@ -12,7 +10,6 @@ ACE_ATM_Connector::dump (void) const
ACE_TRACE ("ACE_ATM_Connector::dump");
#endif /* ACE_HAS_DUMP */
}
ACE_INLINE
ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream,
const ACE_ATM_Addr &remote_sap,
@@ -38,9 +35,7 @@ ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream,
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_ATM_Stream::ACE_ATM_Stream")));
}
// Try to complete a non-blocking connection.
ACE_INLINE
int
ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream,
@@ -59,7 +54,6 @@ ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream,
return 0;
#endif
}
ACE_INLINE
int
ACE_ATM_Connector::add_leaf (ACE_ATM_Stream &current_stream,
@@ -76,33 +70,26 @@ ACE_ATM_Connector::add_leaf (ACE_ATM_Stream &current_stream,
struct sockaddr_atm *saddr = (struct sockaddr_atm *)remote_sap.get_addr();
ACE_QoS cqos = qos.get_qos();
int addr_len = sizeof( struct sockaddr_atm );
ACE_QoS_Params qos_params(0,
0,
&cqos,
0,
(JL_SENDER_ONLY));
ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" );
ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(),
(struct sockaddr *)saddr,
addr_len,
qos_params);
if ( result == ACE_INVALID_HANDLE )
ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n",
::WSAGetLastError());
return (result != ACE_INVALID_HANDLE);
#elif defined (ACE_HAS_LINUX_ATM)
ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux \n");
ACE_UNUSED_ARG(current_stream);
ACE_UNUSED_ARG(remote_sap);
ACE_UNUSED_ARG(leaf_id);
ACE_UNUSED_ARG(timeout);
return 0;
#else
ACE_UNUSED_ARG(current_stream);
@@ -112,7 +99,6 @@ ACE_ATM_Connector::add_leaf (ACE_ATM_Stream &current_stream,
return 0;
#endif
}
ACE_INLINE
int
ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle)
@@ -127,6 +113,5 @@ ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle)
return 0;
#endif /* ACE_WIN32 */
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,21 +1,12 @@
// $Id: ATM_Params.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/ATM_Params.h"
#if defined (ACE_HAS_ATM)
ACE_RCSID(ace, ATM_Params, "$Id: ATM_Params.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Params.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Params)
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_ATM */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//==========================================================================
/**
* @file ATM_Params.h
@@ -10,21 +9,15 @@
*/
//==========================================================================
#ifndef ACE_ATM_PARAMS_H
#define ACE_ATM_PARAMS_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_ATM)
#include /**/ "ace/ACE_export.h"
#if defined (ACE_HAS_FORE_ATM_XTI)
#include "ace/TLI.h"
#define ATM_PROTOCOL_DEFAULT 0
@@ -48,9 +41,7 @@ typedef int Param_Udata;
typedef int Param_Info;
typedef int Param_Udata;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_ATM_Params
*
@@ -86,129 +77,88 @@ public:
= ACE_FLAG_MULTIPOINT_C_ROOT
| ACE_FLAG_MULTIPOINT_D_ROOT, // connector by default
int reuse_addr = 0);
/// Destructor.
~ACE_ATM_Params ();
/// Get protocol family.
int get_protocol_family (void) const;
/// Set protocol family.
void set_protocol_family (int);
/// Get protocol.
int get_protocol (void) const;
/// Set protocol.
void set_protocol (int);
/// Get type.
int get_type (void) const;
/// Set type.
void set_type (int);
/// Get protocol info.
ACE_Protocol_Info *get_protocol_info( void );
/// Set protocol info.
void set_protocol_info( ACE_Protocol_Info *);
/// Get socket group.
ACE_SOCK_GROUP get_sock_group( void );
/// Set socket group.
void set_sock_group( ACE_SOCK_GROUP );
/// Get socket flags.
u_long get_flags( void );
/// Set socket flags.
void set_flags( u_long );
/// Get reuse_addr flag.
int get_reuse_addr (void) const;
/// Set reuse_addr flag.
void set_reuse_addr (int);
/// Get device.
const char* get_device (void) const;
/// Get info.
Param_Info* get_info (void) const;
/// Set info.
void set_info (Param_Info *);
/// Get r/w flag.
int get_rw_flag (void) const;
/// Set r/w flag.
void set_rw_flag (int);
/// Get user data.
Param_Udata* get_user_data (void) const;
/// Set user data.
void set_user_data (Param_Udata*);
/// Get open flag.
int get_oflag (void) const;
/// Set open flag.
void set_oflag (int);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
/// Protocol family for sockets connections.
int protocol_family_;
/// Protocol for sockets connections.
int protocol_;
/// Type for opening sockets.
int type_;
/// Information about the protocol.
ACE_Protocol_Info *protocol_info_;
/// Socket group used (for sockets only).
ACE_SOCK_GROUP group_;
/// Flags for sockets (for sockets only).
u_long flags_;
/// Flag for reusing address for opening sockets.
int reuse_addr_;
/// Device name for XTI/ATM connections.
const char *device_;
/// Info for XTI/ATM connections.
Param_Info *info_;
/// R/W flag for XTI/ATM connections.
int rw_flag_;
/// User data for XTI/ATM connections.
Param_Udata *udata_;
/// Open flag for XTI/ATM connections.
int oflag_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ATM_Params.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_PARAMS_H */

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: ATM_Params.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
ACE_ATM_Params::dump (void) const
{
@@ -11,7 +9,6 @@ ACE_ATM_Params::dump (void) const
ACE_TRACE ("ACE_ATM_Params::dump");
#endif /* ACE_HAS_DUMP */
}
ACE_INLINE
ACE_ATM_Params::ACE_ATM_Params (int rw_flag,
const char device[],
@@ -40,14 +37,12 @@ ACE_ATM_Params::ACE_ATM_Params (int rw_flag,
{
ACE_TRACE ("ACE_ATM_Params::ACE_ATM_Params");
}
// Default dtor.
ACE_INLINE
ACE_ATM_Params::~ACE_ATM_Params (void)
{
ACE_TRACE ("ACE_ATM_Params::~ACE_ATM_Params");
}
ACE_INLINE
int
ACE_ATM_Params::get_protocol_family (void) const
@@ -55,7 +50,6 @@ ACE_ATM_Params::get_protocol_family (void) const
ACE_TRACE ("ACE_ATM_Params::get_protocol_family");
return protocol_family_;
}
ACE_INLINE
void
ACE_ATM_Params::set_protocol_family (int family)
@@ -63,7 +57,6 @@ ACE_ATM_Params::set_protocol_family (int family)
ACE_TRACE ("ACE_ATM_Params::set_protocol_family");
protocol_family_ = family;
}
ACE_INLINE
int
ACE_ATM_Params::get_protocol (void) const
@@ -71,7 +64,6 @@ ACE_ATM_Params::get_protocol (void) const
ACE_TRACE ("ACE_ATM_Params::get_protocol");
return protocol_;
}
ACE_INLINE
void
ACE_ATM_Params::set_protocol (int protocol)
@@ -79,7 +71,6 @@ ACE_ATM_Params::set_protocol (int protocol)
ACE_TRACE ("ACE_ATM_Params::set_protocol");
protocol_ = protocol;
}
ACE_INLINE
int
ACE_ATM_Params::get_type (void) const
@@ -87,7 +78,6 @@ ACE_ATM_Params::get_type (void) const
ACE_TRACE ("ACE_ATM_Params::get_type");
return type_;
}
ACE_INLINE
void
ACE_ATM_Params::set_type (int type)
@@ -95,7 +85,6 @@ ACE_ATM_Params::set_type (int type)
ACE_TRACE ("ACE_ATM_Params::set_type");
type_ = type;
}
ACE_INLINE
ACE_Protocol_Info*
ACE_ATM_Params::get_protocol_info( void )
@@ -103,7 +92,6 @@ ACE_ATM_Params::get_protocol_info( void )
ACE_TRACE ("ACE_ATM_Params::get_protocol_info");
return protocol_info_;
}
ACE_INLINE
void
ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info )
@@ -111,7 +99,6 @@ ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info )
ACE_TRACE ("ACE_ATM_Params::set_protocol_info");
protocol_info_ = protocol_info;
}
ACE_INLINE
ACE_SOCK_GROUP
ACE_ATM_Params::get_sock_group( void )
@@ -119,7 +106,6 @@ ACE_ATM_Params::get_sock_group( void )
ACE_TRACE ("ACE_ATM_Params::get_sock_group");
return group_;
}
ACE_INLINE
void
ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g )
@@ -127,7 +113,6 @@ ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g )
ACE_TRACE ("ACE_ATM_Params::set_sock_group");
group_ = g;
}
ACE_INLINE
u_long
ACE_ATM_Params::get_flags( void )
@@ -135,7 +120,6 @@ ACE_ATM_Params::get_flags( void )
ACE_TRACE ("ACE_ATM_Params::get_flags");
return flags_;
}
ACE_INLINE
void
ACE_ATM_Params::set_flags( u_long flags)
@@ -143,7 +127,6 @@ ACE_ATM_Params::set_flags( u_long flags)
ACE_TRACE ("ACE_ATM_Params::set_flags");
flags_ = flags;
}
ACE_INLINE
int
ACE_ATM_Params::get_reuse_addr (void) const
@@ -151,7 +134,6 @@ ACE_ATM_Params::get_reuse_addr (void) const
ACE_TRACE ("ACE_ATM_Params::get_reuse_addr");
return reuse_addr_;
}
ACE_INLINE
void
ACE_ATM_Params::set_reuse_addr (int reuse_addr)
@@ -159,7 +141,6 @@ ACE_ATM_Params::set_reuse_addr (int reuse_addr)
ACE_TRACE ("ACE_ATM_Params::set_reuse_addr");
reuse_addr_ = reuse_addr;
}
ACE_INLINE
const char*
ACE_ATM_Params::get_device (void) const
@@ -167,7 +148,6 @@ ACE_ATM_Params::get_device (void) const
ACE_TRACE ("ACE_ATM_Params::get_device");
return device_;
}
ACE_INLINE
Param_Info*
ACE_ATM_Params::get_info (void) const
@@ -175,7 +155,6 @@ ACE_ATM_Params::get_info (void) const
ACE_TRACE ("ACE_ATM_Params::get_info");
return info_;
}
ACE_INLINE
void
ACE_ATM_Params::set_info (Param_Info* info)
@@ -183,7 +162,6 @@ ACE_ATM_Params::set_info (Param_Info* info)
ACE_TRACE ("ACE_ATM_Params::set_info");
info_ = info;
}
ACE_INLINE
int
ACE_ATM_Params::get_rw_flag (void) const
@@ -191,7 +169,6 @@ ACE_ATM_Params::get_rw_flag (void) const
ACE_TRACE ("ACE_ATM_Params::get_rw_flag");
return rw_flag_;
}
ACE_INLINE
void
ACE_ATM_Params::set_rw_flag (int rw_flag)
@@ -199,7 +176,6 @@ ACE_ATM_Params::set_rw_flag (int rw_flag)
ACE_TRACE ("ACE_ATM_Params::set_rw_flag");
rw_flag_ = rw_flag;
}
ACE_INLINE
Param_Udata*
ACE_ATM_Params::get_user_data (void) const
@@ -207,7 +183,6 @@ ACE_ATM_Params::get_user_data (void) const
ACE_TRACE ("ACE_ATM_Params::get_user_data");
return udata_;
}
ACE_INLINE
void
ACE_ATM_Params::set_user_data (Param_Udata *udata)
@@ -215,7 +190,6 @@ ACE_ATM_Params::set_user_data (Param_Udata *udata)
ACE_TRACE ("ACE_ATM_Params::set_user_data");
udata_ = udata;
}
ACE_INLINE
int
ACE_ATM_Params::get_oflag (void) const
@@ -223,7 +197,6 @@ ACE_ATM_Params::get_oflag (void) const
ACE_TRACE ("ACE_ATM_Params::get_oflag");
return oflag_;
}
ACE_INLINE
void
ACE_ATM_Params::set_oflag (int oflag)
@@ -231,5 +204,4 @@ ACE_ATM_Params::set_oflag (int oflag)
ACE_TRACE ("ACE_ATM_Params::set_oflag");
oflag_ = oflag;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,17 +1,11 @@
// $Id: ATM_QoS.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/ATM_QoS.h"
ACE_RCSID(ace, ATM_QoS, "$Id: ATM_QoS.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if defined (ACE_HAS_ATM)
#if !defined (__ACE_INLINE__)
#include "ace/ATM_QoS.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
#define BHLI_MAGIC "FORE_ATM"
// This is line rate in cells/s for an OC-3 MM interface.
@@ -36,9 +30,7 @@ const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0;
const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x0;
const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
ACE_ALLOC_HOOK_DEFINE(ACE_ATM_QoS)
ACE_ATM_QoS::ACE_ATM_QoS (int pktSize)
{
ACE_TRACE ("ACE_ATM_QoS::ACE_ATM_QoS");
@@ -53,7 +45,6 @@ ACE_ATM_QoS::ACE_ATM_QoS (int pktSize)
ACE_UNUSED_ARG (pktSize);
#endif /* ACE_HAS_LINUX_ATM */
}
ACE_ATM_QoS::ACE_ATM_QoS(int rate,
int pktSize)
{
@@ -65,7 +56,6 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
ATM_QOS_CLASS_IE ie_qos;
Q2931_IE *ie_ptr;
int size;
// Setting up cbr parameters ...
ie_aalparams.AALType = AALTYPE_5;
ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize
@@ -74,9 +64,7 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
= pktSize; // was 1516;
ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE;
ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL;
size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE);
ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
ie_td.Forward.PeakCellRate_CLP01 = rate;
ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
@@ -84,7 +72,6 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
ie_td.Forward.Tagging = SAP_FIELD_ABSENT;
ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
ie_td.Backward.PeakCellRate_CLP01 = rate;
ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
@@ -92,29 +79,22 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
ie_td.Backward.Tagging = SAP_FIELD_ABSENT;
ie_td.BestEffort = 0; // Note: this must be set to zero for CBR.
size += sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
ie_bbc.BearerClass = BCOB_X;
ie_bbc.TrafficType = TT_CBR;
ie_bbc.TimingRequirements = TR_END_TO_END;
ie_bbc.ClippingSusceptability = CLIP_NOT;
ie_bbc.UserPlaneConnectionConfig = UP_P2P;
size += sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE );
ie_qos.QOSClassForward = QOS_CLASS1;
ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used
// since we do only simplex data xfer.
size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE);
qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size);
if (qos_.ProviderSpecific.buf == 0) {
ACE_ERROR((LM_ERROR,
@@ -124,21 +104,18 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
}
qos_.ProviderSpecific.len = size;
ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size);
ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf;
ie_ptr->IEType = IE_AALParameters;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( AAL_PARAMETERS_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE));
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_TrafficDescriptor;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE));
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_BroadbandBearerCapability;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE )
@@ -147,14 +124,12 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
ACE_OS::memcpy(ie_ptr->IE,
&ie_bbc,
sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE));
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_QOSClass;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE )
+ sizeof( ULONG )
+ sizeof( ATM_QOS_CLASS_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE));
// qos_.SendingFlowspec.TokenRate = 0xffffffff;
// qos_.SendingFlowspec.TokenBucketSize = 0xffffffff;
// qos_.SendingFlowspec.PeakBandwidth = 0xffffffff;
@@ -164,7 +139,6 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
// This will most probably be ignored by the service provider.
// qos_.SendingFlowspec.MaxSduSize = 0xffffffff;
// qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff;
// qos_.ReceivingFlowspec.TokenRate = 0xffffffff;
// qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff;
// qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff;
@@ -174,7 +148,6 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
// This will most probably be ignored by the service provider.
// qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff;
// qos_.ReceivingFlowspec.MinimumPolicedSize = 0;
ACE_Flow_Spec send_fspec( 0xffffffff,
0xffffffff,
0xffffffff,
@@ -197,7 +170,6 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
0,
15,
ACE_DEFAULT_THREAD_PRIORITY );
qos_.sending_flowspec (send_fspec);
qos_.receiving_flowspec (recv_fspec);
#elif defined (ACE_HAS_FORE_ATM_XTI)
@@ -209,7 +181,6 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
sizeof(qos_));
qos_.aal = ATM_PROTOCOL_DEFAULT;
qos_.rxtp.max_sdu = pktSize;
if (rate > 0) {
qos_.rxtp.pcr = rate;
qos_.rxtp.traffic_class = ATM_CBR;
@@ -220,13 +191,11 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate,
qos_.rxtp.traffic_class = ATM_UBR;
qos_.txtp.traffic_class = ATM_UBR;
}
qos_.txtp.max_sdu = pktSize;
#else
ACE_UNUSED_ARG (rate);
#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */
}
void
ACE_ATM_QoS::set_cbr_rate (int rate,
int pktSize)
@@ -241,9 +210,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
Q2931_IE *ie_ptr;
int size;
*/
ACE_OS::printf( "ATM_QoS(set_cbr_rate): set rate to %d c/s\n", rate );
// Setting up cbr parameters ...
/*
FORE has changed this - we no longer specify QoS this way
@@ -254,9 +221,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
= pktSize; // was 1516;
ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE;
ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL;
size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE);
ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
ie_td.Forward.PeakCellRate_CLP01 = rate;
ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
@@ -264,7 +229,6 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
ie_td.Forward.Tagging = SAP_FIELD_ABSENT;
ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
ie_td.Backward.PeakCellRate_CLP01 = rate;
ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
@@ -272,29 +236,22 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
ie_td.Backward.Tagging = SAP_FIELD_ABSENT;
ie_td.BestEffort = 0; // Note: this must be set to zero for CBR.
size += sizeof( Q2931_IE_TYPE ) +
sizeof( ULONG ) +
sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
ie_bbc.BearerClass = BCOB_X;
ie_bbc.TrafficType = TT_CBR;
ie_bbc.TimingRequirements = TR_END_TO_END;
ie_bbc.ClippingSusceptability = CLIP_NOT;
ie_bbc.UserPlaneConnectionConfig = UP_P2P;
size += sizeof(Q2931_IE_TYPE) +
sizeof(ULONG) +
sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE);
ie_qos.QOSClassForward = QOS_CLASS1;
ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used
// since we only simplex data xfer.
size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE);
qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size);
if (qos_.ProviderSpecific.buf == 0) {
ACE_ERROR((LM_ERROR,
@@ -304,21 +261,18 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
}
qos_.ProviderSpecific.len = size;
ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size);
ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf;
ie_ptr->IEType = IE_AALParameters;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
sizeof( ULONG ) +
sizeof( AAL_PARAMETERS_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE));
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_TrafficDescriptor;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
sizeof( ULONG ) +
sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE));
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_BroadbandBearerCapability;
ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
@@ -327,14 +281,12 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ACE_OS::memcpy( ie_ptr->IE,
&ie_bbc,
sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ));
ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
ie_ptr->IEType = IE_QOSClass;
ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) +
sizeof(ATM_QOS_CLASS_IE);
ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE));
*/
const int BYTES_PER_ATM_CELL = 53;
ACE_OS::memset(&qos_, 0, sizeof(ATM_QoS));
// Setting the token rate sets the minimum rate. 3 Mbits/sec seems too high.
@@ -354,7 +306,6 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
qos_.ProviderSpecific.buf=0;
qos_.ProviderSpecific.len=0;
// unidirectional P2MP; we don't need to setup the Receiving flowspec
//qos_.SendingFlowspec.TokenRate = 0xffffffff;
//qos_.SendingFlowspec.TokenBucketSize = 0xffffffff;
//qos_.SendingFlowspec.PeakBandwidth = 0xffffffff;
@@ -364,7 +315,6 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
// This will most probably be ignored by the service provider.
//qos_.SendingFlowspec.MaxSduSize = 0xffffffff;
//qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff;
//qos_.ReceivingFlowspec.TokenRate = 0xffffffff;
//qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff;
//qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff;
@@ -374,7 +324,6 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
// This will most probably be ignored by the service provider.
//qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff;
//qos_.ReceivingFlowspec.MinimumPolicedSize = 0;
/*
ACE_Flow_Spec send_fspec( 0xffffffff,
0xffffffff,
@@ -398,7 +347,6 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
0,
15,
ACE_DEFAULT_THREAD_PRIORITY );
qos_.sending_flowspec( send_fspec );
qos_.receiving_flowspec( recv_fspec );
*/
@@ -407,7 +355,6 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ACE_UNUSED_ARG (pktSize);
#elif defined (ACE_HAS_LINUX_ATM)
ACE_UNUSED_ARG (pktSize);
qos_.rxtp.traffic_class = ATM_CBR;
qos_.rxtp.pcr = rate;
qos_.txtp.traffic_class = ATM_CBR;
@@ -416,7 +363,6 @@ ACE_ATM_QoS::set_cbr_rate (int rate,
ACE_UNUSED_ARG (rate);
#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */
}
void
ACE_ATM_QoS::set_rate (ACE_HANDLE fd,
int rate,
@@ -425,7 +371,6 @@ ACE_ATM_QoS::set_rate (ACE_HANDLE fd,
ACE_TRACE ("ACE_ATM_QoS::set_rate");
#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM)
set_cbr_rate( rate );
ACE_UNUSED_ARG( fd );
ACE_UNUSED_ARG( flags );
#elif defined (ACE_HAS_FORE_ATM_XTI)
@@ -439,7 +384,6 @@ ACE_ATM_QoS::set_rate (ACE_HANDLE fd,
ACE_UNUSED_ARG (rate);
#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM || ACE_HAS_FORE_ATM_XTI */
}
char*
ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
int rate,
@@ -457,46 +401,35 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
char *buf;
int qos_cells;
struct t_info info;
if (ACE_OS::t_getinfo (fd, &info) == -1)
{
ACE_OS::t_error ("t_getinfo");
return 0;
}
buf = (char *) ACE_OS::malloc (info.options);
if (buf == 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("Unable to allocate %d bytes for options\n"),
info.options),
0);
popt = (struct t_opthdr *) buf;
if (flags & OPT_FLAGS_CPID)
{
// This constructs the T_ATM_ORIG_ADDR option, which is used to
// signal the UNI 3.1 Calling Party ID Information Element.
t_atm_addr *source_addr;
popt->len = sizeof (struct t_opthdr) + sizeof (t_atm_addr);
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_ORIG_ADDR;
popt->status = 0;
source_addr =
(t_atm_addr *)((char *) popt + sizeof (struct t_opthdr));
source_addr->address_format = T_ATM_ENDSYS_ADDR;
source_addr->address_length = ATMNSAP_ADDR_LEN;
ATMSAPAddress local_addr;
struct t_bind boundaddr;
boundaddr.addr.maxlen = sizeof(local_addr);
boundaddr.addr.buf = (char *) &local_addr;
//if (ACE_OS::t_getprotaddr(fd, &boundaddr, 0) < 0) {
if (ACE_OS::t_getname(fd,
&boundaddr.addr,
@@ -508,39 +441,30 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
ACE_OS::free (buf);
return 0;
}
ACE_OS::memcpy(source_addr->address,
local_addr.sap.t_atm_sap_addr.address,
ATMNSAP_ADDR_LEN);
popt = T_OPT_NEXTHDR (buf, info.options , popt);
}
// This constructs all options necessary (bearer cap., QoS, and
// Traffic Descriptor) to signal for a CBR connection with the
// specified QoS in kbit/sec., and/or specify a PMP connection.
// For FORE 200e cards, the adapter shapes traffic to CBR with rate
// equal to PCR CLP=0+1 (traffic.forward.PCR_all_traffic)
qos_cells = (rate * 1000) / (48*8);
if ((qos_cells > 0 && qos_cells < LINE_RATE)
|| (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)))
{
struct t_atm_bearer *bearer;
struct t_atm_traffic *traffic;
// T_ATM_BEARER_CAP: Broadband bearer capability
popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_bearer);
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_BEARER_CAP;
popt->status = 0;
bearer = (struct t_atm_bearer *)((char *) popt +
sizeof (struct t_opthdr));
bearer->bearer_class = T_ATM_CLASS_X;
if (qos_cells)
{
bearer->traffic_type = T_ATM_CBR;
@@ -552,23 +476,18 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
bearer->timing_requirements = 0;
}
bearer->clipping_susceptibility = T_ATM_NULL;
if (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP))
bearer->connection_configuration = T_ATM_1_TO_MANY;
else
bearer->connection_configuration = T_ATM_1_TO_1;
popt = T_OPT_NEXTHDR (buf, info.options, popt);
// T_ATM_TRAFFIC: traffic descriptor
popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_traffic);
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_TRAFFIC;
popt->status = 0;
traffic = (struct t_atm_traffic *)((char *) popt +
sizeof (struct t_opthdr));
traffic->forward.PCR_high_priority = T_ATM_ABSENT;
traffic->forward.PCR_all_traffic = qos_cells ? qos_cells : LINE_RATE;
traffic->forward.SCR_high_priority = T_ATM_ABSENT;
@@ -576,7 +495,6 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
traffic->forward.MBS_high_priority = T_ATM_ABSENT;
traffic->forward.MBS_all_traffic = T_ATM_ABSENT;
traffic->forward.tagging = T_NO;
traffic->backward.PCR_high_priority = T_ATM_ABSENT;
traffic->backward.PCR_all_traffic =
(ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP))
@@ -586,35 +504,27 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
traffic->backward.MBS_high_priority = T_ATM_ABSENT;
traffic->backward.MBS_all_traffic = T_ATM_ABSENT;
traffic->backward.tagging = T_NO;
traffic->best_effort = qos_cells ? T_NO : T_YES;
popt = T_OPT_NEXTHDR (buf,
info.options,
popt);
}
if (qos_cells > 0 && qos_cells < LINE_RATE)
{
struct t_atm_qos *qos;
// T_ATM_QOS: Quality of Service
popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_qos);
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_QOS;
popt->status = 0;
qos = (struct t_atm_qos *)((char *) popt + sizeof (struct t_opthdr));
qos->coding_standard = T_ATM_ITU_CODING;
qos->forward.qos_class = T_ATM_QOS_CLASS_1;
qos->backward.qos_class = T_ATM_QOS_CLASS_1;
popt = T_OPT_NEXTHDR (buf, info.options, popt);
}
// Return actual size of options and option buffer to user.
*len = (char *) popt - buf;
return buf;
#else
ACE_UNUSED_ARG (fd);
@@ -624,9 +534,6 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd,
return (0);
#endif /* ACE_HAS_FORE_ATM_WS2 */
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_ATM */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//==========================================================================
/**
* @file ATM_QoS.h
@@ -10,19 +9,14 @@
*/
//==========================================================================
#ifndef ACE_ATM_QoS_H
#define ACE_ATM_QoS_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined(ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_ATM)
#if defined (ACE_HAS_FORE_ATM_WS2)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// just map to WS2 GQOS struct
@@ -43,9 +37,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef int ATM_QoS;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_ATM_QoS
*
@@ -64,52 +56,39 @@ public:
static const int OPT_FLAGS_PMP;
static const int DEFAULT_SELECTOR;
static const int DEFAULT_PKT_SIZE;
// = Initializattion and termination methods.
/// Default constructor.
ACE_ATM_QoS(int = DEFAULT_PKT_SIZE);
/// Constructor with a CBR rate.
ACE_ATM_QoS(int,
int = DEFAULT_PKT_SIZE);
~ACE_ATM_QoS ();
/// Set the rate.
void set_rate (ACE_HANDLE,
int,
int);
/// Set CBR rate in cells per second.
void set_cbr_rate (int,
int = DEFAULT_PKT_SIZE);
/// Get ATM_QoS struct.
ATM_QoS get_qos (void);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
/// Construct QoS options.
char* construct_options(ACE_HANDLE,
int,
int,
long*);
private:
ATM_QoS qos_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ATM_QoS.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_QoS_H */

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: ATM_QoS.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
ACE_ATM_QoS::dump (void) const
{
@@ -11,13 +9,11 @@ ACE_ATM_QoS::dump (void) const
ACE_TRACE ("ACE_ATM_QoS::dump");
#endif /* ACE_HAS_DUMP */
}
ACE_INLINE
ACE_ATM_QoS::~ACE_ATM_QoS ()
{
ACE_TRACE ("ACE_ATM_QoS::~ACE_ATM_QoS");
}
ACE_INLINE
ATM_QoS
ACE_ATM_QoS::get_qos (void)
@@ -25,5 +21,4 @@ ACE_ATM_QoS::get_qos (void)
ACE_TRACE ("ACE_ATM_QoS::get_qos");
return qos_;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,19 +1,12 @@
// $Id: ATM_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/ATM_Stream.h"
ACE_RCSID (ace, ATM_Stream, "$Id: ATM_Stream.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if defined (ACE_HAS_ATM)
#if !defined (__ACE_INLINE__)
#include "ace/ATM_Stream.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_ALLOC_HOOK_DEFINE (ACE_ATM_Stream)
char*
ACE_ATM_Stream::get_peer_name (void) const
{
@@ -31,7 +24,6 @@ ACE_ATM_Stream::get_peer_name (void) const
// ::t_getprotaddr (get_handle (),
// localaddr,
// peeraddr);
// char* connected_name = (char*) ACE_OS::malloc (peeraddr->addr.len + 1);
// ACE_OS::strcpy (connected_name,
// peeraddr->addr.buf);
@@ -40,10 +32,8 @@ ACE_ATM_Stream::get_peer_name (void) const
// ACE_OS::t_free ((char *) peeraddr,
// T_BIND);
// return (connected_name);
#error "This doesn't seem to work. May need to jimmy-rig something with the"
#error "/etc/xti_hosts file - Ugh!"
ACE_ATM_Addr sa;
struct netbuf name;
name.maxlen = sa.get_size ();
@@ -53,19 +43,16 @@ ACE_ATM_Stream::get_peer_name (void) const
// TI_GETPEERNAME,
// &name);
return (name.buf);
#elif defined (ACE_HAS_FORE_ATM_WS2)
// Use getpeername for WinSock2.
struct sockaddr_atm name;
ACE_OS::memset (&name, 0, sizeof (name));
int nameSize = sizeof (name);
if (ACE_OS::getpeername (this->get_handle (),
(struct sockaddr *) &name,
&nameSize) != 0) {
return 0;
}
char buffer[256];
for (unsigned int index = 0; index < ATM_ADDR_SIZE - 1; index++) {
buffer[ index * 3 ] = '\0';
@@ -76,10 +63,8 @@ ACE_ATM_Stream::get_peer_name (void) const
buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0';
for (index = 0; index < ACE_OS::strlen (buffer); ++index)
buffer[index] = ACE_OS::ace_tolower (buffer[index]);
ifstream atm_hosts ("C:/WINNT/atmhosts");
assert (atm_hosts.is_open ());
// Find the host address in the ATM hosts file and return the
// host name
char line[256];
@@ -100,19 +85,16 @@ ACE_ATM_Stream::get_peer_name (void) const
break;
}
}
return host_name;
#elif defined (ACE_HAS_LINUX_ATM)
ATM_Addr name;
int nameSize = sizeof (name.sockaddratmsvc);
if (ACE_OS::getpeername (this->get_handle (),
(struct sockaddr *) & (name.sockaddratmsvc),
&nameSize) < 0) {
ACE_OS::perror ("ACE_ATM_Stream (get_peer_name) : ");
return 0;
}
static ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1];
int total_len;
if ((total_len = atm2text (buffer,sizeof buffer,
@@ -121,13 +103,11 @@ ACE_ATM_Stream::get_peer_name (void) const
ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("ACE_ATM_Stream (get_peer_name) :%d"),errno));
return 0;
}
return (char*) buffer;
#else
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
ACE_HANDLE
ACE_ATM_Stream::get_handle (void) const
{
@@ -138,7 +118,6 @@ ACE_ATM_Stream::get_handle (void) const
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
int
ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
ACE_UINT16 &vci) const
@@ -150,14 +129,12 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
int opt_size = sizeof (t_atm_conn_prop);
struct t_info info;
struct t_optmgmt opt_req, opt_ret;
if (ACE_OS::t_getinfo (stream_.get_handle (),
&info) < 0)
{
ACE_OS::t_error ("t_getinfo");
return -1;
}
char *buf_req = (char *) ACE_OS::malloc (info.options);
if (buf_req == 0)
{
@@ -166,7 +143,6 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
info.options);
return -1;
}
char *buf_ret = (char *) ACE_OS::malloc (info.options);
if (buf_ret == 0)
{
@@ -175,52 +151,41 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
info.options);
return -1;
}
ACE_OS::memset (&opt_req, 0, sizeof (opt_req));
ACE_OS::memset (&opt_ret, 0, sizeof (opt_ret));
struct t_opthdr *popt = (struct t_opthdr *) buf_req;
struct t_opthdr *popt_ret = (struct t_opthdr *) buf_ret;
popt->len= sizeof (struct t_opthdr) + opt_size;
// We are only concerned with SVCs so no other check or values are needed
// here.
popt->level = T_ATM_SIGNALING;
popt->name = T_ATM_CONN_PROP;
popt->status = 0;
opt_req.opt.len = popt->len;
opt_req.opt.buf = (char *) popt;
opt_req.flags = T_CURRENT;
popt = T_OPT_NEXTHDR (buf_req,
info.options,
popt);
opt_ret.opt.maxlen = info.options;
opt_ret.opt.buf = (char *) popt_ret;
if (ACE_OS::t_optmgmt (stream_.get_handle (),
&opt_req,
&opt_ret) < 0) {
ACE_OS::t_error ("t_optmgmt");
return -1;
}
ACE_OS::memcpy (connect_opts,
(char *) popt_ret + sizeof (struct t_opthdr),
opt_size);
ACE_OS::free (buf_ret);
ACE_OS::free (buf_req);
vpi = conn_prop.vpi;
vci = conn_prop.vci;
return (0);
#elif defined (ACE_HAS_FORE_ATM_WS2)
ATM_CONNECTION_ID connID;
DWORD bytes = 0;
if (::WSAIoctl ((int) this -> get_handle (),
SIO_GET_ATM_CONNECTION_ID,
0,
@@ -233,10 +198,8 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
== SOCKET_ERROR) {
ACE_OS::printf ("Error: WSAIoctl %d\n", WSAGetLastError ());
}
vpi = (ACE_UINT16) connID.VPI;
vci = (ACE_UINT16) connID.VCI;
return 0;
#elif defined (ACE_HAS_LINUX_ATM)
#if defined (SO_ATMPVC) /* atm version>=0.62 */
@@ -254,7 +217,6 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
}
vpi = (ACE_UINT16) mypvcaddr.sap_addr.vpi;
vci = (ACE_UINT16) mypvcaddr.sap_addr.vci;
return 0;
#elif defined (SO_VCID) /* patch for atm version 0.59 */
struct atm_vcid mypvcid;
@@ -270,22 +232,18 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi,
}
vpi = (ACE_UINT16) mypvcid.vpi;
vci = (ACE_UINT16) mypvcid.vci;
return 0;
#else
ACE_DEBUG (LM_DEBUG,
ACE_TEXT ("ACE_ATM_Stream::get_vpi_vci: Not implemented in this ATM version. Update to >= 0.62\n Or patch 0.59"));
ACE_UNUSED_ARG (vci);
ACE_UNUSED_ARG (vpi);
return (-1);
#endif /* SO_ATMPVC || SO_VCID */
#else
return (-1);
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_ATM */

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file ATM_Stream.h
@@ -10,22 +9,16 @@
*/
//=============================================================================
#ifndef ACE_ATM_STREAM_H
#define ACE_ATM_STREAM_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_ATM)
#include "ace/ATM_Addr.h"
#include "ace/ATM_Params.h"
#if defined (ACE_WIN32)
#include "ace/SOCK_Stream.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -37,9 +30,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef ACE_TLI_Stream ATM_Stream;
ACE_END_VERSIONED_NAMESPACE_DECL
#endif
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_ATM_Stream
*
@@ -51,57 +42,42 @@ public:
// = Initialization and termination methods.
/// Default constructor.
ACE_ATM_Stream (void);
// = ATM-specific open and shutdown operations.
/// open the stream.
int open (ACE_ATM_Params params = ACE_ATM_Params());
/// Close down and release resources.
int close (void);
/// Get the underlying handle.
ACE_HANDLE get_handle (void) const;
/// Get the underlying stream.
ATM_Stream& get_stream (void);
/// Get the name of the connected host.
char* get_peer_name (void) const;
/// Get the VPI and VCI of the stream.
int get_vpi_vci (ACE_UINT16 &vpi,
ACE_UINT16 &vci) const;
/// Recv an n byte buffer from the connected transport mechanism.
ssize_t recv (void *buf,
size_t n,
int *flags = 0) const;
/// Send exactly n bytes to the connected transport mechanism.
ssize_t send_n (const void *buf,
size_t n,
int flags) const;
// = Meta-type info
typedef ACE_ATM_Addr PEER_ADDR;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
/// Typedef'd to the appropriate stream mechanism above.
ATM_Stream stream_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ATM_Stream.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_ATM */
#include /**/ "ace/post.h"
#endif /* ACE_ATM_STREAM_H */

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: ATM_Stream.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
ACE_ATM_Stream::dump (void) const
{
@@ -11,13 +9,11 @@ ACE_ATM_Stream::dump (void) const
ACE_TRACE ("ACE_ATM_Stream::dump");
#endif /* ACE_HAS_DUMP */
}
ACE_INLINE
ACE_ATM_Stream::ACE_ATM_Stream (void)
{
ACE_TRACE ("ACE_ATM_Stream::ACE_ATM_Stream");
}
ACE_INLINE
int
ACE_ATM_Stream::open (ACE_ATM_Params params)
@@ -30,7 +26,6 @@ ACE_ATM_Stream::open (ACE_ATM_Params params)
return (handle == ACE_INVALID_HANDLE ? -1 : 0);
#elif defined (ACE_HAS_FORE_ATM_WS2)
params.set_flags( ACE_FLAG_MULTIPOINT_C_ROOT | ACE_FLAG_MULTIPOINT_D_ROOT );
int retval = stream_.open (params.get_type(),
params.get_protocol_family(),
params.get_protocol(),
@@ -40,9 +35,7 @@ ACE_ATM_Stream::open (ACE_ATM_Params params)
params.get_reuse_addr());
if (retval == -1)
return -1;
struct sockaddr_atm sock_addr;
ACE_OS::memset(&sock_addr, 0, sizeof(struct sockaddr_atm));
sock_addr.satm_family = AF_ATM;
sock_addr.satm_number.AddressType=ADDR_ANY;
@@ -57,14 +50,12 @@ ACE_ATM_Stream::open (ACE_ATM_Params params)
ACE_OS::printf("Error binding local address: %d",WSAGetLastError());
return -1;
}
return 0;
#else
ACE_UNUSED_ARG(params);
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI */
}
ACE_INLINE
int
ACE_ATM_Stream::close (void)
@@ -76,7 +67,6 @@ ACE_ATM_Stream::close (void)
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
}
ACE_INLINE
ATM_Stream&
ACE_ATM_Stream::get_stream (void)
@@ -84,7 +74,6 @@ ACE_ATM_Stream::get_stream (void)
ACE_TRACE ("ACE_ATM_Stream::get_stream");
return stream_;
}
ACE_INLINE
ssize_t
ACE_ATM_Stream::recv (void *buf,
@@ -106,7 +95,6 @@ ACE_ATM_Stream::recv (void *buf,
return (0);
#endif /* ACE_HAS_FORE_ATM_XTI */
}
ACE_INLINE
ssize_t
ACE_ATM_Stream::send_n (const void *buf,
@@ -129,5 +117,4 @@ ACE_ATM_Stream::send_n (const void *buf,
return (0);
#endif /* ACE_HAS_FORE_ATM_XTI */
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Acceptor.h
@@ -9,23 +8,16 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_ACCEPTOR_H
#define ACE_ACCEPTOR_H
#include /**/ "ace/pre.h"
#include "ace/Service_Object.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Strategies_T.h"
#include "ace/Synch_Options.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Acceptor
*
@@ -53,17 +45,14 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
class ACE_Acceptor : public ACE_Service_Object
{
public:
// Useful STL-style traits.
typedef ACE_PEER_ACCEPTOR_ADDR addr_type;
typedef ACE_PEER_ACCEPTOR acceptor_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
/// "Do-nothing" constructor.
ACE_Acceptor (ACE_Reactor * = 0,
int use_select = 1);
/**
* Open the contained @c PEER_ACCEPTOR object to begin listening, and
* register with the specified reactor for accept events. An
@@ -102,7 +91,6 @@ public:
int flags = 0,
int use_select = 1,
int reuse_addr = 1);
/**
* Open the contained @c PEER_ACCEPTOR object to begin listening, and
* register with the specified reactor for accept events. An
@@ -144,37 +132,27 @@ public:
int flags = 0,
int use_select = 1,
int reuse_addr = 1);
/// Close down the Acceptor's resources.
virtual ~ACE_Acceptor (void);
/// Return the underlying PEER_ACCEPTOR object.
virtual operator ACE_PEER_ACCEPTOR &() const;
/// Return the underlying PEER_ACCEPTOR object.
virtual ACE_PEER_ACCEPTOR &acceptor (void) const;
/// Returns the listening acceptor's {ACE_HANDLE}.
virtual ACE_HANDLE get_handle (void) const;
/// Close down the Acceptor
virtual int close (void);
/// In the event that an accept fails, this method will be called and
/// the return value will be returned from handle_input().
virtual int handle_accept_error (void);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
// = The following three methods define the Acceptor's strategies
// for creating, accepting, and activating SVC_HANDLER's,
// respectively.
/**
* Bridge method for creating a SVC_HANDLER. The default is to
* create a new {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged.
@@ -184,14 +162,12 @@ protected:
* linking the handler, etc.). Returns -1 on failure, else 0.
*/
virtual int make_svc_handler (SVC_HANDLER *&sh);
/**
* Bridge method for accepting the new connection into the
* <svc_handler>. The default behavior delegates to the
* PEER_ACCEPTOR::accept.
*/
virtual int accept_svc_handler (SVC_HANDLER *svc_handler);
/**
* Bridge method for activating a {svc_handler} with the appropriate
* concurrency strategy. The default behavior of this method is to
@@ -203,43 +179,33 @@ protected:
* multi-processing).
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
// = Demultiplexing hooks.
/// Perform termination activities when {this} is removed from the
/// {reactor}.
virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
/// Accepts all pending connections from clients, and creates and
/// activates SVC_HANDLERs.
virtual int handle_input (ACE_HANDLE);
// = Dynamic linking hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int init (int argc, ACE_TCHAR *argv[]);
/// Calls {handle_close}.
virtual int fini (void);
/// Default version returns address info in {buf}.
virtual int info (ACE_TCHAR **buf, size_t) const;
public:
// = Service management hooks.
/// This method calls {Reactor::suspend}.
virtual int suspend (void);
/// This method calls {Reactor::resume}.
virtual int resume (void);
protected:
/// Concrete factory for accepting connections from clients...
ACE_PEER_ACCEPTOR peer_acceptor_;
/// Needed to reopen the socket if {accept} fails.
ACE_PEER_ACCEPTOR_ADDR peer_acceptor_addr_;
/**
* Flags that indicate how {SVC_HANDLER}'s should be initialized
* prior to being activated. Right now, the only flag that is
@@ -247,15 +213,12 @@ protected:
* the {SVC_HANDLER} when it is opened.
*/
int flags_;
/// Flag that indicates whether it shall use {select} in the
/// {accept}-loop.
int use_select_;
/// Needed to reopen the socket if {accept} fails.
int reuse_addr_;
};
/**
* @class ACE_Strategy_Acceptor
*
@@ -275,7 +238,6 @@ class ACE_Strategy_Acceptor
: public ACE_Acceptor <SVC_HANDLER, ACE_PEER_ACCEPTOR_2>
{
public:
// Useful STL-style traits.
typedef ACE_Creation_Strategy<SVC_HANDLER>
creation_strategy_type;
@@ -286,21 +248,17 @@ public:
typedef ACE_Scheduling_Strategy<SVC_HANDLER> scheduling_strategy_type;
typedef ACE_Acceptor <SVC_HANDLER, ACE_PEER_ACCEPTOR_2>
base_type;
// = Define some useful (old style) traits.
typedef ACE_Creation_Strategy<SVC_HANDLER> CREATION_STRATEGY;
typedef ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> ACCEPT_STRATEGY;
typedef ACE_Concurrency_Strategy<SVC_HANDLER> CONCURRENCY_STRATEGY;
typedef ACE_Scheduling_Strategy<SVC_HANDLER> SCHEDULING_STRATEGY;
/// Default constructor.
ACE_Strategy_Acceptor (const ACE_TCHAR service_name[] = 0,
const ACE_TCHAR service_description[] = 0,
int use_select = 1,
int reuse_addr = 1);
/**
* Initialize the appropriate strategies for creation, passive
* connection acceptance, and concurrency, and then register {this}
@@ -317,7 +275,6 @@ public:
const ACE_TCHAR service_description[] = 0,
int use_select = 1,
int reuse_addr = 1);
/**
* Open the contained @c PEER_ACCEPTOR object to begin listening, and
* register with the specified reactor for accept events.
@@ -357,7 +314,6 @@ public:
int flags = 0,
int use_select = 1,
int reuse_addr = 1);
/**
* Initialize the appropriate strategies for creation, passive
* connection acceptance, and concurrency, and then register {this}
@@ -374,47 +330,33 @@ public:
const ACE_TCHAR *service_description = 0,
int use_select = 1,
int reuse_addr = 1);
/// Close down the Strategy_Acceptor's resources.
virtual ~ACE_Strategy_Acceptor (void);
/// Return the underlying PEER_ACCEPTOR object.
virtual operator ACE_PEER_ACCEPTOR &() const;
/// Return the underlying PEER_ACCEPTOR object.
virtual ACE_PEER_ACCEPTOR &acceptor (void) const;
/// Returns the listening acceptor's {ACE_HANDLE}.
virtual ACE_HANDLE get_handle (void) const;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
// = Service management hooks.
/// This method delegates to the {Scheduling_Strategy}'s {suspend}
/// method.
virtual int suspend (void);
/// This method delegates to the {Scheduling_Strategy}'s {resume}
/// method.
virtual int resume (void);
protected:
/// Calls {handle_close} when dynamically unlinked.
virtual int fini (void);
/// Default version returns address info in {buf}.
virtual int info (ACE_TCHAR **buf, size_t) const;
// = The following three methods define the {Acceptor}'s strategies
// for creating, accepting, and activating {SVC_HANDLER}'s,
// respectively.
/**
* Bridge method for creating a {SVC_HANDLER}. The strategy for
* creating a {SVC_HANDLER} are configured into the Acceptor via
@@ -426,14 +368,12 @@ protected:
* linking the handler, etc.). Returns -1 on failure, else 0.
*/
virtual int make_svc_handler (SVC_HANDLER *&);
/**
* Bridge method for accepting the new connection into the
* {SVC_HANDLER}. The default behavior delegates to the
* {PEER_ACCEPTOR::accept} in the {Acceptor_Strategy}.
*/
virtual int accept_svc_handler (SVC_HANDLER *svc_handler);
/**
* Bridge method for activating a {SVC_HANDLER} with the appropriate
* concurrency strategy. The default behavior of this method is to
@@ -445,62 +385,45 @@ protected:
* multi-processing).
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
// = Demultiplexing hooks.
/// Perform termination activities when {this} is removed from the
/// {Reactor}.
virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
/// Handle SIGINT.
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
// = These data members are "logically private" but are put in the
// protected part in case subclasses want to access them.
// = Strategy objects.
/// Creation strategy for an Acceptor.
CREATION_STRATEGY *creation_strategy_;
/// true if {Acceptor} created the creation strategy and thus should
/// delete it, else false.
bool delete_creation_strategy_;
/// Accept strategy for an {Acceptor}.
ACCEPT_STRATEGY *accept_strategy_;
/// true if {Acceptor} created the accept strategy and thus should delete
/// it, else false.
bool delete_accept_strategy_;
/// Concurrency strategy for an {Acceptor}.
CONCURRENCY_STRATEGY *concurrency_strategy_;
/// true if {Acceptor} created the concurrency strategy and thus should
/// delete it, else false.
bool delete_concurrency_strategy_;
/// Scheduling strategy for an {Acceptor}.
SCHEDULING_STRATEGY *scheduling_strategy_;
/// true if {Acceptor} created the scheduling strategy and thus should
/// delete it, else false.
bool delete_scheduling_strategy_;
// = Service information objects.
/// Name of the service.
ACE_TCHAR *service_name_;
/// Description of the service.
ACE_TCHAR *service_description_;
/// Address that the {Strategy_Acceptor} uses to listen for
/// connections.
ACE_PEER_ACCEPTOR_ADDR service_addr_;
};
/**
* @class ACE_Oneshot_Acceptor
*
@@ -525,16 +448,13 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
class ACE_Oneshot_Acceptor : public ACE_Service_Object
{
public:
// Useful STL-style traits.
typedef ACE_PEER_ACCEPTOR_ADDR addr_type;
typedef ACE_PEER_ACCEPTOR acceptor_type;
typedef SVC_HANDLER handler_type;
typedef typename SVC_HANDLER::stream_type stream_type;
/// Constructor.
ACE_Oneshot_Acceptor (void);
/**
* Initialize the appropriate strategies for concurrency and then
* open the {peer_acceptor} at the designated {local_addr}. Note
@@ -546,7 +466,6 @@ public:
ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
ACE_Reactor *reactor = ACE_Reactor::instance (),
ACE_Concurrency_Strategy<SVC_HANDLER> * = 0);
/**
* Initialize the appropriate strategies for concurrency and then
* open the {peer_acceptor} at the designated {local_addr}. Note
@@ -558,10 +477,8 @@ public:
int open (const ACE_PEER_ACCEPTOR_ADDR &,
ACE_Reactor *reactor = ACE_Reactor::instance (),
ACE_Concurrency_Strategy<SVC_HANDLER> * = 0);
/// Close down the {Oneshot_Acceptor}.
virtual ~ACE_Oneshot_Acceptor (void);
// = Explicit factory operation.
/// Create a {SVC_HANDLER}, accept the connection into the
/// {SVC_HANDLER}, and activate the {SVC_HANDLER}.
@@ -570,25 +487,18 @@ public:
const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults,
int restart = 1,
int reset_new_handle = 0);
/// Cancel a oneshot acceptor that was started asynchronously.
virtual int cancel (void);
/// Return the underlying {PEER_ACCEPTOR} object.
virtual operator ACE_PEER_ACCEPTOR &() const;
/// Return the underlying {PEER_ACCEPTOR} object.
virtual ACE_PEER_ACCEPTOR &acceptor (void) const;
/// Close down the {Oneshot_Acceptor}.
virtual int close (void);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
/**
* Bridge method for activating a {svc_handler} with the appropriate
@@ -599,7 +509,6 @@ protected:
* object" via multi-threading or multi-processing).
*/
virtual int activate_svc_handler (SVC_HANDLER *svc_handler);
/// Factors out the code shared between the {accept} and
/// {handle_input} methods.
int shared_accept (SVC_HANDLER *svc_handler,
@@ -607,45 +516,35 @@ protected:
ACE_Time_Value *timeout,
int restart,
int reset_new_handle);
// = Demultiplexing hooks.
/// Returns the listening acceptor's {ACE_HANDLE}.
virtual ACE_HANDLE get_handle (void) const;
/// Perform termination activities when {this} is removed from the
/// {reactor}.
virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
/// Accept one connection from a client and activates the
/// SVC_HANDLER.
virtual int handle_input (ACE_HANDLE);
/// Called when an acceptor times out...
virtual int handle_timeout (const ACE_Time_Value &tv,
const void *arg);
// = Dynamic linking hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int init (int argc, ACE_TCHAR *argv[]);
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int fini (void);
/// Default version returns address info in {buf}.
virtual int info (ACE_TCHAR **, size_t) const;
// = Service management hooks.
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int suspend (void);
/// Default version does no work and returns -1. Must be overloaded
/// by application developer to do anything meaningful.
virtual int resume (void);
private:
/**
* Insert ourselves into the {ACE_Reactor} so that we can continue
@@ -655,35 +554,25 @@ private:
int register_handler (SVC_HANDLER *svc_handler,
const ACE_Synch_Options &options,
int restart);
/// Hold the svc_handler_ across asynchrony boundaries.
SVC_HANDLER *svc_handler_;
/// Hold the restart flag across asynchrony boundaries.
int restart_;
/// Factory that establishes connections passively.
ACE_PEER_ACCEPTOR peer_acceptor_;
/// Concurrency strategy for an Acceptor.
ACE_Concurrency_Strategy<SVC_HANDLER> *concurrency_strategy_;
/// true if Acceptor created the concurrency strategy and thus should
/// delete it, else false.
bool delete_concurrency_strategy_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Acceptor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Acceptor.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_ACCEPTOR_H */

View File

@@ -1,20 +1,15 @@
#include "ace/Activation_Queue.h"
#if !defined (__ACE_INLINE__)
#include "ace/Activation_Queue.inl"
#endif /* __ACE_INLINE__ */
#include "ace/Log_Msg.h"
#include "ace/Method_Request.h"
#include "ace/Malloc_Base.h"
#include "ace/Time_Value.h"
ACE_RCSID (ace,
Activation_Queue,
"$Id: Activation_Queue.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
void
ACE_Activation_Queue::dump (void) const
{
@@ -30,11 +25,9 @@ ACE_Activation_Queue::dump (void) const
//FUZZ: disable check_for_NULL
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(NULL)\n")));
//FUZZ: enable check_for_NULL
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue<ACE_SYNCH> *new_queue,
ACE_Allocator *alloc,
ACE_Allocator *db_alloc)
@@ -44,7 +37,6 @@ ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue<ACE_SYNCH> *new_qu
{
if (this->allocator_ == 0)
this->allocator_ = ACE_Allocator::instance ();
if (new_queue)
this->queue_ = new_queue;
else
@@ -54,7 +46,6 @@ ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue<ACE_SYNCH> *new_qu
this->delete_queue_ = true;
}
}
void
ACE_Activation_Queue::queue (ACE_Message_Queue<ACE_SYNCH> *q)
{
@@ -63,7 +54,6 @@ ACE_Activation_Queue::queue (ACE_Message_Queue<ACE_SYNCH> *q)
{
// Destroy the current queue.
delete this->queue_;
// Set the flag to false. NOTE that the delete_queue_ flag is a
// flag used to only indicate whether or not if an internal
// ACE_Message_Queue has been created, therefore, it will not
@@ -72,21 +62,17 @@ ACE_Activation_Queue::queue (ACE_Message_Queue<ACE_SYNCH> *q)
// function.
this->delete_queue_ = false;
}
queue_ = q;
}
ACE_Activation_Queue::~ACE_Activation_Queue (void)
{
if (this->delete_queue_)
delete this->queue_;
}
ACE_Method_Request *
ACE_Activation_Queue::dequeue (ACE_Time_Value *tv)
{
ACE_Message_Block *mb = 0;
// Dequeue the message.
if (this->queue_->dequeue_head (mb, tv) != -1)
{
@@ -100,13 +86,11 @@ ACE_Activation_Queue::dequeue (ACE_Time_Value *tv)
else
return 0;
}
int
ACE_Activation_Queue::enqueue (ACE_Method_Request *mr,
ACE_Time_Value *tv)
{
ACE_Message_Block *mb = 0;
// We pass sizeof (*mr) here so that flow control will work
// correctly. Since we also pass <mr> note that no unnecessary
// memory is actually allocated -- just the size field is set.
@@ -124,16 +108,12 @@ ACE_Activation_Queue::enqueue (ACE_Method_Request *mr,
this->data_block_allocator_, // data_block allocator
this->allocator_), // message_block allocator
-1);
// Enqueue in priority order.
int const result = this->queue_->enqueue_prio (mb, tv);
// Free ACE_Message_Block if enqueue_prio failed.
if (result == -1)
ACE_DES_FREE (mb, this->allocator_->free, ACE_Message_Block);
return result;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Activation_Queue.h
@@ -10,28 +9,19 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_ACTIVATION_QUEUE_H
#define ACE_ACTIVATION_QUEUE_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Message_Queue.h"
#include "ace/Condition_Thread_Mutex.h"
/// Define to be compatible with the terminology in the POSA2 book!
#define ACE_Activation_List ACE_Activation_Queue
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Method_Request;
/**
* @class ACE_Activation_Queue
*
@@ -76,12 +66,9 @@ public:
ACE_Activation_Queue (ACE_Message_Queue<ACE_SYNCH> *new_queue = 0,
ACE_Allocator *alloc = 0,
ACE_Allocator *db_alloc = 0);
/// Destructor.
virtual ~ACE_Activation_Queue (void);
// = Activate Queue operations.
/// Dequeue the next available ACE_Method_Request.
/**
* @param tv If 0, the method will block until a method request is
@@ -95,7 +82,6 @@ public:
* the specified timeout elapses, errno will be @c EWOULDBLOCK.
*/
ACE_Method_Request *dequeue (ACE_Time_Value *tv = 0);
/// Enqueue the ACE_Method_Request in priority order.
/**
* The priority of the method request is obtained via the @c priority()
@@ -117,58 +103,39 @@ public:
* the specified timeout elapses, errno will be @c EWOULDBLOCK.
*/
int enqueue (ACE_Method_Request *new_method_request, ACE_Time_Value *tv = 0);
/// Get the current number of method objects in the queue.
size_t method_count (void) const;
/// Returns 1 if the queue is empty, 0 otherwise.
int is_empty (void) const;
/// Returns 1 if the queue is full, 0 otherwise.
int is_full (void) const;
/// Dump the state of an request.
void dump (void) const;
/// Get a pointer to the underlying queue.
ACE_Message_Queue<ACE_SYNCH> *queue (void) const;
/// Set the pointer to the underlying queue.
void queue (ACE_Message_Queue<ACE_SYNCH> *q);
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
// = Prevent copying and assignment.
ACE_Activation_Queue (const ACE_Activation_Queue &);
void operator= (const ACE_Activation_Queue &);
protected:
/// Stores the Method_Requests.
ACE_Message_Queue<ACE_SYNCH> *queue_;
/// Keeps track of whether we need to delete the queue.
bool delete_queue_;
private:
/// Allocation strategy of the queue.
ACE_Allocator *allocator_;
/// Allocation strategy of the message blocks.
ACE_Allocator *data_block_allocator_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Activation_Queue.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_ACTIVATION_QUEUE_H */

View File

@@ -1,31 +1,25 @@
// -*- C++ -*-
//
// $Id: Activation_Queue.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE size_t
ACE_Activation_Queue::method_count (void) const
{
return queue_->message_count ();
}
ACE_INLINE int
ACE_Activation_Queue::is_full (void) const
{
return queue_->is_full ();
}
ACE_INLINE int
ACE_Activation_Queue::is_empty (void) const
{
return queue_->is_empty ();
}
ACE_INLINE ACE_Message_Queue<ACE_SYNCH> *
ACE_Activation_Queue::queue (void) const
{
return queue_;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,9 +1,6 @@
// $Id: Active_Map_Manager.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Active_Map_Manager.h"
ACE_RCSID(ace, Active_Map_Manager, "$Id: Active_Map_Manager.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if !defined (__ACE_INLINE__)
#include "ace/Active_Map_Manager.inl"
#endif /* __ACE_INLINE__ */

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file Active_Map_Manager.h
@@ -10,21 +9,15 @@
*/
//=============================================================================
#ifndef ACE_ACTIVE_MAP_MANAGER_H
#define ACE_ACTIVE_MAP_MANAGER_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Basic_Types.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Active_Map_Manager_Key
*
@@ -39,7 +32,6 @@ class ACE_Export ACE_Active_Map_Manager_Key
public:
/// Default constructor.
ACE_Active_Map_Manager_Key (void);
/**
* Constructor given the @a slot_index and @a slot_generation number.
* This is useful once the user has somehow recovered the
@@ -47,42 +39,30 @@ public:
*/
ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index,
ACE_UINT32 slot_generation);
/// Get the slot_index.
ACE_UINT32 slot_index (void) const;
/// Set the slot_index.
void slot_index (ACE_UINT32 i);
/// Get the slot_generation number.
ACE_UINT32 slot_generation (void) const;
/// Set the slot_generation number.
void slot_generation (ACE_UINT32 g);
/// Size required to store information about active key.
static size_t size (void);
/// Recover state of active key from @a data. User must make sure
/// that @a data encoded using the encode() method.
void decode (const void *data);
/// Encode state of the active key into @a data. @a data must be as
/// big as the value returned from <size>.
void encode (void *data) const;
/// Compare keys.
bool operator== (const ACE_Active_Map_Manager_Key &rhs) const;
bool operator!= (const ACE_Active_Map_Manager_Key &rhs) const;
// = This really should be protected but because of template
// friends, they are not.
/// Increment the <slot_generation> number.
void increment_slot_generation_count (void);
private:
/**
* @brief Data for the Active Object Map Key.
*
@@ -94,24 +74,18 @@ private:
{
/// Slot index in the active map.
ACE_UINT32 slot_index_;
/// Slot generation number of <slot_index_> slot in the active map.
ACE_UINT32 slot_generation_;
};
/// Data for the Active Object Map Key.
key_data key_data_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Active_Map_Manager.inl"
#endif /* __ACE_INLINE__ */
// Include the templates here.
#include "ace/Active_Map_Manager_T.h"
#include /**/ "ace/post.h"
#endif /* ACE_ACTIVE_MAP_MANAGER_H */

View File

@@ -1,11 +1,8 @@
// -*- C++ -*-
//
// $Id: Active_Map_Manager.inl 80826 2008-03-04 14:51:23Z wotte $
#include "ace/OS_NS_string.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void)
{
@@ -14,7 +11,6 @@ ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void)
this->key_data_.slot_index_ = (ACE_UINT32) ~0;
this->key_data_.slot_generation_ = 0;
}
ACE_INLINE
ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index,
ACE_UINT32 slot_generation)
@@ -22,19 +18,16 @@ ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index,
this->key_data_.slot_index_ = slot_index;
this->key_data_.slot_generation_ = slot_generation;
}
ACE_INLINE ACE_UINT32
ACE_Active_Map_Manager_Key::slot_index (void) const
{
return this->key_data_.slot_index_;
}
ACE_INLINE ACE_UINT32
ACE_Active_Map_Manager_Key::slot_generation (void) const
{
return this->key_data_.slot_generation_;
}
ACE_INLINE bool
ACE_Active_Map_Manager_Key::operator== (const ACE_Active_Map_Manager_Key &rhs) const
{
@@ -42,38 +35,32 @@ ACE_Active_Map_Manager_Key::operator== (const ACE_Active_Map_Manager_Key &rhs) c
this->key_data_.slot_index_ == rhs.key_data_.slot_index_ &&
this->key_data_.slot_generation_ == rhs.key_data_.slot_generation_;
}
ACE_INLINE bool
ACE_Active_Map_Manager_Key::operator!= (const ACE_Active_Map_Manager_Key &rhs) const
{
return !this->operator== (rhs);
}
ACE_INLINE void
ACE_Active_Map_Manager_Key::slot_index (ACE_UINT32 i)
{
this->key_data_.slot_index_ = i;
}
ACE_INLINE void
ACE_Active_Map_Manager_Key::slot_generation (ACE_UINT32 g)
{
this->key_data_.slot_generation_ = g;
}
ACE_INLINE void
ACE_Active_Map_Manager_Key::increment_slot_generation_count (void)
{
++this->key_data_.slot_generation_;
}
/* static */
ACE_INLINE size_t
ACE_Active_Map_Manager_Key::size (void)
{
return sizeof (ACE_UINT32) + sizeof (ACE_UINT32);
}
ACE_INLINE void
ACE_Active_Map_Manager_Key::decode (const void *data)
{
@@ -82,7 +69,6 @@ ACE_Active_Map_Manager_Key::decode (const void *data)
data,
sizeof this->key_data_);
}
ACE_INLINE void
ACE_Active_Map_Manager_Key::encode (void *data) const
{
@@ -91,5 +77,4 @@ ACE_Active_Map_Manager_Key::encode (void *data) const
&this->key_data_,
sizeof this->key_data_);
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file Active_Map_Manager_T.h
@@ -10,22 +9,16 @@
*/
//=============================================================================
#ifndef ACE_ACTIVE_MAP_MANAGER_T_H
#define ACE_ACTIVE_MAP_MANAGER_T_H
#include /**/ "ace/pre.h"
#include "ace/Map_Manager.h"
#include "ace/Active_Map_Manager.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Null_Mutex.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Active_Map_Manager
*
@@ -39,48 +32,37 @@ template <class T>
class ACE_Active_Map_Manager : public ACE_Map_Manager<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
{
public:
// = Traits.
typedef ACE_Active_Map_Manager_Key key_type;
typedef T mapped_type;
typedef ACE_Map_Entry<ACE_Active_Map_Manager_Key, T> ENTRY;
typedef ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> ITERATOR;
typedef ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> REVERSE_ITERATOR;
typedef ENTRY entry;
typedef ITERATOR iterator;
typedef REVERSE_ITERATOR reverse_iterator;
// = Initialization and termination methods.
/// Initialize a <Active_Map_Manager> with the ACE_DEFAULT_MAP_SIZE.
ACE_Active_Map_Manager (ACE_Allocator *alloc = 0);
/// Initialize a <Active_Map_Manager> with @a size entries.
ACE_Active_Map_Manager (size_t size,
ACE_Allocator *alloc = 0);
/// Close down a <Active_Map_Manager> and release dynamically
/// allocated resources.
~ACE_Active_Map_Manager (void);
/// Initialize a <Active_Map_Manager> with size @a length.
int open (size_t length = ACE_DEFAULT_MAP_SIZE,
ACE_Allocator *alloc = 0);
/// Close down a <Active_Map_Manager> and release dynamically
/// allocated resources.
int close (void);
/// Add @a value to the map, and the corresponding key produced by the
/// Active_Map_Manager is returned through @a key.
int bind (const T &value,
ACE_Active_Map_Manager_Key &key);
/// Add @a value to the map. The user does not care about the
/// corresponding key produced by the Active_Map_Manager.
int bind (const T &value);
/**
* Reserves a slot in the internal structure and returns the key and
* a pointer to the value. User should place their @a value into
@@ -92,12 +74,10 @@ public:
*/
int bind (ACE_Active_Map_Manager_Key &key,
T *&internal_value);
/// Reassociate @a key with @a value. The function fails if @a key is
/// not in the map.
int rebind (const ACE_Active_Map_Manager_Key &key,
const T &value);
/**
* Reassociate @a key with @a value, storing the old value into the
* "out" parameter @a old_value. The function fails if @a key is not
@@ -106,7 +86,6 @@ public:
int rebind (const ACE_Active_Map_Manager_Key &key,
const T &value,
T &old_value);
/**
* Reassociate @a key with @a value, storing the old key and value
* into the "out" parameter @a old_key and @a old_value. The function
@@ -116,14 +95,11 @@ public:
const T &value,
ACE_Active_Map_Manager_Key &old_key,
T &old_value);
/// Locate @a value associated with @a key.
int find (const ACE_Active_Map_Manager_Key &key,
T &value) const;
/// Is @a key in the map?
int find (const ACE_Active_Map_Manager_Key &key) const;
/**
* Locate @a value associated with @a key. The value is returned via
* <internal_value> and hence a copy is saved. Note that
@@ -133,19 +109,15 @@ public:
*/
int find (const ACE_Active_Map_Manager_Key &key,
T *&internal_value) const;
// Creates a key. User should place their @a value into
// <*internal_value>. This method is useful in reducing the number
// of copies required in some cases.
/// Remove @a key from the map.
int unbind (const ACE_Active_Map_Manager_Key &key);
/// Remove @a key from the map, and return the @a value associated with
/// @a key.
int unbind (const ACE_Active_Map_Manager_Key &key,
T &value);
/**
* Locate @a value associated with @a key. The value is returned via
* <internal_value> and hence a copy is saved. Note that
@@ -155,58 +127,41 @@ public:
*/
int unbind (const ACE_Active_Map_Manager_Key &key,
T *&internal_value);
/// Return the current size of the map.
size_t current_size (void) const;
/// Return the total size of the map.
size_t total_size (void) const;
/// Returns a key that cannot be found in the map.
static const ACE_Active_Map_Manager_Key npos (void);
/// Dump the state of an object.
void dump (void) const;
// = STL styled iterator factory functions.
/// Return forward iterator.
ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> begin (void);
ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> end (void);
/// Return reverse iterator.
ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> rbegin (void);
ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> rend (void);
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
/// Private base class
typedef ACE_Map_Manager<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> ACE_AMM_BASE;
private:
// = Disallow these operations.
ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager<T> &))
ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager (const ACE_Active_Map_Manager<T> &))
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Active_Map_Manager_T.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Active_Map_Manager_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Active_Map_Manager_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_ACTIVE_MAP_MANAGER_T_H */

View File

@@ -1,38 +1,29 @@
// -*- C++ -*-
//
// $Id: Active_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::bind (ACE_Active_Map_Manager_Key &key,
T *&internal_value)
{
ACE_UINT32 slot_index;
int result = this->next_free (slot_index);
if (result == 0)
{
// Move from free list to occupied list
this->move_from_free_list_to_occupied_list (slot_index);
// Reset the key.
this->search_structure_[slot_index].ext_id_.increment_slot_generation_count ();
this->search_structure_[slot_index].ext_id_.slot_index (slot_index);
// Copy the key for the user.
key = this->search_structure_[slot_index].ext_id_;
// This is where the user should place the value.
internal_value = &this->search_structure_[slot_index].int_id_;
// Update the current size.
++this->cur_size_;
}
return result;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::bind (const T &value,
ACE_Active_Map_Manager_Key &key)
@@ -40,30 +31,25 @@ ACE_Active_Map_Manager<T>::bind (const T &value,
T *internal_value = 0;
int result = this->bind (key,
internal_value);
if (result == 0)
{
// Store new value.
*internal_value = value;
}
return result;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::bind (const T &value)
{
ACE_Active_Map_Manager_Key key;
return this->bind (value, key);
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
T *&internal_value) const
{
ACE_UINT32 slot_index = key.slot_index ();
ACE_UINT32 slot_generation = key.slot_generation ();
if (slot_index > this->total_size_ ||
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
this->search_structure_[slot_index].free_ ||
@@ -79,10 +65,8 @@ ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
// This is where the user value is.
internal_value = &this->search_structure_[slot_index].int_id_;
}
return 0;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key) const
{
@@ -90,7 +74,6 @@ ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key) const
return this->find (key,
internal_value);
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
T &value) const
@@ -98,47 +81,37 @@ ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
T *internal_value = 0;
int result = this->find (key,
internal_value);
if (result == 0)
value = *internal_value;
return result;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
const T &value)
{
int result = this->find (key);
if (result == 0)
{
// Store new value.
this->search_structure_[key.slot_index ()].int_id_ = value;
}
return result;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
const T &value,
T &old_value)
{
int result = this->find (key);
if (result == 0)
{
// Copy old value.
old_value = this->search_structure_[key.slot_index ()].int_id_;
// Store new value.
this->search_structure_[key.slot_index ()].int_id_ = value;
}
return result;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
const T &value,
@@ -146,60 +119,44 @@ ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
T &old_value)
{
int result = this->find (key);
if (result == 0)
{
// Copy old key.
old_key = this->search_structure_[key.slot_index ()].ext_id_;
// Copy old value.
old_value = this->search_structure_[key.slot_index ()].int_id_;
// Store new value.
this->search_structure_[key.slot_index ()].int_id_ = value;
}
return result;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key,
T *&internal_value)
{
int result = this->find (key,
internal_value);
if (result == 0)
{
ACE_UINT32 slot_index = key.slot_index ();
#if defined (ACE_HAS_LAZY_MAP_MANAGER)
//
// In the case of lazy map managers, the movement of free slots
// from the occupied list to the free list is delayed until we
// run out of free slots in the free list.
//
this->search_structure_[slot_index].free_ = 1;
#else
// Move from occupied list to free list.
this->move_from_occupied_list_to_free_list (slot_index);
#endif /* ACE_HAS_LAZY_MAP_MANAGER */
// Reset the slot_index. This will tell us that this entry is free.
this->search_structure_[slot_index].ext_id_.slot_index (this->free_list_id ());
// Update the current size.
--this->cur_size_;
}
return result;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key,
T &value)
@@ -207,16 +164,13 @@ ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key,
T *internal_value;
int result = this->unbind (key,
internal_value);
if (result == 0)
{
// Copy old value.
value = *internal_value;
}
return result;
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key)
{
@@ -224,13 +178,11 @@ ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key)
return this->unbind (key,
internal_value);
}
template <class T> ACE_INLINE
ACE_Active_Map_Manager<T>::ACE_Active_Map_Manager (ACE_Allocator *alloc)
: ACE_AMM_BASE (alloc)
{
}
template <class T> ACE_INLINE
ACE_Active_Map_Manager<T>::ACE_Active_Map_Manager (size_t size,
ACE_Allocator *alloc)
@@ -238,44 +190,37 @@ ACE_Active_Map_Manager<T>::ACE_Active_Map_Manager (size_t size,
alloc)
{
}
template <class T> ACE_INLINE
ACE_Active_Map_Manager<T>::~ACE_Active_Map_Manager (void)
{
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::open (size_t length,
ACE_Allocator *alloc)
{
return ACE_AMM_BASE::open (length, alloc);
}
template <class T> ACE_INLINE int
ACE_Active_Map_Manager<T>::close (void)
{
return ACE_AMM_BASE::close ();
}
template <class T> ACE_INLINE size_t
ACE_Active_Map_Manager<T>::current_size (void) const
{
return ACE_AMM_BASE::current_size ();
}
template <class T> ACE_INLINE size_t
ACE_Active_Map_Manager<T>::total_size (void) const
{
return ACE_AMM_BASE::total_size ();
}
/* static */
template <class T> ACE_INLINE const ACE_Active_Map_Manager_Key
ACE_Active_Map_Manager<T>::npos (void)
{
return ACE_Active_Map_Manager_Key (~0, ~0);
}
template <class T> ACE_INLINE void
ACE_Active_Map_Manager<T>::dump (void) const
{
@@ -283,29 +228,24 @@ ACE_Active_Map_Manager<T>::dump (void) const
ACE_AMM_BASE::dump ();
#endif /* ACE_HAS_DUMP */
}
template <class T> ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
ACE_Active_Map_Manager<T>::begin (void)
{
return ACE_AMM_BASE::begin ();
}
template <class T> ACE_INLINE ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
ACE_Active_Map_Manager<T>::end (void)
{
return ACE_AMM_BASE::end ();
}
template <class T> ACE_INLINE ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
ACE_Active_Map_Manager<T>::rbegin (void)
{
return ACE_AMM_BASE::rbegin ();
}
template <class T> ACE_INLINE ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
ACE_Active_Map_Manager<T>::rend (void)
{
return ACE_AMM_BASE::rend ();
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,74 +1,57 @@
// $Id: Addr.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Addr.h"
ACE_RCSID (ace,
Addr,
"$Id: Addr.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if !defined (__ACE_INLINE__)
#include "ace/Addr.inl"
#endif /* __ACE_INLINE__ */
#include "ace/Log_Msg.h"
#include "ace/os_include/sys/os_socket.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Note: this object requires static construction and destruction.
/* static */
const ACE_Addr ACE_Addr::sap_any (AF_ANY, -1);
ACE_ALLOC_HOOK_DEFINE(ACE_Addr)
// Initializes instance variables. Note that 0 is an unspecified
// protocol family type...
ACE_Addr::ACE_Addr (int type, int size) :
addr_type_ (type),
addr_size_ (size)
{
}
ACE_Addr::~ACE_Addr (void)
{
}
void *
ACE_Addr::get_addr (void) const
{
return 0;
}
void
ACE_Addr::set_addr (void *, int)
{
}
// Initializes instance variables.
void
ACE_Addr::base_set (int type, int size)
{
this->addr_type_ = type;
this->addr_size_ = size;
}
void
ACE_Addr::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Addr::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("addr_type_ = %d"), this->addr_type_));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\naddr_size_ = %d"), this->addr_size_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Addr.h
@@ -9,20 +8,14 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_ADDR_H
#define ACE_ADDR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Addr
*
@@ -35,70 +28,48 @@ public:
// = Initialization and termination methods.
/// Initializes instance variables.
ACE_Addr (int type = -1, int size = -1);
/// Destructor.
virtual ~ACE_Addr (void);
// = Get/set the size of the address.
/// Return the size of the address.
int get_size (void) const;
/// Sets the size of the address.
void set_size (int size);
// = Get/set the type of the address.
/// Get the type of the address.
int get_type (void) const;
/// Set the type of the address.
void set_type (int type);
/// Return a pointer to the address.
virtual void *get_addr (void) const;
/// Set a pointer to the address.
virtual void set_addr (void *, int len);
// = Equality/inequality tests
/// Check for address equality.
bool operator == (const ACE_Addr &sap) const;
/// Check for address inequality.
bool operator != (const ACE_Addr &sap) const;
/// Initializes instance variables.
void base_set (int type, int size);
/// Wild-card address.
static const ACE_Addr sap_any;
/// Returns a hash value. This should be overwritten by a subclass
/// that can produce a better hash value.
virtual unsigned long hash (void) const;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
/// e.g., AF_UNIX, AF_INET, AF_SPIPE, etc.
int addr_type_;
/// Number of bytes in the address.
int addr_size_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Addr.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_ADDR_H */

View File

@@ -1,61 +1,47 @@
// -*- C++ -*-
//
// $Id: Addr.inl 80826 2008-03-04 14:51:23Z wotte $
// Return the address of the address.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE bool
ACE_Addr::operator == (const ACE_Addr &sap) const
{
return (sap.addr_type_ == this->addr_type_ &&
sap.addr_size_ == this->addr_size_ );
}
ACE_INLINE bool
ACE_Addr::operator != (const ACE_Addr &sap) const
{
return (sap.addr_type_ != this->addr_type_ ||
sap.addr_size_ != this->addr_size_ );
}
// Return the size of the address.
ACE_INLINE int
ACE_Addr::get_size (void) const
{
return this->addr_size_;
}
// Sets the size of the address.
ACE_INLINE void
ACE_Addr::set_size (int size)
{
this->addr_size_ = size;
}
// Return the type of the address.
ACE_INLINE int
ACE_Addr::get_type (void) const
{
return this->addr_type_;
}
// Set the type of the address.
ACE_INLINE void
ACE_Addr::set_type (int type)
{
this->addr_type_ = type;
}
ACE_INLINE unsigned long
ACE_Addr::hash (void) const
{
return 0;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Arg_Shifter.h
@@ -9,22 +8,15 @@
* @author Seth Widoff
*/
//=============================================================================
#ifndef ACE_ARG_SHIFTER_H
#define ACE_ARG_SHIFTER_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Global_Macros.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Arg_Shifter_T
*
@@ -70,19 +62,15 @@ public:
ACE_Arg_Shifter_T (int& argc,
const CHAR_TYPE **argv,
const CHAR_TYPE **temp = 0);
/// Same behavior as the preceding constructor, but without the
/// "const" qualifier.
ACE_Arg_Shifter_T (int& argc,
CHAR_TYPE **argv,
CHAR_TYPE **temp = 0);
/// Destructor.
~ACE_Arg_Shifter_T (void);
/// Get the current head of the vector.
const CHAR_TYPE *get_current (void) const;
/**
* If the @a flag matches the current_arg of arg shifter
* this method will attempt to return the associated
@@ -116,7 +104,6 @@ public:
* and the cur arg is left pointing to the entire flag/value pair
*/
const CHAR_TYPE *get_the_parameter (const CHAR_TYPE* flag);
/**
* Check if the current argument matches (case insensitive) <flag>
*
@@ -147,76 +134,54 @@ public:
* then -1 is returned
*/
int cur_arg_strncasecmp (const CHAR_TYPE *flag);
/// Consume @a number argument(s) by sticking them/it on the end of
/// the vector.
int consume_arg (int number = 1);
/// Place @a number arguments in the same relative order ahead of the
/// known arguments in the vector.
int ignore_arg (int number = 1);
/// Returns the number of args left to see in the vector.
int is_anything_left (void) const;
/// Returns 1 if there's a next item in the vector and it begins with
/// '-'.
int is_option_next (void) const;
/// Returns 1 if there's a next item in the vector and it doesn't
/// begin with '-'.
int is_parameter_next (void) const;
/// Returns the number of irrelevant args seen.
int num_ignored_args (void) const;
private:
/// Copy Constructor should not be used.
ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T (const ACE_Arg_Shifter_T<CHAR_TYPE>&))
/// Assignment '=' operator should not be used.
ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T operator= (const ACE_Arg_Shifter_T<CHAR_TYPE>&))
/// Refactor the constructor logic.
void init (void);
/// The size of the argument vector.
int& argc_;
/// The size of argv_.
int total_size_;
/// The temporary array over which we traverse.
const CHAR_TYPE **temp_;
/// The array in which the arguments are reordered.
const CHAR_TYPE **argv_;
/// The element in <temp_> we're currently examining.
int current_index_;
/// The index of <argv_> in which we'll stick the next unknown
/// argument.
int back_;
/// The index of <argv_> in which we'll stick the next known
/// argument.
int front_;
};
typedef ACE_Arg_Shifter_T<ACE_TCHAR> ACE_Arg_Shifter;
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Arg_Shifter.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Arg_Shifter.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_ARG_SHIFTER_H */

View File

@@ -1,20 +1,14 @@
// $Id: Argv_Type_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Argv_Type_Converter.h"
#if !defined (__ACE_INLINE__)
#include "ace/Argv_Type_Converter.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID (ace,
Argv_Type_Converter,
"$Id: Argv_Type_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $")
#include "ace/OS_NS_string.h"
#include "ace/OS_Errno.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#if defined (ACE_USES_WCHAR)
ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv)
: saved_argc_ (argc),
@@ -26,13 +20,11 @@ ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv)
char_passed_ (false)
{
this->initialize ();
for (int i = 0; i < argc; ++i)
this->char_argv_[i] = ACE_OS::strdup (ACE_TEXT_ALWAYS_CHAR (argv[i]));
}
#endif // ACE_USES_WCHAR
ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char **argv)
: saved_argc_(argc),
char_argv_(argv)
@@ -44,7 +36,6 @@ ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char **argv)
char_passed_(false)
{
this->initialize();
for (int i = 0; i < argc; ++i)
this->wchar_argv_[i] = ACE_OS::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i]));
}
@@ -52,7 +43,6 @@ ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char **argv)
{
}
#endif // ACE_USES_WCHAR
ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
{
#if defined (ACE_USES_WCHAR)
@@ -62,10 +52,8 @@ ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
// if original type is wchar_t
if (this->char_passed_)
this->align_wchar_with_char ();
for (int i = 0; i < this->before_pass_argc_; ++i)
ACE_OS::free (this->char_argv_[i]);
delete [] this->char_argv_;
}
else
@@ -73,15 +61,12 @@ ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
// if original type is char
if (this->wchar_passed_)
this->align_char_with_wchar ();
for (int i = 0; i < this->before_pass_argc_; ++i)
ACE_OS::free (this->wchar_argv_[i]);
delete [] this->wchar_argv_;
}
#endif // ACE_USES_WCHAR
}
#if defined (ACE_USES_WCHAR)
void
ACE_Argv_Type_Converter::initialize (void)
@@ -104,13 +89,11 @@ ACE_Argv_Type_Converter::initialize (void)
}
}
void
ACE_Argv_Type_Converter::align_char_with_wchar (void)
{
int wchar_argv_index = 0;
wchar_t* match_argv = this->wchar_argv_[0]; // pick the initial entry
while (wchar_argv_index < this->saved_argc_)
{
// if n'th entries of both argv lists are different
@@ -132,20 +115,16 @@ ACE_Argv_Type_Converter::align_char_with_wchar (void)
}
}
}
// move to the next wchar argv list entry
match_argv = this->wchar_argv_[++wchar_argv_index];
}
this->cleanup ();
}
void
ACE_Argv_Type_Converter::align_wchar_with_char (void)
{
int char_argv_index = 0;
char* match_argv = this->char_argv_[0]; // pick the initial entry
while (char_argv_index < saved_argc_)
{
// if n'th entries of both argv lists are different
@@ -168,14 +147,11 @@ ACE_Argv_Type_Converter::align_wchar_with_char (void)
}
}
}
// move to the next wchar argv list entry
match_argv = this->char_argv_[++char_argv_index];
}
this->cleanup();
}
void
ACE_Argv_Type_Converter::cleanup (void)
{
@@ -193,13 +169,10 @@ ACE_Argv_Type_Converter::cleanup (void)
this->wchar_argv_[i] = 0;
}
}
this->before_pass_argc_ = this->saved_argc_;
this->wchar_passed_ = false;
this->char_passed_ = false;
}
#endif // ACE_USES_WCHAR
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Argv_Type_Converter.h
@@ -9,21 +8,15 @@
* @author Si Mong Park <spark@ociweb.com>
*/
//=============================================================================
#ifndef ACE_ARGV_TYPE_CONVERTER_H
#define ACE_ARGV_TYPE_CONVERTER_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#include "ace/OS_Memory.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Argv_Type_Converter
*
@@ -39,82 +32,57 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Argv_Type_Converter
{
public:
ACE_Argv_Type_Converter (int &argc, char** argv);
#if defined (ACE_USES_WCHAR)
ACE_Argv_Type_Converter (int &argc, wchar_t** argv);
#endif // ACE_USES_WCHAR
~ACE_Argv_Type_Converter (void);
/// Returns the pointer of converted command line.
ACE_TCHAR** get_TCHAR_argv (void);
/// Returns the pointer of ASCII (char) command line.
char** get_ASCII_argv (void);
/// Returns the number of sub paramters (argc).
int& get_argc (void);
private:
/// Copy Constructor should not be used.
ACE_Argv_Type_Converter (const ACE_Argv_Type_Converter&);
/// Assignment '=' operator should not be used.
ACE_Argv_Type_Converter operator= (const ACE_Argv_Type_Converter&);
#if defined (ACE_USES_WCHAR)
/// Perform common initialization for two Ctor's.
void initialize (void);
/// Align all entries in the char type argv list with wchar_t type
/// argv list.
void align_char_with_wchar (void);
/// Align all entries in the wchar_t type argv list with char type
/// argv list.
void align_wchar_with_char (void);
/// Clean up removed (comsumed) argv entries and reset the pass flags.
void cleanup (void);
#endif // ACE_USES_WCHAR
private:
/// Original number of input paramter, same as 'argc'.
int &saved_argc_;
/// Data member pointer that contains converted argv in ACE_ANTI_TCHAR.
char** char_argv_;
#if defined (ACE_USES_WCHAR)
/// Data member pointer that contains converted argv in ACE_TCHAR.
wchar_t** wchar_argv_;
/// argc value before any argv has been passed.
int before_pass_argc_;
/// false represents original argv passed in is char, and true
/// represents wchar_t.
bool const original_type_;
/// true indicates wchar_t type argv has been passed.
bool wchar_passed_;
/// true indicates char type argv has been passed.
bool char_passed_;
#endif /* ACE_USES_WCHAR */
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Argv_Type_Converter.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_ARGV_TYPE_CONVERTER_H */

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: Argv_Type_Converter.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE ACE_TCHAR**
ACE_Argv_Type_Converter::get_TCHAR_argv (void)
{
@@ -12,14 +10,12 @@ ACE_Argv_Type_Converter::get_TCHAR_argv (void)
{
this->align_wchar_with_char ();
}
this->wchar_passed_ = true;
return this->wchar_argv_;
#else
return this->char_argv_;
#endif // ACE_USES_WCHAR
}
ACE_INLINE char**
ACE_Argv_Type_Converter::get_ASCII_argv (void)
{
@@ -28,17 +24,13 @@ ACE_Argv_Type_Converter::get_ASCII_argv (void)
{
this->align_char_with_wchar ();
}
this->char_passed_ = true;
#endif // ACE_USES_WCHAR
return this->char_argv_;
}
ACE_INLINE int&
ACE_Argv_Type_Converter::get_argc (void)
{
return this->saved_argc_;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file Array.h
@@ -14,17 +13,13 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_ARRAY_H
#define ACE_ARRAY_H
#include /**/ "ace/pre.h"
#include "ace/Containers_T.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include /**/ "ace/post.h"
#endif /* ACE_ARRAY_H */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Array_Base.h
@@ -9,27 +8,19 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_ARRAY_BASE_H
#define ACE_ARRAY_BASE_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Global_Macros.h"
#include "ace/Malloc_Base.h"
#include <iterator> /* For reverse_iterator adapters */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Forward declaration.
template <class T> class ACE_Array_Iterator;
/**
* @class ACE_Array_Base
*
@@ -43,11 +34,9 @@ template<class T>
class ACE_Array_Base
{
public:
// Old/ACE-style traits.
typedef T TYPE;
typedef ACE_Array_Iterator<T> ITERATOR;
// STL-style typedefs/traits.
typedef T value_type;
typedef value_type * iterator;
@@ -58,27 +47,21 @@ public:
typedef value_type const * const_pointer;
typedef ptrdiff_t difference_type;
typedef ACE_Allocator::size_type size_type;
ACE_DECLARE_STL_REVERSE_ITERATORS
// = Initialization and termination methods.
/// Dynamically create an uninitialized array.
ACE_Array_Base (size_type size = 0,
ACE_Allocator * the_allocator = 0);
/// Dynamically initialize the entire array to the <default_value>.
ACE_Array_Base (size_type size,
T const & default_value,
ACE_Allocator * the_allocator = 0);
/**
* The copy constructor performs initialization by making an exact
* copy of the contents of parameter <s>, i.e., *this == s will
* return true.
*/
ACE_Array_Base (ACE_Array_Base<T> const & s);
/**
* Assignment operator performs an assignment by making an exact
* copy of the contents of parameter <s>, i.e., *this == s will
@@ -88,24 +71,18 @@ public:
* reallocate a new <array_>, and then copy the contents of <s>.
*/
void operator= (ACE_Array_Base<T> const & s);
/// Clean up the array (e.g., delete dynamically allocated memory).
~ACE_Array_Base (void);
// = Set/get methods.
/// Set item in the array at location @a slot. Doesn't
/// perform range checking.
T & operator[] (size_type slot);
/// Get item in the array at location @a slot. Doesn't
/// perform range checking.
T const & operator[] (size_type slot) const;
/// Set an item in the array at location @a slot. Returns
/// -1 if @a slot is not in range, else returns 0.
int set (T const & new_item, size_type slot);
/**
* Get an item in the array at location @a slot. Returns -1 if
* @a slot is not in range, else returns 0. Note that this function
@@ -113,20 +90,16 @@ public:
* the const operator [], but then you'll be responsible for range checking.
*/
int get (T & item, size_type slot) const;
/// Returns the <cur_size_> of the array.
size_type size (void) const;
/**
* Changes the size of the array to match <new_size>.
* It copies the old contents into the new array.
* Return -1 on failure.
*/
int size (size_type new_size);
/// Returns the <max_size_> of the array.
size_type max_size (void) const;
/**
* Changes the size of the array to match <new_size>.
* It copies the old contents into the new array.
@@ -134,7 +107,6 @@ public:
* It does not affect new_size
*/
int max_size (size_type new_size);
/**
* @name Forward Iterator Accessors
*
@@ -146,7 +118,6 @@ public:
const_iterator begin (void) const;
const_iterator end (void) const;
//@}
/**
* @name Reverse Iterator Accessors
*
@@ -158,21 +129,16 @@ public:
const_reverse_iterator rbegin (void) const;
const_reverse_iterator rend (void) const;
//@}
/// Swap the contents of this array with the given @a array in
/// an exception-safe manner.
void swap (ACE_Array_Base<T> & array);
protected:
/// Returns 1 if @a slot is within range, i.e., 0 >= @a slot <
/// <cur_size_>, else returns 0.
bool in_range (size_type slot) const;
/// Maximum size of the array, i.e., the total number of <T> elements
/// in <array_>.
size_type max_size_;
/**
* Current size of the array. This starts out being == to
* <max_size_>. However, if we are assigned a smaller array, then
@@ -181,18 +147,13 @@ protected:
* don't have to.
*/
size_type cur_size_;
/// Pointer to the array's storage buffer.
value_type * array_;
/// Allocation strategy of the ACE_Array_Base.
ACE_Allocator * allocator_;
friend class ACE_Array_Iterator<T>;
};
// ****************************************************************
/**
* @class ACE_Array_Iterator
*
@@ -209,49 +170,35 @@ class ACE_Array_Iterator
public:
// = Initialization method.
ACE_Array_Iterator (ACE_Array_Base<T> &);
// = Iteration methods.
/// Pass back the <next_item> that hasn't been seen in the Array.
/// Returns 0 when all items have been seen, else 1.
int next (T *&next_item);
/// Move forward by one element in the Array. Returns 0 when all the
/// items in the Array have been seen, else 1.
int advance (void);
/// Returns 1 when all items have been seen, else 0.
int done (void) const;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
/// Pointer to the current item in the iteration.
size_t current_;
/// Pointer to the Array we're iterating over.
ACE_Array_Base<T> &array_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Array_Base.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Array_Base.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Array_Base.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_ARRAY_BASE_H */

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: Array_Base.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Clean up the array (e.g., delete dynamically allocated memory).
template <class T> ACE_INLINE
ACE_Array_Base<T>::~ACE_Array_Base (void)
@@ -13,95 +11,80 @@ ACE_Array_Base<T>::~ACE_Array_Base (void)
this->allocator_->free,
T);
}
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::iterator
ACE_Array_Base<T>::begin (void)
{
return this->array_;
}
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::iterator
ACE_Array_Base<T>::end (void)
{
return this->array_ + this->cur_size_;
}
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_iterator
ACE_Array_Base<T>::begin (void) const
{
return this->array_;
}
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_iterator
ACE_Array_Base<T>::end (void) const
{
return this->array_ + this->cur_size_;
}
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator
ACE_Array_Base<T>::rbegin (void)
{
return reverse_iterator (this->end ());
}
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator
ACE_Array_Base<T>::rend (void)
{
return reverse_iterator (this->begin ());
}
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator
ACE_Array_Base<T>::rbegin (void) const
{
return const_reverse_iterator (this->end ());
}
template <class T>
ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator
ACE_Array_Base<T>::rend (void) const
{
return const_reverse_iterator (this->begin ());
}
template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type
ACE_Array_Base<T>::size (void) const
{
return this->cur_size_;
}
template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type
ACE_Array_Base<T>::max_size (void) const
{
return this->max_size_;
}
template <class T> ACE_INLINE bool
ACE_Array_Base<T>::in_range (typename ACE_Array_Base<T>::size_type index) const
{
return index < this->cur_size_;
}
template <class T> ACE_INLINE T &
ACE_Array_Base<T>::operator[] (typename ACE_Array_Base<T>::size_type index)
{
return this->array_[index];
}
template <class T> ACE_INLINE const T &
ACE_Array_Base<T>::operator[] (typename ACE_Array_Base<T>::size_type index) const
{
return this->array_[index];
}
// ****************************************************************
template <class T> ACE_INLINE void
ACE_Array_Iterator<T>::dump (void) const
{
@@ -109,7 +92,6 @@ ACE_Array_Iterator<T>::dump (void) const
// ACE_TRACE ("ACE_Array_Iterator<T>::dump");
#endif /* ACE_HAS_DUMP */
}
template <class T> ACE_INLINE
ACE_Array_Iterator<T>::ACE_Array_Iterator (ACE_Array_Base<T> &a)
: current_ (0),
@@ -117,12 +99,10 @@ ACE_Array_Iterator<T>::ACE_Array_Iterator (ACE_Array_Base<T> &a)
{
// ACE_TRACE ("ACE_Array_Iterator<T>::ACE_Array_Iterator");
}
template <class T> ACE_INLINE int
ACE_Array_Iterator<T>::advance (void)
{
// ACE_TRACE ("ACE_Array_Iterator<T>::advance");
if (this->current_ < array_.size ())
{
++this->current_;
@@ -134,13 +114,10 @@ ACE_Array_Iterator<T>::advance (void)
return 0;
}
}
template <class T> ACE_INLINE int
ACE_Array_Iterator<T>::done (void) const
{
ACE_TRACE ("ACE_Array_Iterator<T>::done");
return this->current_ >= array_.size ();
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Array_Map.h
@@ -16,24 +15,17 @@
*/
//=============================================================================
#ifndef ACE_ARRAY_MAP_H
#define ACE_ARRAY_MAP_H
#include /**/ "ace/pre.h"
#include "ace/config-lite.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include <utility>
#include <iterator>
#include <functional>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Array_Map
*
@@ -88,7 +80,6 @@ template<typename Key, typename Value, class EqualTo = std::equal_to<Key> >
class ACE_Array_Map
{
public:
// STL-style typedefs/traits.
typedef Key key_type;
typedef Value data_type;
@@ -101,28 +92,22 @@ public:
typedef value_type const * const_pointer;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
ACE_DECLARE_STL_REVERSE_ITERATORS
/// Default Constructor.
/**
* Create an empty map with a preallocated buffer of size @a s.
*/
ACE_Array_Map (size_type s = 0);
#ifndef ACE_LACKS_MEMBER_TEMPLATES
template<typename InputIterator>
ACE_Array_Map (InputIterator f, InputIterator l);
#else
ACE_Array_Map (const_iterator f, const_iterator l);
#endif /* !ACE_LACKS_MEMBER_TEMPLATES */
ACE_Array_Map (ACE_Array_Map const & map);
ACE_Array_Map & operator= (ACE_Array_Map const & map);
/// Destructor.
~ACE_Array_Map (void);
/**
* @name Forward Iterator Accessors
*
@@ -134,7 +119,6 @@ public:
const_iterator begin (void) const;
const_iterator end (void) const;
//@}
/**
* @name Reverse Iterator Accessors
*
@@ -146,30 +130,24 @@ public:
const_reverse_iterator rbegin (void) const;
const_reverse_iterator rend (void) const;
//@}
/// Return current size of map.
/**
* @return The number of elements in the map.
*/
size_type size (void) const;
/// Maximum number of elements the map can hold.
size_type max_size (void) const;
/// Return @c true if the map is empty, else @c false.
bool is_empty (void) const; // ACE style
/**
* Return @c true if the map is empty, else @c false. We recommend
* using @c is_empty() instead since it's more consistent with the
* ACE container naming conventions.
*/
bool empty (void) const; // STL style
/// Swap the contents of this map with the given @a map in an
/// exception-safe manner.
void swap (ACE_Array_Map & map);
/// Insert the value @a x into the map.
/**
* STL-style map insertion method.
@@ -180,7 +158,6 @@ public:
* contains a value with the same key as @a x.
*/
std::pair<iterator, bool> insert (value_type const & x);
#ifndef ACE_LACKS_MEMBER_TEMPLATES
/// Insert range of elements into map.
template<typename InputIterator>
@@ -189,28 +166,23 @@ public:
/// Insert range of elements into map.
void insert (const_iterator f, const_iterator l);
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
/// Remove element at position @a pos from the map.
void erase (iterator pos);
/// Remove element corresponding to key @a k from the map.
/**
* @return Number of elements that were erased.
*/
size_type erase (key_type const & k);
/// Remove range of elements [@a first, @a last) from the map.
/**
* @note [@a first, @a last) must be valid range within the map.
*/
void erase (iterator first, iterator last);
/// Clear contents of map.
/**
* @note This a constant time (O(1)) operation.
*/
void clear (void);
/**
* @name Search Operations
*
@@ -222,21 +194,18 @@ public:
* map.
*/
iterator find (key_type const & k);
/**
* @return @c end() if data corresponding to key @a k is not in the
* map.
*/
const_iterator find (key_type const & k) const;
//@}
/// Count the number of elements corresponding to key @a k.
/**
* @return In the case of this map, the count will always be one if
* such exists in the map.
*/
size_type count (key_type const & k);
/// Convenience array index operator.
/**
* Array index operator that allows insertion and retrieval of
@@ -245,57 +214,40 @@ public:
* map["Foo"] = 12;
*/
data_type & operator[] (key_type const & k);
private:
/// Increase size of underlying buffer by @a s.
void grow (size_type s);
private:
/// Number of elements in the map.
size_type size_;
/// Current size of underlying array.
/**
* @note @c capacity_ is always greater than or equal to @c size_;
*/
size_type capacity_;
/// Underlying array containing keys and data.
value_type * nodes_;
};
// --------------------------------------------------------------
/// @c ACE_Array_Map equality operator.
template <typename Key, typename Value, class EqualTo>
bool operator== (ACE_Array_Map<Key, Value, EqualTo> const & lhs,
ACE_Array_Map<Key, Value, EqualTo> const & rhs);
/// @c ACE_Array_Map lexicographical comparison operator.
template <typename Key, typename Value, class EqualTo>
bool operator< (ACE_Array_Map<Key, Value, EqualTo> const & lhs,
ACE_Array_Map<Key, Value, EqualTo> const & rhs);
// --------------------------------------------------------------
ACE_END_VERSIONED_NAMESPACE_DECL
#ifdef __ACE_INLINE__
# include "ace/Array_Map.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
# include "ace/Array_Map.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Array_Map.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_ARRAY_MAP_H */

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: Array_Map.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template<typename Key, typename Value, class EqualTo>
ACE_INLINE
ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (
@@ -13,105 +11,89 @@ ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (
, nodes_ (s == 0 ? 0 : new value_type[s])
{
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE ACE_Array_Map<Key, Value, EqualTo> &
ACE_Array_Map<Key, Value, EqualTo>::operator= (
ACE_Array_Map<Key, Value, EqualTo> const & map)
{
// Strongly exception-safe assignment.
ACE_Array_Map<Key, Value, EqualTo> temp (map);
this->swap (temp);
return *this;
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::iterator
ACE_Array_Map<Key, Value, EqualTo>::begin (void)
{
return this->nodes_;
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::iterator
ACE_Array_Map<Key, Value, EqualTo>::end (void)
{
return this->nodes_ + this->size_;
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator
ACE_Array_Map<Key, Value, EqualTo>::begin (void) const
{
return this->nodes_;
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator
ACE_Array_Map<Key, Value, EqualTo>::end (void) const
{
return this->nodes_ + this->size_;
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::reverse_iterator
ACE_Array_Map<Key, Value, EqualTo>::rbegin (void)
{
return reverse_iterator (this->end ());
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::reverse_iterator
ACE_Array_Map<Key, Value, EqualTo>::rend (void)
{
return reverse_iterator (this->begin ());
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_reverse_iterator
ACE_Array_Map<Key, Value, EqualTo>::rbegin (void) const
{
return const_reverse_iterator (this->end ());
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::const_reverse_iterator
ACE_Array_Map<Key, Value, EqualTo>::rend (void) const
{
return const_reverse_iterator (this->begin ());
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
ACE_Array_Map<Key, Value, EqualTo>::size (void) const
{
return this->size_;
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
ACE_Array_Map<Key, Value, EqualTo>::max_size (void) const
{
return size_type (-1) / sizeof (value_type);
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE bool
ACE_Array_Map<Key, Value, EqualTo>::is_empty (void) const
{
return this->size_ == 0;
}
// The following method is deprecated.
template<typename Key, typename Value, class EqualTo>
ACE_INLINE bool
ACE_Array_Map<Key, Value, EqualTo>::empty (void) const
{
return this->is_empty ();
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::size_type
ACE_Array_Map<Key, Value, EqualTo>::count (
@@ -120,7 +102,6 @@ ACE_Array_Map<Key, Value, EqualTo>::count (
return
(this->find (k) == this->end () ? 0 : 1); // Only one datum per key.
}
template<typename Key, typename Value, class EqualTo>
ACE_INLINE typename ACE_Array_Map<Key, Value, EqualTo>::data_type &
ACE_Array_Map<Key, Value, EqualTo>::operator[] (
@@ -129,5 +110,4 @@ ACE_Array_Map<Key, Value, EqualTo>::operator[] (
iterator i = (this->insert (value_type (k, data_type ()))).first;
return (*i).second;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,12 +1,8 @@
// $Id: Assert.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Assert.h"
#include "ace/Log_Msg.h"
ACE_RCSID(ace, Assert, "$Id: Assert.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// The following ASSERT macro is courtesy of Alexandre Karev
// <akg@na47sun05.cern.ch>.
void
@@ -14,12 +10,9 @@ __ace_assert(const char *file, int line, const ACE_TCHAR *expression)
{
int error = ACE_Log_Msg::last_error_adapter ();
ACE_Log_Msg *log = ACE_Log_Msg::instance ();
log->set (file, line, -1, error, log->restart (),
log->msg_ostream (), log->msg_callback ());
log->log (LM_ERROR, ACE_TEXT ("ACE_ASSERT: file %N, line %l assertion failed for '%s'.%a\n"), expression, -1);
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Assert.h
@@ -9,20 +8,14 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_ASSERT_H
#define ACE_ASSERT_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#include /**/ "ace/config-all.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Export void __ace_assert(const char *file, int line, const ACE_TCHAR *expression);
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_NDEBUG)
#define ACE_ASSERT(x) \
(static_cast<void>(0))
@@ -32,8 +25,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
? static_cast<void>(0) \
: ACE_VERSIONED_NAMESPACE_NAME::__ace_assert(__FILE__, __LINE__, ACE_TEXT_CHAR_TO_TCHAR (#X)))
#endif /* ACE_NDEBUG */
#include /**/ "ace/post.h"
#endif /* ACE_ASSERT */

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file Asynch_Acceptor.h
@@ -9,29 +8,21 @@
* @author Irfan Pyarali (irfan@cs.wustl.edu)
*/
//=============================================================================
#ifndef ACE_ASYNCH_ACCEPTOR_H
#define ACE_ASYNCH_ACCEPTOR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on platforms that support async i/o.
#include "ace/Default_Constants.h"
#include "ace/Asynch_IO.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Forward declarations
class ACE_Message_Block;
class ACE_INET_Addr;
/**
* @class ACE_Asynch_Acceptor
*
@@ -48,10 +39,8 @@ class ACE_Asynch_Acceptor : public ACE_Handler
public:
/// A do nothing constructor.
ACE_Asynch_Acceptor (void);
/// Virtual destruction
virtual ~ACE_Asynch_Acceptor (void);
/**
* @c open starts one or more asynchronous accept requests on a
* @a address. Each accept operation may optionally read an
@@ -115,10 +104,8 @@ public:
bool validate_new_connection = false,
int reissue_accept = 1,
int number_of_initial_accepts = -1);
/// Get the underlying handle.
virtual ACE_HANDLE get_handle (void) const;
/**
* Set the underlying listen handle. It is the user's responsibility
* to make sure that the old listen handle has been appropriately
@@ -126,14 +113,12 @@ public:
* either completed or have been canceled on the old listen handle.
*/
virtual int set_handle (ACE_HANDLE handle);
/// This initiates a new asynchronous accept operation.
/**
* You need only call this method if the @a reissue_accept argument
* passed to @c open() was 0.
*/
virtual int accept (size_t bytes_to_read = 0, const void *act = 0);
/**
* Cancels all pending accepts operations issued by this object.
*
@@ -141,7 +126,6 @@ public:
* are canceled.
*/
virtual int cancel (void);
/**
* Template method to validate peer before service is opened.
* This method is called after a new connection is accepted if the
@@ -165,7 +149,6 @@ public:
virtual int validate_connection (const ACE_Asynch_Accept::Result& result,
const ACE_INET_Addr &remote,
const ACE_INET_Addr& local);
/**
* Template method for deciding whether to reissue accept.
*
@@ -178,104 +161,77 @@ public:
* be changed using the @c reissue_accept() method.
*/
virtual int should_reissue_accept (void);
//
// These are low level tweaking methods
//
/// Get flag that indicates if parsing and passing of addresses to
/// the service_handler is necessary.
virtual bool pass_addresses (void) const;
/// Set flag that indicates if parsing and passing of addresses to
/// the service_handler is necessary.
virtual void pass_addresses (bool new_value);
/// Get flag that indicates if address validation is required.
virtual bool validate_new_connection (void) const;
/// Set flag that indicates if address validation is required.
virtual void validate_new_connection (bool new_value);
/// Get flag that indicates if a new accept should be reissued when a accept
/// completes.
virtual int reissue_accept (void) const;
/// Set flag that indicates if a new accept should be reissued when a accept
/// completes.
virtual void reissue_accept (int new_value);
/// Get bytes to be read with the <accept> call.
virtual size_t bytes_to_read (void) const;
/// Set bytes to be read with the <accept> call.
virtual void bytes_to_read (size_t new_value);
/// @deprecated address_size() assumes IPv4 use, so is not always valid.
/// This method will be removed after ACE 5.5. Internal uses have been
/// changes to base needed sizes on the addr_family_ member.
static size_t address_size (void);
protected:
/// This is called when an outstanding accept completes.
virtual void handle_accept (const ACE_Asynch_Accept::Result &result);
/// Return the listen handle.
ACE_HANDLE handle (void) const;
/// Set the listen handle.
void handle (ACE_HANDLE h);
/// This parses the address from read buffer.
void parse_address (const ACE_Asynch_Accept::Result &result,
ACE_INET_Addr &remote_address,
ACE_INET_Addr &local_address);
/// Return the asynch accept object.
ACE_Asynch_Accept &asynch_accept (void);
/**
* This is the template method used to create new handler.
* Subclasses must overwrite this method if a new handler creation
* strategy is required.
*/
virtual HANDLER *make_handler (void);
private:
/// Handle used to listen for new connections.
ACE_HANDLE listen_handle_;
/// Asynch_Accept used to make life easier :-)
ACE_Asynch_Accept asynch_accept_;
/// Flag that indicates if parsing of addresses is necessary.
bool pass_addresses_;
/// Flag that indicates if address validation is required.
bool validate_new_connection_;
/// Flag that indicates if a new accept should be reissued when a
/// accept completes.
int reissue_accept_;
/// Bytes to be read with the <accept> call.
size_t bytes_to_read_;
/// Address family used to open this object. Obtained from @a address passed
/// to @c open().
int addr_family_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Asynch_Acceptor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Asynch_Acceptor.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_ACCEPTOR_H */

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file Asynch_Connector.h
@@ -9,28 +8,20 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
#ifndef ACE_ASYNCH_CONNECTOR_H
#define ACE_ASYNCH_CONNECTOR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE)
// This only works on platforms that support async i/o.
#include "ace/Asynch_IO.h"
#include "ace/INET_Addr.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Forward declarations
class ACE_Message_Block;
/**
* @class ACE_Asynch_Connector
*
@@ -41,31 +32,26 @@ class ACE_Message_Block;
* Unlike the ACE_Connector, however, this class is designed to
* be used asynchronously with the ACE Proactor framework.
*/
template <class HANDLER>
class ACE_Asynch_Connector : public ACE_Handler
{
public:
/// A do nothing constructor.
ACE_Asynch_Connector (void);
/// Virtual destruction
virtual ~ACE_Asynch_Connector (void);
/**
* This opens asynch connector
*/
virtual int open (bool pass_addresses = false,
ACE_Proactor *proactor = 0,
bool validate_new_connection = true);
/// This initiates a new asynchronous connect
virtual int connect (const ACE_INET_Addr &remote_sap,
const ACE_INET_Addr &local_sap =
(const ACE_INET_Addr &)ACE_Addr::sap_any,
int reuse_addr = 1,
const void *act = 0);
/**
* This cancels all pending accepts operations that were issued by
* the calling thread.
@@ -77,7 +63,6 @@ public:
*/
virtual int cancel (void);
/**
* Template method to validate peer before service is opened.
* This method is called when the connection attempt completes,
@@ -108,64 +93,48 @@ public:
virtual int validate_connection (const ACE_Asynch_Connect::Result& result,
const ACE_INET_Addr &remote,
const ACE_INET_Addr& local);
//
// These are low level tweaking methods
//
/// Set and get flag that indicates if parsing and passing of
/// addresses to the service_handler is necessary.
virtual bool pass_addresses (void) const;
virtual void pass_addresses (bool new_value);
/// Set and get flag that indicates if address validation is
/// required.
virtual bool validate_new_connection (void) const;
virtual void validate_new_connection (bool new_value);
protected:
/// This is called when an outstanding accept completes.
virtual void handle_connect (const ACE_Asynch_Connect::Result &result);
/// This parses the address from read buffer.
void parse_address (const ACE_Asynch_Connect::Result &result,
ACE_INET_Addr &remote_address,
ACE_INET_Addr &local_address);
/// Return the asynch Connect object.
ACE_Asynch_Connect & asynch_connect (void);
/**
* This is the template method used to create new handler.
* Subclasses must overwrite this method if a new handler creation
* strategy is required.
*/
virtual HANDLER *make_handler (void);
private:
/// Asynch_Connect used to make life easier :-)
ACE_Asynch_Connect asynch_connect_;
/// Flag that indicates if parsing of addresses is necessary.
bool pass_addresses_;
/// Flag that indicates if address validation is required.
bool validate_new_connection_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Asynch_Connector.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Asynch_Connector.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_CONNECTOR_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,118 +1,86 @@
// $Id: Asynch_IO_Impl.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Asynch_IO_Impl.h"
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on Win32 platforms and on Unix platforms supporting
// aio calls.
#if !defined (__ACE_INLINE__)
#include "ace/Asynch_IO_Impl.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Asynch_Result_Impl::~ACE_Asynch_Result_Impl (void)
{
}
ACE_Asynch_Operation_Impl::~ACE_Asynch_Operation_Impl (void)
{
}
ACE_Asynch_Read_Stream_Impl::~ACE_Asynch_Read_Stream_Impl (void)
{
}
ACE_Asynch_Read_Stream_Result_Impl::~ACE_Asynch_Read_Stream_Result_Impl (void)
{
}
ACE_Asynch_Write_Stream_Impl::~ACE_Asynch_Write_Stream_Impl (void)
{
}
ACE_Asynch_Write_Stream_Result_Impl::~ACE_Asynch_Write_Stream_Result_Impl (void)
{
}
ACE_Asynch_Read_File_Impl::~ACE_Asynch_Read_File_Impl (void)
{
}
ACE_Asynch_Write_File_Impl::~ACE_Asynch_Write_File_Impl (void)
{
}
ACE_Asynch_Read_File_Result_Impl::~ACE_Asynch_Read_File_Result_Impl (void)
{
}
ACE_Asynch_Write_File_Result_Impl::~ACE_Asynch_Write_File_Result_Impl (void)
{
}
ACE_Asynch_Accept_Result_Impl::~ACE_Asynch_Accept_Result_Impl (void)
{
}
ACE_Asynch_Connect_Result_Impl::~ACE_Asynch_Connect_Result_Impl (void)
{
}
ACE_Asynch_Accept_Impl::~ACE_Asynch_Accept_Impl (void)
{
}
ACE_Asynch_Connect_Impl::~ACE_Asynch_Connect_Impl (void)
{
}
ACE_Asynch_Transmit_File_Impl::~ACE_Asynch_Transmit_File_Impl (void)
{
}
ACE_Asynch_Transmit_File_Result_Impl::~ACE_Asynch_Transmit_File_Result_Impl (void)
{
}
ACE_Asynch_Read_Dgram_Impl::~ACE_Asynch_Read_Dgram_Impl (void)
{
}
ACE_Asynch_Read_Dgram_Impl::ACE_Asynch_Read_Dgram_Impl (void)
{
}
ACE_Asynch_Write_Dgram_Impl::~ACE_Asynch_Write_Dgram_Impl (void)
{
}
ACE_Asynch_Write_Dgram_Impl::ACE_Asynch_Write_Dgram_Impl (void)
{
}
//***********************************************
ACE_Asynch_Read_Dgram_Result_Impl::~ACE_Asynch_Read_Dgram_Result_Impl (void)
{
}
ACE_Asynch_Read_Dgram_Result_Impl::ACE_Asynch_Read_Dgram_Result_Impl (void)
{
}
//***********************************************
ACE_Asynch_Write_Dgram_Result_Impl::~ACE_Asynch_Write_Dgram_Result_Impl (void)
{
}
ACE_Asynch_Write_Dgram_Result_Impl::ACE_Asynch_Write_Dgram_Result_Impl (void)
{
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file Asynch_IO_Impl.h
@@ -19,28 +18,20 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
#ifndef ACE_ASYNCH_IO_IMPL_H
#define ACE_ASYNCH_IO_IMPL_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
// This only works on Win32 platforms and on Unix platforms supporting
// aio calls.
#include "ace/Asynch_IO.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Forward declaration.
class ACE_Proactor_Impl;
/**
* @class ACE_Asynch_Result_Impl
*
@@ -52,33 +43,24 @@ class ACE_Export ACE_Asynch_Result_Impl
{
public:
virtual ~ACE_Asynch_Result_Impl (void);
/// Number of bytes transferred by the operation.
virtual size_t bytes_transferred (void) const = 0;
/// ACT associated with the operation.
virtual const void *act (void) const = 0;
/// Did the operation succeed?
virtual int success (void) const = 0;
/// This ACT is not the same as the ACT associated with the
/// asynchronous operation.
virtual const void *completion_key (void) const = 0;
/// Error value if the operation fail.
virtual u_long error (void) const = 0;
/// Event associated with the OVERLAPPED structure.
virtual ACE_HANDLE event (void) const = 0;
/// This really make sense only when doing file I/O.
virtual u_long offset (void) const = 0;
virtual u_long offset_high (void) const = 0;
/// Priority of the operation.
virtual int priority (void) const = 0;
/**
* POSIX4 real-time signal number to be used for the
* operation. <signal_number> ranges from SIGRTMIN to SIGRTMAX. By
@@ -86,7 +68,6 @@ public:
* on non-POSIX4 systems and returns 0.
*/
virtual int signal_number (void) const = 0;
// protected:
//
// These two should really be protected. But sometimes it
@@ -96,15 +77,12 @@ public:
int success,
const void *completion_key,
u_long error = 0) = 0;
/// Post @c this to the Proactor's completion port.
virtual int post_completion (ACE_Proactor_Impl *proactor) = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Result_Impl (void);
};
/**
* @class ACE_Asynch_Operation_Impl
*
@@ -116,7 +94,6 @@ class ACE_Export ACE_Asynch_Operation_Impl
{
public:
virtual ~ACE_Asynch_Operation_Impl (void);
/**
* Initializes the factory with information which will be used with
* each asynchronous call. If @a handle == ACE_INVALID_HANDLE,
@@ -127,24 +104,19 @@ public:
ACE_HANDLE handle,
const void *completion_key,
ACE_Proactor *proactor) = 0;
/**
* This cancels all pending accepts operations that were issued by
* the calling thread. The function does not cancel asynchronous
* operations issued by other threads.
*/
virtual int cancel (void) = 0;
// = Access methods.
/// Return the underlying proactor.
virtual ACE_Proactor* proactor (void) const = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Operation_Impl (void);
};
/**
* @class ACE_Asynch_Read_Stream_Impl
*
@@ -157,7 +129,6 @@ class ACE_Export ACE_Asynch_Read_Stream_Impl : public virtual ACE_Asynch_Operati
{
public:
virtual ~ACE_Asynch_Read_Stream_Impl (void);
/// This starts off an asynchronous read. Upto @a bytes_to_read will
/// be read and stored in the @a message_block.
virtual int read (ACE_Message_Block &message_block,
@@ -165,7 +136,6 @@ public:
const void *act,
int priority,
int signal_number) = 0;
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with scatter support, through chaining of composite
@@ -177,12 +147,10 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_Stream_Impl (void);
};
/**
* @class ACE_Asynch_Read_Stream_Result_Impl
*
@@ -195,22 +163,17 @@ class ACE_Export ACE_Asynch_Read_Stream_Result_Impl : public virtual ACE_Asynch_
{
public:
virtual ~ACE_Asynch_Read_Stream_Result_Impl (void);
/// The number of bytes which were requested at the start of the
/// asynchronous read.
virtual size_t bytes_to_read (void) const = 0;
/// Message block which contains the read data.
virtual ACE_Message_Block &message_block (void) const = 0;
/// I/O handle used for reading.
virtual ACE_HANDLE handle (void) const = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_Stream_Result_Impl (void);
};
/**
* @class ACE_Asynch_Write_Stream_Impl
*
@@ -223,7 +186,6 @@ class ACE_Export ACE_Asynch_Write_Stream_Impl : public virtual ACE_Asynch_Operat
{
public:
virtual ~ACE_Asynch_Write_Stream_Impl (void);
/// This starts off an asynchronous write. Upto @a bytes_to_write
/// will be written from the @a message_block.
virtual int write (ACE_Message_Block &message_block,
@@ -231,7 +193,6 @@ public:
const void *act,
int priority,
int signal_number) = 0;
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with gather support, through chaining of composite
@@ -243,12 +204,10 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_Stream_Impl (void);
};
/**
* @class ACE_Asynch_Write_Stream_Result_Impl
*
@@ -261,22 +220,17 @@ class ACE_Export ACE_Asynch_Write_Stream_Result_Impl : public virtual ACE_Asynch
{
public:
virtual ~ACE_Asynch_Write_Stream_Result_Impl (void);
/// The number of bytes which were requested at the start of the
/// asynchronous write.
virtual size_t bytes_to_write (void) const = 0;
/// Message block that contains the data to be written.
virtual ACE_Message_Block &message_block (void) const = 0;
/// I/O handle used for writing.
virtual ACE_HANDLE handle (void) const = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_Stream_Result_Impl (void);
};
/**
* @class ACE_Asynch_Read_File_Impl
*
@@ -289,7 +243,6 @@ class ACE_Export ACE_Asynch_Read_File_Impl : public virtual ACE_Asynch_Read_Stre
{
public:
virtual ~ACE_Asynch_Read_File_Impl (void);
/**
* This starts off an asynchronous read. Upto @a bytes_to_read will
* be read and stored in the @a message_block. The read will start
@@ -302,7 +255,6 @@ public:
const void *act,
int priority,
int signal_number) = 0;
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with scatter support, through chaining of composite
@@ -318,7 +270,6 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
/// This starts off an asynchronous read. Upto @a bytes_to_read will
/// be read and stored in the @a message_block.
virtual int read (ACE_Message_Block &message_block,
@@ -326,7 +277,6 @@ public:
const void *act,
int priority,
int signal_number) = 0;
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with scatter support, through chaining of composite
@@ -338,12 +288,10 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_File_Impl (void);
};
/**
* @class ACE_Asynch_Read_File_Result_Impl
*
@@ -356,12 +304,10 @@ class ACE_Export ACE_Asynch_Read_File_Result_Impl : public virtual ACE_Asynch_Re
public:
/// Destructor.
virtual ~ACE_Asynch_Read_File_Result_Impl (void);
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_File_Result_Impl (void);
};
/**
* @class ACE_Asynch_Write_File_Impl
*
@@ -374,7 +320,6 @@ class ACE_Export ACE_Asynch_Write_File_Impl : public virtual ACE_Asynch_Write_St
{
public:
virtual ~ACE_Asynch_Write_File_Impl (void);
/**
* This starts off an asynchronous write. Upto @a bytes_to_write
* will be write and stored in the @a message_block. The write will
@@ -387,7 +332,6 @@ public:
const void *act,
int priority,
int signal_number) = 0;
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with gather support, through chaining of composite
@@ -403,7 +347,6 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
/// This starts off an asynchronous write. Upto @a bytes_to_write
/// will be written from the @a message_block.
virtual int write (ACE_Message_Block &message_block,
@@ -411,7 +354,6 @@ public:
const void *act,
int priority,
int signal_number) = 0;
#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
/**
* Same as above but with gather support, through chaining of composite
@@ -423,12 +365,10 @@ public:
int priority,
int signal_number) = 0;
#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_File_Impl (void);
};
/**
* @class ACE_Asynch_Write_File_Result_Impl
*
@@ -441,12 +381,10 @@ class ACE_Export ACE_Asynch_Write_File_Result_Impl : public virtual ACE_Asynch_W
{
public:
virtual ~ACE_Asynch_Write_File_Result_Impl (void);
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_File_Result_Impl (void);
};
/**
* @class ACE_Asynch_Accept_Impl
*
@@ -459,7 +397,6 @@ class ACE_Export ACE_Asynch_Accept_Impl : public virtual ACE_Asynch_Operation_Im
{
public:
virtual ~ACE_Asynch_Accept_Impl (void);
/**
* This starts off an asynchronous accept. The asynchronous accept
* call also allows any initial data to be returned to the
@@ -478,12 +415,10 @@ public:
int priority,
int signal_number,
int addr_family) = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Accept_Impl (void);
};
/**
* @class ACE_Asynch_Accept_Result_Impl
*
@@ -496,26 +431,20 @@ class ACE_Export ACE_Asynch_Accept_Result_Impl : public virtual ACE_Asynch_Resul
{
public:
virtual ~ACE_Asynch_Accept_Result_Impl (void);
/// The number of bytes which were requested at the start of the
/// asynchronous accept.
virtual size_t bytes_to_read (void) const = 0;
/// Message block which contains the read data.
virtual ACE_Message_Block &message_block (void) const = 0;
/// I/O handle used for accepting new connections.
virtual ACE_HANDLE listen_handle (void) const = 0;
/// I/O handle for the new connection.
virtual ACE_HANDLE accept_handle (void) const = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Accept_Result_Impl (void);
};
/**
* @class ACE_Asynch_Connect_Impl
*
@@ -528,7 +457,6 @@ class ACE_Export ACE_Asynch_Connect_Impl : public virtual ACE_Asynch_Operation_I
{
public:
virtual ~ACE_Asynch_Connect_Impl (void);
/**
* This starts off an asynchronous connect
*/
@@ -539,12 +467,10 @@ public:
const void *act,
int priority,
int signal_number) = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Connect_Impl (void);
};
/**
* @class ACE_Asynch_Connect_Result_Impl
*
@@ -557,16 +483,13 @@ class ACE_Export ACE_Asynch_Connect_Result_Impl : public virtual ACE_Asynch_Resu
{
public:
virtual ~ACE_Asynch_Connect_Result_Impl (void);
/// I/O handle for the connection.
virtual ACE_HANDLE connect_handle (void) const = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Connect_Result_Impl (void);
};
/**
* @class ACE_Asynch_Transmit_File_Impl
*
@@ -579,7 +502,6 @@ class ACE_Asynch_Transmit_File_Impl : public virtual ACE_Asynch_Operation_Impl
{
public:
virtual ~ACE_Asynch_Transmit_File_Impl (void);
/// This starts off an asynchronous transmit file.
virtual int transmit_file (ACE_HANDLE file,
ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
@@ -591,12 +513,10 @@ public:
const void *act,
int priority,
int signal_number) = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Transmit_File_Impl (void);
};
/**
* @class ACE_Asynch_Transmit_File_Result_Impl
*
@@ -609,33 +529,25 @@ class ACE_Export ACE_Asynch_Transmit_File_Result_Impl : public virtual ACE_Async
{
public:
virtual ~ACE_Asynch_Transmit_File_Result_Impl (void);
/// Socket used for transmitting the file.
virtual ACE_HANDLE socket (void) const = 0;
/// File from which the data is read.
virtual ACE_HANDLE file (void) const = 0;
/// Header and trailer data associated with this transmit file.
virtual ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const = 0;
/// The number of bytes which were requested at the start of the
/// asynchronous transmit file.
virtual size_t bytes_to_write (void) const = 0;
/// Number of bytes per send requested at the start of the transmit
/// file.
virtual size_t bytes_per_send (void) const = 0;
/// Flags which were passed into transmit file.
virtual u_long flags (void) const = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Transmit_File_Result_Impl (void);
};
/**
* @class ACE_Asynch_Read_Dgram_Impl
*
@@ -648,7 +560,6 @@ class ACE_Export ACE_Asynch_Read_Dgram_Impl : public virtual ACE_Asynch_Operatio
{
public:
virtual ~ACE_Asynch_Read_Dgram_Impl (void);
/** This starts off an asynchronous read. Upto
* <message_block->total_size()> will be read and stored in the
* @a message_block. @a message_block's <wr_ptr> will be updated to reflect
@@ -682,12 +593,10 @@ public:
const void *act,
int priority,
int signal_number) = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_Dgram_Impl (void);
};
/**
* @class ACE_Asynch_Read_Dgram_Result_Impl
*
@@ -700,28 +609,21 @@ class ACE_Export ACE_Asynch_Read_Dgram_Result_Impl : public virtual ACE_Asynch_R
{
public:
virtual ~ACE_Asynch_Read_Dgram_Result_Impl (void);
/// Message block which contains the read data
virtual ACE_Message_Block *message_block (void) const = 0;
/// The number of bytes which were requested at the start of the
/// asynchronous read.
virtual size_t bytes_to_read (void) const = 0;
/// The address of where the packet came from
virtual int remote_address (ACE_Addr& addr) const = 0;
/// The flags used in the read
virtual int flags (void) const = 0;
/// I/O handle used for reading.
virtual ACE_HANDLE handle (void) const = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Read_Dgram_Result_Impl (void);
};
/**
* @class ACE_Asynch_Write_Dgram_Impl
*
@@ -734,7 +636,6 @@ class ACE_Export ACE_Asynch_Write_Dgram_Impl : public virtual ACE_Asynch_Operati
{
public:
virtual ~ACE_Asynch_Write_Dgram_Impl (void);
/** This starts off an asynchronous send. Upto
* <message_block->total_length()> will be sent. @a message_block's
* <rd_ptr> will be updated to reflect the sent bytes if the send operation
@@ -768,12 +669,10 @@ public:
const void *act,
int priority,
int signal_number) = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_Dgram_Impl (void);
};
/**
* @class ACE_Asynch_Write_Dgram_Result_Impl
*
@@ -786,31 +685,23 @@ class ACE_Export ACE_Asynch_Write_Dgram_Result_Impl : public virtual ACE_Asynch_
{
public:
virtual ~ACE_Asynch_Write_Dgram_Result_Impl (void);
/// The number of bytes which were requested at the start of the
/// asynchronous write.
virtual size_t bytes_to_write (void) const = 0;
/// Message block which contains the sent data
virtual ACE_Message_Block *message_block (void) const = 0;
/// The flags using in the write
virtual int flags (void) const = 0;
/// I/O handle used for writing.
virtual ACE_HANDLE handle (void) const = 0;
protected:
/// Do-nothing constructor.
ACE_Asynch_Write_Dgram_Result_Impl (void);
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Asynch_IO_Impl.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_IO_IMPL_H */

View File

@@ -1,106 +1,88 @@
// -*- C++ -*-
//
// $Id: Asynch_IO_Impl.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Asynch_Result_Impl::ACE_Asynch_Result_Impl (void)
{
}
ACE_INLINE
ACE_Asynch_Operation_Impl::ACE_Asynch_Operation_Impl (void)
{
}
ACE_INLINE
ACE_Asynch_Read_Stream_Impl::ACE_Asynch_Read_Stream_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Read_Stream_Result_Impl::ACE_Asynch_Read_Stream_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Write_Stream_Impl::ACE_Asynch_Write_Stream_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Write_Stream_Result_Impl::ACE_Asynch_Write_Stream_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Read_File_Impl::ACE_Asynch_Read_File_Impl (void)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Read_Stream_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Read_File_Result_Impl::ACE_Asynch_Read_File_Result_Impl (void)
: ACE_Asynch_Result_Impl (),
ACE_Asynch_Read_Stream_Result_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Write_File_Impl::ACE_Asynch_Write_File_Impl (void)
: ACE_Asynch_Operation_Impl (),
ACE_Asynch_Write_Stream_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Write_File_Result_Impl::ACE_Asynch_Write_File_Result_Impl (void)
: ACE_Asynch_Result_Impl (),
ACE_Asynch_Write_Stream_Result_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Accept_Impl::ACE_Asynch_Accept_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Accept_Result_Impl::ACE_Asynch_Accept_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Connect_Impl::ACE_Asynch_Connect_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Connect_Result_Impl::ACE_Asynch_Connect_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Transmit_File_Impl::ACE_Asynch_Transmit_File_Impl (void)
: ACE_Asynch_Operation_Impl ()
{
}
ACE_INLINE
ACE_Asynch_Transmit_File_Result_Impl::ACE_Asynch_Transmit_File_Result_Impl (void)
: ACE_Asynch_Result_Impl ()
{
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,25 +1,18 @@
// $Id: Asynch_Pseudo_Task.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Asynch_Pseudo_Task.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_signal.h"
ACE_RCSID(ace, Asynch_Pseudo_Task, "$Id: Asynch_Pseudo_Task.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task ()
: select_reactor_ (), // should be initialized before reactor_
reactor_ (&select_reactor_, 0) // don't delete implementation
{
}
ACE_Asynch_Pseudo_Task::~ACE_Asynch_Pseudo_Task ()
{
this->stop ();
}
int
ACE_Asynch_Pseudo_Task::start (void)
{
@@ -28,49 +21,37 @@ ACE_Asynch_Pseudo_Task::start (void)
ACE_TEXT ("%N:%l:%p\n"),
ACE_TEXT ("start reactor is not initialized")),
-1);
return this->activate () == -1 ? -1 : 0; // If started, return 0
}
int
ACE_Asynch_Pseudo_Task::stop (void)
{
if (this->thr_count () == 0) // already stopped
return 0;
if (this->reactor_.end_reactor_event_loop () == -1)
return -1;
this->wait ();
this->reactor_.close ();
return 0;
}
int
ACE_Asynch_Pseudo_Task::svc (void)
{
#if !defined (ACE_WIN32)
sigset_t RT_signals;
sigemptyset (&RT_signals);
for (int si = ACE_SIGRTMIN; si <= ACE_SIGRTMAX; si++)
sigaddset (&RT_signals, si);
if (ACE_OS::pthread_sigmask (SIG_BLOCK, &RT_signals, 0) != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Error:(%P | %t):%p\n"),
ACE_TEXT ("pthread_sigmask")));
#endif
reactor_.owner (ACE_Thread::self ());
reactor_.run_reactor_event_loop ();
return 0;
}
int
ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle,
ACE_Event_Handler *handler,
@@ -80,10 +61,8 @@ ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle,
// Register the handler with the reactor.
if (-1 == this->reactor_.register_handler (handle, handler, mask))
return -1;
if (flg_suspend == 0)
return 0;
// Suspend the handle now. Enable only when the accept is issued
// by the application.
if (this->reactor_.suspend_handler (handle) == -1)
@@ -96,10 +75,8 @@ ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle,
| ACE_Event_Handler::DONT_CALL);
return -1;
}
return 0;
}
int
ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_HANDLE handle)
{
@@ -107,25 +84,21 @@ ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_HANDLE handle)
ACE_Event_Handler::ALL_EVENTS_MASK
| ACE_Event_Handler::DONT_CALL);
}
int
ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_Handle_Set &set)
{
return this->reactor_.remove_handler (set, ACE_Event_Handler::ALL_EVENTS_MASK
| ACE_Event_Handler::DONT_CALL);
}
int
ACE_Asynch_Pseudo_Task::suspend_io_handler (ACE_HANDLE handle)
{
return this->reactor_.suspend_handler (handle);
}
int
ACE_Asynch_Pseudo_Task::resume_io_handler (ACE_HANDLE handle)
{
return this->reactor_.resume_handler (handle);
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Asynch_Pseudo_Task.h
@@ -9,31 +8,23 @@
* @author Alexander Libman <alibman@ihug.com.au>
*/
//=============================================================================
#ifndef ACE_ASYNCH_PSEUDO_TASK_H
#define ACE_ASYNCH_PSEUDO_TASK_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Reactor.h"
#include "ace/Select_Reactor.h"
#include "ace/Task.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/*
* Specialization hook to replace the Reactor with the
* concrete Reactor implementation, e.g., select_st,
* select_mt etc.
*/
//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK
/**
* @class ACE_Asynch_Pseudo_Task
*
@@ -43,32 +34,23 @@ class ACE_Export ACE_Asynch_Pseudo_Task : public ACE_Task<ACE_NULL_SYNCH>
public:
ACE_Asynch_Pseudo_Task();
virtual ~ACE_Asynch_Pseudo_Task();
int start (void);
int stop (void);
int register_io_handler (ACE_HANDLE handle,
ACE_Event_Handler *handler,
ACE_Reactor_Mask mask,
int flg_suspend);
int remove_io_handler (ACE_HANDLE handle);
int remove_io_handler (ACE_Handle_Set &set);
int resume_io_handler (ACE_HANDLE handle);
int suspend_io_handler (ACE_HANDLE handle);
protected:
virtual int svc (void);
/// Should be initialized before reactor_
ACE_Select_Reactor select_reactor_;
ACE_Reactor reactor_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* ACE_ASYNCH_PSEUDO_TASK_H */

View File

@@ -1,31 +1,23 @@
// $Id: Atomic_Op.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Atomic_Op.h"
#include "ace/OS_NS_unistd.h"
ACE_RCSID (ace,
Atomic_Op,
"$Id: Atomic_Op.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if !defined (__ACE_INLINE__)
#include "ace/Atomic_Op.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_HAS_BUILTIN_ATOMIC_OP)
#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC)
# include "ace/Atomic_Op_Sparc.h"
#endif /* ACE_INCLUDE_ATOMIC_OP_SPARC */
namespace {
#if defined (_MSC_VER)
// Disable "no return value" warning, as we will be putting
// the return values directly into the EAX register.
#pragma warning (push)
#pragma warning (disable: 4035)
#endif /* _MSC_VER */
long
single_cpu_increment (volatile long *value)
{
@@ -49,7 +41,6 @@ single_cpu_increment (volatile long *value)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
long
single_cpu_decrement (volatile long *value)
{
@@ -73,7 +64,6 @@ single_cpu_decrement (volatile long *value)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
long
single_cpu_exchange (volatile long *value, long rhs)
{
@@ -96,7 +86,6 @@ single_cpu_exchange (volatile long *value, long rhs)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
long
single_cpu_exchange_add (volatile long *value, long rhs)
{
@@ -138,7 +127,6 @@ single_cpu_exchange_add (volatile long *value, long rhs)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
long
multi_cpu_increment (volatile long *value)
{
@@ -156,7 +144,6 @@ multi_cpu_increment (volatile long *value)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
long
multi_cpu_decrement (volatile long *value)
{
@@ -174,7 +161,6 @@ multi_cpu_decrement (volatile long *value)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
long
multi_cpu_exchange (volatile long *value, long rhs)
{
@@ -193,7 +179,6 @@ multi_cpu_exchange (volatile long *value, long rhs)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
long
multi_cpu_exchange_add (volatile long *value, long rhs)
{
@@ -230,20 +215,15 @@ multi_cpu_exchange_add (volatile long *value, long rhs)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_INTEL_ASSEMBLY*/
}
#if defined (_MSC_VER)
#pragma warning (pop)
#endif /* _MSC_VER */
} // end namespace
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::increment_fn_) (volatile long *) = multi_cpu_increment;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::decrement_fn_) (volatile long *) = multi_cpu_decrement;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::exchange_fn_) (volatile long *, long) = multi_cpu_exchange;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::exchange_add_fn_) (volatile long *, long) = multi_cpu_exchange_add;
void
ACE_Atomic_Op<ACE_Thread_Mutex, long>::init_functions (void)
{
@@ -262,7 +242,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::init_functions (void)
exchange_add_fn_ = multi_cpu_exchange_add;
}
}
void
ACE_Atomic_Op<ACE_Thread_Mutex, long>::dump (void) const
{
@@ -271,12 +250,10 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
long (*ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::increment_fn_) (volatile long *) = multi_cpu_increment;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::decrement_fn_) (volatile long *) = multi_cpu_decrement;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::exchange_fn_) (volatile long *, long) = multi_cpu_exchange;
long (*ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::exchange_add_fn_) (volatile long *, long) = multi_cpu_exchange_add;
void
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::init_functions (void)
{
@@ -295,7 +272,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::init_functions (void)
exchange_add_fn_ = multi_cpu_exchange_add;
}
}
void
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::dump (void) const
{
@@ -304,8 +280,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Atomic_Op.h
@@ -9,22 +8,16 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//=============================================================================
#ifndef ACE_ATOMIC_OP_H
#define ACE_ATOMIC_OP_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Thread_Mutex.h"
// Include the templates here.
#include "ace/Atomic_Op_T.h"
// Determine whether builtin atomic op support is
// available on this platform.
#if defined (ACE_HAS_THREADS)
@@ -45,11 +38,8 @@
# define ACE_HAS_BUILTIN_ATOMIC_OP
# endif /* WIN32 */
#endif /* ACE_HAS_THREADS */
#if defined (ACE_HAS_BUILTIN_ATOMIC_OP)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Atomic_Op<ACE_Thread_Mutex, long>
*
@@ -65,90 +55,63 @@ class ACE_Export ACE_Atomic_Op<ACE_Thread_Mutex, long>
public:
/// Initialize <value_> to 0.
ACE_Atomic_Op (void);
/// Initialize <value_> to c.
ACE_Atomic_Op (long c);
/// Manage copying...
ACE_Atomic_Op (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &c);
/// Atomically pre-increment <value_>.
long operator++ (void);
/// Atomically post-increment <value_>.
long operator++ (int);
/// Atomically increment <value_> by rhs.
long operator+= (long rhs);
/// Atomically pre-decrement <value_>.
long operator-- (void);
/// Atomically post-decrement <value_>.
long operator-- (int);
/// Atomically decrement <value_> by rhs.
long operator-= (long rhs);
/// Atomically compare <value_> with rhs.
bool operator== (long rhs) const;
/// Atomically compare <value_> with rhs.
bool operator!= (long rhs) const;
/// Atomically check if <value_> greater than or equal to rhs.
bool operator>= (long rhs) const;
/// Atomically check if <value_> greater than rhs.
bool operator> (long rhs) const;
/// Atomically check if <value_> less than or equal to rhs.
bool operator<= (long rhs) const;
/// Atomically check if <value_> less than rhs.
bool operator< (long rhs) const;
/// Atomically assign rhs to <value_>.
ACE_Atomic_Op<ACE_Thread_Mutex, long> &operator= (long rhs);
/// Atomically assign <rhs> to <value_>.
ACE_Atomic_Op<ACE_Thread_Mutex, long> &operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs);
/// Explicitly return <value_>.
long value (void) const;
/// Dump the state of an object.
void dump (void) const;
/// Explicitly return <value_> (by reference).
volatile long &value_i (void);
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
/// Used during ACE object manager initialization to optimize the fast
/// atomic op implementation according to the number of CPUs.
static void init_functions (void);
private:
// This function cannot be supported by this template specialization.
// If you need access to an underlying lock, use the ACE_Atomic_Op_Ex
// template instead.
ACE_Thread_Mutex &mutex (void);
private:
/// Current object decorated by the atomic op.
volatile long value_;
// Pointers to selected atomic op implementations.
static long (*increment_fn_) (volatile long *);
static long (*decrement_fn_) (volatile long *);
static long (*exchange_fn_) (volatile long *, long);
static long (*exchange_add_fn_) (volatile long *, long);
};
/**
* @class ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>
*
@@ -164,98 +127,68 @@ class ACE_Export ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>
public:
/// Initialize <value_> to 0.
ACE_Atomic_Op (void);
/// Initialize <value_> to c.
ACE_Atomic_Op (unsigned long c);
/// Manage copying...
ACE_Atomic_Op (const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &c);
/// Atomically pre-increment <value_>.
unsigned long operator++ (void);
/// Atomically post-increment <value_>.
unsigned long operator++ (int);
/// Atomically increment <value_> by rhs.
unsigned long operator+= (unsigned long rhs);
/// Atomically pre-decrement <value_>.
unsigned long operator-- (void);
/// Atomically post-decrement <value_>.
unsigned long operator-- (int);
/// Atomically decrement <value_> by rhs.
unsigned long operator-= (unsigned long rhs);
/// Atomically compare <value_> with rhs.
bool operator== (unsigned long rhs) const;
/// Atomically compare <value_> with rhs.
bool operator!= (unsigned long rhs) const;
/// Atomically check if <value_> greater than or equal to rhs.
bool operator>= (unsigned long rhs) const;
/// Atomically check if <value_> greater than rhs.
bool operator> (unsigned long rhs) const;
/// Atomically check if <value_> less than or equal to rhs.
bool operator<= (unsigned long rhs) const;
/// Atomically check if <value_> less than rhs.
bool operator< (unsigned long rhs) const;
/// Atomically assign rhs to <value_>.
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &operator= (unsigned long rhs);
/// Atomically assign <rhs> to <value_>.
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &rhs);
/// Explicitly return <value_>.
unsigned long value (void) const;
/// Dump the state of an object.
void dump (void) const;
/// Explicitly return <value_> (by reference).
volatile unsigned long &value_i (void);
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
/// Used during ACE object manager initialization to optimize the fast
/// atomic op implementation according to the number of CPUs.
static void init_functions (void);
private:
// This function cannot be supported by this template specialization.
// If you need access to an underlying lock, use the ACE_Atomic_Op_Ex
// template instead.
ACE_Thread_Mutex &mutex (void);
private:
/// Current object decorated by the atomic op.
volatile unsigned long value_;
// Pointers to selected atomic op implementations.
static long (*increment_fn_) (volatile long *);
static long (*decrement_fn_) (volatile long *);
static long (*exchange_fn_) (volatile long *, long);
static long (*exchange_add_fn_) (volatile long *, long);
};
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */
#if defined (__ACE_INLINE__)
#include "ace/Atomic_Op.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /*ACE_ATOMIC_OP_H*/

View File

@@ -1,36 +1,28 @@
// -*- C++ -*-
//
// $Id: Atomic_Op.inl 80826 2008-03-04 14:51:23Z wotte $
#if defined (ACE_HAS_BUILTIN_ATOMIC_OP)
#if defined (ACE_HAS_INTRINSIC_INTERLOCKED)
# include "ace/os_include/os_intrin.h"
#pragma intrinsic (_InterlockedExchange, _InterlockedExchangeAdd, _InterlockedIncrement, _InterlockedDecrement)
#endif /* ACE_HAS_INTRINSIC_INTERLOCKED */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (void)
: value_ (0)
{
}
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (long c)
: value_ (c)
{
}
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (
const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs)
: value_ (rhs.value_)
{
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (void)
{
@@ -42,13 +34,11 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (void)
return (*increment_fn_) (&this->value_);
#endif /* WIN32 */
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (int)
{
return ++*this - 1;
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (void)
{
@@ -60,13 +50,11 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (void)
return (*decrement_fn_) (&this->value_);
#endif /* WIN32 */
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (int)
{
return --*this + 1;
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator+= (long rhs)
{
@@ -80,7 +68,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator+= (long rhs)
return (*exchange_add_fn_) (&this->value_, rhs) + rhs;
#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-= (long rhs)
{
@@ -94,43 +81,36 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-= (long rhs)
return (*exchange_add_fn_) (&this->value_, -rhs) - rhs;
#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator== (long rhs) const
{
return (this->value_ == rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator!= (long rhs) const
{
return (this->value_ != rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator>= (long rhs) const
{
return (this->value_ >= rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator> (long rhs) const
{
return (this->value_ > rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator<= (long rhs) const
{
return (this->value_ <= rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator< (long rhs) const
{
return (this->value_ < rhs);
}
ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, long> &
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (long rhs)
{
@@ -143,7 +123,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (long rhs)
#endif /* WIN32 */
return *this;
}
ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, long> &
ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (
const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs)
@@ -157,39 +136,33 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (
#endif /* WIN32 */
return *this;
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::value (void) const
{
return this->value_;
}
ACE_INLINE volatile long &
ACE_Atomic_Op<ACE_Thread_Mutex, long>::value_i (void)
{
return this->value_;
}
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (void)
: value_ (0)
{
}
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (unsigned long c)
: value_ (c)
{
}
ACE_INLINE
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (
const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &rhs)
: value_ (rhs.value_)
{
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator++ (void)
{
@@ -201,13 +174,11 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator++ (void)
return static_cast<unsigned long> ((*increment_fn_) (reinterpret_cast<volatile long *> (&this->value_)));
#endif /* WIN32 */
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator++ (int)
{
return ++*this - 1;
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-- (void)
{
@@ -219,13 +190,11 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-- (void)
return static_cast<unsigned long> ((*decrement_fn_) (reinterpret_cast<volatile long *> (&this->value_)));
#endif /* WIN32 */
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-- (int)
{
return --*this + 1;
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator+= (unsigned long rhs)
{
@@ -239,7 +208,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator+= (unsigned long rhs)
return static_cast<unsigned long> ((*exchange_add_fn_) (reinterpret_cast<volatile long *> (&this->value_), rhs)) + rhs;
#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-= (unsigned long rhs)
{
@@ -254,43 +222,36 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-= (unsigned long rhs)
return static_cast<unsigned long> ((*exchange_add_fn_) (reinterpret_cast<volatile long *> (&this->value_), -l_rhs)) - rhs;
#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator== (unsigned long rhs) const
{
return (this->value_ == rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator!= (unsigned long rhs) const
{
return (this->value_ != rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator>= (unsigned long rhs) const
{
return (this->value_ >= rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator> (unsigned long rhs) const
{
return (this->value_ > rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator<= (unsigned long rhs) const
{
return (this->value_ <= rhs);
}
ACE_INLINE bool
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator< (unsigned long rhs) const
{
return (this->value_ < rhs);
}
ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (unsigned long rhs)
{
@@ -303,7 +264,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (unsigned long rhs)
#endif /* WIN32 */
return *this;
}
ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (
const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &rhs)
@@ -317,19 +277,15 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (
#endif /* WIN32 */
return *this;
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::value (void) const
{
return this->value_;
}
ACE_INLINE volatile unsigned long &
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::value_i (void)
{
return this->value_;
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */

View File

@@ -6,9 +6,7 @@
* Portions of this code are based on atomic operations found in the
* linux kernel source code.
*/
#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC)
#if defined(__i386) && defined(__SUNPRO_C)
static void
__sunpro_asm_code() {
@@ -23,7 +21,6 @@ ace_atomic_add_long: \n\
addl 0x00000008(%esp), %eax \n\
ret \n\
");
__asm("\n\
.globl ace_atomic_swap_long \n\
.type ace_atomic_swap_long,@function \n\
@@ -34,7 +31,6 @@ ace_atomic_swap_long: \n\
xchg %eax, (%edx) \n\
ret \n\
");
__asm("\n\
.globl ace_atomic_swap_add_long \n\
.type ace_atomic_swap_add_long,@function \n\
@@ -46,9 +42,7 @@ ace_atomic_swap_add_long: \n\
ret \n\
");
}
#elif defined(__x86_64) && defined(__SUNPRO_C)
static void
__sunpro_asm_code() {
__asm("\n\
@@ -61,7 +55,6 @@ ace_atomic_add_long: \n\
addq %rsi, %rax \n\
ret \n\
");
__asm("\n\
.globl ace_atomic_swap_long \n\
.type ace_atomic_swap_long,@function \n\
@@ -71,7 +64,6 @@ ace_atomic_swap_long: \n\
movq %rsi, %rax \n\
ret \n\
");
__asm("\n\
.globl ace_atomic_swap_add_long \n\
.type ace_atomic_swap_add_long,@function \n\
@@ -82,9 +74,7 @@ ace_atomic_swap_add_long: \n\
ret \n\
");
}
#elif defined (__sparcv9)
unsigned long
ace_atomic_add_long (volatile unsigned long *dest, long rhs)
{
@@ -99,7 +89,6 @@ ace_atomic_add_long (volatile unsigned long *dest, long rhs)
"retl\n"
"add %o2, %o1, %o0\n");
}
unsigned long
ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs)
{
@@ -114,7 +103,6 @@ ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs)
"retl\n"
"mov %o3, %o0\n");
}
unsigned long
ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs)
{
@@ -130,9 +118,7 @@ ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs)
"retl\n"
"mov %o4, %o0\n");
}
#else
unsigned long
ace_atomic_add_long (volatile unsigned long *dest, long rhs)
{
@@ -147,7 +133,6 @@ ace_atomic_add_long (volatile unsigned long *dest, long rhs)
"retl\n"
"add %o2, %o1, %o0\n");
}
unsigned long
ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs)
{
@@ -162,7 +147,6 @@ ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs)
"retl\n"
"mov %o3, %o0\n");
}
unsigned long
ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs)
{
@@ -178,9 +162,7 @@ ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs)
"retl\n"
"mov %o4, %o0\n");
}
# endif /* __sparcv9 */
#elif !defined (__GNUC__) && !defined (__INTEL_COMPILER)
/* Make compilers stop complaining about an empty translation unit */
static int shut_up_compiler = 0;

View File

@@ -1,15 +1,12 @@
/* -*- C++ -*- */
// $Id: Atomic_Op_Sparc.h 80826 2008-03-04 14:51:23Z wotte $
#ifndef ACE_ATOMIC_OP_SPARC_H
#define ACE_ATOMIC_OP_SPARC_H
extern "C"
{
unsigned long ace_atomic_add_long (volatile unsigned long *dest, long rhs);
unsigned long ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs);
unsigned long ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs);
}
#endif /* ACE_ATOMIC_OP_SPARC_H */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Atomic_Op_T.h
@@ -9,85 +8,69 @@
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
//=============================================================================
#ifndef ACE_ATOMIC_OP_T_H
#define ACE_ATOMIC_OP_T_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template<typename TYPE>
struct ACE_Type_Traits
{
typedef TYPE const & parameter_type;
};
template<>
struct ACE_Type_Traits<bool>
{
typedef bool parameter_type;
};
template<>
struct ACE_Type_Traits<char>
{
typedef char parameter_type;
};
template<>
struct ACE_Type_Traits<signed char>
{
typedef signed char parameter_type;
};
template<>
struct ACE_Type_Traits<unsigned char>
{
typedef unsigned char parameter_type;
};
template<>
struct ACE_Type_Traits<short>
{
typedef short parameter_type;
};
template<>
struct ACE_Type_Traits<unsigned short>
{
typedef unsigned short parameter_type;
};
template<>
struct ACE_Type_Traits<int>
{
typedef int parameter_type;
};
template<>
struct ACE_Type_Traits<unsigned int>
{
typedef unsigned int parameter_type;
};
template<>
struct ACE_Type_Traits<long>
{
typedef long parameter_type;
};
template<>
struct ACE_Type_Traits<unsigned long>
{
typedef unsigned long parameter_type;
};
#ifndef ACE_LACKS_LONGLONG_T
template<>
struct ACE_Type_Traits<long long>
@@ -95,7 +78,6 @@ struct ACE_Type_Traits<long long>
typedef long long parameter_type;
};
#endif /* !ACE_LACKS_LONGLONG_T */
#if !defined (ACE_LACKS_LONGLONG_T) \
&& !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
template<>
@@ -104,31 +86,26 @@ struct ACE_Type_Traits<unsigned long long>
typedef unsigned long long parameter_type;
};
#endif /* !ACE_LACKS_LONGLONG_T && !ACE_LACKS_UNSIGNEDLONGLONG_T */
template<>
struct ACE_Type_Traits<float>
{
typedef float parameter_type;
};
template<>
struct ACE_Type_Traits<double>
{
typedef double parameter_type;
};
template<>
struct ACE_Type_Traits<long double>
{
typedef long double parameter_type;
};
template<typename TYPE>
struct ACE_Type_Traits<TYPE*>
{
typedef TYPE* parameter_type;
};
/**
* @class ACE_Atomic_Op_Ex
*
@@ -151,74 +128,50 @@ template <class ACE_LOCK, typename TYPE>
class ACE_Atomic_Op_Ex
{
public:
typedef typename ACE_Type_Traits<TYPE>::parameter_type arg_type;
// = Initialization methods.
/// Initialize @c value_ to 0.
ACE_Atomic_Op_Ex (ACE_LOCK & mtx);
/// Initialize @c value_ to c.
ACE_Atomic_Op_Ex (ACE_LOCK & mtx, arg_type c);
// = Accessors.
/// Atomically pre-increment @c value_.
TYPE operator++ (void);
/// Atomically post-increment @c value_.
TYPE operator++ (int);
/// Atomically increment @c value_ by rhs.
TYPE operator+= (arg_type rhs);
/// Atomically pre-decrement @c value_.
TYPE operator-- (void);
/// Atomically post-decrement @c value_.
TYPE operator-- (int);
/// Atomically decrement @c value_ by rhs.
TYPE operator-= (arg_type rhs);
/// Atomically compare @c value_ with rhs.
bool operator== (arg_type rhs) const;
/// Atomically compare @c value_ with rhs.
bool operator!= (arg_type rhs) const;
/// Atomically check if @c value_ greater than or equal to rhs.
bool operator>= (arg_type rhs) const;
/// Atomically check if @c value_ greater than rhs.
bool operator> (arg_type rhs) const;
/// Atomically check if @c value_ less than or equal to rhs.
bool operator<= (arg_type rhs) const;
/// Atomically check if @c value_ less than rhs.
bool operator< (arg_type rhs) const;
/// Atomically assign rhs to @c value_.
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &operator= (arg_type rhs);
/// Atomically assign <rhs> to @c value_.
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &operator= (
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> const & rhs);
/// Explicitly return @c value_.
TYPE value (void) const;
/// Dump the state of an object.
void dump (void) const;
// ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
/// Manage copying...
ACE_Atomic_Op_Ex (ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> const &);
/**
* Returns a reference to the underlying <ACE_LOCK>. This makes it
* possible to acquire the lock explicitly, which can be useful in
@@ -227,7 +180,6 @@ public:
* name would be lock_, but HP/C++ will choke on that!
*/
ACE_LOCK & mutex (void);
/**
* Explicitly return @c value_ (by reference). This gives the user
* full, unrestricted access to the underlying value. This method
@@ -235,15 +187,12 @@ public:
* lock. Use with care ;-)
*/
TYPE & value_i (void);
private:
/// Type of synchronization mechanism.
ACE_LOCK & mutex_;
/// Current object decorated by the atomic op.
TYPE value_;
};
/**
* @class ACE_Atomic_Op
*
@@ -262,67 +211,46 @@ template <class ACE_LOCK, typename TYPE>
class ACE_Atomic_Op
{
public:
typedef typename ACE_Type_Traits<TYPE>::parameter_type arg_type;
/// Initialize @c value_ to 0.
ACE_Atomic_Op (void);
/// Initialize @c value_ to c.
ACE_Atomic_Op (arg_type c);
/// Manage copying...
ACE_Atomic_Op (ACE_Atomic_Op<ACE_LOCK, TYPE> const & c);
/// Atomically assign rhs to @c value_.
ACE_Atomic_Op<ACE_LOCK, TYPE> & operator= (arg_type rhs);
/// Atomically assign <rhs> to @c value_.
ACE_Atomic_Op<ACE_LOCK, TYPE> & operator= (
ACE_Atomic_Op<ACE_LOCK, TYPE> const & rhs);
/// Atomically pre-increment @c value_.
TYPE operator++ (void);
/// Atomically post-increment @c value_.
TYPE operator++ (int);
/// Atomically increment @c value_ by rhs.
TYPE operator+= (arg_type rhs);
/// Atomically pre-decrement @c value_.
TYPE operator-- (void);
/// Atomically post-decrement @c value_.
TYPE operator-- (int);
/// Atomically decrement @c value_ by rhs.
TYPE operator-= (arg_type rhs);
/// Atomically compare @c value_ with rhs.
bool operator== (arg_type rhs) const;
/// Atomically compare @c value_ with rhs.
bool operator!= (arg_type rhs) const;
/// Atomically check if @c value_ greater than or equal to rhs.
bool operator>= (arg_type rhs) const;
/// Atomically check if @c value_ greater than rhs.
bool operator> (arg_type rhs) const;
/// Atomically check if @c value_ less than or equal to rhs.
bool operator<= (arg_type rhs) const;
/// Atomically check if @c value_ less than rhs.
bool operator< (arg_type rhs) const;
/// Explicitly return @c value_.
TYPE value (void) const;
/// Dump the state of an object.
void dump (void) const;
/**
* Returns a reference to the underlying <ACE_LOCK>. This makes it
* possible to acquire the lock explicitly, which can be useful in
@@ -334,7 +262,6 @@ public:
* using the ACE_Atomic_Op_Ex template instead.
*/
ACE_LOCK & mutex (void);
/**
* Explicitly return @c value_ (by reference). This gives the user
* full, unrestricted access to the underlying value. This method
@@ -342,29 +269,22 @@ public:
* lock. Use with care ;-)
*/
TYPE & value_i (void);
private:
/// Type of synchronization mechanism.
ACE_LOCK own_mutex_;
/// Underlying atomic op implementation.
ACE_Atomic_Op_Ex <ACE_LOCK, TYPE> impl_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Atomic_Op_T.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Atomic_Op_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Atomic_Op_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /*ACE_ATOMIC_OP_T_H*/

View File

@@ -1,17 +1,12 @@
// -*- C++ -*-
//
// $Id: Atomic_Op_T.inl 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Guard_T.h"
#include <algorithm>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
//
// ACE_Atomic_Op_Ex inline functions
//
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (void)
@@ -20,7 +15,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (void)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return ++this->value_;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator+= (
@@ -30,7 +24,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator+= (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_ += rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (void)
@@ -39,7 +32,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (void)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return --this->value_;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-= (
@@ -49,7 +41,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-= (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_ -= rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex (
@@ -59,7 +50,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex (
{
// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex");
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (int)
@@ -68,7 +58,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (int)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_++;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (int)
@@ -77,7 +66,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (int)
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_--;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator== (
@@ -87,7 +75,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator== (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ == rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!= (
@@ -96,7 +83,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!= (
// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!=");
return !(*this == rhs);
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>= (
@@ -106,7 +92,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>= (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ >= rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator> (
@@ -116,7 +101,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator> (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ > rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<= (
@@ -126,7 +110,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<= (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ <= rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator< (
@@ -136,22 +119,17 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator< (
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false);
return this->value_ < rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> const & rhs)
{
// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator=");
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> tmp (rhs);
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this);
std::swap (this->value_, tmp.value_);
return *this;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value (void) const
@@ -160,7 +138,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value (void) const
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
return this->value_;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE &
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value_i (void)
@@ -171,7 +148,6 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value_i (void)
// lock. Use with care ;-)
return this->value_;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (
@@ -182,11 +158,9 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (
this->value_ = rhs;
return *this;
}
//
// ACE_Atomic_Op inline functions
//
template <class ACE_LOCK, class TYPE> ACE_INLINE
ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (
ACE_Atomic_Op<ACE_LOCK, TYPE> const & rhs)
@@ -195,7 +169,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (
// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op");
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op<ACE_LOCK, TYPE> &
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (
@@ -204,7 +177,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (
this->impl_ = i;
return *this;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op<ACE_LOCK, TYPE> &
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (
@@ -213,21 +185,18 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (
this->impl_ = rhs.impl_;
return *this;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (void)
{
return ++this->impl_;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (int)
{
return this->impl_++;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+= (
@@ -235,21 +204,18 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+= (
{
return this->impl_ += rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (void)
{
return --this->impl_;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (int)
{
return this->impl_--;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-= (
@@ -257,7 +223,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-= (
{
return this->impl_ -= rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator== (
@@ -265,7 +230,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator== (
{
return this->impl_ == rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator!= (
@@ -273,7 +237,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator!= (
{
return this->impl_ != rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>= (
@@ -281,7 +244,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>= (
{
return this->impl_ >= rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator> (
@@ -289,7 +251,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator> (
{
return this->impl_ > rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<= (
@@ -297,7 +258,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<= (
{
return this->impl_ <= rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE bool
ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< (
@@ -305,14 +265,12 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< (
{
return this->impl_ < rhs;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::value (void) const
{
return this->impl_.value ();
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE void
ACE_Atomic_Op<ACE_LOCK, TYPE>::dump (void) const
@@ -322,19 +280,16 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::dump (void) const
#endif /* ACE_HAS_DUMP */
return;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE ACE_LOCK &
ACE_Atomic_Op<ACE_LOCK, TYPE>::mutex (void)
{
return this->own_mutex_;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE &
ACE_Atomic_Op<ACE_LOCK, TYPE>::value_i (void)
{
return this->impl_.value_i ();
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,17 +1,12 @@
// $Id: Auto_Event.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Auto_Event.h"
#if !defined (__ACE_INLINE__)
#include "ace/Auto_Event.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID (ace,
Auto_Event,
"$Id: Auto_Event.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Auto_Event::ACE_Auto_Event (int initial_state,
int type,
const char *name,
@@ -23,7 +18,6 @@ ACE_Auto_Event::ACE_Auto_Event (int initial_state,
arg)
{
}
#if defined (ACE_HAS_WCHAR)
ACE_Auto_Event::ACE_Auto_Event (int initial_state,
int type,
@@ -37,7 +31,6 @@ ACE_Auto_Event::ACE_Auto_Event (int initial_state,
{
}
#endif /* ACE_HAS_WCHAR */
void
ACE_Auto_Event::dump (void) const
{
@@ -45,6 +38,5 @@ ACE_Auto_Event::dump (void) const
ACE_Event::dump ();
#endif /* ACE_HAS_DUMP */
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//==========================================================================
/**
* @file Auto_Event.h
@@ -11,21 +10,15 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
#ifndef ACE_AUTO_EVENT_H
#define ACE_AUTO_EVENT_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Event.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Auto_Event
*
@@ -44,7 +37,6 @@ public:
int type = USYNC_THREAD,
const char *name = 0,
void *arg = 0);
#if defined (ACE_HAS_WCHAR)
/// Constructor which will create auto event (wchar_t version)
ACE_Auto_Event (int initial_state,
@@ -52,23 +44,17 @@ public:
const wchar_t *name,
void *arg = 0);
#endif /* ACE_HAS_WCHAR */
/// Default dtor.
~ACE_Auto_Event (void);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks
ACE_ALLOC_HOOK_DECLARE;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Auto_Event.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_AUTO_EVENT_H */

View File

@@ -1,12 +1,9 @@
// -*- C++ -*-
//
// $Id: Auto_Event.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Auto_Event::~ACE_Auto_Event (void)
{
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -11,17 +11,12 @@
#ifndef ACE_AUTO_FUNCTOR_H
#define ACE_AUTO_FUNCTOR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Global_Macros.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
namespace ACE_Utils
{
/**
@@ -35,10 +30,8 @@ struct Auto_Functor_Ref
{
X * p_;
Functor f_;
Auto_Functor_Ref(X * p, Functor f);
};
/**
* @class Auto_Functor
*
@@ -60,69 +53,45 @@ class Auto_Functor
public:
typedef X element_type;
typedef Functor functor_type;
/// Constructor
explicit Auto_Functor (X * p = 0,
Functor functor = Functor()); // throw()
Auto_Functor (Auto_Functor & rhs); // throw()
Auto_Functor<X,Functor>& operator= (Auto_Functor & rhs); // throw()
#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
template<typename Y>
Auto_Functor(Auto_Functor<Y,Functor>& rhs); // throw()
template<typename Y>
Auto_Functor<X,Functor>& operator= (Auto_Functor<Y,Functor>& rhs); // throw()
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
~Auto_Functor(); // throw()
X & operator*() const; // throw()
X * operator->() const; // throw()
X * get(); // throw()
X * release(); // throw()
void reset (X * p = 0); // throw()
void reset (X * p, Functor f); // throw()
Functor const & functor() const; // throw()
Auto_Functor(Auto_Functor_Ref<X,Functor> rhs); // throw()
Auto_Functor<X,Functor> & operator=(Auto_Functor_Ref<X,Functor> rhs); // throw()
#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
template<typename Y> operator Auto_Functor_Ref<Y,Functor>(); // throw()
template<typename Y> operator Auto_Functor<Y,Functor>(); // throw()
#else
operator Auto_Functor_Ref<X,Functor>(); // throw()
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
private:
X * p_;
Functor f_;
};
} // namespace ACE_Utils
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined(__ACE_INLINE__)
# include "ace/Auto_Functor.inl"
#endif /* __ACE_INLINE__ */
#if defined(ACE_TEMPLATES_REQUIRE_SOURCE)
# include "ace/Auto_Functor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#include /**/ "ace/post.h"
#endif /* ACE_AUTO_FUNCTOR_H*/

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: Auto_Functor.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template<typename X, typename Functor> ACE_INLINE
ACE_Utils::Auto_Functor_Ref<X,Functor>::
Auto_Functor_Ref(X * p, Functor f)
@@ -11,21 +9,18 @@ Auto_Functor_Ref(X * p, Functor f)
, f_(f)
{
}
template<typename X, typename Functor> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(X * p, Functor f)
: p_(p)
, f_(f)
{
}
template<typename X, typename Functor> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor & rhs)
: p_(rhs.release())
, f_(rhs.f_)
{
}
template<typename X, typename Functor>
ACE_INLINE ACE_Utils::Auto_Functor<X,Functor>&
ACE_Utils::Auto_Functor<X,Functor>:: operator=(Auto_Functor & rhs)
@@ -34,7 +29,6 @@ ACE_Utils::Auto_Functor<X,Functor>:: operator=(Auto_Functor & rhs)
f_ = rhs.f_;
return *this;
}
#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
template<typename X, typename Functor> template<typename Y> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor<Y,Functor>& rhs)
@@ -42,7 +36,6 @@ ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor<Y,Functor>& rhs)
, f_(rhs.f_)
{
}
template<typename X, typename Functor> template<typename Y>
ACE_INLINE ACE_Utils::Auto_Functor<X,Functor>&
ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor<Y,Functor>& rhs)
@@ -51,27 +44,23 @@ ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor<Y,Functor>& rhs)
return *this;
}
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
template<typename X, typename Functor> ACE_INLINE X &
ACE_Utils::Auto_Functor<X,Functor>::operator*() const
{
return *p_;
}
template<typename X, typename Functor>
ACE_INLINE X *
ACE_Utils::Auto_Functor<X,Functor>::operator->() const
{
return p_;
}
template<typename X, typename Functor>
ACE_INLINE X *
ACE_Utils::Auto_Functor<X,Functor>::get()
{
return p_;
}
template<typename X, typename Functor>
ACE_INLINE X *
ACE_Utils::Auto_Functor<X,Functor>::release()
@@ -80,21 +69,18 @@ ACE_Utils::Auto_Functor<X,Functor>::release()
p_ = 0;
return tmp;
}
template<typename X, typename Functor>
ACE_INLINE Functor const &
ACE_Utils::Auto_Functor<X,Functor>::functor() const
{
return f_;
}
template<typename X, typename Functor> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor_Ref<X,Functor> rhs)
: p_(rhs.p_)
, f_(rhs.f_)
{
}
template<typename X, typename Functor>
ACE_INLINE ACE_Utils::Auto_Functor<X,Functor> &
ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor_Ref<X,Functor> rhs)
@@ -106,29 +92,22 @@ ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor_Ref<X,Functor> rhs)
}
return *this;
}
#if !defined(ACE_LACKS_MEMBER_TEMPLATES)
template<typename X, typename Functor> template<typename Y> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor_Ref<Y,Functor>()
{
return ACE_Utils::Auto_Functor_Ref<Y,Functor>(release(), f_);
}
template<typename X, typename Functor> template<typename Y> ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor<Y,Functor>()
{
return ACE_Utils::Auto_Functor<Y,Functor>(release(), f_);
}
#else
template<typename X, typename Functor>ACE_INLINE
ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor_Ref<X,Functor>()
{
return ACE_Utils::Auto_Functor_Ref<X,Functor>(release(), f_);
}
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Auto_IncDec_T.h
@@ -10,22 +9,15 @@
*/
//=============================================================================
#ifndef ACE_AUTO_INCDEC_T_H
#define ACE_AUTO_INCDEC_T_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Global_Macros.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Auto_IncDec
*
@@ -41,21 +33,16 @@ template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>
class ACE_Auto_IncDec
{
public:
/// Implicitly increment the counter.
ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter);
/// Implicitly decrement the counter.
~ACE_Auto_IncDec (void);
/// Dump the state of an object.
void dump (void) const;
protected:
/// Reference to the <ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> counter
/// we're incrementing/decrementing.
ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter_;
private:
// = Prevent assignment and initialization.
ACE_UNIMPLEMENTED_FUNC (void operator= (const
@@ -63,13 +50,10 @@ private:
ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const
ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &))
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Auto_IncDec_T.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Auto_IncDec_T.cpp"
// On Win32 platforms, this code will be included as template source
@@ -81,12 +65,9 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// specialization code. Also, the specialization code *must* be
// inlined or the compiler will ignore the specializations.
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Auto_IncDec_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_AUTO_INCDEC_T_H */

View File

@@ -1,11 +1,8 @@
// -*- C++ -*-
//
// $Id: Auto_IncDec_T.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Implicitly and automatically increment the counter.
template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> ACE_INLINE
ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>::ACE_Auto_IncDec
(ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter)
@@ -13,13 +10,10 @@ ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>::ACE_Auto_IncDec
{
++this->counter_;
}
// Implicitly and automatically decrement the counter.
template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> ACE_INLINE
ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>::~ACE_Auto_IncDec (void)
{
--this->counter_;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
/* -*- C++ -*- */
//=============================================================================
/**
* @file Auto_Ptr.h
@@ -12,17 +11,13 @@
* @author Dr. Harald M. Mueller <mueller@garwein.hai.siemens.co.at>
*/
//=============================================================================
#ifndef ACE_AUTO_PTR_H
#define ACE_AUTO_PTR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (_MSC_VER)
// Suppress warning e.g. "return type for
// 'ACE_Auto_Array_Pointer<type>::operator ->' is 'type *' (i.e., not a UDT
@@ -32,9 +27,7 @@
# pragma warning(disable: 4284)
#endif /* _MSC_VER */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Auto_Basic_Ptr
*
@@ -46,32 +39,24 @@ class ACE_Auto_Basic_Ptr
{
public:
typedef X element_type;
// = Initialization and termination methods
explicit ACE_Auto_Basic_Ptr (X * p = 0) : p_ (p) {}
ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> & ap);
ACE_Auto_Basic_Ptr<X> &operator= (ACE_Auto_Basic_Ptr<X> & rhs);
~ACE_Auto_Basic_Ptr (void);
// = Accessor methods.
X &operator *() const;
X *get (void) const;
X *release (void);
void reset (X * p = 0);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
X *p_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if !defined (ACE_LACKS_AUTO_PTR) && \
defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \
(ACE_HAS_STANDARD_CPP_LIBRARY != 0)
@@ -81,7 +66,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
using std::auto_ptr;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
#else /* ACE_HAS_STANDARD_CPP_LIBRARY */
/**
* @class auto_ptr
*
@@ -92,18 +76,13 @@ class auto_ptr : public ACE_Auto_Basic_Ptr<X>
{
public:
typedef X element_type;
// = Initialization and termination methods
explicit auto_ptr (X * p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
auto_ptr (auto_ptr<X> & ap) : ACE_Auto_Basic_Ptr<X> (ap.release ()) {}
X *operator-> () const;
};
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @brief Implements the draft C++ standard auto_ptr abstraction.
* This version can be used instead of auto_ptr<T>, and obviates
@@ -115,13 +94,10 @@ class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr <X>
{
public:
typedef X element_type;
// = Initialization and termination methods
explicit ACE_Auto_Ptr (X * p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
X *operator-> () const;
};
/**
* @class ACE_Auto_Basic_Array_Ptr
*
@@ -135,31 +111,24 @@ class ACE_Auto_Basic_Array_Ptr
{
public:
typedef X element_type;
// = Initialization and termination methods.
explicit ACE_Auto_Basic_Array_Ptr (X * p = 0) : p_ (p) {}
ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> & ap);
ACE_Auto_Basic_Array_Ptr<X> &operator= (ACE_Auto_Basic_Array_Ptr<X> & rhs);
~ACE_Auto_Basic_Array_Ptr (void);
// = Accessor methods.
X & operator* () const;
X & operator[] (int i) const;
X * get (void) const;
X * release (void);
void reset (X * p = 0);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
X * p_;
};
/**
* @class ACE_Auto_Array_Ptr
*
@@ -171,15 +140,12 @@ class ACE_Auto_Array_Ptr : public ACE_Auto_Basic_Array_Ptr<X>
{
public:
typedef X element_type;
// = Initialization and termination methods.
explicit ACE_Auto_Array_Ptr (X *p = 0)
: ACE_Auto_Basic_Array_Ptr<X> (p) {}
X *operator-> () const;
};
/**
* @brief Reset given @c auto_ptr element to new element.
*
@@ -206,9 +172,7 @@ ACE_auto_ptr_reset (AUTO_PTR_TYPE & ap,
ap.reset (p);
#endif /* ACE_AUTO_PTR_LACKS_RESET */
}
ACE_END_VERSIONED_NAMESPACE_DECL
// Some platforms have an older version of auto_ptr
// support, which lacks reset, and cannot be disabled
// easily. Portability to these platforms requires
@@ -220,24 +184,19 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// ACE_AUTO_PTR_RESET.
# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \
ACE_auto_ptr_reset (AUTOPTR, NEWPTR);
#if defined (__ACE_INLINE__)
#include "ace/Auto_Ptr.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Auto_Ptr.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Auto_Ptr.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#if defined (_MSC_VER)
// Restore the warning state to what it was before entry.
# pragma warning(pop)
#endif /* _MSC_VER */
#include /**/ "ace/post.h"
#endif /* ACE_AUTO_PTR_H */

View File

@@ -1,11 +1,8 @@
// -*- C++ -*-
//
// $Id: Auto_Ptr.inl 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Global_Macros.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template<class X> ACE_INLINE void
ACE_Auto_Basic_Ptr<X>::dump (void) const
{
@@ -13,7 +10,6 @@ ACE_Auto_Basic_Ptr<X>::dump (void) const
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::dump");
#endif /* ACE_HAS_DUMP */
}
template<class X> ACE_INLINE void
ACE_Auto_Basic_Array_Ptr<X>::dump (void) const
{
@@ -21,21 +17,18 @@ ACE_Auto_Basic_Array_Ptr<X>::dump (void) const
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::dump");
#endif /* ACE_HAS_DUMP */
}
template<class X> ACE_INLINE
ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr<X> &rhs)
: p_ (rhs.release ())
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::ACE_Auto_Basic_Ptr");
}
template<class X> ACE_INLINE X *
ACE_Auto_Basic_Ptr<X>::get (void) const
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::get");
return this->p_;
}
template<class X> ACE_INLINE X *
ACE_Auto_Basic_Ptr<X>::release (void)
{
@@ -44,7 +37,6 @@ ACE_Auto_Basic_Ptr<X>::release (void)
this->p_ = 0;
return old;
}
template<class X> ACE_INLINE void
ACE_Auto_Basic_Ptr<X>::reset (X *p)
{
@@ -53,7 +45,6 @@ ACE_Auto_Basic_Ptr<X>::reset (X *p)
delete this->get ();
this->p_ = p;
}
template<class X> ACE_INLINE ACE_Auto_Basic_Ptr<X> &
ACE_Auto_Basic_Ptr<X>::operator= (ACE_Auto_Basic_Ptr<X> &rhs)
{
@@ -64,48 +55,40 @@ ACE_Auto_Basic_Ptr<X>::operator= (ACE_Auto_Basic_Ptr<X> &rhs)
}
return *this;
}
template<class X> ACE_INLINE
ACE_Auto_Basic_Ptr<X>::~ACE_Auto_Basic_Ptr (void)
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::~ACE_Auto_Basic_Ptr");
delete this->get ();
}
template<class X> ACE_INLINE X &
ACE_Auto_Basic_Ptr<X>::operator *() const
{
ACE_TRACE ("ACE_Auto_Basic_Ptr<X>::operator *()");
return *this->get ();
}
#if defined (ACE_LACKS_AUTO_PTR) || \
!defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \
(ACE_HAS_STANDARD_CPP_LIBRARY == 0)
template<class X> ACE_INLINE X *
auto_ptr<X>::operator-> () const
{
ACE_TRACE ("auto_ptr<X>::operator->");
return this->get ();
}
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
template<class X> ACE_INLINE X *
ACE_Auto_Ptr<X>::operator-> () const
{
ACE_TRACE ("ACE_Auto_Ptr<X>::operator->");
return this->get ();
}
template<class X> ACE_INLINE X *
ACE_Auto_Basic_Array_Ptr<X>::get (void) const
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::get");
return this->p_;
}
template<class X> ACE_INLINE X *
ACE_Auto_Basic_Array_Ptr<X>::release (void)
{
@@ -114,7 +97,6 @@ ACE_Auto_Basic_Array_Ptr<X>::release (void)
this->p_ = 0;
return old;
}
template<class X> ACE_INLINE void
ACE_Auto_Basic_Array_Ptr<X>::reset (X *p)
{
@@ -123,14 +105,12 @@ ACE_Auto_Basic_Array_Ptr<X>::reset (X *p)
delete [] this->get ();
this->p_ = p;
}
template<class X> ACE_INLINE
ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr<X> &rhs)
: p_ (rhs.release ())
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::ACE_Auto_Basic_Array_Ptr");
}
template<class X> ACE_INLINE ACE_Auto_Basic_Array_Ptr<X> &
ACE_Auto_Basic_Array_Ptr<X>::operator= (ACE_Auto_Basic_Array_Ptr<X> &rhs)
{
@@ -141,31 +121,26 @@ ACE_Auto_Basic_Array_Ptr<X>::operator= (ACE_Auto_Basic_Array_Ptr<X> &rhs)
}
return *this;
}
template<class X> ACE_INLINE
ACE_Auto_Basic_Array_Ptr<X>::~ACE_Auto_Basic_Array_Ptr (void)
{
ACE_TRACE ("ACE_Auto_Basic_Array_Ptr<X>::~ACE_Auto_Basic_Array_Ptr");
delete [] this->get ();
}
template<class X> ACE_INLINE X &
ACE_Auto_Basic_Array_Ptr<X>::operator *() const
{
return *this->get ();
}
template<class X> ACE_INLINE X &
ACE_Auto_Basic_Array_Ptr<X>::operator[](int i) const
{
X *array = this->get ();
return array[i];
}
template<class X> ACE_INLINE X *
ACE_Auto_Array_Ptr<X>::operator->() const
{
return this->get ();
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,34 +1,24 @@
// $Id: Barrier.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Barrier.h"
#if defined (ACE_HAS_THREADS)
#if !defined (__ACE_INLINE__)
#include "ace/Barrier.inl"
#endif /* __ACE_INLINE__ */
#include "ace/Guard_T.h"
#include "ace/OS_NS_errno.h"
#if defined (ACE_HAS_DUMP)
# include "ace/Log_Msg.h"
#endif /* ACE_HAS_DUMP */
ACE_RCSID (ace,
Barrier,
"$Id: Barrier.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_ALLOC_HOOK_DEFINE(ACE_Sub_Barrier)
void
ACE_Sub_Barrier::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Sub_Barrier::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->barrier_finished_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("running_threads_ = %d"), this->running_threads_));
@@ -36,7 +26,6 @@ ACE_Sub_Barrier::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
ACE_Sub_Barrier::ACE_Sub_Barrier (unsigned int count,
ACE_Thread_Mutex &lock,
const ACE_TCHAR *name,
@@ -46,15 +35,12 @@ ACE_Sub_Barrier::ACE_Sub_Barrier (unsigned int count,
{
// ACE_TRACE ("ACE_Sub_Barrier::ACE_Sub_Barrier");
}
ACE_ALLOC_HOOK_DEFINE(ACE_Barrier)
void
ACE_Barrier::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Barrier::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->lock_.dump ();
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_generation_ = %d"), this->current_generation_));
@@ -64,7 +50,6 @@ ACE_Barrier::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
ACE_Barrier::ACE_Barrier (unsigned int count,
const ACE_TCHAR *name,
void *arg)
@@ -78,25 +63,20 @@ ACE_Barrier::ACE_Barrier (unsigned int count,
this->sub_barrier_[0] = &this->sub_barrier_1_;
this->sub_barrier_[1] = &this->sub_barrier_2_;
}
int
ACE_Barrier::wait (void)
{
ACE_TRACE ("ACE_Barrier::wait");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
ACE_Sub_Barrier *sbp =
this->sub_barrier_[this->current_generation_];
// Check for shutdown...
if (sbp == 0)
{
errno = ESHUTDOWN;
return -1;
}
int retval = 0;
if (sbp->running_threads_ == 1)
{
// We're the last running thread, so swap generations and tell
@@ -110,11 +90,9 @@ ACE_Barrier::wait (void)
else
{
--sbp->running_threads_;
// Block until all the other threads wait().
while (sbp->running_threads_ != this->count_)
sbp->barrier_finished_.wait ();
// We're awake and the count has completed. See if it completed
// because all threads hit the barrier, or because the barrier
// was shut down.
@@ -124,45 +102,36 @@ ACE_Barrier::wait (void)
retval = -1;
}
}
return retval;
}
int
ACE_Barrier::shutdown (void)
{
ACE_TRACE ("ACE_Barrier::shutdown");
ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1);
ACE_Sub_Barrier *sbp =
this->sub_barrier_[this->current_generation_];
// Check for shutdown...
if (sbp == 0)
{
errno = ESHUTDOWN;
return -1;
}
// Flag the shutdown
this->sub_barrier_[0] = 0;
this->sub_barrier_[1] = 0;
// Tell all the threads waiting on the barrier to continue on their way.
sbp->running_threads_ = this->count_;
sbp->barrier_finished_.broadcast ();
return 0;
}
ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Barrier)
ACE_Thread_Barrier::ACE_Thread_Barrier (unsigned int count,
const ACE_TCHAR *name)
: ACE_Barrier (count, name)
{
// ACE_TRACE ("ACE_Thread_Barrier::ACE_Thread_Barrier");
}
void
ACE_Thread_Barrier::dump (void) const
{
@@ -171,17 +140,14 @@ ACE_Thread_Barrier::dump (void) const
ACE_Barrier::dump ();
#endif /* ACE_HAS_DUMP */
}
#if 0
ACE_ALLOC_HOOK_DEFINE(ACE_Process_Barrier)
ACE_Process_Barrier::ACE_Process_Barrier (u_int count,
const ACE_TCHAR *name)
: ACE_Barrier (count, USYNC_PROCESS, name)
{
// ACE_TRACE ("ACE_Process_Barrier::ACE_Process_Barrier");
}
void
ACE_Process_Barrier::dump (void) const
{
@@ -191,8 +157,6 @@ ACE_Process_Barrier::dump (void) const
#endif /* ACE_HAS_DUMP */
}
#endif /* 0 */
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_THREADS */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//==========================================================================
/**
* @file Barrier.h
@@ -11,26 +10,18 @@
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
#ifndef ACE_BARRIER_H
#define ACE_BARRIER_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include /**/ "ace/config-all.h"
// ACE platform supports some form of threading.
#if !defined (ACE_HAS_THREADS)
#include "ace/OS_NS_errno.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Barrier
*
@@ -44,15 +35,10 @@ public:
int wait (void) { ACE_NOTSUP_RETURN (-1); }
void dump (void) const {}
};
ACE_END_VERSIONED_NAMESPACE_DECL
#else /* ACE_HAS_THREADS */
#include "ace/Condition_Thread_Mutex.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
struct ACE_Export ACE_Sub_Barrier
{
// = Initialization.
@@ -60,22 +46,16 @@ struct ACE_Export ACE_Sub_Barrier
ACE_Thread_Mutex &lock,
const ACE_TCHAR *name = 0,
void *arg = 0);
~ACE_Sub_Barrier (void);
/// True if this generation of the barrier is done.
ACE_Condition_Thread_Mutex barrier_finished_;
/// Number of threads that are still running.
int running_threads_;
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
/**
* @class ACE_Barrier
*
@@ -100,10 +80,8 @@ public:
ACE_Barrier (unsigned int count,
const ACE_TCHAR *name = 0,
void *arg = 0);
/// Default dtor.
~ACE_Barrier (void);
/// Block the caller until all @c count threads have called @c wait and
/// then allow all the caller threads to continue in parallel.
///
@@ -111,7 +89,6 @@ public:
/// @retval -1 if an error occurs or the barrier is shut
/// down (@sa shutdown ()).
int wait (void);
/// Shut the barrier down, aborting the wait of all waiting threads.
/// Any threads waiting on the barrier when it is shut down will return with
/// value -1, errno ESHUTDOWN.
@@ -120,24 +97,18 @@ public:
///
/// @since ACE beta 5.4.9.
int shutdown (void);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
protected:
/// Serialize access to the barrier state.
ACE_Thread_Mutex lock_;
/// Either 0 or 1, depending on whether we are the first generation
/// of waiters or the next generation of waiters.
int current_generation_;
/// Total number of threads that can be waiting at any one time.
int count_;
/**
* We keep two @c sub_barriers, one for the first "generation" of
* waiters, and one for the next "generation" of waiters. This
@@ -149,13 +120,11 @@ protected:
ACE_Sub_Barrier sub_barrier_1_;
ACE_Sub_Barrier sub_barrier_2_;
ACE_Sub_Barrier *sub_barrier_[2];
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Barrier &);
ACE_Barrier (const ACE_Barrier &);
};
#if 0
/**
* @class ACE_Process_Barrier
@@ -170,15 +139,12 @@ class ACE_Export ACE_Process_Barrier : public ACE_Barrier
public:
/// Create a Process_Barrier, passing in the optional @a name.
ACE_Process_Barrier (unsigned int count, const ACE_TCHAR *name = 0);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
#endif /* 0 */
/**
* @class ACE_Thread_Barrier
*
@@ -192,25 +158,18 @@ class ACE_Export ACE_Thread_Barrier : public ACE_Barrier
public:
/// Create a Thread_Barrier, passing in the optional @a name.
ACE_Thread_Barrier (unsigned int count, const ACE_TCHAR *name = 0);
/// Default dtor.
~ACE_Thread_Barrier (void);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Barrier.inl"
#endif /* __ACE_INLINE__ */
#endif /* !ACE_HAS_THREADS */
#include /**/ "ace/post.h"
#endif /* ACE_BARRIER_H */

View File

@@ -1,22 +1,17 @@
// -*- C++ -*-
//
// $Id: Barrier.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Sub_Barrier::~ACE_Sub_Barrier (void)
{
}
ACE_INLINE
ACE_Barrier::~ACE_Barrier (void)
{
}
ACE_INLINE
ACE_Thread_Barrier::~ACE_Thread_Barrier (void)
{
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,29 +1,21 @@
// $Id: Base_Thread_Adapter.cpp 81239 2008-04-04 22:28:48Z iliyan $
#include "ace/Base_Thread_Adapter.h"
ACE_RCSID (ace,
Base_Thread_Adapter,
"$Id: Base_Thread_Adapter.cpp 81239 2008-04-04 22:28:48Z iliyan $")
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/Base_Thread_Adapter.inl"
#endif /* ACE_HAS_INLINED_OSCALLS */
#if defined (ACE_HAS_TSS_EMULATION)
# include "ace/OS_NS_Thread.h"
#endif /* ACE_HAS_TSS_EMULATION */
#include "ace/Service_Config.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::init_log_msg_hook_ = 0;
ACE_INHERIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = 0;
ACE_CLOSE_LOG_MSG_HOOK ACE_Base_Thread_Adapter::close_log_msg_hook_ = 0;
ACE_SYNC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::sync_log_msg_hook_ = 0;
ACE_THR_DESC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = 0;
ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter (
ACE_THR_FUNC user_func,
void *arg,
@@ -41,7 +33,6 @@ ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter (
, ctx_ (ACE_Service_Config::current())
{
ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter");
if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0)
(*ACE_Base_Thread_Adapter::init_log_msg_hook_) (
this->log_msg_attributes_
@@ -54,11 +45,9 @@ ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter (
getitimer (ITIMER_PROF, &itimer_);
#endif // ACE_USES_GPROF
}
ACE_Base_Thread_Adapter::~ACE_Base_Thread_Adapter (void)
{
}
void
ACE_Base_Thread_Adapter::inherit_log_msg (void)
{
@@ -66,27 +55,23 @@ ACE_Base_Thread_Adapter::inherit_log_msg (void)
(*ACE_Base_Thread_Adapter::inherit_log_msg_hook_)(
this->thr_desc_,
this->log_msg_attributes_);
// Initialize the proper configuration context for the new thread
// Placed here since inherit_log_msg() gets called from any of our
// descendants (before self-destructing)
ACE_Service_Config::current (this->ctx_);
}
void
ACE_Base_Thread_Adapter::close_log_msg (void)
{
if (ACE_Base_Thread_Adapter::close_log_msg_hook_ != 0)
(*ACE_Base_Thread_Adapter::close_log_msg_hook_) ();
}
void
ACE_Base_Thread_Adapter::sync_log_msg (const ACE_TCHAR *prg)
{
if (ACE_Base_Thread_Adapter::sync_log_msg_hook_ != 0)
(*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg);
}
ACE_OS_Thread_Descriptor *
ACE_Base_Thread_Adapter::thr_desc_log_msg (void)
{
@@ -94,17 +79,13 @@ ACE_Base_Thread_Adapter::thr_desc_log_msg (void)
return (*ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_) ();
return 0;
}
ACE_END_VERSIONED_NAMESPACE_DECL
// Run the thread entry point for the <ACE_Thread_Adapter>. This must
// be an extern "C" to make certain compilers happy...
extern "C" ACE_THR_FUNC_RETURN
ACE_THREAD_ADAPTER_NAME (void *args)
{
ACE_OS_TRACE ("ACE_THREAD_ADAPTER_NAME");
#if defined (ACE_HAS_TSS_EMULATION)
// As early as we can in the execution of the new thread, allocate
// its local TS storage. Allocate it on the stack, to save dynamic
@@ -112,18 +93,13 @@ ACE_THREAD_ADAPTER_NAME (void *args)
void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX];
ACE_TSS_Emulation::tss_open (ts_storage);
#endif /* ACE_HAS_TSS_EMULATION */
ACE_Base_Thread_Adapter * const thread_args =
static_cast<ACE_Base_Thread_Adapter *> (args);
#ifdef ACE_USES_GPROF
setitimer (ITIMER_PROF, thread_args->timerval (), 0);
#endif // ACE_USES_GPROF
// Invoke the user-supplied function with the args.
ACE_THR_FUNC_RETURN status = thread_args->invoke ();
return status;
}

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Base_Thread_Adapter.h
@@ -9,37 +8,27 @@
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_BASE_THREAD_ADAPTER_H
#define ACE_BASE_THREAD_ADAPTER_H
#include /**/ "ace/pre.h"
#include "ace/OS_Log_Msg_Attributes.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include /**/ "ace/ACE_export.h"
#include "ace/OS_Log_Msg_Attributes.h"
#ifdef ACE_USES_GPROF
#include "os_include/sys/os_time.h"
#endif // ACE_USES_GPROF
#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1)
# define ACE_THREAD_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_thread_adapter)
#else
# define ACE_THREAD_ADAPTER_NAME ace_thread_adapter
#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
// Run the thread entry point for the ACE_Thread_Adapter. This must
// be an extern "C" to make certain compilers happy...
extern "C" ACE_Export ACE_THR_FUNC_RETURN ACE_THREAD_ADAPTER_NAME (void *args);
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_OS_Thread_Descriptor
*
@@ -53,11 +42,9 @@ class ACE_Export ACE_OS_Thread_Descriptor
public:
/// Get the thread creation flags.
long flags (void) const;
protected:
/// For use by ACE_Thread_Descriptor.
ACE_OS_Thread_Descriptor (long flags = 0);
/**
* Keeps track of whether this thread was created "detached" or not.
* If a thread is *not* created detached then if someone calls
@@ -67,11 +54,8 @@ protected:
long flags_;
};
class ACE_Service_Gestalt;
/**
* @class ACE_Base_Thread_Adapter
*
@@ -91,31 +75,23 @@ class ACE_Service_Gestalt;
class ACE_Export ACE_Base_Thread_Adapter
{
public:
virtual ~ACE_Base_Thread_Adapter (void);
/// Virtual method invoked by the thread entry point.
virtual ACE_THR_FUNC_RETURN invoke (void) = 0;
/// Accessor for the C entry point function to the OS thread creation
/// routine.
ACE_THR_C_FUNC entry_point (void);
#ifdef ACE_USES_GPROF
/// Accessor to the itimer_
/// followed http://sam.zoy.org/writings/programming/gprof.html
struct itimerval* timerval (void);
#endif // ACE_USES_PROF
/// Invoke the close_log_msg_hook, if it is present
static void close_log_msg (void);
/// Invoke the sync_log_msg_hook, if it is present
static void sync_log_msg (const ACE_TCHAR *prog_name);
/// Invoke the thr_desc_log_msg_hook, if it is present
static ACE_OS_Thread_Descriptor *thr_desc_log_msg (void);
protected:
/// Constructor.
ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func,
@@ -130,7 +106,6 @@ protected:
/// Inherit the logging features if the parent thread has an
/// ACE_Log_Msg.
void inherit_log_msg (void);
private:
/// The hooks to inherit and cleanup the Log_Msg attributes
static ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_;
@@ -138,28 +113,22 @@ private:
static ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_;
static ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_;
static ACE_THR_DESC_LOG_MSG_HOOK thr_desc_log_msg_hook_;
/// Set the Log_Msg hooks
static void set_log_msg_hooks (ACE_INIT_LOG_MSG_HOOK init_hook,
ACE_INHERIT_LOG_MSG_HOOK inherit_hook,
ACE_CLOSE_LOG_MSG_HOOK close_hook,
ACE_SYNC_LOG_MSG_HOOK sync_hook,
ACE_THR_DESC_LOG_MSG_HOOK thr_desc);
/// Allow the ACE_Log_Msg class to set its hooks.
friend class ACE_Log_Msg;
protected:
/// Thread startup function passed in by the user (C++ linkage).
ACE_THR_FUNC user_func_;
/// Argument to thread startup function.
void *arg_;
/// Entry point to the underlying OS thread creation call (C
/// linkage).
ACE_THR_C_FUNC entry_point_;
/**
* Optional thread descriptor. Passing this pointer in will force
* the spawned thread to cache this location in <Log_Msg> and wait
@@ -167,22 +136,17 @@ protected:
* descriptor.
*/
ACE_OS_Thread_Descriptor *thr_desc_;
/// The ACE_Log_Msg attributes.
ACE_OS_Log_Msg_Attributes log_msg_attributes_;
/// That is usefull for gprof, define itimerval
#ifdef ACE_USES_GPROF
struct itimerval itimer_;
#endif // ACE_USES_GPROF
/// Keep a reference to the configuration context that spawns the
/// thread so the child can inherit it.
ACE_Service_Gestalt * const ctx_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
@@ -190,7 +154,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INLINE inline
# include "ace/Base_Thread_Adapter.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
#include /**/ "ace/post.h"
#endif /* ACE_BASE_THREAD_ADAPTER_H */

View File

@@ -1,21 +1,17 @@
// -*- C++ -*-
//
// $Id: Base_Thread_Adapter.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE long
ACE_OS_Thread_Descriptor::flags (void) const
{
return flags_;
}
ACE_INLINE
ACE_OS_Thread_Descriptor::ACE_OS_Thread_Descriptor (long flags)
: flags_ (flags)
{
}
ACE_INLINE void
ACE_Base_Thread_Adapter::set_log_msg_hooks (
ACE_INIT_LOG_MSG_HOOK init_hook,
@@ -30,13 +26,11 @@ ACE_Base_Thread_Adapter::set_log_msg_hooks (
ACE_Base_Thread_Adapter::sync_log_msg_hook_ = sync_hook;
ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = thr_desc_hook;
}
ACE_INLINE ACE_THR_C_FUNC
ACE_Base_Thread_Adapter::entry_point (void)
{
return this->entry_point_;
}
#ifdef ACE_USES_GPROF
ACE_INLINE itimerval*
ACE_Base_Thread_Adapter::timerval (void)
@@ -44,5 +38,4 @@ ACE_Base_Thread_Adapter::timerval (void)
return &(this->itimer_);
}
#endif // ACE_USES_GPROF
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,14 +1,11 @@
// $Id: Based_Pointer_Repository.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Map_Manager.h"
#include "ace/Based_Pointer_Repository.h"
#include "ace/Guard_T.h"
#include "ace/Null_Mutex.h"
#include "ace/Synch_Traits.h"
#include "ace/RW_Thread_Mutex.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Based_Pointer_Repository_Rep
*
@@ -25,37 +22,30 @@ public:
typedef ACE_Map_Manager <void *, size_t, ACE_Null_Mutex> MAP_MANAGER;
typedef ACE_Map_Iterator <void *, size_t, ACE_Null_Mutex> MAP_ITERATOR;
typedef ACE_Map_Entry <void *, size_t> MAP_ENTRY;
/// Keeps track of the mapping between addresses and their associated
/// values.
MAP_MANAGER addr_map_;
/// Synchronize concurrent access to the map.
ACE_SYNCH_MUTEX lock_;
};
ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository (void)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository");
ACE_NEW (this->rep_,
ACE_Based_Pointer_Repository_Rep);
}
ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository (void)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository");
delete this->rep_;
}
// Search for appropriate base address in repository
int
ACE_Based_Pointer_Repository::find (void *addr, void *&base_addr)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::find");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0;
for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_);
iter.next (ce) != 0;
iter.advance ())
@@ -67,35 +57,27 @@ ACE_Based_Pointer_Repository::find (void *addr, void *&base_addr)
base_addr = ce->ext_id_;
return 1;
}
// Assume base address 0 (e.g., if new'ed).
base_addr = 0;
return 0;
}
// Bind a new entry to the repository or update the size of an
// existing entry.
int
ACE_Based_Pointer_Repository::bind (void *addr, size_t size)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::bind");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
return this->rep_->addr_map_.rebind (addr, size);
}
// Unbind a base from the repository.
int
ACE_Based_Pointer_Repository::unbind (void *addr)
{
ACE_TRACE ("ACE_Based_Pointer_Repository::unbind");
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0;
// Search for service handlers that requested notification.
for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_);
iter.next (ce) != 0;
iter.advance ())
@@ -107,14 +89,11 @@ ACE_Based_Pointer_Repository::unbind (void *addr)
// Unbind base address.
return this->rep_->addr_map_.unbind (ce->ext_id_);
}
return 0;
}
#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
template ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX> *
ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX>::singleton_;
#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Based_Pointer_Repository.h
@@ -10,28 +9,20 @@
* @author Douglas C. Schmidt <schmidt@.cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_BASED_POINTER_REPOSITORY_H
#define ACE_BASED_POINTER_REPOSITORY_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Singleton.h"
#include "ace/Synch_Traits.h"
#include "ace/os_include/os_stddef.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Forward decl., using the "Cheshire Cat" technique.
class ACE_Based_Pointer_Repository_Rep;
/**
* @class ACE_Based_Pointer_Repository
*
@@ -42,11 +33,9 @@ class ACE_Export ACE_Based_Pointer_Repository
{
public:
// = Use ACE_Null_Mutex to allow locking while iterating.
// = Initialization and termination methods.
ACE_Based_Pointer_Repository (void);
~ACE_Based_Pointer_Repository (void);
// = Search structure methods.
/**
* Return the appropriate @a base_addr region that contains @a addr.
@@ -55,38 +44,27 @@ public:
*/
int find (void *addr,
void *&base_addr);
/// Bind a new entry to the repository or update the size of an
/// existing entry. Returns 0 on success and -1 on failure.
int bind (void *addr,
size_t size);
/// Unbind from the repository the <base_addr> that @a addr is
/// contained within.
int unbind (void *addr);
private:
/// Use the "Cheshire-Cat" technique to hide the implementation in
/// order to avoid circular #include dependencies.
ACE_Based_Pointer_Repository_Rep *rep_;
};
// ----------------------------------
/// Declare a process wide singleton
ACE_SINGLETON_DECLARE (ACE_Singleton,
ACE_Based_Pointer_Repository,
ACE_SYNCH_RW_MUTEX)
/// Provide a Singleton access point to the based pointer repository.
typedef ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX>
ACE_BASED_POINTER_REPOSITORY;
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* ACE_BASED_POINTER_REPOSITORY_H */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Based_Pointer_T.h
@@ -10,15 +9,11 @@
* @author Douglas C. Schmidt <schmidt@.cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_BASED_POINTER_T_H
#define ACE_BASED_POINTER_T_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#include "ace/Basic_Types.h"
#if defined (_MSC_VER)
// Suppress warning e.g. "return type for
// 'ACE_Based_Pointer<long>::operator ->' is 'long *' (i.e., not a UDT
@@ -26,9 +21,7 @@
// notation)"
#pragma warning(disable: 4284)
#endif /* _MSC_VER */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Based_Pointer_Basic
*
@@ -62,7 +55,6 @@ public:
* address 0.
*/
ACE_Based_Pointer_Basic (void);
/**
* Initialize this object using the @a initial pointer. This
* constructor initializes the <base_offset_> by asking the
@@ -85,66 +77,46 @@ public:
* indicates a "NULL" pointer.
*/
ACE_Based_Pointer_Basic (CONCRETE *initial);
/// Copy constructor.
ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic<CONCRETE> &);
/// Constructor for know base address. @a o is only used to
/// resolve overload ambiguity.
ACE_Based_Pointer_Basic (const void *base_addr, int o);
/// Pseudo-assignment operator.
void operator = (CONCRETE *from);
/// Pseudo-assignment operator.
void operator = (const ACE_Based_Pointer_Basic<CONCRETE> &);
/// Dereference operator.
CONCRETE operator * (void) const;
/// Less than operator.
bool operator < (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
/// Less than or equal operator.
bool operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
/// Greater than operator.
bool operator > (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
/// Greater than or equal operator.
bool operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
/// Equality operator.
bool operator == (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
/// Inequality operator.
bool operator != (const ACE_Based_Pointer_Basic<CONCRETE> &) const;
/// Subscript operator.
CONCRETE operator [](int index) const;
/// Increment operator.
void operator+= (int index);
/// Returns the underlying memory address of the smart pointer.
operator CONCRETE *() const;
/// Returns the underlying memory address of the smart pointer.
CONCRETE *addr (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
/// Dump the state of the object.
void dump (void) const;
protected:
ptrdiff_t target_;
/// Keep track of our offset from the base pointer.
ptrdiff_t base_offset_;
};
/**
* @class ACE_Based_Pointer
*
@@ -163,44 +135,32 @@ public:
/// Constructor. See constructor for ACE_Based_Pointer_Basic for
/// details.
ACE_Based_Pointer (void);
/// Initialize this object using the <initial> pointer. See
/// constructor for ACE_Based_Pointer_Basic for details.
ACE_Based_Pointer (CONCRETE *initial);
/// Initialize this object with known @a base_addr. @a dummy is
/// a dummy value used to resolve overload ambiguity and it
/// otherwise ignored.
ACE_Based_Pointer (const void *base_addr, int dummy);
/// Copy constructor (not implemented yet).
ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &);
/// Assignment operator.
void operator = (const ACE_Based_Pointer<CONCRETE> &);
/// Pseudo-assignment operator.
void operator = (CONCRETE *from);
/// The C++ "delegation operator".
CONCRETE *operator-> (void);
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Based_Pointer_T.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Based_Pointer_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Based_Pointer_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_BASED_POINTER_T_H */

View File

@@ -1,19 +1,15 @@
// -*- C++ -*-
//
// $Id: Based_Pointer_T.inl 81705 2008-05-15 14:02:02Z johnnyw $
#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_)
#include "ace/Global_Macros.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <class CONCRETE> ACE_INLINE CONCRETE *
ACE_Based_Pointer<CONCRETE>::operator->(void)
{
ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator->");
return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
}
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer_Basic<CONCRETE>::operator = (CONCRETE *rhs)
{
@@ -25,7 +21,6 @@ ACE_Based_Pointer_Basic<CONCRETE>::operator = (CONCRETE *rhs)
this->target_ = ((char *) rhs
- ((char *) this - this->base_offset_));
}
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer<CONCRETE>::operator = (CONCRETE *rhs)
{
@@ -37,33 +32,27 @@ ACE_Based_Pointer<CONCRETE>::operator = (CONCRETE *rhs)
this->target_ = ((char *) rhs
- ((char *) this - this->base_offset_));
}
template <class CONCRETE> ACE_INLINE CONCRETE
ACE_Based_Pointer_Basic<CONCRETE>::operator *(void) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator *");
return *reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
}
template <class CONCRETE> ACE_INLINE CONCRETE *
ACE_Based_Pointer_Basic<CONCRETE>::addr (void) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::addr");
if (this->target_ == -1)
return 0;
else
return reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
}
template <class CONCRETE> ACE_INLINE
ACE_Based_Pointer_Basic<CONCRETE>::operator CONCRETE *() const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator CONCRETE *()");
return this->addr ();
}
template <class CONCRETE> ACE_INLINE CONCRETE
ACE_Based_Pointer_Basic<CONCRETE>::operator [] (int index) const
{
@@ -72,68 +61,58 @@ ACE_Based_Pointer_Basic<CONCRETE>::operator [] (int index) const
reinterpret_cast<CONCRETE *> (ACE_COMPUTE_BASED_POINTER (this));
return c[index];
}
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer_Basic<CONCRETE>::operator += (int index)
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator +=");
this->base_offset_ += (index * sizeof (CONCRETE));
}
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator == (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator ==");
return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs);
}
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator != (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator !=");
return !(*this == rhs);
}
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator < (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <");
return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs);
}
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator <= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator <=");
return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs);
}
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator > (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >");
return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs);
}
template <class CONCRETE> ACE_INLINE bool
ACE_Based_Pointer_Basic<CONCRETE>::operator >= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs) const
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator >=");
return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs);
}
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer_Basic<CONCRETE>::operator= (const ACE_Based_Pointer_Basic<CONCRETE> &rhs)
{
ACE_TRACE ("ACE_Based_Pointer_Basic<CONCRETE>::operator=");
*this = rhs.addr ();
}
template <class CONCRETE> ACE_INLINE void
ACE_Based_Pointer<CONCRETE>::operator= (const ACE_Based_Pointer<CONCRETE> &rhs)
{
ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator=");
*this = rhs.addr ();
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,29 +1,22 @@
// $Id: Basic_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "ace/Basic_Stats.h"
#include "ace/Log_Msg.h"
#if !defined (__ACE_INLINE__)
#include "ace/Basic_Stats.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID(ace,
Basic_Stats,
"$Id: Basic_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
void
ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs)
{
if (rhs.samples_count_ == 0)
return;
if (this->samples_count_ == 0)
{
this->min_ = rhs.min_;
this->min_at_ = rhs.min_at_;
this->max_ = rhs.max_;
this->max_at_ = rhs.max_at_;
}
@@ -40,11 +33,9 @@ ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs)
this->max_at_ = rhs.max_at_;
}
}
this->samples_count_ += rhs.samples_count_;
this->sum_ += rhs.sum_;
}
void
ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg, ACE_UINT32 sf) const
{
@@ -55,25 +46,20 @@ ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg, ACE_UINT32 sf) const
ACE_TEXT ("%s : no data collected\n"), msg));
return;
}
ACE_UINT64 avg = this->sum_ / this->samples_count_;
ACE_UINT64 l_min = this->min_ / sf;
ACE_UINT64 l_max = this->max_ / sf;
ACE_UINT64 l_avg = avg / sf;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("%s latency : %Q[%d]/%Q/%Q[%d] (min/avg/max)\n"),
msg,
l_min, this->min_at_,
l_avg,
l_max, this->max_at_));
#else
ACE_UNUSED_ARG (msg);
ACE_UNUSED_ARG (sf);
#endif /* ACE_NLOGGING */
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -9,20 +9,15 @@
*/
//=============================================================================
#ifndef ACE_BASIC_STATS_H
#define ACE_BASIC_STATS_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#include "ace/Basic_Types.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/// Collect basic stats about a series of samples
/**
* Compute the average and standard deviation (aka jitter) for an
@@ -38,16 +33,12 @@ public:
* the class is initialized.
*/
ACE_Basic_Stats (void);
/// The number of samples received so far
ACE_UINT32 samples_count (void) const;
/// Record one sample.
void sample (ACE_UINT64 value);
/// Update the values to reflect the stats in @a rhs.
void accumulate (const ACE_Basic_Stats &rhs);
/// Dump all the samples
/**
* Prints out the results, using @a msg as a prefix for each message and
@@ -57,32 +48,23 @@ public:
*/
void dump_results (const ACE_TCHAR *msg,
ACE_UINT32 scale_factor) const;
/// The number of samples
ACE_UINT32 samples_count_;
/// The minimum value
ACE_UINT64 min_;
/// The number of the sample that had the minimum value
ACE_UINT32 min_at_;
/// The maximum value
ACE_UINT64 max_;
/// The number of the sample that had the maximum value
ACE_UINT32 max_at_;
/// The sum of all the values
ACE_UINT64 sum_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Basic_Stats.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_BASIC_STATS_H */

View File

@@ -1,9 +1,7 @@
// -*- C++ -*-
//
// $Id: Basic_Stats.inl 80826 2008-03-04 14:51:23Z wotte $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Basic_Stats::ACE_Basic_Stats (void)
: samples_count_ (0)
@@ -14,18 +12,15 @@ ACE_Basic_Stats::ACE_Basic_Stats (void)
, sum_ (0)
{
}
ACE_INLINE ACE_UINT32
ACE_Basic_Stats::samples_count (void) const
{
return this->samples_count_;
}
ACE_INLINE void
ACE_Basic_Stats::sample (ACE_UINT64 value)
{
++this->samples_count_;
if (this->samples_count_ == 1u)
{
this->min_ = value;
@@ -46,8 +41,6 @@ ACE_Basic_Stats::sample (ACE_UINT64 value)
this->max_at_ = this->samples_count_;
}
}
this->sum_ += value;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,15 +1,12 @@
#include "ace/Basic_Types.h"
#if !defined (__ACE_INLINE__)
# include "ace/Basic_Types.inl"
#endif /* ! __ACE_INLINE__ */
ACE_RCSID (ace,
Basic_Types,
"$Id: Basic_Types.cpp 80826 2008-03-04 14:51:23Z wotte $")
#if defined (ACE_LACKS_LONGLONG_T) && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
# include "ace/Log_Msg.h"
# include "ace/OS_NS_stdio.h"
@@ -18,9 +15,7 @@ ACE_RCSID (ace,
// FUZZ: disable check_for_streams_include
# include "ace/streams.h"
# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
void
ACE_U_LongLong::output (FILE *file) const
{
@@ -30,7 +25,6 @@ ACE_U_LongLong::output (FILE *file) const
ACE_OS::fprintf (file, "0x%lx", l_ ());
}
ACE_TCHAR *
ACE_U_LongLong::as_string (ACE_TCHAR *output,
unsigned int base,
@@ -95,7 +89,6 @@ ACE_U_LongLong::as_string (ACE_TCHAR *output,
{
ACE_OS::sprintf(output,
(uppercase ? "%lX" : "%lx"), this->l_ ());
}
break;
}
@@ -107,11 +100,9 @@ ACE_U_LongLong::as_string (ACE_TCHAR *output,
}
}
}
return output;
}
# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ostream&
operator<< (ostream& os, const ACE_U_LongLong& ll)
@@ -122,7 +113,6 @@ operator<< (ostream& os, const ACE_U_LongLong& ll)
unsigned long flags = os.setf(0);
#endif
char buffer[32];
if ((flags & ios::oct) != 0)
os << ll.as_string (buffer, 8);
else if ((flags & ios::hex) != 0)
@@ -132,9 +122,6 @@ operator<< (ostream& os, const ACE_U_LongLong& ll)
return os;
}
# endif
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_LACKS_LONGLONG_T */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Basic_Types.h
@@ -42,50 +41,37 @@
*
*/
//=============================================================================
#include "ace/config-lite.h"
#ifndef ACE_BASIC_TYPES_H
# define ACE_BASIC_TYPES_H
# include /**/ "ace/pre.h"
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
// Pull in definitions
# include "ace/os_include/os_limits.h" // Integer limits
# include "ace/os_include/os_float.h" // Floating point limits
# include "ace/os_include/os_stdlib.h" // Other types
# include "ace/os_include/os_stddef.h" // Get ptrdiff_t - see further comments below
# if defined(ACE_LACKS_LONGLONG_T)
# include "ace/os_include/os_stdio.h" // For long long emulation
# endif /* ACE_LACKS_LONGLONG_T */
# include "ace/os_include/sys/os_types.h"
# if !defined (ACE_LACKS_SYS_PARAM_H)
# include /**/ <sys/param.h>
# endif /* ACE_LACKS_SYS_PARAM_H */
# include "ace/ACE_export.h"
# if !defined (ACE_LACKS_STDINT_H)
# include <stdint.h>
# endif
# if !defined (ACE_LACKS_INTTYPES_H)
# include <inttypes.h>
# endif
#ifdef ACE_LACKS_INTPTR_T
# include "ace/If_Then_Else.h"
// This intptr_t typedef is here instead of
// <ace/os_include/os_inttypes.h> since it depends on the template
// metaprogramming in <ace/If_Then_Else.h>.
// We could compare ACE_SIZEOF_VOID_P against ACE_SIZEOF_LONG, etc.
// However, that depends on the ACE preprocessor symbol definitions in
// the platform-specific configuration header being correct.
@@ -93,7 +79,6 @@
// i.e. determining the type at compile-time rather than at
// preprocessing-time, will work for all platforms, and does not
// depend on ACE developer-defined configuration parameters.
typedef ACE::If_Then_Else<
(sizeof (void*) == sizeof (signed int)),
signed int,
@@ -111,7 +96,6 @@ typedef ACE::If_Then_Else<
#endif /* ACE_LACKS_LONGLONG_T */
>::result_type
>::result_type intptr_t;
typedef ACE::If_Then_Else<
(sizeof (void*) == sizeof (unsigned int)),
unsigned int,
@@ -129,12 +113,9 @@ typedef ACE::If_Then_Else<
#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */
>::result_type
>::result_type uintptr_t;
#endif /* ACE_LACKS_INTPTR_T */
// A char always has 1 byte, by definition.
# define ACE_SIZEOF_CHAR 1
// Unfortunately, there isn't a portable way to determine the size of a wchar.
// So we just define them on a platform basis. If the platform doesn't
// define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code
@@ -151,7 +132,6 @@ typedef ACE::If_Then_Else<
# endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
# endif /* !ACE_SIZEOF_WCHAR */
# endif /* ACE_HAS_WCHAR */
// The number of bytes in a short.
# if !defined (ACE_SIZEOF_SHORT)
# if (USHRT_MAX) == 255U
@@ -166,7 +146,6 @@ typedef ACE::If_Then_Else<
# error: unsupported short size, must be updated for this platform!
# endif /* USHRT_MAX */
# endif /* !defined (ACE_SIZEOF_SHORT) */
// The number of bytes in an int.
# if !defined (ACE_SIZEOF_INT)
# if (UINT_MAX) == 65535U
@@ -179,7 +158,6 @@ typedef ACE::If_Then_Else<
# error: unsupported int size, must be updated for this platform!
# endif /* UINT_MAX */
# endif /* !defined (ACE_SIZEOF_INT) */
// The number of bytes in a long.
# if !defined (ACE_SIZEOF_LONG)
# if (ULONG_MAX) == 65535UL
@@ -192,7 +170,6 @@ typedef ACE::If_Then_Else<
# error: unsupported long size, must be updated for this platform!
# endif /* ULONG_MAX */
# endif /* !defined (ACE_SIZEOF_LONG) */
// The number of bytes in a long long.
# if !defined (ACE_SIZEOF_LONG_LONG)
# if defined (ACE_LACKS_LONGLONG_T)
@@ -220,13 +197,10 @@ typedef ACE::If_Then_Else<
# endif
# endif /* !defined (ACE_SIZEOF_LONG_LONG) */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// The sizes of the commonly implemented types are now known. Set up
// typedefs for whatever we can. Some of these are needed for certain
// cases of ACE_UINT64, so do them before the 64-bit stuff.
#if defined (ACE_INT8_TYPE)
typedef ACE_INT8_TYPE ACE_INT8;
#elif defined (ACE_HAS_INT8_T)
@@ -236,7 +210,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
typedef char ACE_INT8;
#endif /* defined (ACE_INT8_TYPE) */
#if defined (ACE_UINT8_TYPE)
typedef ACE_UINT8_TYPE ACE_UINT8;
#elif defined (ACE_HAS_UINT8_T)
@@ -244,7 +217,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
typedef unsigned char ACE_UINT8;
#endif /* defined (ACE_UINT8_TYPE) */
#if defined (ACE_INT16_TYPE)
typedef ACE_INT16_TYPE ACE_INT16;
#elif defined (ACE_HAS_INT16_T)
@@ -256,7 +228,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
# error Have to add to the ACE_INT16 type setting
#endif /* defined (ACE_INT16_TYPE) */
#if defined (ACE_UINT16_TYPE)
typedef ACE_UINT16_TYPE ACE_UINT16;
#elif defined (ACE_HAS_UINT16_T)
@@ -268,7 +239,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
# error Have to add to the ACE_UINT16 type setting
#endif /* defined (ACE_UINT16_TYPE) */
#if defined (ACE_INT32_TYPE)
typedef ACE_INT32_TYPE ACE_INT32;
#elif defined (ACE_HAS_INT32_T)
@@ -280,7 +250,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
# error Have to add to the ACE_INT32 type setting
#endif /* defined (ACE_INT32_TYPE) */
#if defined (ACE_UINT32_TYPE)
typedef ACE_UINT32_TYPE ACE_UINT32;
#elif defined (ACE_HAS_UINT32_T)
@@ -292,7 +261,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#else
# error Have to add to the ACE_UINT32 type setting
#endif /* defined (ACE_UINT32_TYPE) */
#if defined (ACE_INT64_TYPE)
typedef ACE_INT64_TYPE ACE_INT64;
#elif defined (ACE_HAS_INT64_T)
@@ -307,10 +275,8 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# endif /* __GNUC__ */
typedef long long ACE_INT64;
#endif /* defined (ACE_INT64_TYPE) */
#if !(defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T))
/* See matching #if around ACE_U_LongLong class declaration below */
# if defined (ACE_UINT64_TYPE)
typedef ACE_UINT64_TYPE ACE_UINT64;
# elif defined (ACE_HAS_UINT64_T)
@@ -327,15 +293,11 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# endif /* defined (ACE_UINT64_TYPE) */
#endif /* !(ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T) */
typedef ACE_UINT16 ACE_USHORT16; // @@ Backward compatibility.
// Define a generic byte for use in codecs
typedef unsigned char ACE_Byte;
// Define a pseudo wide character type when wchar is not supported so we
// can support basic wide character string operations.
# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
# define ACE_WINT_T wint_t
# define ACE_WCHAR_T wchar_t
@@ -343,21 +305,17 @@ typedef unsigned char ACE_Byte;
# define ACE_WINT_T ACE_UINT16
# define ACE_WCHAR_T ACE_UINT16
# endif /* ACE_HAS_WCHAR */
// The number of bytes in a void *.
# ifndef ACE_SIZEOF_VOID_P
# define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG
# endif /* ACE_SIZEOF_VOID_P */
// Type for doing arithmetic on pointers ... as elsewhere, we assume
// that unsigned versions of a type are the same size as the signed
// version of the same type.
# if defined (ACE_HAS_WINCE) && (_WIN32_WCE < 400)
typedef unsigned long ptrdiff_t; // evc3, PocketPC don't defined ptrdiff_t
# endif
ACE_END_VERSIONED_NAMESPACE_DECL
// Byte-order (endian-ness) determination.
# if defined (BYTE_ORDER)
# if (BYTE_ORDER == LITTLE_ENDIAN)
@@ -404,14 +362,12 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_BYTE_ORDER ACE_BIG_ENDIAN
# endif
# endif /* ! BYTE_ORDER && ! __BYTE_ORDER */
// Byte swapping macros to deal with differences between little endian
// and big endian machines. Note that "long" here refers to 32 bit
// quantities.
# define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \
| ACE_SWAP_WORD(((L) >> 16) & 0xFFFF))
# define ACE_SWAP_WORD(L) ((((L) & 0x00FF) << 8) | (((L) & 0xFF00) >> 8))
# if defined (ACE_LITTLE_ENDIAN)
# define ACE_HTONL(X) ACE_SWAP_LONG (X)
# define ACE_NTOHL(X) ACE_SWAP_LONG (X)
@@ -423,7 +379,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_IDL_NCTOHL(X) (X << 24)
# define ACE_IDL_NSTOHL(X) ((X) << 16)
# endif /* ACE_LITTLE_ENDIAN */
# if defined (ACE_LITTLE_ENDIAN)
# define ACE_HTONS(x) ACE_SWAP_WORD(x)
# define ACE_NTOHS(x) ACE_SWAP_WORD(x)
@@ -431,7 +386,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_HTONS(x) x
# define ACE_NTOHS(x) x
# endif /* ACE_LITTLE_ENDIAN */
#if defined (ACE_LACKS_LONGLONG_T)
// This throws away the high 32 bits. It's very unlikely that a
// pointer will be more than 32 bits wide if the platform does not
@@ -445,14 +399,11 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
reinterpret_cast<PTR_TYPE> (static_cast<intptr_t> (L))
#endif /* ! ACE_LACKS_LONGLONG_T */
// If the platform lacks an unsigned long long, define one.
#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
// Forward declaration for streams
# include "ace/iosfwd.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_U_LongLong
*
@@ -481,7 +432,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_U_LongLong &operator= (const ACE_INT32 &);
ACE_U_LongLong &operator= (const ACE_UINT32 &);
~ACE_U_LongLong (void);
// = Overloaded relation operators.
bool operator== (const ACE_U_LongLong &) const;
bool operator== (const ACE_UINT32) const;
@@ -495,21 +445,17 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
bool operator> (const ACE_UINT32) const;
bool operator>= (const ACE_U_LongLong &) const;
bool operator>= (const ACE_UINT32) const;
ACE_U_LongLong operator+ (const ACE_U_LongLong &) const;
ACE_U_LongLong operator+ (const ACE_UINT32) const;
ACE_U_LongLong operator- (const ACE_U_LongLong &) const;
ACE_U_LongLong operator- (const ACE_UINT32) const;
ACE_U_LongLong operator* (const ACE_UINT32) const;
ACE_U_LongLong &operator*= (const ACE_UINT32);
ACE_U_LongLong operator<< (const unsigned int) const;
ACE_U_LongLong &operator<<= (const unsigned int);
ACE_U_LongLong operator>> (const unsigned int) const;
ACE_U_LongLong &operator>>= (const unsigned int);
double operator/ (const double) const;
ACE_U_LongLong &operator+= (const ACE_U_LongLong &);
ACE_U_LongLong &operator+= (const ACE_UINT32);
ACE_U_LongLong &operator-= (const ACE_U_LongLong &);
@@ -522,19 +468,16 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_U_LongLong &operator|= (const ACE_UINT32);
ACE_U_LongLong &operator&= (const ACE_U_LongLong);
ACE_U_LongLong &operator&= (const ACE_UINT32);
// Note that the following take ACE_UINT32 arguments. These are
// typical use cases, and easy to implement. But, they limit the
// return values to 32 bits as well. There are no checks for
// overflow.
ACE_UINT32 operator/ (const ACE_UINT32) const;
ACE_UINT32 operator% (const ACE_UINT32) const;
// The following only operate on the lower 32 bits (they take only
// 32 bit arguments).
ACE_UINT32 operator| (const ACE_INT32) const;
ACE_UINT32 operator& (const ACE_INT32) const;
// The following operators convert their arguments to
// ACE_UINT32. So, there may be information loss if they are
// used.
@@ -548,27 +491,20 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_UINT32 operator/ (const unsigned int) const;
ACE_UINT32 operator/ (const int) const;
# endif /* ACE_SIZEOF_INT != 4 */
// = Helper methods.
/// Outputs the value to the FILE, in hex.
void output (FILE * = stdout) const;
ACE_TCHAR *as_string (ACE_TCHAR *string,
unsigned int base = 10,
unsigned int uppercase = 0) const;
ACE_UINT32 hi (void) const;
ACE_UINT32 lo (void) const;
void hi (const ACE_UINT32 hi);
void lo (const ACE_UINT32 lo);
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
long long to_int64 (void) const;
# endif
private:
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
long long data_;
#else
@@ -580,9 +516,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_UINT32 hi_;
/// Low 32 bits.
ACE_UINT32 lo_;
# else
/// Low 32 bits.
ACE_UINT32 lo_;
/// High 32 bits.
@@ -593,31 +527,23 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
union
{
struct ace_hi_lo_correct_endian data_;
/// To ensure alignment on 8-byte boundary.
double for_alignment_;
};
// @note the following four accessors are inlined here in
// order to minimize the extent of the data_ struct. It's
// only used here; the .i and .cpp files use the accessors.
/// Internal utility function to hide access through struct.
const ACE_UINT32 &h_ () const { return data_.hi_; }
/// Internal utility function to hide access through struct.
ACE_UINT32 &h_ () { return data_.hi_; }
/// Internal utility function to hide access through struct.
const ACE_UINT32 &l_ () const { return data_.lo_; }
/// Internal utility function to hide access through struct.
ACE_UINT32 &l_ () { return data_.lo_; }
// @note the above four accessors are inlined here in
// order to minimize the extent of the data_ struct. It's
// only used here; the .inl and .cpp files use the accessors.
/// These functions are used to implement multiplication.
ACE_UINT32 ul_shift (ACE_UINT32 a,
ACE_UINT32 c_in,
@@ -633,19 +559,13 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_UINT32 *carry) const;
#endif // ACE_LACKS_UNSIGNEDLONGLONG_T
};
typedef ACE_U_LongLong ACE_UINT64;
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ostream &operator<< (ostream &, const ACE_U_LongLong &);
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
ACE_END_VERSIONED_NAMESPACE_DECL
# endif /* ACE_LACKS_LONGLONG_T */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Conversions from ACE_UINT64 to ACE_UINT32. ACE_CU64_TO_CU32 should
// be used on const ACE_UINT64's.
# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
@@ -659,7 +579,6 @@ ACE_U64_TO_U32 (ACE_U_LongLong const & n)
*/
return n.lo ();
}
inline ACE_UINT32
ACE_CU64_TO_CU32 (ACE_U_LongLong const & n)
{
@@ -671,16 +590,13 @@ ACE_U64_TO_U32 (ACE_UINT64 n)
{
return static_cast<ACE_UINT32> (n);
}
inline ACE_UINT32
ACE_CU64_TO_CU32 (ACE_UINT64 n)
{
return static_cast<ACE_UINT32> (n);
}
# endif /* ! ACE_LACKS_LONGLONG_T */
ACE_END_VERSIONED_NAMESPACE_DECL
// 64-bit literals require special marking on some platforms.
# if defined (ACE_LACKS_LONGLONG_T)
// Can only specify 32-bit arguments.
@@ -703,7 +619,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT64_LITERAL(n) n ## ull
# define ACE_INT64_LITERAL(n) n ## ll
# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
#if !defined (ACE_INT8_FORMAT_SPECIFIER)
# if defined (PRId8)
# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId8)
@@ -711,7 +626,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%d")
# endif /* defined (PRId8) */
#endif /* ACE_INT8_FORMAT_SPECIFIER */
#if !defined (ACE_UINT8_FORMAT_SPECIFIER)
# if defined (PRIu8)
# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu8)
@@ -719,7 +633,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%u")
# endif /* defined (PRIu8) */
#endif /* ACE_UINT8_FORMAT_SPECIFIER */
#if !defined (ACE_INT16_FORMAT_SPECIFIER)
# if defined (PRId16)
# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId16)
@@ -727,7 +640,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%d")
# endif /* defined (PRId16) */
#endif /* ACE_INT16_FORMAT_SPECIFIER */
#if !defined (ACE_UINT16_FORMAT_SPECIFIER)
# if defined (PRIu16)
# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu16)
@@ -735,7 +647,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%u")
# endif /* defined (PRIu16) */
#endif /* ACE_UINT16_FORMAT_SPECIFIER */
#if !defined (ACE_INT32_FORMAT_SPECIFIER)
# if defined (PRId32)
# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId32)
@@ -745,7 +656,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%ld")
# endif /* defined (PRId32) */
#endif /* ACE_INT32_FORMAT_SPECIFIER */
#if !defined (ACE_UINT32_FORMAT_SPECIFIER)
# if defined (PRIu32)
# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu32)
@@ -755,7 +665,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%lu")
# endif /* defined (PRIu32) */
#endif /* ACE_UINT32_FORMAT_SPECIFIER */
#if !defined (ACE_INT64_FORMAT_SPECIFIER)
# if defined (PRId64)
# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId64)
@@ -765,7 +674,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%lld")
# endif /* defined (PRId64) */
#endif /* ACE_INT64_FORMAT_SPECIFIER */
#if !defined (ACE_UINT64_FORMAT_SPECIFIER)
# if defined (PRIu64)
# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu64)
@@ -775,7 +683,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%llu")
# endif /* defined (PRIu64) */
#endif /* ACE_UINT64_FORMAT_SPECIFIER */
#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER)
# if defined (ACE_WIN64)
# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%I64d")
@@ -783,7 +690,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%d")
# endif /* ACE_WIN64 */
#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER)
# if defined (ACE_WIN64)
# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%I64u")
@@ -791,7 +697,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%u")
# endif /* ACE_WIN64 */
#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
// Cast from UINT64 to a double requires an intermediate cast to INT64
// on some platforms.
# if defined (ACE_LACKS_LONGLONG_T)
@@ -805,7 +710,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_UINT64_DBLCAST_ADAPTER(n) (n)
# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
// The number of bytes in a float.
# ifndef ACE_SIZEOF_FLOAT
# if FLT_MAX_EXP == 128
@@ -816,7 +720,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# error: unsupported float size, must be updated for this platform!
# endif /* FLT_MAX_EXP */
# endif /* ACE_SIZEOF_FLOAT */
// The number of bytes in a double.
# ifndef ACE_SIZEOF_DOUBLE
# if DBL_MAX_EXP == 128
@@ -827,7 +730,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# error: unsupported double size, must be updated for this platform!
# endif /* DBL_MAX_EXP */
# endif /* ACE_SIZEOF_DOUBLE */
// The number of bytes in a long double.
# ifndef ACE_SIZEOF_LONG_DOUBLE
# if LDBL_MAX_EXP == 128
@@ -848,7 +750,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# error: unsupported double size, must be updated for this platform!
# endif /* LDBL_MAX_EXP */
# endif /* ACE_SIZEOF_LONG_DOUBLE */
// Max and min sizes for the ACE integer types.
#define ACE_CHAR_MAX 0x7F
#define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1
@@ -862,7 +763,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_UINT32_MAX 0xFFFFFFFF
#define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF)
#define ACE_INT64_MIN -(ACE_INT64_MAX)-1
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
// ACE_U_LongLong's constructor accepts a "long long" in this
// case. Set it to ACE_U_LongLong (-1) since the bit pattern for long
@@ -875,17 +775,14 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#else
# define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF)
#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */
// These use ANSI/IEEE format.
#define ACE_FLT_MAX 3.402823466e+38F
#define ACE_FLT_MIN 1.175494351e-38F
#define ACE_DBL_MAX 1.7976931348623158e+308
#define ACE_DBL_MIN 2.2250738585072014e-308
# if defined (__ACE_INLINE__)
# include "ace/Basic_Types.inl"
# endif /* __ACE_INLINE__ */
# include /**/ "ace/post.h"
#endif /* ACE_BASIC_TYPES_H */

View File

@@ -1,80 +1,65 @@
// -*- C++ -*-
//
// $Id: Basic_Types.inl 80826 2008-03-04 14:51:23Z wotte $
# if !defined (ACE_LACKS_LONGLONG_T) && defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Implementation for ACE_U_LongLong when we have signed long long
// but no unsigned long long.
ACE_INLINE
ACE_U_LongLong::ACE_U_LongLong (const long long value)
: data_ (value)
{
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::hi (void) const
{
return (data_ >> 32) & 0xFFFFFFFF;
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::lo (void) const
{
return data_ & 0xFFFFFFFF;
}
ACE_INLINE void
ACE_U_LongLong::hi (const ACE_UINT32 hi)
{
data_ = hi;
data_ <<= 32;
}
ACE_INLINE void
ACE_U_LongLong::lo (const ACE_UINT32 lo)
{
data_ = lo;
}
ACE_INLINE long long
ACE_U_LongLong::to_int64 (void) const
{
return data_;
}
ACE_INLINE
ACE_U_LongLong::~ACE_U_LongLong (void)
{
}
ACE_INLINE bool
ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const
{
return data_ == n.data_;
}
ACE_INLINE bool
ACE_U_LongLong::operator== (const ACE_UINT32 n) const
{
return data_ == n;
}
ACE_INLINE bool
ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const
{
return ! (*this == n);
}
ACE_INLINE bool
ACE_U_LongLong::operator!= (const ACE_UINT32 n) const
{
return ! (*this == n);
}
ACE_INLINE bool
ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const
{
@@ -89,27 +74,22 @@ ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const
else
return data_ < n.data_;
}
ACE_INLINE bool
ACE_U_LongLong::operator< (const ACE_UINT32 n) const
{
return operator< (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE bool
ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const
{
if (data_ == n.data_) return true;
return data_ < n.data_;
}
ACE_INLINE bool
ACE_U_LongLong::operator<= (const ACE_UINT32 n) const
{
return operator<= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE bool
ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const
{
@@ -124,41 +104,33 @@ ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const
else
return data_ > n.data_;
}
ACE_INLINE bool
ACE_U_LongLong::operator> (const ACE_UINT32 n) const
{
return operator> (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE bool
ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const
{
if (data_ == n.data_) return true;
return data_ > n.data_;
}
ACE_INLINE bool
ACE_U_LongLong::operator>= (const ACE_UINT32 n) const
{
return operator>= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE
ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n)
: data_ (n.data_)
{
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_U_LongLong &n)
{
data_ = n.data_;
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_INT32 &rhs)
{
@@ -175,135 +147,107 @@ ACE_U_LongLong::operator= (const ACE_INT32 &rhs)
// implementation is to simply set all bits to zero.
data_ = 0;
}
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_UINT32 &rhs)
{
data_ = rhs;
return *this;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const
{
return data_ + n.data_;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator+ (const ACE_UINT32 n) const
{
return operator+ (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const
{
return data_ - n.data_;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator- (const ACE_UINT32 n) const
{
return operator- (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator<< (const u_int n) const
{
return data_ << n;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator<<= (const u_int n)
{
data_ <<= n;
return *this;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator>> (const u_int n) const
{
return data_ >> n;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator>>= (const u_int n)
{
data_ >>= n;
return *this;
}
ACE_INLINE double
ACE_U_LongLong::operator/ (const double n) const
{
return data_ / n;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator+= (const ACE_U_LongLong &n)
{
data_ += n.data_;
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator+= (const ACE_UINT32 n)
{
return operator+= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator* (const ACE_UINT32 n) const
{
return data_ * n;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator*= (const ACE_UINT32 n)
{
data_ *= n;
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-= (const ACE_U_LongLong &n)
{
data_ -= n.data_;
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-= (const ACE_UINT32 n)
{
return operator-= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator++ ()
{
++data_;
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-- ()
{
--data_;
return *this;
}
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator++ (int)
{
@@ -313,7 +257,6 @@ ACE_U_LongLong::operator++ (int)
++*this;
return temp;
}
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator-- (int)
{
@@ -323,170 +266,139 @@ ACE_U_LongLong::operator-- (int)
--*this;
return temp;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator|= (const ACE_U_LongLong n)
{
data_ |= n.data_;
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator|= (const ACE_UINT32 n)
{
return operator|= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator&= (const ACE_U_LongLong n)
{
data_ &= n.data_;
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator&= (const ACE_UINT32 n)
{
return operator&= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const ACE_UINT32 n) const
{
return data_ / n;
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator% (const ACE_UINT32 n) const
{
return data_ % n;
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator| (const ACE_INT32 n) const
{
return data_ | n;
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator& (const ACE_INT32 n) const
{
return data_ & n;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator* (const ACE_INT32 n) const
{
return operator* ((ACE_UINT32) n);
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator*= (const ACE_INT32 n)
{
return operator*= ((ACE_UINT32) n);
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const ACE_INT32 n) const
{
return operator/ ((ACE_UINT32) n);
}
#if ACE_SIZEOF_INT == 4
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const u_long n) const
{
return operator/ ((ACE_UINT32) n);
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const long n) const
{
return operator/ ((ACE_UINT32) n);
}
#else /* ACE_SIZEOF_INT != 4 */
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const u_int n) const
{
return operator/ ((ACE_UINT32) n);
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const int n) const
{
return operator/ ((ACE_UINT32) n);
}
#endif
ACE_END_VERSIONED_NAMESPACE_DECL
#elif defined (ACE_LACKS_LONGLONG_T)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_U_LongLong::ACE_U_LongLong (const ACE_UINT32 lo, const ACE_UINT32 hi)
{
h_ () = hi;
l_ () = lo;
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::hi (void) const
{
return h_ ();
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::lo (void) const
{
return l_ ();
}
ACE_INLINE void
ACE_U_LongLong::hi (const ACE_UINT32 hi)
{
h_ () = hi;
}
ACE_INLINE void
ACE_U_LongLong::lo (const ACE_UINT32 lo)
{
l_ () = lo;
}
ACE_INLINE
ACE_U_LongLong::~ACE_U_LongLong (void)
{
}
ACE_INLINE bool
ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const
{
return h_ () == n.h_ () && l_ () == n.l_ ();
}
ACE_INLINE bool
ACE_U_LongLong::operator== (const ACE_UINT32 n) const
{
return h_ () == 0 && l_ () == n;
}
ACE_INLINE bool
ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const
{
return ! (*this == n);
}
ACE_INLINE bool
ACE_U_LongLong::operator!= (const ACE_UINT32 n) const
{
return ! (*this == n);
}
ACE_INLINE bool
ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const
{
@@ -494,13 +406,11 @@ ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const
: h_ () > n.h_ () ? 0
: l_ () < n.l_ ();
}
ACE_INLINE bool
ACE_U_LongLong::operator< (const ACE_UINT32 n) const
{
return operator< (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE bool
ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const
{
@@ -508,13 +418,11 @@ ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const
: h_ () > n.h_ () ? 0
: l_ () <= n.l_ ();
}
ACE_INLINE bool
ACE_U_LongLong::operator<= (const ACE_UINT32 n) const
{
return operator<= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE bool
ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const
{
@@ -522,13 +430,11 @@ ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const
: h_ () < n.h_ () ? 0
: l_ () > n.l_ ();
}
ACE_INLINE bool
ACE_U_LongLong::operator> (const ACE_UINT32 n) const
{
return operator> (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE bool
ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const
{
@@ -536,29 +442,24 @@ ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const
: h_ () < n.h_ () ? 0
: l_ () >= n.l_ ();
}
ACE_INLINE bool
ACE_U_LongLong::operator>= (const ACE_UINT32 n) const
{
return operator>= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE
ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n)
{
h_ () = n.h_ ();
l_ () = n.l_ ();
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_U_LongLong &n)
{
h_ () = n.h_ ();
l_ () = n.l_ ();
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_INT32 &rhs)
{
@@ -576,168 +477,131 @@ ACE_U_LongLong::operator= (const ACE_INT32 &rhs)
l_ () = 0;
h_ () = 0;
}
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator= (const ACE_UINT32 &rhs)
{
l_ () = rhs;
h_ () = 0;
return *this;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const
{
ACE_U_LongLong ret (l_ () + n.l_ (), h_ () + n.h_ ());
if (ret.l_ () < n.l_ ()) /* carry */ ++ret.h_ ();
return ret;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator+ (const ACE_UINT32 n) const
{
return operator+ (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const
{
ACE_U_LongLong ret (l_ () - n.l_ (), h_ () - n.h_ ());
if (l_ () < n.l_ ()) /* borrow */ --ret.h_ ();
return ret;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator- (const ACE_UINT32 n) const
{
return operator- (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator<< (const u_int n) const
{
const ACE_UINT32 carry_mask = l_ () >> (32 - n);
ACE_U_LongLong ret (n < 32 ? l_ () << n : 0,
n < 32 ? (h_ () << n) | carry_mask : carry_mask);
return ret;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator<<= (const u_int n)
{
const ACE_UINT32 carry_mask = l_ () >> (32 - n);
h_ () = n < 32 ? (h_ () << n) | carry_mask : carry_mask;
// g++ 2.7.2.3/Solaris 2.5.1 doesn't modify l_ () if shifted by 32.
l_ () = n < 32 ? l_ () << n : 0;
return *this;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator>> (const u_int n) const
{
const ACE_UINT32 carry_mask = h_ () << (32 - n);
ACE_U_LongLong ret (n < 32 ? (l_ () >> n) | carry_mask : 0,
n < 32 ? h_ () >> n : 0);
return ret;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator>>= (const u_int n)
{
const ACE_UINT32 carry_mask = h_ () << (32 - n);
l_ () = n < 32 ? (l_ () >> n) | carry_mask : carry_mask;
h_ () = n < 32 ? h_ () >> n : 0;
return *this;
}
ACE_INLINE double
ACE_U_LongLong::operator/ (const double n) const
{
// See the derivation above in operator/ (const ACE_UINT32).
return ((double) 0xffffffffu - n + 1.0) / n * h_ () +
(double) h_ () + (double) l_ () / n;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator+= (const ACE_U_LongLong &n)
{
h_ () += n.h_ ();
l_ () += n.l_ ();
if (l_ () < n.l_ ()) /* carry */ ++h_ ();
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator+= (const ACE_UINT32 n)
{
return operator+= (static_cast<const ACE_U_LongLong> (n));
}
#define ACE_HIGHBIT (~(~0UL >> 1))
ACE_INLINE ACE_UINT32
ACE_U_LongLong::ul_shift (ACE_UINT32 a, ACE_UINT32 c_in, ACE_UINT32 *c_out) const
{
const ACE_UINT32 b = (a << 1) | c_in;
*c_out = (*c_out << 1) + ((a & ACE_HIGHBIT) > 0);
return b;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::ull_shift (ACE_U_LongLong a,
ACE_UINT32 c_in,
ACE_UINT32 *c_out) const
{
ACE_U_LongLong b;
b.l_ () = (a.l_ () << 1) | c_in;
c_in = ((a.l_ () & ACE_HIGHBIT) > 0);
b.h_ () = (a.h_ () << 1) | c_in;
*c_out = (*c_out << 1) + ((a.h_ () & ACE_HIGHBIT) > 0);
return b;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::ull_add (ACE_U_LongLong a, ACE_U_LongLong b, ACE_UINT32 *carry) const
{
ACE_U_LongLong r (0, 0);
ACE_UINT32 c1, c2, c3, c4;
c1 = a.l_ () % 2;
c2 = b.l_ () % 2;
c3 = 0;
r.l_ () = a.l_ ()/2 + b.l_ ()/2 + (c1+c2)/2;
r.l_ () = ul_shift (r.l_ (), (c1+c2)%2, &c3);
c1 = a.h_ () % 2;
c2 = b.h_ () % 2;
c4 = 0;
r.h_ () = a.h_ ()/2 + b.h_ ()/2 + (c1+c2+c3)/2;
r.h_ () = ul_shift (r.h_ (), (c1+c2+c3)%2, &c4);
*carry = c4;
return r;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) const
{
@@ -745,7 +609,6 @@ ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) con
const ACE_U_LongLong zero (0, 0);
ACE_U_LongLong accum (0, 0);
ACE_UINT32 c;
*carry = 0;
if (b > 0)
do
@@ -759,60 +622,47 @@ ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) con
mask >>= 1;
}
while (mask > 0);
return accum;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator* (const ACE_UINT32 n) const
{
ACE_UINT32 carry; // will throw the carry away
return ull_mult (*this, n, &carry);
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator*= (const ACE_UINT32 n)
{
ACE_UINT32 carry; // will throw the carry away
return *this = ull_mult (*this, n, &carry);
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-= (const ACE_U_LongLong &n)
{
h_ () -= n.h_ ();
if (l_ () < n.l_ ()) /* borrow */ --h_ ();
l_ () -= n.l_ ();
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-= (const ACE_UINT32 n)
{
return operator-= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator++ ()
{
++l_ ();
if (l_ () == 0) /* carry */ ++h_ ();
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator-- ()
{
if (l_ () == 0) /* borrow */ --h_ ();
--l_ ();
return *this;
}
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator++ (int)
{
@@ -822,7 +672,6 @@ ACE_U_LongLong::operator++ (int)
++*this;
return temp;
}
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator-- (int)
{
@@ -832,37 +681,30 @@ ACE_U_LongLong::operator-- (int)
--*this;
return temp;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator|= (const ACE_U_LongLong n)
{
l_ () |= n.l_ ();
h_ () |= n.h_ ();
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator|= (const ACE_UINT32 n)
{
return operator|= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator&= (const ACE_U_LongLong n)
{
l_ () &= n.l_ ();
h_ () &= n.h_ ();
return *this;
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator&= (const ACE_UINT32 n)
{
return operator&= (static_cast<const ACE_U_LongLong> (n));
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const ACE_UINT32 n) const
{
@@ -874,10 +716,8 @@ ACE_U_LongLong::operator/ (const ACE_UINT32 n) const
// = ((0x100000000u - n) / n * hi_ + hi_ * n / n + lo_ / n
// = (0x100000000u - n) / n * hi_ + hi_ + lo_ / n
// = (0xffffffffu - n + 1) / n * hi_ + hi_ + lo_ / n
return (0xffffffffu - n + 1) / n * h_ () + h_ () + l_ () / n;
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator% (const ACE_UINT32 n) const
{
@@ -888,67 +728,55 @@ ACE_U_LongLong::operator% (const ACE_UINT32 n) const
// = (0x100000000u % n * hi_ + lo_ % n) % n
// = ((0x100000000u - n) % n * hi_ + lo_ % n) % n
// = ((0xffffffffu - n + 1) % n * hi_ + lo_ % n) % n
return ((0xffffffff - n + 1) % n * h_ () + l_ () % n) % n;
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator| (const ACE_INT32 n) const
{
return l_ () | n;
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator& (const ACE_INT32 n) const
{
return l_ () & n;
}
ACE_INLINE ACE_U_LongLong
ACE_U_LongLong::operator* (const ACE_INT32 n) const
{
return operator* ((ACE_UINT32) n);
}
ACE_INLINE ACE_U_LongLong &
ACE_U_LongLong::operator*= (const ACE_INT32 n)
{
return operator*= ((ACE_UINT32) n);
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const ACE_INT32 n) const
{
return operator/ ((ACE_UINT32) n);
}
#if ACE_SIZEOF_INT == 4
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const u_long n) const
{
return operator/ ((ACE_UINT32) n);
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const long n) const
{
return operator/ ((ACE_UINT32) n);
}
#else /* ACE_SIZEOF_INT != 4 */
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const u_int n) const
{
return operator/ ((ACE_UINT32) n);
}
ACE_INLINE ACE_UINT32
ACE_U_LongLong::operator/ (const int n) const
{
return operator/ ((ACE_UINT32) n);
}
#endif /* ACE_SIZEOF_INT != 4 */
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Bound_Ptr.h
@@ -10,22 +9,15 @@
* @author Boris Kolpackov <boris@codesynthesis.com>
*/
//=============================================================================
#ifndef ACE_BOUND_PTR_H
#define ACE_BOUND_PTR_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Auto_Ptr.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Bound_Ptr_Counter
*
@@ -41,61 +33,45 @@ class ACE_Bound_Ptr_Counter
public:
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
ACE_Bound_Ptr_Counter (long init_obj_ref_count = 0);
~ACE_Bound_Ptr_Counter (void);
/// Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the
/// reference count to indicate ownership by a strong pointer.
static ACE_Bound_Ptr_Counter<ACE_LOCK> *create_strong (void);
/// Increase both the object and counter reference counts and return
/// the new object reference count. A return value of -1 indicates
/// that the object has already been destroyed.
static long attach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
/// Decreases both the object and counter reference counts and
/// deletes whichever has no more references. Returns the new object
/// reference count.
static long detach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
/// Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the
/// reference count to indicate no ownership.
static ACE_Bound_Ptr_Counter<ACE_LOCK> *create_weak (void);
/// Increase the counter reference count and return argument.
static void attach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
/// Decreases the counter reference count and deletes the counter if
/// it has no more references.
static void detach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
/// Determine whether the object has been deleted.
static bool object_was_deleted (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter);
private:
/// Allocate a new ACE_Bound_Ptr_Counter<ACE_LOCK> instance,
/// returning NULL if it cannot be created.
static ACE_Bound_Ptr_Counter<ACE_LOCK> *internal_create (long init_obj_ref_count);
private:
/// Reference count of underlying object. Is set to -1 once the
/// object has been destroyed to indicate to all weak pointers that
/// it is no longer valid.
long obj_ref_count_;
/// Reference count of this counter.
long self_ref_count_;
/// Mutex variable to synchronize access to the reference counts.
ACE_LOCK lock_;
};
// Forward decl.
template <class X, class ACE_LOCK> class ACE_Weak_Bound_Ptr;
/**
* @class ACE_Strong_Bound_Ptr
*
@@ -115,17 +91,13 @@ public:
/// Constructor that initializes an ACE_Strong_Bound_Ptr to point to the
/// object \<p\> immediately.
explicit ACE_Strong_Bound_Ptr (X *p = 0);
/// Constructor that initializes an ACE_Strong_Bound_Ptr by stealing
/// ownership of an object from an auto_ptr.
explicit ACE_Strong_Bound_Ptr (auto_ptr<X> p);
/// Copy constructor binds @c this and @a r to the same object.
ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
/// Constructor binds @c this and @a r to the same object.
ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r);
/// Copy constructor binds @c this and @a r to the same object if
/// Y* can be implicitly converted to X*.
template <class Y>
@@ -138,16 +110,12 @@ public:
//
COUNTER::attach_strong (this->counter_);
}
/// Destructor.
~ACE_Strong_Bound_Ptr (void);
/// Assignment operator that binds @c this and @a r to the same object.
void operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
/// Assignment operator that binds @c this and @a r to the same object.
void operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r);
/// Assignment operator that binds @c this and @a r to the same object
/// if Y* can be implicitly converted to X*.
template <class Y>
@@ -157,9 +125,7 @@ public:
// This operator is temporarily defined here to increase our chances
// of being accepted by broken compilers.
//
// This will work if &r == this, by first increasing the ref count
COUNTER *new_counter = r.counter_;
X* new_ptr = dynamic_cast<X_t*> (r.ptr_);
COUNTER::attach_strong (new_counter);
@@ -167,10 +133,8 @@ public:
delete this->ptr_;
this->counter_ = new_counter;
this->ptr_ = new_ptr;
return *this;
}
/// Equality operator that returns @c true if both
/// ACE_Strong_Bound_Ptr instances point to the same underlying
/// object.
@@ -179,7 +143,6 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const;
/// Equality operator that returns true if the ACE_Strong_Bound_Ptr
/// and ACE_Weak_Bound_Ptr objects point to the same underlying
/// object.
@@ -188,64 +151,46 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const;
/// Equality operator that returns @c true if the
/// ACE_Strong_Bound_Ptr and the raw pointer point to the same
/// underlying object.
bool operator == (X *p) const;
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const;
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const;
/// Inequality operator, which is the opposite of equality.
bool operator != (X *p) const;
/// Redirection operator
X *operator-> (void) const;
/// Dereference operator
X &operator * (void) const;
/// Get the pointer value.
X *get (void) const;
/// Resets the ACE_Strong_Bound_Ptr to refer to a different
/// underlying object.
void reset (X *p = 0);
/// Resets the ACE_Strong_Bound_Ptr to refer to a different
/// underlying object, ownership of which is stolen from the
/// auto_ptr.
void reset (auto_ptr<X> p);
/// Allows us to check for NULL on all ACE_Strong_Bound_Ptr
/// objects.
int null (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
typedef X X_t; // This indirection is for Borland C++.
friend class ACE_Weak_Bound_Ptr<X, ACE_LOCK>;
template <class Y, class L>
friend class ACE_Strong_Bound_Ptr;
/// The ACE_Bound_Ptr_Counter type.
typedef ACE_Bound_Ptr_Counter<ACE_LOCK> COUNTER;
/// The reference counter.
COUNTER *counter_;
/// The underlying object.
X *ptr_;
};
/**
* @class ACE_Weak_Bound_Ptr
*
@@ -269,22 +214,16 @@ public:
/// Constructor that initializes an ACE_Weak_Bound_Ptr to point to
/// the object \<p\> immediately.
explicit ACE_Weak_Bound_Ptr (X *p = 0);
/// Copy constructor binds @c this and @a r to the same object.
ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r);
/// Constructor binds @c this and @a r to the same object.
ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
/// Destructor.
~ACE_Weak_Bound_Ptr (void);
/// Assignment operator that binds @c this and @a r to the same object.
void operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r);
/// Assignment operator that binds @c this and @a r to the same object.
void operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
/// Equality operator that returns @c true if both
/// ACE_Weak_Bound_Ptr objects point to the same underlying object.
/**
@@ -292,7 +231,6 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const;
/// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr
/// and ACE_Strong_Bound_Ptr objects point to the same underlying
/// object.
@@ -301,20 +239,15 @@ public:
* instantiated and not used yet.
*/
bool operator == (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const;
/// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr
/// and the raw pointer point to the same underlying object.
bool operator == (X *p) const;
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const;
/// Inequality operator, which is the opposite of equality.
bool operator != (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const;
/// Inequality operator, which is the opposite of equality.
bool operator != (X *p) const;
/// Redirection operator.
/**
* It returns a temporary strong pointer and makes use of the
@@ -324,21 +257,17 @@ public:
* the locking overhead, then use the unsafe_get method instead.
*/
ACE_Strong_Bound_Ptr<X, ACE_LOCK> operator-> (void) const;
/// Obtain a strong pointer corresponding to this weak pointer. This
/// function is useful to create a temporary strong pointer for
/// conversion to a reference.
ACE_Strong_Bound_Ptr<X, ACE_LOCK> strong (void) const;
/// Get the pointer value. Warning: this does not affect the
/// reference count of the underlying object, so it may disappear on
/// you while you are using it if you are not careful.
X *unsafe_get (void) const;
/// Resets the ACE_Weak_Bound_Ptr to refer to a different underlying
/// object.
void reset (X *p = 0);
/// Increment the reference count on the underlying object.
/**
* Returns the new reference count on the object. This function may
@@ -347,7 +276,6 @@ public:
* servants.
*/
long add_ref (void);
/// Decrement the reference count on the underlying object, which is deleted
/// if the count has reached zero.
/**
@@ -357,33 +285,22 @@ public:
* servants.
*/
long remove_ref (void);
/// Allows us to check for NULL on all ACE_Weak_Bound_Ptr objects.
int null (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
private:
typedef X X_t; // This indirection is for Borland C++.
friend class ACE_Strong_Bound_Ptr<X, ACE_LOCK>;
/// The ACE_Bound_Ptr_Counter type.
typedef ACE_Bound_Ptr_Counter<ACE_LOCK> COUNTER;
/// The reference counter.
COUNTER *counter_;
/// The underlying object.
X *ptr_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#include "ace/Bound_Ptr.inl"
#include /**/ "ace/post.h"
#endif /* ACE_BOUND_PTR_H */

View File

@@ -1,15 +1,11 @@
/* -*- C++ -*- */
// $Id: Bound_Ptr.inl 80826 2008-03-04 14:51:23Z wotte $
// Bound_Ptr.i
#include "ace/Guard_T.h"
#if !defined (ACE_NEW_THROWS_EXCEPTIONS)
# include "ace/Log_Msg.h"
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> *
ACE_Bound_Ptr_Counter<ACE_LOCK>::internal_create (long init_obj_ref_count)
{
@@ -19,7 +15,6 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::internal_create (long init_obj_ref_count)
0);
return temp;
}
template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> *
ACE_Bound_Ptr_Counter<ACE_LOCK>::create_strong (void)
{
@@ -34,57 +29,43 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::create_strong (void)
return temp;
}
template <class ACE_LOCK> inline long
ACE_Bound_Ptr_Counter<ACE_LOCK>::attach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1);
// Can't attach a strong pointer to an object that has already been deleted.
if (counter->obj_ref_count_ == -1)
return -1;
long new_obj_ref_count = ++counter->obj_ref_count_;
++counter->self_ref_count_;
return new_obj_ref_count;
}
template <class ACE_LOCK> inline long
ACE_Bound_Ptr_Counter<ACE_LOCK>::detach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
ACE_Bound_Ptr_Counter<ACE_LOCK> *counter_del = 0;
long new_obj_ref_count;
{
ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1);
if ((new_obj_ref_count = --counter->obj_ref_count_) == 0)
// Change the object reference count to -1 to indicate that the
// object has been deleted, as opposed to a weak pointer that
// simply hasn't had any strong pointers created from it yet.
counter->obj_ref_count_ = -1;
if (--counter->self_ref_count_ == 0)
// Since counter contains the lock held by the ACE_Guard, the
// guard needs to be released before freeing the memory holding
// the lock. So save the pointer to free, then release, then
// free.
counter_del = counter;
} // Release the lock
delete counter_del;
return new_obj_ref_count;
}
template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> *
ACE_Bound_Ptr_Counter<ACE_LOCK>::create_weak (void)
{
// Set initial object reference count to 0.
ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = internal_create (0);
#if defined (ACE_NEW_THROWS_EXCEPTIONS)
if (temp == 0)
@@ -94,69 +75,55 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::create_weak (void)
#endif /* ACE_NEW_THROWS_EXCEPTIONS */
return temp;
}
template <class ACE_LOCK> inline void
ACE_Bound_Ptr_Counter<ACE_LOCK>::attach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
ACE_GUARD (ACE_LOCK, guard, counter->lock_);
++counter->self_ref_count_;
}
template <class ACE_LOCK> inline void
ACE_Bound_Ptr_Counter<ACE_LOCK>::detach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
ACE_Bound_Ptr_Counter<ACE_LOCK> *counter_del = 0;
{
ACE_GUARD (ACE_LOCK, guard, counter->lock_);
if (--counter->self_ref_count_ == 0)
// Since counter contains the lock held by the ACE_Guard, the
// guard needs to be released before freeing the memory holding
// the lock. So save the pointer to free, then release, then
// free.
counter_del = counter;
} // Release the lock
delete counter_del;
}
template <class ACE_LOCK> inline bool
ACE_Bound_Ptr_Counter<ACE_LOCK>::object_was_deleted (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter)
{
ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, 0);
return counter->obj_ref_count_ == -1;
}
template <class ACE_LOCK> inline
ACE_Bound_Ptr_Counter<ACE_LOCK>::ACE_Bound_Ptr_Counter (long init_obj_ref_count)
: obj_ref_count_ (init_obj_ref_count),
self_ref_count_ (1)
{
}
template <class ACE_LOCK> inline
ACE_Bound_Ptr_Counter<ACE_LOCK>::~ACE_Bound_Ptr_Counter (void)
{
}
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (X *p)
: counter_ (COUNTER::create_strong ()),
ptr_ (p)
{
}
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (auto_ptr<X> p)
: counter_ (COUNTER::create_strong ()),
ptr_ (p.release())
{
}
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r)
: counter_ (r.counter_),
@@ -164,7 +131,6 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_
{
COUNTER::attach_strong (this->counter_);
}
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r)
: counter_ (r.counter_),
@@ -180,14 +146,12 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Pt
this->ptr_ = 0;
}
}
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::~ACE_Strong_Bound_Ptr (void)
{
if (COUNTER::detach_strong (this->counter_) == 0)
delete this->ptr_;
}
template <class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &rhs)
{
@@ -195,7 +159,6 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE
// why go through all that?
if (&rhs == this)
return;
COUNTER *new_counter = rhs.counter_;
X_t *new_ptr = rhs.ptr_;
COUNTER::attach_strong (new_counter);
@@ -204,7 +167,6 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE
this->counter_ = new_counter;
this->ptr_ = new_ptr;
}
template <class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &rhs)
{
@@ -212,10 +174,8 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_L
// why go through all that?
if (&rhs == this)
return;
COUNTER *new_counter = rhs.counter_;
X_t *new_ptr = rhs.ptr_;
// When creating a strong pointer from a weak one we can't assume that the
// underlying object still exists. Therefore we must check for a return value
// of -1, which indicates that the object has been destroyed.
@@ -225,75 +185,63 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_L
new_counter = COUNTER::create_strong ();
new_ptr = 0;
}
if (COUNTER::detach_strong (this->counter_) == 0)
delete this->ptr_;
this->counter_ = new_counter;
this->ptr_ = new_ptr;
}
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const
{
return this->ptr_ == r.ptr_;
}
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const
{
// Use the weak pointer's operator== since it will check for null.
return r == *this;
}
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator== (X *p) const
{
return this->ptr_ == p;
}
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const
{
return this->ptr_ != r.ptr_;
}
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const
{
// Use the weak pointer's operator!= since it will check for null.
return r != *this;
}
template <class X, class ACE_LOCK> inline bool
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator!= (X *p) const
{
return this->ptr_ != p;
}
template <class X, class ACE_LOCK> inline X *
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator-> (void) const
{
return this->ptr_;
}
template<class X, class ACE_LOCK> inline X &
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator *() const
{
return *this->ptr_;
}
template <class X, class ACE_LOCK> inline X*
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::get (void) const
{
return this->ptr_;
}
template <class X, class ACE_LOCK> inline int
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::null (void) const
{
return this->ptr_ == 0;
}
template<class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
{
@@ -304,7 +252,6 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
if (COUNTER::detach_strong (old_counter) == 0)
delete old_ptr;
}
template<class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (auto_ptr<X> p)
{
@@ -315,14 +262,12 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (auto_ptr<X> p)
if (COUNTER::detach_strong (old_counter) == 0)
delete old_ptr;
}
template <class X, class ACE_LOCK> inline
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (X *p)
: counter_ (COUNTER::create_weak ()),
ptr_ (p)
{
}
template <class X, class ACE_LOCK> inline
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r)
: counter_ (r.counter_),
@@ -330,7 +275,6 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr<X,
{
COUNTER::attach_weak (this->counter_);
}
template <class X, class ACE_LOCK> inline
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r)
: counter_ (r.counter_),
@@ -338,13 +282,11 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr<
{
COUNTER::attach_weak (this->counter_);
}
template <class X, class ACE_LOCK> inline
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::~ACE_Weak_Bound_Ptr (void)
{
COUNTER::detach_weak (this->counter_);
}
template <class X, class ACE_LOCK> inline void
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &rhs)
{
@@ -355,7 +297,6 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOC
this->counter_ = new_counter;
this->ptr_ = rhs.ptr_;
}
template <class X, class ACE_LOCK> inline void
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &rhs)
{
@@ -366,7 +307,6 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE_L
this->counter_ = new_counter;
this->ptr_ = rhs.ptr_;
}
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const
{
@@ -374,10 +314,8 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Weak_Bound_Ptr<X, ACE_LOC
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return r.ptr_ == 0;
return this->ptr_ == r.ptr_;
}
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const
{
@@ -385,10 +323,8 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (const ACE_Strong_Bound_Ptr<X, ACE_L
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return r.ptr_ == 0;
return this->ptr_ == r.ptr_;
}
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (X *p) const
{
@@ -396,10 +332,8 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator== (X *p) const
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return p == 0;
return this->ptr_ == p;
}
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const
{
@@ -407,10 +341,8 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Weak_Bound_Ptr<X, ACE_LOC
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return r.ptr_ != 0;
return this->ptr_ != r.ptr_;
}
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const
{
@@ -418,10 +350,8 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (const ACE_Strong_Bound_Ptr<X, ACE_L
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return r.ptr_ != 0;
return this->ptr_ != r.ptr_;
}
template <class X, class ACE_LOCK> inline bool
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (X *p) const
{
@@ -429,22 +359,18 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator!= (X *p) const
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return p != 0;
return this->ptr_ != p;
}
template <class X, class ACE_LOCK> inline ACE_Strong_Bound_Ptr<X, ACE_LOCK>
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::operator-> (void) const
{
return ACE_Strong_Bound_Ptr<X, ACE_LOCK> (*this);
}
template <class X, class ACE_LOCK> inline ACE_Strong_Bound_Ptr<X, ACE_LOCK>
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::strong (void) const
{
return ACE_Strong_Bound_Ptr<X, ACE_LOCK> (*this);
}
template <class X, class ACE_LOCK> inline X*
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::unsafe_get (void) const
{
@@ -452,7 +378,6 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::unsafe_get (void) const
// is defined to be unsafe!
return this->ptr_;
}
template <class X, class ACE_LOCK> inline int
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::null (void) const
{
@@ -460,10 +385,8 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::null (void) const
// if the underlying object has been deleted.
if (COUNTER::object_was_deleted (this->counter_))
return 1;
return this->ptr_ == 0;
}
template<class X, class ACE_LOCK> inline void
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
{
@@ -472,13 +395,11 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
this->ptr_ = p;
COUNTER::detach_weak (old_counter);
}
template<class X, class ACE_LOCK> inline long
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::add_ref ()
{
return COUNTER::attach_strong (counter_);
}
template<class X, class ACE_LOCK> inline long
ACE_Weak_Bound_Ptr<X, ACE_LOCK>::remove_ref ()
{
@@ -490,5 +411,4 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::remove_ref ()
}
return new_obj_ref_count;
}
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,36 +1,27 @@
#include "ace/CDR_Base.h"
#if !defined (__ACE_INLINE__)
# include "ace/CDR_Base.inl"
#endif /* ! __ACE_INLINE__ */
#include "ace/Message_Block.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
ACE_RCSID (ace,
CDR_Base,
"$Id: CDR_Base.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#if defined (NONNATIVE_LONGDOUBLE)
static const ACE_INT16 max_eleven_bit = 0x3ff;
static const ACE_INT16 max_fifteen_bit = 0x3fff;
#endif /* NONNATIVE_LONGDOUBLE */
//
// See comments in CDR_Base.inl about optimization cases for swap_XX_array.
//
void
ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
{
// ACE_ASSERT(n > 0); The caller checks that n > 0
// We pretend that AMD64/GNU G++ systems have a Pentium CPU to
// take advantage of the inline assembly implementation.
// Later, we try to read in 32 or 64 bit chunks,
// so make sure we don't do that for unaligned addresses.
#if ACE_SIZEOF_LONG == 8 && \
@@ -56,17 +47,14 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
#endif
if (n == 0)
return;
//
// Loop unrolling. Here be dragons.
//
// (n & (~3)) is the greatest multiple of 4 not bigger than n.
// In the while loop ahead, orig will move over the array by 8 byte
// increments (4 elements of 2 bytes).
// end marks our barrier for not falling outside.
char const * const end = orig + 2 * (n & (~3));
// See if we're aligned for writting in 64 or 32 bit chunks...
#if ACE_SIZEOF_LONG == 8 && \
!((defined(__amd64__) || defined (__x86_64__)) && defined(__GNUG__))
@@ -105,27 +93,21 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
// 64 bit architecture.
register unsigned long a =
* reinterpret_cast<const unsigned long*> (orig);
register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
a = (a1 | a2);
* reinterpret_cast<unsigned long*> (target) = a;
#else
register ACE_UINT32 a =
* reinterpret_cast<const ACE_UINT32*> (orig);
register ACE_UINT32 b =
* reinterpret_cast<const ACE_UINT32*> (orig + 4);
register ACE_UINT32 a1 = (a & 0x00ff00ffU) << 8;
register ACE_UINT32 b1 = (b & 0x00ff00ffU) << 8;
register ACE_UINT32 a2 = (a & 0xff00ff00U) >> 8;
register ACE_UINT32 b2 = (b & 0xff00ff00U) >> 8;
a = (a1 | a2);
b = (b1 | b2);
* reinterpret_cast<ACE_UINT32*> (target) = a;
* reinterpret_cast<ACE_UINT32*> (target + 4) = b;
#endif
@@ -176,17 +158,13 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
// 64 bit architecture.
register unsigned long a =
* reinterpret_cast<const unsigned long*> (orig);
register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8;
register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8;
a = (a1 | a2);
ACE_UINT16 b1 = static_cast<ACE_UINT16> (a >> 48);
ACE_UINT16 b2 = static_cast<ACE_UINT16> ((a >> 32) & 0xffff);
ACE_UINT16 b3 = static_cast<ACE_UINT16> ((a >> 16) & 0xffff);
ACE_UINT16 b4 = static_cast<ACE_UINT16> (a & 0xffff);
#if defined(ACE_LITTLE_ENDIAN)
* reinterpret_cast<ACE_UINT16*> (target) = b4;
* reinterpret_cast<ACE_UINT16*> (target + 2) = b3;
@@ -203,20 +181,16 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
* reinterpret_cast<const ACE_UINT32*> (orig);
register ACE_UINT32 b =
* reinterpret_cast<const ACE_UINT32*> (orig + 4);
register ACE_UINT32 a1 = (a & 0x00ff00ff) << 8;
register ACE_UINT32 b1 = (b & 0x00ff00ff) << 8;
register ACE_UINT32 a2 = (a & 0xff00ff00) >> 8;
register ACE_UINT32 b2 = (b & 0xff00ff00) >> 8;
a = (a1 | a2);
b = (b1 | b2);
ACE_UINT32 c1 = static_cast<ACE_UINT16> (a >> 16);
ACE_UINT32 c2 = static_cast<ACE_UINT16> (a & 0xffff);
ACE_UINT32 c3 = static_cast<ACE_UINT16> (b >> 16);
ACE_UINT32 c4 = static_cast<ACE_UINT16> (b & 0xffff);
#if defined(ACE_LITTLE_ENDIAN)
* reinterpret_cast<ACE_UINT16*> (target) = c2;
* reinterpret_cast<ACE_UINT16*> (target + 2) = c1;
@@ -229,12 +203,10 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
* reinterpret_cast<ACE_UINT16*> (target + 6) = c4;
#endif
#endif
orig += 8;
target += 8;
}
}
// (n & 3) == (n % 4).
switch (n&3) {
case 3:
@@ -249,12 +221,10 @@ ACE_CDR::swap_2_array (char const * orig, char* target, size_t n)
ACE_CDR::swap_2 (orig, target);
}
}
void
ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
{
// ACE_ASSERT (n > 0); The caller checks that n > 0
#if ACE_SIZEOF_LONG == 8
// Later, we read from *orig in 64 bit chunks,
// so make sure we don't generate unaligned readings.
@@ -268,20 +238,16 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
--n;
}
#endif /* ACE_SIZEOF_LONG == 8 */
if (n == 0)
return;
//
// Loop unrolling. Here be dragons.
//
// (n & (~3)) is the greatest multiple of 4 not bigger than n.
// In the while loop, orig will move over the array by 16 byte
// increments (4 elements of 4 bytes).
// ends marks our barrier for not falling outside.
char const * const end = orig + 4 * (n & (~3));
#if ACE_SIZEOF_LONG == 8
// 64 bits architecture.
// See if we can write in 8 byte chunks.
@@ -293,7 +259,6 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
* reinterpret_cast<const long*> (orig);
register unsigned long b =
* reinterpret_cast<const long*> (orig + 8);
#if defined(ACE_HAS_INTEL_ASSEMBLY)
asm ("bswapq %1" : "=r" (a) : "0" (a));
asm ("bswapq %1" : "=r" (b) : "0" (b));
@@ -308,14 +273,11 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
register unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
register unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
a = (a84 | a73 | a62 | a51);
b = (b84 | b73 | b62 | b51);
#endif
* reinterpret_cast<long*> (target) = a;
* reinterpret_cast<long*> (target + 8) = b;
orig += 16;
target += 16;
}
@@ -329,7 +291,6 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
* reinterpret_cast<const long*> (orig);
register unsigned long b =
* reinterpret_cast<const long*> (orig + 8);
#if defined(ACE_HAS_INTEL_ASSEMBLY)
asm ("bswapq %1" : "=r" (a) : "0" (a));
asm ("bswapq %1" : "=r" (b) : "0" (b));
@@ -344,16 +305,13 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8;
register unsigned long a51 = (a & 0xff000000ff000000L) >> 24;
register unsigned long b51 = (b & 0xff000000ff000000L) >> 24;
a = (a84 | a73 | a62 | a51);
b = (b84 | b73 | b62 | b51);
#endif
ACE_UINT32 c1 = static_cast<ACE_UINT32> (a >> 32);
ACE_UINT32 c2 = static_cast<ACE_UINT32> (a & 0xffffffff);
ACE_UINT32 c3 = static_cast<ACE_UINT32> (b >> 32);
ACE_UINT32 c4 = static_cast<ACE_UINT32> (b & 0xffffffff);
#if defined (ACE_LITTLE_ENDIAN)
* reinterpret_cast<ACE_UINT32*> (target + 0) = c2;
* reinterpret_cast<ACE_UINT32*> (target + 4) = c1;
@@ -369,9 +327,7 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
target += 16;
}
}
#else /* ACE_SIZEOF_LONG != 8 */
while (orig < end)
{
#if defined (ACE_HAS_PENTIUM) && defined (__GNUG__)
@@ -383,12 +339,10 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
*reinterpret_cast<const unsigned int*> (orig + 8);
register unsigned int d =
*reinterpret_cast<const unsigned int*> (orig + 12);
asm ("bswap %1" : "=r" (a) : "0" (a));
asm ("bswap %1" : "=r" (b) : "0" (b));
asm ("bswap %1" : "=r" (c) : "0" (c));
asm ("bswap %1" : "=r" (d) : "0" (d));
*reinterpret_cast<unsigned int*> (target) = a;
*reinterpret_cast<unsigned int*> (target + 4) = b;
*reinterpret_cast<unsigned int*> (target + 8) = c;
@@ -419,26 +373,21 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
* reinterpret_cast<const ACE_UINT32*> (orig + 8);
register ACE_UINT32 d =
* reinterpret_cast<const ACE_UINT32*> (orig + 12);
// Expect the optimizer reordering this A LOT.
// We leave it this way for clarity.
a = (a << 24) | ((a & 0xff00) << 8) | ((a & 0xff0000) >> 8) | (a >> 24);
b = (b << 24) | ((b & 0xff00) << 8) | ((b & 0xff0000) >> 8) | (b >> 24);
c = (c << 24) | ((c & 0xff00) << 8) | ((c & 0xff0000) >> 8) | (c >> 24);
d = (d << 24) | ((d & 0xff00) << 8) | ((d & 0xff0000) >> 8) | (d >> 24);
* reinterpret_cast<ACE_UINT32*> (target) = a;
* reinterpret_cast<ACE_UINT32*> (target + 4) = b;
* reinterpret_cast<ACE_UINT32*> (target + 8) = c;
* reinterpret_cast<ACE_UINT32*> (target + 12) = d;
#endif
orig += 16;
target += 16;
}
#endif /* ACE_SIZEOF_LONG == 8 */
// (n & 3) == (n % 4).
switch (n & 3) {
case 3:
@@ -453,7 +402,6 @@ ACE_CDR::swap_4_array (char const * orig, char* target, size_t n)
ACE_CDR::swap_4 (orig, target);
}
}
//
// We don't benefit from unrolling in swap_8_array and swap_16_array
// (swap_8 and swap_16 are big enough).
@@ -462,7 +410,6 @@ void
ACE_CDR::swap_8_array (char const * orig, char* target, size_t n)
{
// ACE_ASSERT(n > 0); The caller checks that n > 0
char const * const end = orig + 8*n;
while (orig < end)
{
@@ -471,12 +418,10 @@ ACE_CDR::swap_8_array (char const * orig, char* target, size_t n)
target += 8;
}
}
void
ACE_CDR::swap_16_array (char const * orig, char* target, size_t n)
{
// ACE_ASSERT(n > 0); The caller checks that n > 0
char const * const end = orig + 16*n;
while (orig < end)
{
@@ -485,7 +430,6 @@ ACE_CDR::swap_16_array (char const * orig, char* target, size_t n)
target += 16;
}
}
void
ACE_CDR::mb_align (ACE_Message_Block *mb)
{
@@ -498,44 +442,34 @@ ACE_CDR::mb_align (ACE_Message_Block *mb)
mb->rd_ptr (start);
mb->wr_ptr (start);
}
int
ACE_CDR::grow (ACE_Message_Block *mb, size_t minsize)
{
size_t newsize =
ACE_CDR::first_size (minsize + ACE_CDR::MAX_ALIGNMENT);
if (newsize <= mb->size ())
return 0;
ACE_Data_Block *db =
mb->data_block ()->clone_nocopy (0, newsize);
if (db == 0)
return -1;
// Do the equivalent of ACE_CDR::mb_align() here to avoid having
// to allocate an ACE_Message_Block on the stack thereby avoiding
// the manipulation of the data blocks reference count
size_t mb_len = mb->length ();
char *start = ACE_ptr_align_binary (db->base (),
ACE_CDR::MAX_ALIGNMENT);
ACE_OS::memcpy (start, mb->rd_ptr (), mb_len);
mb->data_block (db);
// Setting the data block on the mb resets the read and write
// pointers back to the beginning. We must set the rd_ptr to the
// aligned start and adjust the write pointer to the end
mb->rd_ptr (start);
mb->wr_ptr (start + mb_len);
// Remove the DONT_DELETE flags from mb
mb->clr_self_flags (ACE_Message_Block::DONT_DELETE);
return 0;
}
size_t
ACE_CDR::total_length (const ACE_Message_Block* begin,
const ACE_Message_Block* end)
@@ -548,19 +482,16 @@ ACE_CDR::total_length (const ACE_Message_Block* begin,
l += i->length ();
return l;
}
void
ACE_CDR::consolidate (ACE_Message_Block *dst,
const ACE_Message_Block *src)
{
if (src == 0)
return;
size_t newsize =
ACE_CDR::first_size (ACE_CDR::total_length (src, 0)
+ ACE_CDR::MAX_ALIGNMENT);
dst->size (newsize);
#if !defined (ACE_CDR_IGNORE_ALIGNMENT)
// We must copy the contents of <src> into the new buffer, but
// respecting the alignment.
@@ -574,7 +505,6 @@ ACE_CDR::consolidate (ACE_Message_Block *dst,
dst->rd_ptr (static_cast<size_t> (offset));
dst->wr_ptr (dst->rd_ptr ());
#endif /* ACE_CDR_IGNORE_ALIGNMENT */
for (const ACE_Message_Block* i = src;
i != 0;
i = i->cont ())
@@ -587,28 +517,23 @@ ACE_CDR::consolidate (ACE_Message_Block *dst,
dst->wr_ptr (i->length ());
}
}
#if defined (NONNATIVE_LONGLONG)
bool
ACE_CDR::LongLong::operator== (const ACE_CDR::LongLong &rhs) const
{
return this->h == rhs.h && this->l == rhs.l;
}
bool
ACE_CDR::LongLong::operator!= (const ACE_CDR::LongLong &rhs) const
{
return this->l != rhs.l || this->h != rhs.h;
}
#endif /* NONNATIVE_LONGLONG */
#if defined (NONNATIVE_LONGDOUBLE)
ACE_CDR::LongDouble&
ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
{
ACE_OS::memset (this->ld, 0, sizeof (this->ld));
if (sizeof (rhs) == 8)
{
#if defined (ACE_LITTLE_ENDIAN)
@@ -626,7 +551,6 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
ACE_INT16 exponent = ((rhs_ptr[0] & 0x7f) << 4) |
((rhs_ptr[1] >> 4) & 0xf);
const char* exp_ptr = reinterpret_cast<const char*> (&exponent);
// Infinity and NaN have an exponent of 0x7ff in 64-bit IEEE
if (exponent == 0x7ff)
{
@@ -637,11 +561,9 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
exponent = (exponent - max_eleven_bit) + max_fifteen_bit;
}
exponent |= sign;
// Store the sign bit and exponent
this->ld[0] = exp_ptr[byte_zero];
this->ld[1] = exp_ptr[byte_one];
// Store the mantissa. In an 8 byte double, it is split by
// 4 bits (because of the 12 bits for sign and exponent), so
// we have to shift and or the rhs to get the right bytes.
@@ -674,7 +596,6 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
}
return *this;
}
ACE_CDR::LongDouble&
ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble& rhs)
{
@@ -682,24 +603,20 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble& rhs)
*this = rhs;
return *this;
}
bool
ACE_CDR::LongDouble::operator== (const ACE_CDR::LongDouble &rhs) const
{
return ACE_OS::memcmp (this->ld, rhs.ld, 16) == 0;
}
bool
ACE_CDR::LongDouble::operator!= (const ACE_CDR::LongDouble &rhs) const
{
return ACE_OS::memcmp (this->ld, rhs.ld, 16) != 0;
}
ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
{
ACE_CDR::LongDouble::NativeImpl ret = 0.0;
char* lhs_ptr = reinterpret_cast<char*> (&ret);
if (sizeof (ret) == 8)
{
#if defined (ACE_LITTLE_ENDIAN)
@@ -716,10 +633,8 @@ ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
char* exp_ptr = reinterpret_cast<char*> (&exponent);
exp_ptr[byte_zero] = copy[0];
exp_ptr[byte_one] = copy[1];
ACE_INT16 sign = (exponent & 0x8000);
exponent &= 0x7fff;
// Infinity and NaN have an exponent of 0x7fff in 128-bit IEEE
if (exponent == 0x7fff)
{
@@ -730,11 +645,9 @@ ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
exponent = (exponent - max_fifteen_bit) + max_eleven_bit;
}
exponent = (exponent << 4) | sign;
// Store the sign and exponent
lhs_ptr[0] = exp_ptr[byte_zero];
lhs_ptr[1] = exp_ptr[byte_one];
// Store the mantissa. In an 8 byte double, it is split by
// 4 bits (because of the 12 bits for sign and exponent), so
// we have to shift and or the rhs to get the right bytes.
@@ -754,7 +667,6 @@ ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
++ri;
}
}
#if defined (ACE_LITTLE_ENDIAN)
ACE_CDR::swap_8 (lhs_ptr, lhs_ptr);
#endif
@@ -763,38 +675,31 @@ ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const
{
ACE_OS::memcpy(lhs_ptr, this->ld, sizeof (ret));
}
// This bit of code is unnecessary. However, this code is
// necessary to work around a bug in the gcc 4.1.1 optimizer.
ACE_CDR::LongDouble tmp;
tmp.assign (ret);
return ret;
}
#endif /* NONNATIVE_LONGDOUBLE */
#if defined(_UNICOS) && !defined(_CRAYMPP)
// placeholders to get things compiling
ACE_CDR::Float::Float (void)
{
}
ACE_CDR::Float::Float (const float & /* init */)
{
}
ACE_CDR::Float &
ACE_CDR::Float::operator= (const float & /* rhs */)
{
return *this;
}
bool
ACE_CDR::Float::operator!= (const ACE_CDR::Float & /* rhs */) const
{
return false;
}
#endif /* _UNICOS */
ACE_END_VERSIONED_NAMESPACE_DECL

View File

@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file CDR_Base.h
@@ -24,23 +23,16 @@
*/
//=============================================================================
#ifndef ACE_CDR_BASE_H
#define ACE_CDR_BASE_H
#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Basic_Types.h"
#include "ace/Default_Constants.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Stuff used by the ACE CDR classes. Watch these values... they're also used
// in the ACE_CDR Byte_Order enum below.
#if defined ACE_LITTLE_ENDIAN
@@ -50,9 +42,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
# define ACE_CDR_BYTE_ORDER 0
// big endian encapsulation byte order has value = 0
#endif /* ! ACE_LITTLE_ENDIAN */
class ACE_Message_Block;
/**
* @class ACE_CDR
*
@@ -66,19 +56,16 @@ public:
// By defining as many of these constants as possible as enums we
// ensure they get inlined and avoid pointless static memory
// allocations.
enum
{
// Note that some of these get reused as part of the standard
// binary format: unsigned is the same size as its signed cousin,
// float is LONG_SIZE, and double is LONGLONG_SIZE.
OCTET_SIZE = 1,
SHORT_SIZE = 2,
LONG_SIZE = 4,
LONGLONG_SIZE = 8,
LONGDOUBLE_SIZE = 16,
OCTET_ALIGN = 1,
SHORT_ALIGN = 2,
LONG_ALIGN = 4,
@@ -86,11 +73,9 @@ public:
/// @note the CORBA LongDouble alignment requirements do not
/// match its size...
LONGDOUBLE_ALIGN = 8,
/// Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long
/// double", size as above).
MAX_ALIGNMENT = 8,
/// The default buffer size.
/**
* @todo We want to add options to control this
@@ -98,17 +83,14 @@ public:
* default value ;-)
*/
DEFAULT_BUFSIZE = ACE_DEFAULT_CDR_BUFSIZE,
/// The buffer size grows exponentially until it reaches this size;
/// afterwards it grows linearly using the next constant
EXP_GROWTH_MAX = ACE_DEFAULT_CDR_EXP_GROWTH_MAX,
/// Once exponential growth is ruled out the buffer size increases
/// in chunks of this size, note that this constants have the same
/// value right now, but it does not need to be so.
LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK
};
/**
* @enum Byte_Order
*
@@ -124,7 +106,6 @@ public:
/// Use whichever byte order is native to this machine.
BYTE_ORDER_NATIVE = ACE_CDR_BYTE_ORDER
};
/**
* Do byte swapping for each basic IDL type size. There exist only
* routines to put byte, halfword (2 bytes), word (4 bytes),
@@ -147,11 +128,9 @@ public:
static void swap_16_array (char const *orig,
char *target,
size_t length);
/// Align the message block to ACE_CDR::MAX_ALIGNMENT,
/// set by the CORBA spec at 8 bytes.
static void mb_align (ACE_Message_Block *mb);
/**
* Compute the size of the smallest buffer that can contain at least
* @a minsize bytes.
@@ -163,11 +142,9 @@ public:
* large value, but does not explode at the end.
*/
static size_t first_size (size_t minsize);
/// Compute not the smallest, but the second smallest buffer that
/// will fir @a minsize bytes.
static size_t next_size (size_t minsize);
/**
* Increase the capacity of mb to contain at least @a minsize bytes.
* If @a minsize is zero the size is increased by an amount at least
@@ -176,16 +153,13 @@ public:
* @retval 0 Success.
*/
static int grow (ACE_Message_Block *mb, size_t minsize);
/// Copy a message block chain into a single message block,
/// preserving the alignment of the first message block of the
/// original stream, not the following message blocks.
static void consolidate (ACE_Message_Block *dst,
const ACE_Message_Block *src);
static size_t total_length (const ACE_Message_Block *begin,
const ACE_Message_Block *end);
/**
* @name Basic OMG IDL Types
*
@@ -202,7 +176,6 @@ public:
typedef ACE_INT32 Long;
typedef ACE_UINT32 ULong;
typedef ACE_UINT64 ULongLong;
# if (defined (_MSC_VER)) || (defined (__BORLANDC__))
typedef __int64 LongLong;
# elif ACE_SIZEOF_LONG == 8 && !defined(_CRAYMPP)
@@ -230,7 +203,6 @@ public:
ACE_CDR::Long l;
ACE_CDR::Long h;
# endif /* ! ACE_BIG_ENDIAN */
/**
* @name Overloaded Relation Operators.
*
@@ -242,13 +214,11 @@ public:
//@}
};
# endif /* no native 64 bit integer type */
# if defined (NONNATIVE_LONGLONG)
# define ACE_CDR_LONGLONG_INITIALIZER {0,0}
# else
# define ACE_CDR_LONGLONG_INITIALIZER 0
# endif /* NONNATIVE_LONGLONG */
# if ACE_SIZEOF_FLOAT == 4
typedef float Float;
# else /* ACE_SIZEOF_FLOAT != 4 */
@@ -269,7 +239,6 @@ public:
# endif /* ACE_SIZEOF_INT != 4 */
};
# endif /* ACE_SIZEOF_FLOAT != 4 */
# if ACE_SIZEOF_DOUBLE == 8
typedef double Double;
# else /* ACE_SIZEOF_DOUBLE != 8 */
@@ -284,12 +253,10 @@ public:
# endif /* ACE_SIZEOF_INT != 8 */
};
# endif /* ACE_SIZEOF_DOUBLE != 8 */
// 94-9-32 Appendix A defines a 128 bit floating point "long
// double" data type, with greatly extended precision and four
// more bits of exponent (compared to "double"). This is an IDL
// extension, not yet standard.
# if ACE_SIZEOF_LONG_DOUBLE == 16
typedef long double LongDouble;
# define ACE_CDR_LONG_DOUBLE_INITIALIZER 0
@@ -314,15 +281,11 @@ public:
# else
typedef long double NativeImpl;
# endif /* ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE==1 */
char ld[16];
LongDouble& assign (const NativeImpl& rhs);
LongDouble& assign (const LongDouble& rhs);
bool operator== (const LongDouble &rhs) const;
bool operator!= (const LongDouble &rhs) const;
LongDouble& operator*= (const NativeImpl rhs) {
return this->assign (static_cast<NativeImpl> (*this) * rhs);
}
@@ -351,30 +314,22 @@ public:
this->assign (static_cast<NativeImpl> (*this) - 1);
return ldv;
}
operator NativeImpl () const;
};
# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */
//@}
#if !defined (ACE_CDR_GIOP_MAJOR_VERSION)
# define ACE_CDR_GIOP_MAJOR_VERSION 1
#endif /*ACE_CDR_GIOP_MAJOR_VERSION */
#if !defined (ACE_CDR_GIOP_MINOR_VERSION)
# define ACE_CDR_GIOP_MINOR_VERSION 2
#endif /* ACE_CDR_GIOP_MINOR_VERSION */
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
# include "ace/CDR_Base.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_CDR_BASE_H */

View File

@@ -1,19 +1,15 @@
// -*- C++ -*-
//
// $Id: CDR_Base.inl 80826 2008-03-04 14:51:23Z wotte $
#if defined (ACE_HAS_INTRINSIC_BYTESWAP)
// Take advantage of MSVC++ byte swapping compiler intrinsics (found
// in <stdlib.h>).
# pragma intrinsic (_byteswap_ushort, _byteswap_ulong, _byteswap_uint64)
#endif /* ACE_HAS_INTRINSIC_BYTESWAP */
#if defined (ACE_HAS_BSWAP_16) || defined (ACE_HAS_BSWAP_32) || defined (ACE_HAS_BSWAP_64)
# include "ace/os_include/os_byteswap.h"
#endif
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
//
// The ACE_CDR::swap_X and ACE_CDR::swap_X_array routines are broken
// in 5 cases for optimization:
@@ -61,7 +57,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// asigned to a certain variable so you don't have to clobber any
// register directly.
//
ACE_INLINE void
ACE_CDR::swap_2 (const char *orig, char* target)
{
@@ -95,7 +90,6 @@ ACE_CDR::swap_2 (const char *orig, char* target)
*udst = (usrc << 8) | (usrc >> 8);
#endif /* ACE_HAS_PENTIUM */
}
ACE_INLINE void
ACE_CDR::swap_4 (const char* orig, char* target)
{
@@ -130,7 +124,6 @@ ACE_CDR::swap_4 (const char* orig, char* target)
* reinterpret_cast<ACE_UINT32*> (target) = x;
#endif /* ACE_HAS_INTRINSIC_BYTESWAP */
}
ACE_INLINE void
ACE_CDR::swap_8 (const char* orig, char* target)
{
@@ -192,20 +185,17 @@ ACE_CDR::swap_8 (const char* orig, char* target)
* reinterpret_cast<ACE_UINT32*> (target + 4) = x;
#endif /* ACE_HAS_INTRINSIC_BYTESWAP */
}
ACE_INLINE void
ACE_CDR::swap_16 (const char* orig, char* target)
{
swap_8 (orig + 8, target);
swap_8 (orig, target + 8);
}
ACE_INLINE size_t
ACE_CDR::first_size (size_t minsize)
{
if (minsize == 0)
return ACE_CDR::DEFAULT_BUFSIZE;
size_t newsize = ACE_CDR::DEFAULT_BUFSIZE;
while (newsize < minsize)
{
@@ -213,7 +203,6 @@ ACE_CDR::first_size (size_t minsize)
{
// We grow exponentially at the beginning, this is fast and
// reduces the number of allocations.
// Quickly multiply by two using a bit shift. This is
// guaranteed to work since the variable is an unsigned
// integer.
@@ -229,12 +218,10 @@ ACE_CDR::first_size (size_t minsize)
}
return newsize;
}
ACE_INLINE size_t
ACE_CDR::next_size (size_t minsize)
{
size_t newsize = ACE_CDR::first_size (minsize);
if (newsize == minsize)
{
// If necessary increment the size
@@ -246,10 +233,7 @@ ACE_CDR::next_size (size_t minsize)
else
newsize += ACE_CDR::LINEAR_GROWTH_CHUNK;
}
return newsize;
}
ACE_END_VERSIONED_NAMESPACE_DECL
// ****************************************************************

Some files were not shown because too many files have changed in this diff Show More