Merge remote-tracking branch 'origin/master' into 4.3.4

Conflicts:
	src/server/game/Achievements/AchievementMgr.cpp
	src/server/game/Entities/Object/Updates/UpdateFields.h
	src/server/game/Entities/Unit/Unit.cpp
	src/server/scripts/Spells/spell_druid.cpp
This commit is contained in:
Nay
2012-09-17 23:49:13 +01:00
566 changed files with 29934 additions and 14984 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ TrinityCore uses (parts of or in whole) the following opensource software :
ACE (ADAPTIVE Communication Environment)
http://www.cs.wustl.edu/~schmidt/ACE.html
Version: 5.8.3
Version: 6.1.4
bzip2 (a freely available, patent free, high-quality data compressor)
http://www.bzip.org/
+407
View File
@@ -0,0 +1,407 @@
diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt
new file mode 100644
index 0000000..acd3d5a
--- /dev/null
+++ b/dep/acelite/ace/CMakeLists.txt
@@ -0,0 +1,337 @@
+# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# NOTE: Do not use glob here, it would include files we don't want
+set(ace_STAT_SRCS
+ PrecompiledHeaders/WinAcePCH.cpp
+ ACE.cpp
+ ACE_crc32.cpp
+ ACE_crc_ccitt.cpp
+ ace_wchar.cpp
+ Activation_Queue.cpp
+ Active_Map_Manager.cpp
+ Addr.cpp
+ Argv_Type_Converter.cpp
+ Assert.cpp
+ Asynch_IO.cpp
+ Asynch_IO_Impl.cpp
+ Asynch_Pseudo_Task.cpp
+ ATM_Acceptor.cpp
+ ATM_Addr.cpp
+ ATM_Connector.cpp
+ ATM_Params.cpp
+ ATM_QoS.cpp
+ ATM_Stream.cpp
+ Atomic_Op.cpp
+ Atomic_Op_Sparc.c
+ Auto_Event.cpp
+ Barrier.cpp
+ Base_Thread_Adapter.cpp
+ Based_Pointer_Repository.cpp
+ Basic_Stats.cpp
+ Basic_Types.cpp
+ Capabilities.cpp
+ CDR_Base.cpp
+ CDR_Size.cpp
+ CDR_Stream.cpp
+ Cleanup.cpp
+ Codecs.cpp
+ Codeset_IBM1047.cpp
+ Codeset_Registry.cpp
+ Codeset_Registry_db.cpp
+ Condition_Recursive_Thread_Mutex.cpp
+ Condition_Thread_Mutex.cpp
+ Configuration.cpp
+ Configuration_Import_Export.cpp
+ Connection_Recycling_Strategy.cpp
+ Containers.cpp
+ Copy_Disabled.cpp
+ Date_Time.cpp
+ DEV.cpp
+ DEV_Addr.cpp
+ DEV_Connector.cpp
+ DEV_IO.cpp
+ Dev_Poll_Reactor.cpp
+ Dirent.cpp
+ Dirent_Selector.cpp
+ DLL.cpp
+ DLL_Manager.cpp
+ Dump.cpp
+ Dynamic.cpp
+ Dynamic_Message_Strategy.cpp
+ Dynamic_Service_Base.cpp
+ Dynamic_Service_Dependency.cpp
+ Encoding_Converter.cpp
+ Encoding_Converter_Factory.cpp
+ Event.cpp
+ Event_Handler.cpp
+ Event_Handler_Handle_Timeout_Upcall.cpp
+ FIFO.cpp
+ FIFO_Recv.cpp
+ FIFO_Recv_Msg.cpp
+ FIFO_Send.cpp
+ FIFO_Send_Msg.cpp
+ FILE.cpp
+ FILE_Addr.cpp
+ FILE_Connector.cpp
+ FILE_IO.cpp
+ File_Lock.cpp
+ Filecache.cpp
+ Flag_Manip.cpp
+ Framework_Component.cpp
+ Functor.cpp
+ Functor_String.cpp
+ Get_Opt.cpp
+ Handle_Ops.cpp
+ Handle_Set.cpp
+ Hashable.cpp
+ High_Res_Timer.cpp
+ ICMP_Socket.cpp
+ INET_Addr.cpp
+ Init_ACE.cpp
+ IO_Cntl_Msg.cpp
+ IO_SAP.cpp
+ IOStream.cpp
+ IPC_SAP.cpp
+ Lib_Find.cpp
+ Local_Memory_Pool.cpp
+ Local_Name_Space.cpp
+ Local_Tokens.cpp
+ Lock.cpp
+ Log_Msg.cpp
+ Log_Msg_Backend.cpp
+ Log_Msg_Callback.cpp
+ Log_Msg_IPC.cpp
+ Log_Msg_NT_Event_Log.cpp
+ Log_Msg_UNIX_Syslog.cpp
+ Log_Record.cpp
+ Logging_Strategy.cpp
+ LSOCK.cpp
+ LSOCK_Acceptor.cpp
+ LSOCK_CODgram.cpp
+ LSOCK_Connector.cpp
+ LSOCK_Dgram.cpp
+ LSOCK_Stream.cpp
+ Malloc.cpp
+ Malloc_Allocator.cpp
+ Manual_Event.cpp
+ MEM_Acceptor.cpp
+ MEM_Addr.cpp
+ MEM_Connector.cpp
+ MEM_IO.cpp
+ Mem_Map.cpp
+ MEM_SAP.cpp
+ MEM_Stream.cpp
+ Message_Block.cpp
+ Message_Queue.cpp
+ Message_Queue_NT.cpp
+ Message_Queue_Vx.cpp
+ Method_Request.cpp
+ MMAP_Memory_Pool.cpp
+ Monitor_Admin.cpp
+ Monitor_Admin_Manager.cpp
+ Monitor_Base.cpp
+ Monitor_Control_Action.cpp
+ Monitor_Control_Types.cpp
+ Monitor_Point_Registry.cpp
+ Monitor_Size.cpp
+ Msg_WFMO_Reactor.cpp
+ Multihomed_INET_Addr.cpp
+ Mutex.cpp
+ Name_Proxy.cpp
+ Name_Request_Reply.cpp
+ Name_Space.cpp
+ Naming_Context.cpp
+ Netlink_Addr.cpp
+ Notification_Queue.cpp
+ Notification_Strategy.cpp
+ NT_Service.cpp
+ Obchunk.cpp
+ Object_Manager.cpp
+ Object_Manager_Base.cpp
+ OS_Errno.cpp
+ OS_Log_Msg_Attributes.cpp
+ OS_main.cpp
+ OS_NS_arpa_inet.cpp
+ OS_NS_ctype.cpp
+ OS_NS_dirent.cpp
+ OS_NS_dlfcn.cpp
+ OS_NS_errno.cpp
+ OS_NS_fcntl.cpp
+ OS_NS_math.cpp
+ OS_NS_netdb.cpp
+ OS_NS_poll.cpp
+ OS_NS_pwd.cpp
+ OS_NS_regex.cpp
+ OS_NS_signal.cpp
+ OS_NS_stdio.cpp
+ OS_NS_stdlib.cpp
+ OS_NS_string.cpp
+ OS_NS_strings.cpp
+ OS_NS_stropts.cpp
+ OS_NS_sys_mman.cpp
+ OS_NS_sys_msg.cpp
+ OS_NS_sys_resource.cpp
+ OS_NS_sys_select.cpp
+ OS_NS_sys_sendfile.cpp
+ OS_NS_sys_shm.cpp
+ OS_NS_sys_socket.cpp
+ OS_NS_sys_stat.cpp
+ OS_NS_sys_time.cpp
+ OS_NS_sys_uio.cpp
+ OS_NS_sys_utsname.cpp
+ OS_NS_sys_wait.cpp
+ OS_NS_Thread.cpp
+ OS_NS_time.cpp
+ OS_NS_unistd.cpp
+ OS_NS_wchar.cpp
+ OS_QoS.cpp
+ OS_Thread_Adapter.cpp
+ OS_TLI.cpp
+ Pagefile_Memory_Pool.cpp
+ Parse_Node.cpp
+ PI_Malloc.cpp
+ Ping_Socket.cpp
+ Pipe.cpp
+ POSIX_Asynch_IO.cpp
+ POSIX_CB_Proactor.cpp
+ POSIX_Proactor.cpp
+ Priority_Reactor.cpp
+ Proactor.cpp
+ Proactor_Impl.cpp
+ Process.cpp
+ Process_Manager.cpp
+ Process_Mutex.cpp
+ Process_Semaphore.cpp
+ Profile_Timer.cpp
+ Reactor.cpp
+ Reactor_Impl.cpp
+ Reactor_Notification_Strategy.cpp
+ Reactor_Timer_Interface.cpp
+ Read_Buffer.cpp
+ Recursive_Thread_Mutex.cpp
+ Recyclable.cpp
+ Registry.cpp
+ Registry_Name_Space.cpp
+ Remote_Name_Space.cpp
+ Remote_Tokens.cpp
+ Rtems_init.c
+ RW_Mutex.cpp
+ RW_Process_Mutex.cpp
+ RW_Thread_Mutex.cpp
+ Sample_History.cpp
+ Sbrk_Memory_Pool.cpp
+ Sched_Params.cpp
+ Select_Reactor_Base.cpp
+ Semaphore.cpp
+ Service_Config.cpp
+ Service_Gestalt.cpp
+ Service_Manager.cpp
+ Service_Object.cpp
+ Service_Repository.cpp
+ Service_Types.cpp
+ Shared_Memory.cpp
+ Shared_Memory_MM.cpp
+ Shared_Memory_Pool.cpp
+ Shared_Memory_SV.cpp
+ Shared_Object.cpp
+ Sig_Adapter.cpp
+ Sig_Handler.cpp
+ Signal.cpp
+ SOCK.cpp
+ SOCK_Acceptor.cpp
+ SOCK_CODgram.cpp
+ Sock_Connect.cpp
+ SOCK_Connector.cpp
+ SOCK_Dgram.cpp
+ SOCK_Dgram_Bcast.cpp
+ SOCK_Dgram_Mcast.cpp
+ SOCK_IO.cpp
+ SOCK_Netlink.cpp
+ SOCK_SEQPACK_Acceptor.cpp
+ SOCK_SEQPACK_Association.cpp
+ SOCK_SEQPACK_Connector.cpp
+ SOCK_Stream.cpp
+ SPIPE.cpp
+ SPIPE_Acceptor.cpp
+ SPIPE_Addr.cpp
+ SPIPE_Connector.cpp
+ SPIPE_Stream.cpp
+ SString.cpp
+ Stack_Trace.cpp
+ Stats.cpp
+ String_Base_Const.cpp
+ SUN_Proactor.cpp
+ SV_Message.cpp
+ SV_Message_Queue.cpp
+ SV_Semaphore_Complex.cpp
+ SV_Semaphore_Simple.cpp
+ SV_Shared_Memory.cpp
+ Svc_Conf_Lexer.cpp
+ Svc_Conf_y.cpp
+ Synch_Options.cpp
+ System_Time.cpp
+ Task.cpp
+ Thread.cpp
+ Thread_Adapter.cpp
+ Thread_Control.cpp
+ Thread_Exit.cpp
+ Thread_Hook.cpp
+ Thread_Manager.cpp
+ Thread_Mutex.cpp
+ Thread_Semaphore.cpp
+ Throughput_Stats.cpp
+ Time_Policy.cpp
+ Time_Value.cpp
+ Timeprobe.cpp
+ TLI.cpp
+ TLI_Acceptor.cpp
+ TLI_Connector.cpp
+ TLI_Stream.cpp
+ Token.cpp
+ Token_Collection.cpp
+ Token_Invariants.cpp
+ Token_Manager.cpp
+ Token_Request_Reply.cpp
+ TP_Reactor.cpp
+ Trace.cpp
+ TSS_Adapter.cpp
+ TTY_IO.cpp
+ UNIX_Addr.cpp
+ UPIPE_Acceptor.cpp
+ UPIPE_Connector.cpp
+ UPIPE_Stream.cpp
+ UTF16_Encoding_Converter.cpp
+ UTF32_Encoding_Converter.cpp
+ UTF8_Encoding_Converter.cpp
+ UUID.cpp
+ WFMO_Reactor.cpp
+ WIN32_Asynch_IO.cpp
+ WIN32_Proactor.cpp
+ XML_Svc_Conf.cpp
+ XTI_ATM_Mcast.cpp
+)
+
+include_directories(
+ ${CMAKE_SOURCE_DIR}/dep/acelite
+ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
+ ${CMAKE_SOURCE_DIR}/dep/zlib
+)
+
+# Needed for PCH support
+set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX)
+
+add_definitions(-DACE_BUILD_DLL)
+
+add_library(ace SHARED ${ace_STAT_SRCS})
+
+add_native_precompiled_header(ace ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/WinAcePCH)
+
+install(TARGETS ace RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")
diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp
@@ -0,0 +1,2 @@
+
+
diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h
new file mode 100644
index 0000000..6ff97bf
--- /dev/null
+++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h
@@ -0,0 +1,17 @@
+
+#ifndef WIN_ACE_PCH
+#define WIN_ACE_PCH
+
+#include "ace/ACE.h"
+
+#include "ace/Synch_Traits.h"
+#include "ace/Svc_Handler.h"
+#include "ace/SOCK_Stream.h"
+#include "ace/SOCK_Acceptor.h"
+#include "ace/Acceptor.h"
+#include "ace/Thread_Mutex.h"
+#include "ace/Guard_T.h"
+#include "ace/Unbounded_Queue.h"
+#include "ace/Message_Block.h"
+
+#endif
diff --git a/dep/acelite/ace/config-macros.h b/dep/acelite/ace/config-macros.h
index f18c8e0..32e5894 100644
--- a/dep/acelite/ace/config-macros.h
+++ b/dep/acelite/ace/config-macros.h
@@ -21,7 +21,11 @@
#ifndef ACE_CONFIG_MACROS_H
#define ACE_CONFIG_MACROS_H
-#include "ace/config.h"
+#ifdef _WIN32
+ #include "ace/config-win32.h"
+#else
+ #include "ace/config.h"
+#endif
#include "ace/Version.h"
#include "ace/Versioned_Namespace.h"
diff --git a/dep/acelite/ace/config-win32-common.h b/dep/acelite/ace/config-win32-common.h
index 50645a1..098ddbd 100644
--- a/dep/acelite/ace/config-win32-common.h
+++ b/dep/acelite/ace/config-win32-common.h
@@ -527,9 +527,9 @@
# else
# pragma comment(lib, "ws2_32.lib")
# pragma comment(lib, "mswsock.lib")
-# if defined (ACE_HAS_IPV6)
+// # if defined (ACE_HAS_IPV6)
# pragma comment(lib, "iphlpapi.lib")
-# endif
+// # endif
# endif /* ACE_HAS_WINCE */
# endif /* _MSC_VER */
+1 -1
View File
@@ -8,7 +8,7 @@
(henceforth referred to as "DOC software") are copyrighted by
[5]Douglas C. Schmidt and his [6]research group at [7]Washington
University, [8]University of California, Irvine, and [9]Vanderbilt
University, Copyright (c) 1993-2009, all rights reserved. Since DOC
University, Copyright (c) 1993-2012, all rights reserved. Since DOC
software is open-source, freely available software, you are free to
use, modify, copy, and distribute--perpetually and irrevocably--the
DOC software source code and object code produced from the source, as
+2411 -2841
View File
File diff suppressed because it is too large Load Diff
+183
View File
@@ -1,3 +1,186 @@
USER VISIBLE CHANGES BETWEEN ACE-6.1.3 and ACE-6.1.4
====================================================
. Added a new ACE_Time_Value derived template class (Time_Value_T.h):
template <class TIME_POLICY> class ACE_Time_Value_T
This template class overloads 4 new virtual methods from
the ACE_Time_Value base class to provide time policy aware
time values:
to_relative_time ()
to_absolute_time ()
now ()
duplicate ()
. Updated time policy classes to return ACE_Time_Value_T<> instantiations
for the corresponding time policy instead of 'common' time values.
. Added new ACE_Monotonic_Time_Policy (Monotonic_Time_Policy.h).
This class provides a monotonic time source for supported
platforms (Windows and POSIX platforms providing the required
clock_gettime() time source; currently verified for Windows and
Linux)
. Updated OS_NS_Thread to use the new time policy support in ACE_Time_Value
for (relative) time calculations and added new ACE_OS::condattr_setclock ()
method.
. Added TIME_POLICY support to ACE_Condition_Attributes to allow for
monotonic timer support for ACE_Condition.
. Added TIME_POLICY support to ACE_Message_Queue-s, ACE_Task-s and
related classes to enable support for monotonic timers in the timed
wait methods (ACE_Condition based). See docs/ACE-monotonic-timer.html
for how to use this.
. Added two new regression tests:
Monotonic_Task_Test
Monotonic_Message_Queue_Test
and updated the Bug_4055_Regression_Test to a fixed state.
USER VISIBLE CHANGES BETWEEN ACE-6.1.2 and ACE-6.1.3
====================================================
. Added support for Oracle Solaris Studio 12 Update 3 (SunCC 5.12)
. Added new XML_Utils library which comes from DAnCE but is now also used
by OpenDDS
USER VISIBLE CHANGES BETWEEN ACE-6.1.1 and ACE-6.1.2
====================================================
. Added compile time support for Windows CE 7, no runtime testing has
been performed
. The High Res Timer global scale factor on Windows is now 64bit, see bugzilla
3703 for the background of this. If you use the gsf in your code, use the
new ACE_High_Res_Timer::global_scale_factor_type type trait to not get
any conversion warnings
. Removed Tandem NSK v2/v3 support which resulted in cleanup throughout all
code. The emulations for ACE_INT64/ACE_UINT64 have been removed because no
platform is using them anymore
USER VISIBLE CHANGES BETWEEN ACE-6.1.0 and ACE-6.1.1
====================================================
. Minor bug fixes
USER VISIBLE CHANGES BETWEEN ACE-6.0.8 and ACE-6.1.0
====================================================
. Added compilation support for VxWorks 6.9, no runtime
testing has been performed
. Added ACE Run-length encoding compressor
. Fixed several Coverity reported issues
USER VISIBLE CHANGES BETWEEN ACE-6.0.7 and ACE-6.0.8
====================================================
. Added support for MPC's new feature that creates dependency files for IDL
files when generating '-type gnuace' projects. Turned off by default, it
can be enabled in a features file or on the command line with
'-features ace_idl_dependencies=1'.
USER VISIBLE CHANGES BETWEEN ACE-6.0.6 and ACE-6.0.7
====================================================
. Added a new method to ACE_Atomic_Op<LOCK, TYPE>, TYPE exchange (TYPE newval)
which does an atomic exchange of the new value with ACE_Atomic_Op's value
and returns the old value. The tests/Atomic_Op_Test.cpp test program has a
test case that exemplifies its usage; see the Exchange_Tester class.
. Added a new feature to timer queue templates classes: TIME_POLICY.
This feature is specified through a new template argument and provides the
timer queue with a policy for a timer (time of day) value. This feature is
intended to replace (in time) the gettimeofday setter method which has been
marked @deprecated. For now backwards compatibility is guaranteed.
The TIME_POLICY feature provides flexibility with regards to providing a timer
source to the timer queues as well as the possibility for a fully optimized
calling path.
A number of standard time policies are provided in ace/Time_Policy.h.
The tests/Timer_Queue_Test.cpp has been updated to reflect and exemplify these
changes.
. Added the TIME_POLICY feature also to countdown time class which has now
become a template (ace/Countdown_Time_T.h)
. Initial support for Microsoft Visual Studio 11
. Increased overall code quality by using Coverity and Klocwork
USER VISIBLE CHANGES BETWEEN ACE-6.0.5 and ACE-6.0.6
====================================================
. Removed autoconf support, only traditional way of
compilation is shipped from now
. Add support for RHEL 6.1 64bit
USER VISIBLE CHANGES BETWEEN ACE-6.0.4 and ACE-6.0.5
====================================================
. Improved support for Android and added the ability to run all ACE/TAO tests
automatically using the Android emulator
USER VISIBLE CHANGES BETWEEN ACE-6.0.3 and ACE-6.0.4
====================================================
. Removed support for C++ Builder
. Added support for building with the Android NDK, at least r5c. This
is currently available for linux host platforms.
USER VISIBLE CHANGES BETWEEN ACE-6.0.2 and ACE-6.0.3
====================================================
. Added support for GCC 4.6
USER VISIBLE CHANGES BETWEEN ACE-6.0.1 and ACE-6.0.2
====================================================
. The ACE_wrappers/ace/OS.h file has been restored in order to ensure
build-time compatibility with older ACE versions. Its use will still
cause your build to incur more processing time than using the needed
ace/OS_NS_*.h files; however, you should be able to build OS.h-including
code without needing to replace it with OS_NS_* includes.
. Improved and simplified QNX support
. Changed rand_r() and getpwnam_r() to conform Single UNIX Specification.
. Fixed performance of send_v on windows when individual iovec elements
are particularly large.
USER VISIBLE CHANGES BETWEEN ACE-6.0.0 and ACE-6.0.1
====================================================
. Added support for MinGW with GCC 4.5
USER VISIBLE CHANGES BETWEEN ACE-5.8.3 and ACE-6.0.0
====================================================
. Changed the string format produced by ACE::timestamp() from the ctime
format "Day Mon dd hh:mm:ss yyyy" to ISO-8601 yyyy-mm-dd hh:mm:ss.mmmmmm.
This makes the time easier to collate and removes any dependence on locale.
The change affects the output from ACE_Log_Msg's %D format and both VERBOSE
and VERBOSE_LIGHT timestamps in addition to application-made direct calls
to ACE::timestamp().
. Removed GCC < 3 support
. A new build system hook was added for users to include site-private rules
in a build. If a file named "rules.private.GNU" in located in any build
directory it will get included from
$ACE_ROOT/include/makeinclude/rules.local.GNU. The "private_rules_file"
make variable can be set to override the name and/or location of the file.
If no such rules file exists, its absence is silently ignored. This
facility can be used, for example, to integrate a specialized code checker
into the build process.
USER VISIBLE CHANGES BETWEEN ACE-5.8.2 and ACE-5.8.3
====================================================
+2
View File
@@ -1,3 +1,5 @@
$Id: README 94611 2011-10-06 11:54:28Z msmit $
This document is also available at the following URL:
http://www.cs.wustl.edu/~schmidt/ACE.html
+35 -5
View File
@@ -1,8 +1,8 @@
ACKNOWLEDGEMENTS
ACE and TAO have been deeply influenced and improved by the following
members of my research group at Washington University in St. Louis, the
University of California at Irvine, and Vanderbilt University in Nashville.
ACE, TAO, CIAO, and DAnCE have been deeply influenced and improved by the
following members of my research group at Washington University in St. Louis,
the University of California at Irvine, and Vanderbilt University in Nashville.
Everett Anderson <eea1 at cec dot wustl dot edu>
Alexander Babu Arulanthu <alex at cs dot wustl dot edu>
@@ -75,7 +75,7 @@ Torben Worm <tworm at cs dot wustl dot edu>
Ming Xiong <xiongm at isis dot vanderbilt dot edu>
I would also like to thank all the following people who have also
contributed to ACE and TAO over the years:
contributed to ACE, TAO, CIAO, and DAnCE over the years:
Paul Stephenson <pstephenson at objectspace dot com>
Olaf Kruger <okruger at cssc-melb dot tansu dot com dot au>
@@ -411,7 +411,7 @@ Andrew Harbick <aharbick at opentext dot com>
Pavel Motuzenko <p_motuzenko at hotmail dot com>
Ross J. Lillie <lillie at rsch dot comm dot mot dot com>
Sam Hauer <shauer at nmo dot gtegsc dot com>
Frank J. Hodum <fhodum at dctd dot saic dot com>
Frank J. Hodum <FRANK.J.HODUM at saic dot com>
David Miron <dxm at crapper dot dsto dot defence dot gov dot au>
Anton van Straaten <anton at appsolutions dot com>
Joe Covalesky <joe at nowsol dot com>
@@ -2339,6 +2339,36 @@ Matthew Waller <matthewrwaller at gmail dot com>
Elez <elezsh at gmail dot com>
Ranjit Hande <hande at avaya dot com>
Van Vuong <vanvuong1 at us dot ibm dot com>
Mark <markg85 at gmail dot com>
Wendsomde Yameogo <wendsomde at yameogo dot com>
Shi John <John dot Shi at acxiom dot com>
Helmut Böing
Andrew Hill <lists at thefrog dot net>
Henk Jan Priester <hjpriester at gmail dot com>
Glenn Zickert <gzickert at comcast dot net>
Chris Galli <christian dot galli at gmail dot com>
Laura Autón García <darklulu+ace at gmail dot com>
Jonathan Saxton <jsaxton at appsecinc dot com>
Remko Duppen <remko dot duppen at syntel dot nl>
Paul Fitzpatrick <paul at robotrebuilt dot com>
Chad Beaulac <chad dot beaulac at objectivesolutions dot com>
Jochen Meier <gesammeltimusenet2009 at arcor dot de>
Thomas Pauli <thomas dot pauli at tu-dortmund dot de>
Qiao Zhiqiang <qiaozhiqiang at leadcoretech dot com>
JaeSung Lee <berise at gmail dot com>
Chong Wuk Pak <chong dot pak at lmco dot com>
Michael Frommberger <michael dot frommberger at gmx dot net>
Andrey Karpov <karpov at viva64 dot com>
Dmytro Ovdiienko <dmitriy dot ovdienko at gmail.com>
Andrea Sormanni <andrea dot sormanni at gmail dot com>
Thomas Stegemann <Thomas dot Stegemann at materna dot de>
David Simmonds <david dot simmonds at iggroup dot com>
Andreas Dröscher <ace at anticat dot ch>
Markus Manck <Markus dot Manck at Philotech dot de>
Deux deVille <dev2 at weitling dot net>
Mohsin Zaidi <mohsinrzaidi at gmail dot com>
Milind Pangarkar <Milind dot Pangarkar at amdocs dot com>
Ali Akbar Zarezadeh <akzare at cs dot uni-potsdam dot de>
I would particularly like to thank Paul Stephenson, who worked with me
at Ericsson in the early 1990's. Paul devised the recursive Makefile
+1 -1
View File
@@ -1,4 +1,4 @@
This is ACE version 5.8.3, released Wed Oct 27 12:01:05 CEST 2010
This is ACE version 6.1.4, released Wed Aug 29 08:16:04 CEST 2012
If you have any problems with or questions about ACE, please send
e-mail to the ACE mailing list ([email protected]),
+32 -100
View File
@@ -1,4 +1,4 @@
// $Id: ACE.cpp 92298 2010-10-21 11:15:17Z johnnyw $
// $Id: ACE.cpp 96017 2012-08-08 22:18:09Z mitza $
#include "ace/ACE.h"
@@ -25,10 +25,6 @@
#include "ace/OS_TLI.h"
#include "ace/Truncate.h"
#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
extern "C" int maxFiles;
#endif /* ACE_VXWORKS */
#if !defined (__ACE_INLINE__)
#include "ace/ACE.inl"
#endif /* __ACE_INLINE__ */
@@ -68,7 +64,7 @@ ACE::out_of_handles (int error)
#elif defined (HPUX)
// On HPUX, we need to check for EADDRNOTAVAIL also.
error == EADDRNOTAVAIL ||
#elif defined (linux)
#elif defined (ACE_LINUX)
// On linux, we need to check for ENOENT also.
error == ENOENT ||
// For RedHat5.2, need to check for EINVAL too.
@@ -2308,7 +2304,7 @@ ACE::format_hexdump (const char *buffer,
ACE_TEXT (" "));
++obuf;
}
textver[j] = ACE_OS::ace_isprint (c) ? c : '.';
textver[j] = ACE_OS::ace_isprint (c) ? c : u_char ('.');
}
textver[j] = 0;
@@ -2340,7 +2336,7 @@ ACE::format_hexdump (const char *buffer,
ACE_TEXT (" "));
++obuf;
}
textver[i] = ACE_OS::ace_isprint (c) ? c : '.';
textver[i] = ACE_OS::ace_isprint (c) ? c : u_char ('.');
}
for (i = size % 16; i < 16; i++)
@@ -2371,7 +2367,8 @@ ACE::format_hexdump (const char *buffer,
// Returns the current timestamp in the form
// "hour:minute:second:microsecond." The month, day, and year are
// also stored in the beginning of the date_and_time array.
// also stored in the beginning of the date_and_time array
// using ISO-8601 format.
ACE_TCHAR *
ACE::timestamp (ACE_TCHAR date_and_time[],
@@ -2386,7 +2383,10 @@ ACE::timestamp (ACE_TCHAR date_and_time[],
// Returns the given timestamp in the form
// "hour:minute:second:microsecond." The month, day, and year are
// also stored in the beginning of the date_and_time array.
// also stored in the beginning of the date_and_time array
// using ISO-8601 format.
// 012345678901234567890123456
// 2010-12-02 12:56:00.123456<nul>
ACE_TCHAR *
ACE::timestamp (const ACE_Time_Value& time_value,
@@ -2396,92 +2396,32 @@ ACE::timestamp (const ACE_Time_Value& time_value,
{
//ACE_TRACE ("ACE::timestamp");
if (date_and_timelen < 35)
// This magic number is from the formatting statement
// farther down this routine.
if (date_and_timelen < 27)
{
errno = EINVAL;
return 0;
}
#if defined (WIN32)
if (time_value == ACE_Time_Value::zero)
{
// Emulate Unix. Win32 does NOT support all the UNIX versions
// below, so DO we need this ifdef.
static const ACE_TCHAR *day_of_week_name[] =
{
ACE_TEXT ("Sun"),
ACE_TEXT ("Mon"),
ACE_TEXT ("Tue"),
ACE_TEXT ("Wed"),
ACE_TEXT ("Thu"),
ACE_TEXT ("Fri"),
ACE_TEXT ("Sat")
};
static const ACE_TCHAR *month_name[] =
{
ACE_TEXT ("Jan"),
ACE_TEXT ("Feb"),
ACE_TEXT ("Mar"),
ACE_TEXT ("Apr"),
ACE_TEXT ("May"),
ACE_TEXT ("Jun"),
ACE_TEXT ("Jul"),
ACE_TEXT ("Aug"),
ACE_TEXT ("Sep"),
ACE_TEXT ("Oct"),
ACE_TEXT ("Nov"),
ACE_TEXT ("Dec")
};
SYSTEMTIME local;
::GetLocalTime (&local);
ACE_OS::sprintf (date_and_time,
ACE_TEXT ("%3s %3s %2d %04d %02d:%02d:%02d.%06d"),
day_of_week_name[local.wDayOfWeek],
month_name[local.wMonth - 1],
(int) local.wDay,
(int) local.wYear,
(int) local.wHour,
(int) local.wMinute,
(int) local.wSecond,
(int) (local.wMilliseconds * 1000));
return &date_and_time[15 + (return_pointer_to_first_digit != 0)];
}
#endif /* WIN32 */
ACE_TCHAR timebuf[26]; // This magic number is based on the ctime(3c) man page.
ACE_Time_Value cur_time =
(time_value == ACE_Time_Value::zero) ?
ACE_Time_Value (ACE_OS::gettimeofday ()) : time_value;
time_t secs = cur_time.sec ();
ACE_OS::ctime_r (&secs,
timebuf,
sizeof timebuf / sizeof (ACE_TCHAR));
// date_and_timelen > sizeof timebuf!
ACE_OS::strsncpy (date_and_time,
timebuf,
date_and_timelen);
ACE_TCHAR yeartmp[5];
ACE_OS::strsncpy (yeartmp,
&date_and_time[20],
5);
ACE_TCHAR timetmp[9];
ACE_OS::strsncpy (timetmp,
&date_and_time[11],
9);
ACE_OS::sprintf (&date_and_time[11],
# if defined (ACE_USES_WCHAR)
ACE_TEXT ("%ls %ls.%06ld"),
# else
ACE_TEXT ("%s %s.%06ld"),
# endif /* ACE_USES_WCHAR */
yeartmp,
timetmp,
cur_time.usec ());
date_and_time[33] = '\0';
return &date_and_time[15 + (return_pointer_to_first_digit != 0)];
struct tm tms;
ACE_OS::localtime_r (&secs, &tms);
ACE_OS::snprintf (date_and_time,
date_and_timelen,
ACE_TEXT ("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d.%06ld"),
tms.tm_year + 1900,
tms.tm_mon + 1,
tms.tm_mday,
tms.tm_hour,
tms.tm_min,
tms.tm_sec,
static_cast<long> (cur_time.usec()));
date_and_time[date_and_timelen - 1] = '\0';
return &date_and_time[10 + (return_pointer_to_first_digit != 0)];
}
// This function rounds the request to a multiple of the page size.
@@ -2866,9 +2806,7 @@ ACE::max_handles (void)
#endif /* RLIMIT_NOFILE && !ACE_LACKS_RLIMIT */
#if defined (_SC_OPEN_MAX)
return ACE_OS::sysconf (_SC_OPEN_MAX);
#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620)
return maxFiles;
return static_cast<int> (ACE_OS::sysconf (_SC_OPEN_MAX));
#elif defined (FD_SETSIZE)
return FD_SETSIZE;
#else
@@ -2915,7 +2853,7 @@ ACE::set_handle_limit (int new_limit,
#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE)
rl.rlim_cur = new_limit;
return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl);
#elif defined (ACE_LACKS_RLIMIT_NOFILE)
#elif !defined (RLIMIT_NOFILE)
return 0;
#else
// Must return EINVAL errno.
@@ -3342,10 +3280,7 @@ ACE::strnew (const char *s)
ACE_NEW_RETURN (t,
char [ACE_OS::strlen (s) + 1],
0);
if (t == 0)
return 0;
else
return ACE_OS::strcpy (t, s);
return ACE_OS::strcpy (t, s);
}
#if defined (ACE_HAS_WCHAR)
@@ -3358,10 +3293,7 @@ ACE::strnew (const wchar_t *s)
ACE_NEW_RETURN (t,
wchar_t[ACE_OS::strlen (s) + 1],
0);
if (t == 0)
return 0;
else
return ACE_OS::strcpy (t, s);
return ACE_OS::strcpy (t, s);
}
#endif /* ACE_HAS_WCHAR */
@@ -3400,7 +3332,7 @@ namespace
// characters are allowed as the range endpoints. These characters
// are the same values in both signed and unsigned chars so we
// don't have to account for any "pathological cases."
for (char range = p[-1] + 1; range <= p[1]; ++range)
for (char range = static_cast<char> (p[-1] + 1); range <= p[1]; ++range)
{
if (equal_char (s, range, case_sensitive))
{
+41 -19
View File
@@ -4,7 +4,7 @@
/**
* @file ACE.h
*
* $Id: ACE.h 92060 2010-09-27 18:08:48Z johnnyw $
* $Id: ACE.h 93276 2011-02-04 20:03:53Z olli $
*
* This file contains value added ACE functions that extend the
* behavior of the UNIX and Win32 OS calls.
@@ -474,15 +474,23 @@ namespace ACE
ACE_DIRECTORY_SEPARATOR_CHAR);
/**
* Returns the given timestamp in the form
* "hour:minute:second:microsecond." The month, day, and year are
* also stored in the beginning of the @a date_and_time array, which
* is a user-supplied array of size @a time_len> @c ACE_TCHARs.
* Returns 0 if unsuccessful, else returns pointer to beginning of the
* "time" portion of @a date_and_time. If @a
* return_pointer_to_first_digit is 0 then return a pointer to the
* space before the time, else return a pointer to the beginning of
* the time portion.
* Translate the given timestamp to ISO-8601 format.
*
* @param time_value ACE_Time_Value to format. This is assumed to be
* an absolute time value.
* @param date_and_time Array to hold the timestamp.
* @param time_len Size of @a date_and_time in ACE_TCHARs.
* Must be greater than or equal to 27.
* @param return_pointer_to_first_digit If true, returned pointer value
* is to the first time digit, else to the space
* prior to the first time digit. See Return Values.
*
* @retval 0 if unsuccessful, with errno set. If @a time_len is less than
* 27 errno will be EINVAL.
* @retval If successful, pointer to beginning of the "time" portion of
* @a date_and_time. If @a return_pointer_to_first_digit is false
* the pointer is actually to the space before the time, else
* the pointer is to the first time digit.
*/
extern ACE_Export ACE_TCHAR *timestamp (const ACE_Time_Value& time_value,
ACE_TCHAR date_and_time[],
@@ -490,15 +498,21 @@ namespace ACE
bool return_pointer_to_first_digit = false);
/**
* Returns the current timestamp in the form
* "hour:minute:second:microsecond." The month, day, and year are
* also stored in the beginning of the @a date_and_time array, which
* is a user-supplied array of size @a time_len> @c ACE_TCHARs.
* Returns 0 if unsuccessful, else returns pointer to beginning of the
* "time" portion of @a date_and_time. If @a
* return_pointer_to_first_digit is 0 then return a pointer to the
* space before the time, else return a pointer to the beginning of
* the time portion.
* Translate the current time to ISO-8601 timestamp format.
*
* @param date_and_time Array to hold the timestamp.
* @param time_len Size of @a date_and_time in ACE_TCHARs.
* Must be greater than or equal to 27.
* @param return_pointer_to_first_digit If true, returned pointer value
* is to the first time digit, else to the space
* prior to the first time digit. See Return Values.
*
* @retval 0 if unsuccessful, with errno set. If @a time_len is less than
* 27 errno will be EINVAL.
* @retval If successful, pointer to beginning of the "time" portion of
* @a date_and_time. If @a return_pointer_to_first_digit is false
* the pointer is actually to the space before the time, else
* the pointer is to the first time digit.
*/
extern ACE_Export ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[],
size_t time_len,
@@ -650,6 +664,14 @@ namespace ACE
return !((a < b) || (a > b));
}
/// Helper to avoid comparing floating point values with !=
/// (uses < and > operators).
template <typename T>
bool is_inequal (const T& a, const T& b)
{
return !is_equal (a, b);
}
/// Hex conversion utility.
extern ACE_Export ACE_TCHAR nibble2hex (u_int n);
+2 -2
View File
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
// $Id: ACE.inl 91813 2010-09-17 07:52:52Z johnnyw $
// $Id: ACE.inl 95761 2012-05-15 18:23:04Z johnnyw $
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_Thread.h"
@@ -230,7 +230,7 @@ ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len)
ACE_INLINE ssize_t
ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len)
{
#if defined (ACE_WIN32) || defined (ACE_OPENVMS) || defined (ACE_TANDEM_T1248_PTHREADS)
#if defined (ACE_WIN32) || defined (ACE_OPENVMS)
return ACE_OS::recv (handle, (char *) buf, len);
#else
return ACE_OS::read (handle, (char *) buf, len);
+7 -7
View File
@@ -1,4 +1,4 @@
// $Id: ACE_crc_ccitt.cpp 91286 2010-08-05 09:04:31Z johnnyw $
// $Id: ACE_crc_ccitt.cpp 96017 2012-08-08 22:18:09Z mitza $
#include "ace/ACE.h"
@@ -65,7 +65,7 @@ namespace
/*****************************************************************/
}
#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8))
#define COMPUTE(var, ch) (var) = static_cast<ACE_UINT16> (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8))
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -82,13 +82,13 @@ ACE::crc_ccitt (const char *string)
COMPUTE (crc, *p);
}
return ~crc;
return static_cast<ACE_UINT16> (~crc);
}
ACE_UINT16
ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc)
{
crc = ~crc;
crc = static_cast<ACE_UINT16> (~crc);
for (const char *p = (const char *) buffer,
*e = (const char *) buffer + len;
@@ -98,13 +98,13 @@ ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc)
COMPUTE (crc, *p);
}
return ~crc;
return static_cast<ACE_UINT16> (~crc);
}
ACE_UINT16
ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc)
{
crc = ~crc;
crc = static_cast<ACE_UINT16> (~crc);
for (int i = 0; i < len; ++i)
{
@@ -115,7 +115,7 @@ ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc)
COMPUTE (crc, *p);
}
return ~crc;
return static_cast<ACE_UINT16> (~crc);
}
// Close versioned namespace, if enabled by the user.
+4 -4
View File
@@ -1,4 +1,4 @@
// $Id: ARGV.cpp 91286 2010-08-05 09:04:31Z johnnyw $
// $Id: ARGV.cpp 95630 2012-03-22 13:04:47Z johnnyw $
#ifndef ACE_ARGV_CPP
#define ACE_ARGV_CPP
@@ -167,6 +167,7 @@ ACE_ARGV_T<CHAR_TYPE>::ACE_ARGV_T (CHAR_TYPE *first_argv[],
CHAR_TYPE *first_buf = 0;
CHAR_TYPE *second_buf = 0;
size_t buf_len = 1;
// convert the first argv to a string
if (first_argv != 0 && first_argv[0] != 0)
@@ -175,6 +176,7 @@ ACE_ARGV_T<CHAR_TYPE>::ACE_ARGV_T (CHAR_TYPE *first_argv[],
first_buf,
substitute_env_args,
quote_args);
buf_len += ACE_OS::strlen (first_buf);
}
// convert the second argv to a string
@@ -184,14 +186,12 @@ ACE_ARGV_T<CHAR_TYPE>::ACE_ARGV_T (CHAR_TYPE *first_argv[],
second_buf,
substitute_env_args,
quote_args);
buf_len += ACE_OS::strlen (second_buf);
}
// Add the number of arguments in both the argvs.
this->argc_ = first_argc + second_argc;
size_t buf_len =
ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1;
// Allocate memory to the lenght of the combined argv string.
ACE_NEW (this->buf_,
CHAR_TYPE[buf_len + 1]);
+3 -3
View File
@@ -4,7 +4,7 @@
/**
* @file ARGV.h
*
* $Id: ARGV.h 81156 2008-03-30 20:56:47Z iliyan $
* $Id: ARGV.h 95972 2012-07-26 10:20:42Z johnnyw $
*
* @author Doug Schmidt <[email protected]>
* @author Everett Anderson <[email protected]>
@@ -206,8 +206,8 @@ public:
*
* @param index Index to the desired element.
*
* @retval Pointer to the indexed string.
* @retval 0 if @a index is out of bounds.
* @retval Pointer to the indexed string.
* @retval 0 if @a index is out of bounds.
*/
const CHAR_TYPE *operator[] (size_t index);
+1 -2
View File
@@ -1,6 +1,5 @@
// -*- C++ -*-
//
// $Id: ATM_Stream.inl 84262 2009-01-29 10:34:33Z johnnyw $
// $Id: ATM_Stream.inl 92474 2010-11-02 13:29:39Z johnnyw $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+26
View File
@@ -0,0 +1,26 @@
//$Id: Abstract_Timer_Queue.cpp 95334 2011-12-15 12:52:50Z msmit $
#ifndef ACE_ABSTRACT_TIMER_QUEUE_CPP
#define ACE_ABSTRACT_TIMER_QUEUE_CPP
#include "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Abstract_Timer_Queue.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Even though the destructor is pure virtual you must provide an
// implementation. Most people know this, but sometimes we all
// forget, and we might be tempted to remove this code.
template<typename TYPE>
ACE_Abstract_Timer_Queue<TYPE>::
~ACE_Abstract_Timer_Queue ()
{
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_ABSTRACT_TIMER_QUEUE_CPP */
+230
View File
@@ -0,0 +1,230 @@
//$Id: Abstract_Timer_Queue.h 95368 2011-12-19 13:38:49Z mcorino $
#ifndef ACE_ABSTRACT_TIMER_QUEUE_H
#define ACE_ABSTRACT_TIMER_QUEUE_H
#include /**/ "ace/pre.h"
/**
* @file Abstract_Timer_Queue.h
*
* @author Carlos O'Ryan <[email protected]>
*
* Based on classes and files developed by Doug Schmidt, Darrell
* Brunsch, Irfan Pyarali and a cast of thousands.
*/
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Forward declares
class ACE_Time_Value;
class ACE_Command_Base;
template<typename TYPE> class ACE_Timer_Queue_Iterator_T;
template<typename TYPE> class ACE_Timer_Node_T;
/**
* @class ACE_Abstract_Timer_Queue
*
* @brief Base class for all timer queues of a single type.
*
* This is a base class for all the timer queues, regardless of
* locking strategy, upcall mechanism, internal implementation, etc.
* The class was motivated by bug 3706:
* http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3706
* In short, the Reactor (and potentially other classes) want to refer
* to timer queues regardless of the implementation internals.
*/
template<typename TYPE>
class ACE_Abstract_Timer_Queue
{
public:
/// Destructor
virtual ~ACE_Abstract_Timer_Queue (void) = 0;
/// True if queue is empty, else false.
virtual bool is_empty (void) const = 0;
/// Returns the time of the earlier node in the Timer_Queue. Must
/// be called on a non-empty queue.
virtual const ACE_Time_Value &earliest_time (void) const = 0;
/**
* Schedule @a type that will expire at @a future_time, which is
* specified in absolute time. If it expires then @a act is passed
* in as the value to the <functor>. If @a interval is != to
* ACE_Time_Value::zero then it is used to reschedule the @a type
* automatically, using relative time to the current <gettimeofday>.
* This method returns a <timer_id> that uniquely identifies the the
* @a type entry in an internal list. This <timer_id> can be used to
* cancel the timer before it expires. The cancellation ensures
* that <timer_ids> are unique up to values of greater than 2
* billion timers. As long as timers don't stay around longer than
* this there should be no problems with accidentally deleting the
* wrong timer. Returns -1 on failure (which is guaranteed never to
* be a valid <timer_id>).
*/
virtual long schedule (const TYPE &type,
const void *act,
const ACE_Time_Value &future_time,
const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0;
/**
* Run the <functor> for all timers whose values are <= @a current_time.
* This does not account for <timer_skew>. Returns the number of
* timers canceled.
*/
virtual int expire (const ACE_Time_Value &current_time) = 0;
/**
* Run the <functor> for all timers whose values are <=
* <ACE_OS::gettimeofday>. Also accounts for <timer_skew>.
*
* Depending on the resolution of the underlying OS the system calls
* like select()/poll() might return at time different than that is
* specified in the timeout. Suppose the OS guarantees a resolution of t ms.
* The timeline will look like
*
* A B
* | |
* V V
* |-------------|-------------|-------------|-------------|
* t t t t t
*
*
* If you specify a timeout value of A, then the timeout will not occur
* at A but at the next interval of the timer, which is later than
* that is expected. Similarly, if your timeout value is equal to B,
* then the timeout will occur at interval after B. Now depending upon the
* resolution of your timeouts and the accuracy of the timeouts
* needed for your application, you should set the value of
* <timer_skew>. In the above case, if you want the timeout A to fire
* no later than A, then you should specify your <timer_skew> to be
* A % t.
*
* The timeout value should be specified via the macro ACE_TIMER_SKEW
* in your config.h file. The default value is zero.
*
* Things get interesting if the t before the timeout value B is zero
* i.e your timeout is less than the interval. In that case, you are
* almost sure of not getting the desired timeout behaviour. Maybe you
* should look for a better OS :-)
*
* Returns the number of timers canceled.
*/
virtual int expire (void) = 0;
/**
* A couple of classes using Timer_Queues need to dispatch a single
* event at a time. But before they dispatch the event they need to
* release a lock, signal other threads, etc.
*
* This member function should be used in that case. The additional
* operations to be called just before dispatching the event, and
* only if an event will be dispatched, are encapsulated in the
* ACE_Command_Base object.
*/
virtual int expire_single(ACE_Command_Base & pre_dispatch_command) = 0;
/**
* Resets the interval of the timer represented by @a timer_id to
* @a interval, which is specified in relative time to the current
* <gettimeofday>. If @a interval is equal to
* ACE_Time_Value::zero, the timer will become a non-rescheduling
* timer. Returns 0 if successful, -1 if not.
*/
virtual int reset_interval (long timer_id,
const ACE_Time_Value &interval) = 0;
/**
* Cancel all timer associated with @a type. If
* @a dont_call_handle_close is 0 then the <functor> will be invoked,
* which typically invokes the <handle_close> hook. Returns number
* of timers cancelled.
*/
virtual int cancel (const TYPE &type,
int dont_call_handle_close = 1) = 0;
/**
* Cancel the single timer that matches the @a timer_id value (which
* was returned from the <schedule> method). If act is non-NULL
* then it will be set to point to the ``magic cookie'' argument
* passed in when the timer was registered. This makes it possible
* to free up the memory and avoid memory leaks. If
* @a dont_call_handle_close is 0 then the <functor> will be invoked,
* which typically calls the <handle_close> hook. Returns 1 if
* cancellation succeeded and 0 if the @a timer_id wasn't found.
*/
virtual int cancel (long timer_id,
const void **act = 0,
int dont_call_handle_close = 1) = 0;
/**
* Close timer queue. Cancels all timers.
*/
virtual int close (void) = 0;
/**
* Returns the current time of day. This method allows different
* implementations of the timer queue to use special high resolution
* timers.
*/
virtual ACE_Time_Value gettimeofday (void) = 0;
/**
* Allows applications to control how the timer queue gets the time
* of day.
* @deprecated Use TIME_POLICY support instead. See Timer_Queue_T.h
*/
virtual void gettimeofday (ACE_Time_Value (*gettimeofday)(void)) = 0;
/// Determine the next event to timeout. Returns @a max if there are
/// no pending timers or if all pending timers are longer than max.
/// This method acquires a lock internally since it modifies internal state.
virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max) = 0;
/**
* Determine the next event to timeout. Returns @a max if there are
* no pending timers or if all pending timers are longer than max.
* <the_timeout> should be a pointer to storage for the timeout value,
* and this value is also returned. This method does not acquire a
* lock internally since it doesn't modify internal state. If you
* need to call this method when the queue is being modified
* concurrently, however, you should make sure to acquire the <mutex()>
* externally before making the call.
*/
virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max,
ACE_Time_Value *the_timeout) = 0;
/**
* Return the current time, using the right time policy and any
* timer skew defined in derived classes.
*/
virtual ACE_Time_Value current_time() = 0;
/// Type of Iterator.
typedef ACE_Timer_Queue_Iterator_T<TYPE> ITERATOR;
/// Returns a pointer to this ACE_Timer_Queue's iterator.
virtual ITERATOR & iter (void) = 0;
/// Removes the earliest node from the queue and returns it
virtual ACE_Timer_Node_T<TYPE> *remove_first (void) = 0;
/// Reads the earliest node from the queue and returns it.
virtual ACE_Timer_Node_T<TYPE> *get_first (void) = 0;
/// Dump the state of a object.
virtual void dump (void) const = 0;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Abstract_Timer_Queue.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Abstract_Timer_Queue.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include /**/ "ace/post.h"
#endif /* ACE_ABSTRACT_TIMER_QUEUE_H */
+10 -4
View File
@@ -1,4 +1,4 @@
// $Id: Acceptor.cpp 91623 2010-09-06 09:30:59Z sma $
// $Id: Acceptor.cpp 95730 2012-05-04 17:28:19Z johnnyw $
#ifndef ACE_ACCEPTOR_CPP
#define ACE_ACCEPTOR_CPP
@@ -900,7 +900,10 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open
template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor (void)
: delete_concurrency_strategy_ (false)
: svc_handler_ (0),
restart_ (false),
concurrency_strategy_ (0),
delete_concurrency_strategy_ (false)
{
ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor");
this->reactor (0);
@@ -911,7 +914,10 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor
(const ACE_PEER_ACCEPTOR_ADDR &local_addr,
ACE_Reactor *reactor,
ACE_Concurrency_Strategy<SVC_HANDLER> *cs)
: delete_concurrency_strategy_ (false)
: svc_handler_ (0),
restart_ (false),
concurrency_strategy_ (0),
delete_concurrency_strategy_ (false)
{
ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor");
if (this->open (local_addr, reactor, cs) == -1)
@@ -1010,7 +1016,7 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::register_handler
if (tv != 0
&& this->reactor ()->schedule_timer (this,
synch_options.arg (),
*tv) == 0)
*tv) == -1)
return -1;
else
return this->reactor ()->register_handler
+3 -3
View File
@@ -4,7 +4,7 @@
/**
* @file Acceptor.h
*
* $Id: Acceptor.h 88800 2010-02-01 23:18:34Z shuston $
* $Id: Acceptor.h 93624 2011-03-22 21:14:05Z johnnyw $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
@@ -193,9 +193,9 @@ protected:
virtual int accept_svc_handler (SVC_HANDLER *svc_handler);
/**
* Bridge method for activating a {svc_handler} with the appropriate
* Bridge method for activating a @a svc_handler with the appropriate
* concurrency strategy. The default behavior of this method is to
* activate the SVC_HANDLER by calling its {open} method (which
* activate the SVC_HANDLER by calling its open() method (which
* allows the SVC_HANDLER to define its own concurrency strategy).
* However, subclasses can override this strategy to do more
* sophisticated concurrency activations (such as making the
+2 -2
View File
@@ -4,7 +4,7 @@
/**
* @file Active_Map_Manager.h
*
* $Id: Active_Map_Manager.h 91066 2010-07-12 11:05:04Z johnnyw $
* $Id: Active_Map_Manager.h 93359 2011-02-11 11:33:12Z mcorino $
*
* @author Irfan Pyarali
*/
@@ -68,7 +68,7 @@ public:
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>.
/// big as the value returned from size().
void encode (void *data) const;
/// Compare keys.
+3 -3
View File
@@ -4,7 +4,7 @@
/**
* @file Arg_Shifter.h
*
* $Id: Arg_Shifter.h 91459 2010-08-25 09:51:01Z mcorino $
* $Id: Arg_Shifter.h 95972 2012-07-26 10:20:42Z johnnyw $
*
* @author Seth Widoff
*/
@@ -211,10 +211,10 @@ private:
/// The index of <argv_> in which we'll stick the next known
/// argument.
int front_;
/* This is not really the "front" at all. It's the point after
/** This is not really the "front" at all. It's the point after
* which the unknown arguments end and at which the known arguments begin.
*/
int front_;
};
typedef ACE_Arg_Shifter_T<ACE_TCHAR> ACE_Arg_Shifter;
+2 -2
View File
@@ -4,7 +4,7 @@
/**
* @file Argv_Type_Converter.h
*
* $Id: Argv_Type_Converter.h 83891 2008-11-28 11:01:50Z johnnyw $
* $Id: Argv_Type_Converter.h 93359 2011-02-11 11:33:12Z mcorino $
*
* @author Si Mong Park <spark@ociweb.com>
*/
@@ -78,7 +78,7 @@ private:
/// argv list.
void align_wchar_with_char (void);
/// Clean up removed (comsumed) argv entries and reset the pass flags.
/// Clean up removed (consumed) argv entries and reset the pass flags.
void cleanup (void);
#endif // ACE_USES_WCHAR
+4 -4
View File
@@ -4,7 +4,7 @@
/**
* @file Array_Base.h
*
* $Id: Array_Base.h 84477 2009-02-16 13:30:38Z johnnyw $
* $Id: Array_Base.h 93359 2011-02-11 11:33:12Z mcorino $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
@@ -67,21 +67,21 @@ public:
ACE_Array_Base (size_type size = 0,
ACE_Allocator * the_allocator = 0);
/// Dynamically initialize the entire array to the <default_value>.
/// Dynamically initialize the entire array to the @a 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
* copy of the contents of parameter @a 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
* copy of the contents of parameter @a s, i.e., *this == s will
* return true. Note that if the <max_size_> of <array_> is >= than
* <s.max_size_> we can copy it without reallocating. However, if
* <max_size_> is < <s.max_size_> we must delete the <array_>,
+1 -38
View File
@@ -1,4 +1,4 @@
// $Id: Array_Map.cpp 80826 2008-03-04 14:51:23Z wotte $
// $Id: Array_Map.cpp 92386 2010-10-28 07:44:37Z johnnyw $
#ifndef ACE_ARRAY_MAP_CPP
#define ACE_ARRAY_MAP_CPP
@@ -15,7 +15,6 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#ifndef ACE_LACKS_MEMBER_TEMPLATES
template<typename Key, typename Value, class EqualTo>
template<typename InputIterator>
ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (InputIterator f,
@@ -34,26 +33,6 @@ ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (InputIterator f,
// for (InputIterator i = f; i != l; ++i, ++n)
// *n = *i;
}
#else
template<typename Key, typename Value, class EqualTo>
ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (
typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator f,
typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator l)
: size_ (l - f)
, capacity_ (size_)
, nodes_ (size_ == 0 ? 0 : new value_type[size_])
{
(void) std::copy (f,
l,
ACE_make_checked_array_iterator (this->begin (),
this->size_));
// iterator n = this->begin ();
// for (const_iterator i = f; i != l; ++i, ++n)
// *n = *i;
}
#endif /* !ACE_LACKS_MEMBER_TEMPLATES */
template<typename Key, typename Value, class EqualTo>
ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (
@@ -119,7 +98,6 @@ ACE_Array_Map<Key, Value, EqualTo>::insert (
return std::make_pair (i, inserted);
}
#ifndef ACE_LACKS_MEMBER_TEMPLATES
template<typename Key, typename Value, class EqualTo>
template<typename InputIterator>
void
@@ -132,21 +110,6 @@ ACE_Array_Map<Key, Value, EqualTo>::insert (InputIterator f, InputIterator l)
(void) this->insert (*i);
}
}
#else
template<typename Key, typename Value, class EqualTo>
void
ACE_Array_Map<Key, Value, EqualTo>::insert (
typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator f,
typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator l)
{
this->grow (l - f); // Preallocate storage.
for (const_iterator i = f; i != l; ++i)
{
(void) this->insert (*i);
}
}
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
template<typename Key, typename Value, class EqualTo>
void
+1 -10
View File
@@ -4,7 +4,7 @@
/**
* @file Array_Map.h
*
* $Id: Array_Map.h 84136 2009-01-12 11:01:17Z johnnyw $
* $Id: Array_Map.h 92386 2010-10-28 07:44:37Z johnnyw $
*
* Light weight array-based map with fast iteration but linear
* (i.e. O(n)) search times. STL-style interface is exposed.
@@ -110,12 +110,8 @@ public:
*/
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);
@@ -181,14 +177,9 @@ public:
*/
std::pair<iterator, bool> insert (value_type const & x);
#ifndef ACE_LACKS_MEMBER_TEMPLATES
/// Insert range of elements into map.
template<typename InputIterator>
void insert (InputIterator f, InputIterator l);
#else
/// 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);
+7 -4
View File
@@ -1,5 +1,5 @@
/* -*- C++ -*- */
// $Id: Asynch_Acceptor.cpp 91693 2010-09-09 12:57:54Z johnnyw $
// $Id: Asynch_Acceptor.cpp 95630 2012-03-22 13:04:47Z johnnyw $
#ifndef ACE_ASYNCH_ACCEPTOR_C
#define ACE_ASYNCH_ACCEPTOR_C
@@ -30,7 +30,8 @@ ACE_Asynch_Acceptor<HANDLER>::ACE_Asynch_Acceptor (void)
pass_addresses_ (false),
validate_new_connection_ (false),
reissue_accept_ (1),
bytes_to_read_ (0)
bytes_to_read_ (0),
addr_family_ (0)
{
}
@@ -297,8 +298,10 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re
// If no errors
if (!error)
{
// Update the Proactor.
new_handler->proactor (this->proactor ());
// Update the Proactor unless make_handler() or constructed handler
// set up its own.
if (new_handler->proactor () == 0)
new_handler->proactor (this->proactor ());
// Pass the addresses
if (this->pass_addresses_)
+2 -2
View File
@@ -4,7 +4,7 @@
/**
* @file Asynch_IO_Impl.h
*
* $Id: Asynch_IO_Impl.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: Asynch_IO_Impl.h 93359 2011-02-11 11:33:12Z mcorino $
*
*
* This class contains asbtract base classes for all the concrete
@@ -81,7 +81,7 @@ public:
/**
* POSIX4 real-time signal number to be used for the
* operation. <signal_number> ranges from SIGRTMIN to SIGRTMAX. By
* operation. signal_number ranges from SIGRTMIN to SIGRTMAX. By
* default, SIGRTMIN is used to issue <aio_> calls. This is a no-op
* on non-POSIX4 systems and returns 0.
*/
+7 -1
View File
@@ -4,7 +4,7 @@
/**
* @file Atomic_Op.h
*
* $Id: Atomic_Op.h 91523 2010-08-27 14:18:02Z johnnyw $
* $Id: Atomic_Op.h 95225 2011-12-05 20:25:15Z shuston $
*
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
@@ -124,6 +124,9 @@ public:
/// Atomically assign <rhs> to @c value_.
ACE_Atomic_Op<ACE_Thread_Mutex, long> &operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs);
/// Exchange value with @a newval.
long exchange (long newval);
/// Explicitly return @c value_.
long value (void) const;
@@ -221,6 +224,9 @@ public:
/// Atomically assign <rhs> to @c value_.
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &rhs);
/// Exchange value with @a newval.
unsigned long exchange (unsigned long newval);
/// Explicitly return @c value_.
unsigned long value (void) const;
+33 -2
View File
@@ -1,6 +1,5 @@
// -*- C++ -*-
//
// $Id: Atomic_Op.inl 91813 2010-09-17 07:52:52Z johnnyw $
// $Id: Atomic_Op.inl 95225 2011-12-05 20:25:15Z shuston $
#if defined (ACE_HAS_INTRINSIC_INTERLOCKED)
# include "ace/os_include/os_intrin.h"
@@ -189,6 +188,22 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (
return *this;
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::exchange (long newval)
{
#if defined (ACE_HAS_INTRINSIC_INTERLOCKED)
return ::_InterlockedExchange (const_cast<long *> (&this->value_), newval);
#elif defined (WIN32)
return ::InterlockedExchange (const_cast<long *> (&this->value_), newval);
#elif defined (ACE_HAS_VXATOMICLIB)
return ::vxAtomicSet (reinterpret_cast <atomic_t*>(const_cast<long *> (&this->value_)), newval);
#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB)
return ::atomic_swap_ulong (reinterpret_cast<volatile unsigned long*>(&this->value_), newval);
#else /* WIN32 */
return (*exchange_fn_) (&this->value_, newval);
#endif /* WIN32 */
}
ACE_INLINE long
ACE_Atomic_Op<ACE_Thread_Mutex, long>::value (void) const
{
@@ -373,6 +388,22 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (
return *this;
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::exchange (unsigned long newval)
{
#if defined (ACE_HAS_INTRINSIC_INTERLOCKED)
return ::_InterlockedExchange (const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_)), newval);
#elif defined (WIN32)
return ::InterlockedExchange (const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_)), newval);
#elif defined (ACE_HAS_VXATOMICLIB)
return ::vxAtomicSet (reinterpret_cast <atomic_t*>(const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_))), newval);
#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB)
return ::atomic_swap_ulong (&this->value_, newval);
#else /* WIN32 */
return (*exchange_fn_) (reinterpret_cast<volatile long *> (&this->value_), newval);
#endif /* WIN32 */
}
ACE_INLINE unsigned long
ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::value (void) const
{
+4 -1
View File
@@ -4,7 +4,7 @@
/**
* @file Atomic_Op_GCC_T.h
*
* $Id: Atomic_Op_GCC_T.h 89339 2010-03-05 12:20:47Z johnnyw $
* $Id: Atomic_Op_GCC_T.h 95225 2011-12-05 20:25:15Z shuston $
*
* @author Johnny Willemsen <jwillemsen@remedy.nl
*/
@@ -74,6 +74,9 @@ public:
/// Atomically check if @c value_ less than rhs.
bool operator< (T rhs) const;
/// Exchange value with @a newval.
T exchange (T newval);
/// Explicitly return @c value_.
T value (void) const;
+8 -2
View File
@@ -1,6 +1,5 @@
// -*- C++ -*-
//
// $Id: Atomic_Op_GCC_T.inl 89391 2010-03-08 13:53:30Z johnnyw $
// $Id: Atomic_Op_GCC_T.inl 95225 2011-12-05 20:25:15Z shuston $
#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1)
@@ -129,6 +128,13 @@ ACE_Atomic_Op_GCC<T>::operator= (
return *this;
}
template <typename T>
ACE_INLINE T
ACE_Atomic_Op_GCC<T>::exchange (T newval)
{
return __sync_val_compare_and_swap (&this->value_, this->value_, newval);
}
template <typename T>
ACE_INLINE T
ACE_Atomic_Op_GCC<T>::value (void) const
+7 -6
View File
@@ -4,7 +4,7 @@
/**
* @file Atomic_Op_T.h
*
* $Id: Atomic_Op_T.h 92353 2010-10-25 06:34:35Z johnnyw $
* $Id: Atomic_Op_T.h 95761 2012-05-15 18:23:04Z johnnyw $
*
* @author Douglas C. Schmidt <schmidt@uci.edu>
*/
@@ -88,22 +88,17 @@ struct ACE_Type_Traits<unsigned long>
typedef unsigned long parameter_type;
};
#ifndef ACE_LACKS_LONGLONG_T
template<>
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<>
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>
@@ -207,6 +202,9 @@ public:
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &operator= (
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> const & rhs);
/// Exchange value with @a newval.
TYPE exchange (TYPE newval);
/// Explicitly return @c value_.
TYPE value (void) const;
@@ -318,6 +316,9 @@ public:
/// Atomically check if @c value_ less than @a rhs.
bool operator< (arg_type rhs) const;
/// Exchange value with @a newval.
TYPE exchange (TYPE newval);
/// Explicitly return @c value_.
TYPE value (void) const;
+18 -1
View File
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
// $Id: Atomic_Op_T.inl 91688 2010-09-09 11:21:50Z johnnyw $
// $Id: Atomic_Op_T.inl 95225 2011-12-05 20:25:15Z shuston $
#include "ace/Guard_T.h"
@@ -152,6 +152,16 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (
return *this;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::exchange (TYPE newval)
{
// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::exchange");
ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_);
std::swap (this->value_, newval);
return newval;
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value (void) const
@@ -306,6 +316,13 @@ 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>::exchange (TYPE newval)
{
return this->impl_.exchange (newval);
}
template <class ACE_LOCK, class TYPE>
ACE_INLINE TYPE
ACE_Atomic_Op<ACE_LOCK, TYPE>::value (void) const
+1 -7
View File
@@ -3,7 +3,7 @@
/**
* @file Auto_Functor.h
*
* $Id: Auto_Functor.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: Auto_Functor.h 92386 2010-10-28 07:44:37Z johnnyw $
*
* @author Carlos O'Ryan <coryan@atdesk.com>
*/
@@ -69,13 +69,11 @@ public:
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()
@@ -97,13 +95,9 @@ public:
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_;
+1 -15
View File
@@ -1,6 +1,6 @@
// -*- C++ -*-
//
// $Id: Auto_Functor.inl 80826 2008-03-04 14:51:23Z wotte $
// $Id: Auto_Functor.inl 92386 2010-10-28 07:44:37Z johnnyw $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -35,7 +35,6 @@ ACE_Utils::Auto_Functor<X,Functor>:: operator=(Auto_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>::Auto_Functor(Auto_Functor<Y,Functor>& rhs)
: p_(rhs.release())
@@ -50,7 +49,6 @@ ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor<Y,Functor>& rhs)
reset(rhs.release());
return *this;
}
#endif /* ACE_LACKS_MEMBER_TEMPLATES */
template<typename X, typename Functor> ACE_INLINE X &
ACE_Utils::Auto_Functor<X,Functor>::operator*() const
@@ -107,8 +105,6 @@ 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>()
{
@@ -121,14 +117,4 @@ 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
+2 -16
View File
@@ -4,7 +4,7 @@
/**
* @file Auto_Ptr.h
*
* $Id: Auto_Ptr.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: Auto_Ptr.h 92580 2010-11-15 09:48:02Z johnnyw $
*
* @author Doug Schmidt <schmidt@uci.edu>
* @author Irfan Pyarali <irfan@cs.wustl.edu>
@@ -106,9 +106,7 @@ 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
* the need for the ACE_AUTO_PTR_RESET macro on platforms like
* VC6 where the auto_ptr<T> is broken.
* This version can be used instead of auto_ptr<T>
*/
template <typename X>
class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr <X>
@@ -209,18 +207,6 @@ ACE_auto_ptr_reset (AUTO_PTR_TYPE & ap,
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
// use of the following ACE_AUTO_PTR_RESET macro.
//
// The TYPE macro parameter is no longer necessary but we leave it
// around for backward compatibility. This is also the reason why the
// ACE_auto_ptr_reset function template is not called
// 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__ */
+3 -3
View File
@@ -4,7 +4,7 @@
/**
* @file Barrier.h
*
* $Id: Barrier.h 92069 2010-09-28 11:38:59Z johnnyw $
* $Id: Barrier.h 93359 2011-02-11 11:33:12Z mcorino $
*
* Moved from Synch.h.
*
@@ -101,7 +101,7 @@ public:
const ACE_TCHAR *name = 0,
void *arg = 0);
/// Default dtor.
/// Default destructor.
~ACE_Barrier (void);
/// Block the caller until all @c count threads have called @c wait and
@@ -170,7 +170,7 @@ public:
/// Create a Thread_Barrier, passing in the optional @a name.
ACE_Thread_Barrier (unsigned int count, const ACE_TCHAR *name = 0);
/// Default dtor.
/// Default destructor.
~ACE_Thread_Barrier (void);
/// Dump the state of an object.
+7 -1
View File
@@ -1,4 +1,4 @@
// $Id: Base_Thread_Adapter.cpp 91286 2010-08-05 09:04:31Z johnnyw $
// $Id: Base_Thread_Adapter.cpp 95595 2012-03-07 13:33:25Z johnnyw $
#include "ace/Base_Thread_Adapter.h"
@@ -29,12 +29,14 @@ ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter (
, ACE_SEH_EXCEPT_HANDLER selector
, ACE_SEH_EXCEPT_HANDLER handler
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
, long cancel_flags
)
: user_func_ (user_func)
, arg_ (arg)
, entry_point_ (entry_point)
, thr_desc_ (td)
, ctx_ (ACE_Service_Config::current())
, flags_ (cancel_flags)
{
ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter");
@@ -83,6 +85,10 @@ ACE_Base_Thread_Adapter::sync_log_msg (const ACE_TCHAR *prg)
(*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg);
}
ACE_OS_Thread_Descriptor::~ACE_OS_Thread_Descriptor (void)
{
}
ACE_OS_Thread_Descriptor *
ACE_Base_Thread_Adapter::thr_desc_log_msg (void)
{
+16 -12
View File
@@ -4,7 +4,7 @@
/**
* @file Base_Thread_Adapter.h
*
* $Id: Base_Thread_Adapter.h 81239 2008-04-04 22:28:48Z iliyan $
* $Id: Base_Thread_Adapter.h 95595 2012-03-07 13:33:25Z johnnyw $
*
* @author Nanbor Wang <nanbor@cs.wustl.edu>
*/
@@ -33,9 +33,8 @@
# 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...
/// 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
@@ -44,7 +43,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
* @class ACE_OS_Thread_Descriptor
*
* @brief Parent class of all ACE_Thread_Descriptor classes.
* =
*
* Container for ACE_Thread_Descriptor members that are
* used in ACE_OS.
*/
@@ -54,6 +53,8 @@ public:
/// Get the thread creation flags.
long flags (void) const;
virtual ~ACE_OS_Thread_Descriptor (void);
protected:
/// For use by ACE_Thread_Descriptor.
ACE_OS_Thread_Descriptor (long flags = 0);
@@ -61,17 +62,14 @@ protected:
/**
* Keeps track of whether this thread was created "detached" or not.
* If a thread is *not* created detached then if someone calls
* <ACE_Thread_Manager::wait>, we need to join with that thread (and
* ACE_Thread_Manager::wait(), we need to join with that thread (and
* close down the handle).
*/
long flags_;
};
class ACE_Service_Gestalt;
/**
* @class ACE_Base_Thread_Adapter
*
@@ -126,6 +124,7 @@ protected:
, ACE_SEH_EXCEPT_HANDLER selector = 0
, ACE_SEH_EXCEPT_HANDLER handler = 0
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
, long cancel_flags = 0
);
/// Inherit the logging features if the parent thread has an
/// ACE_Log_Msg.
@@ -162,8 +161,8 @@ protected:
/**
* Optional thread descriptor. Passing this pointer in will force
* the spawned thread to cache this location in <Log_Msg> and wait
* until <Thread_Manager> fills in all information in thread
* the spawned thread to cache this location in Log_Msg and wait
* until Thread_Manager fills in all information in thread
* descriptor.
*/
ACE_OS_Thread_Descriptor *thr_desc_;
@@ -171,7 +170,7 @@ protected:
/// The ACE_Log_Msg attributes.
ACE_OS_Log_Msg_Attributes log_msg_attributes_;
/// That is usefull for gprof, define itimerval
/// That is useful for gprof, define itimerval
#ifdef ACE_USES_GPROF
struct itimerval itimer_;
#endif // ACE_USES_GPROF
@@ -179,6 +178,11 @@ protected:
/// Keep a reference to the configuration context that spawns the
/// thread so the child can inherit it.
ACE_Service_Gestalt * const ctx_;
/// Pass through the thread-creation flags that can only be acted on by
/// the spawned thread. Currently this is only the cancellation-related
/// flags.
long flags_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
+4 -2
View File
@@ -1,4 +1,4 @@
// $Id: Basic_Stats.cpp 91286 2010-08-05 09:04:31Z johnnyw $
// $Id: Basic_Stats.cpp 95743 2012-05-13 12:29:28Z johnnyw $
#include "ace/Basic_Stats.h"
#include "ace/Log_Msg.h"
@@ -42,7 +42,9 @@ ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs)
}
void
ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg, ACE_UINT32 sf) const
ACE_Basic_Stats::dump_results (
const ACE_TCHAR *msg,
ACE_Basic_Stats::scale_factor_type sf) const
{
#ifndef ACE_NLOGGING
if (this->samples_count () == 0u)
+8 -3
View File
@@ -3,13 +3,12 @@
/**
* @file Basic_Stats.h
*
* $Id: Basic_Stats.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: Basic_Stats.h 95743 2012-05-13 12:29:28Z johnnyw $
*
* @author Carlos O'Ryan <coryan@uci.edu>
*/
//=============================================================================
#ifndef ACE_BASIC_STATS_H
#define ACE_BASIC_STATS_H
#include /**/ "ace/pre.h"
@@ -32,6 +31,12 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Basic_Stats
{
public:
#if !defined (ACE_WIN32)
typedef ACE_UINT32 scale_factor_type;
#else
typedef ACE_UINT64 scale_factor_type;
#endif
/// Constructor
/**
* The number of samples is pre-allocated, and cannot changes once
@@ -56,7 +61,7 @@ public:
* presented in microseconds.
*/
void dump_results (const ACE_TCHAR *msg,
ACE_UINT32 scale_factor) const;
scale_factor_type scale_factor) const;
/// The number of samples
ACE_UINT32 samples_count_;
+1 -134
View File
@@ -1,136 +1,3 @@
// $Id: Basic_Types.cpp 91366 2010-08-16 12:42:35Z mhengstmengel $
// $Id: Basic_Types.cpp 95763 2012-05-16 06:43:51Z johnnyw $
#include "ace/Basic_Types.h"
#if !defined (__ACE_INLINE__)
# include "ace/Basic_Types.inl"
#endif /* ! __ACE_INLINE__ */
#if defined (ACE_LACKS_LONGLONG_T) && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
# include "ace/Log_Msg.h"
# include "ace/OS_NS_stdio.h"
# include "ace/OS_NS_string.h"
# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
// 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
{
if (h_ () > 0)
ACE_OS::fprintf (file, "0x%lx%0*lx", h_ (), 2 * sizeof l_ (), l_ ());
else
ACE_OS::fprintf (file, "0x%lx", l_ ());
}
ACE_TCHAR *
ACE_U_LongLong::as_string (ACE_TCHAR *output,
unsigned int base,
unsigned int uppercase) const
{
if (*this == 0)
{
ACE_OS::strcpy(output, "0");
}
else
{
switch(base)
{
case 8:
{
unsigned int index = 0;
int bshift = 31;
while(bshift >= 1)
{
unsigned int sval = (this->h_ () >> bshift) & 7;
if (sval > 0 || index != 0)
{
output[index] = sval + '0';
++index;
}
bshift -= 3;
}
bshift = 30;
while(bshift >= 0)
{
unsigned int sval = (this->l_ () >> bshift) & 7;
// Combine the last bit of hi with the first 3-bit digit
if (bshift == 30)
{
sval |= (this->h_ () & 1) << 2;
}
if (sval > 0 || index != 0)
{
output[index] = sval + '0';
++index;
}
bshift -= 3;
}
output[index] = '\0';
break;
}
case 10:
{
ACE_OS::sprintf(output, "%.0f", *this / 1.0);
break;
}
case 16:
{
if (this->h_ () != 0)
{
ACE_OS::sprintf(output,
(uppercase ? "%lX%0*lX" : "%lx%0*lx"),
this->h_ (), 2 * sizeof this->l_ (),
this->l_ ());
}
else
{
ACE_OS::sprintf(output,
(uppercase ? "%lX" : "%lx"), this->l_ ());
}
break;
}
default:
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Unsupported base = %u\n"), base));
output[0] = '\0';
}
}
}
return output;
}
# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ostream&
operator<< (ostream& os, const ACE_U_LongLong& ll)
{
#ifdef __TANDEM && (__CPLUSPLUS_VERSION >= 3)
unsigned long flags = os.flags();
#else
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)
os << ll.as_string (buffer, 16, (flags & ios::uppercase));
else
os << ll.as_string (buffer);
return os;
}
# endif
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_LACKS_LONGLONG_T */
+32 -311
View File
@@ -4,7 +4,7 @@
/**
* @file Basic_Types.h
*
* $Id: Basic_Types.h 91161 2010-07-21 18:25:12Z schmidt $
* $Id: Basic_Types.h 96017 2012-08-08 22:18:09Z mitza $
*
* @author David L. Levine
*
@@ -25,7 +25,6 @@
* - ACE_SIZEOF_LONG_DOUBLE
*
* Wrappers for built-in types of specific sizes:
* - ACE_USHORT16 (For backward compatibility. Use ACE_UINT16 instead.)
* - ACE_INT8
* - ACE_UINT8
* - ACE_INT16
@@ -33,13 +32,10 @@
* - ACE_INT32
* - ACE_UINT32
* - ACE_UINT64
* (@note ACE_INT64 is partly defined, there is no ACE_LongLong for
* platforms that don't have a native 8-byte integer type.)
* - ACE_INT64
*
* Byte-order (endian-ness) determination:
* ACE_BYTE_ORDER, to either ACE_BIG_ENDIAN or ACE_LITTLE_ENDIAN
*
*
*/
//=============================================================================
@@ -60,10 +56,6 @@
# 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)
@@ -100,15 +92,11 @@ typedef ACE::If_Then_Else<
ACE::If_Then_Else<
(sizeof (void*) == sizeof (signed long)),
signed long,
#ifdef ACE_LACKS_LONGLONG_T
void /* Unknown. Force an invalid type */
#else
ACE::If_Then_Else<
(sizeof (void*) == sizeof (signed long long)),
signed long long,
void /* Unknown. Force an invalid type */
>::result_type
#endif /* ACE_LACKS_LONGLONG_T */
>::result_type
>::result_type intptr_t;
@@ -118,15 +106,11 @@ typedef ACE::If_Then_Else<
ACE::If_Then_Else<
(sizeof (void*) == sizeof (unsigned long)),
unsigned long,
#ifdef ACE_LACKS_UNSIGNEDLONGLONG_T
void /* Unknown. Force an invalid type */
#else
ACE::If_Then_Else<
(sizeof (void*) == sizeof (unsigned long long)),
unsigned long long,
void /* Unknown. Force an invalid type */
>::result_type
#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */
>::result_type
>::result_type uintptr_t;
@@ -195,9 +179,7 @@ typedef ACE::If_Then_Else<
// The number of bytes in a long long.
# if !defined (ACE_SIZEOF_LONG_LONG)
# if defined (ACE_LACKS_LONGLONG_T)
# define ACE_SIZEOF_LONG_LONG 8
# elif defined (ULLONG_MAX)
# if defined (ULLONG_MAX)
# if ((ULLONG_MAX) == 4294967295ULL)
# define ACE_SIZEOF_LONG_LONG 4
# elif ((ULLONG_MAX) == 18446744073709551615ULL)
@@ -299,7 +281,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef int64_t ACE_INT64;
#elif ACE_SIZEOF_LONG == 8
typedef long ACE_INT64;
#elif !defined (ACE_LACKS_LONGLONG_T) && ACE_SIZEOF_LONG_LONG == 8
#elif ACE_SIZEOF_LONG_LONG == 8
# ifdef __GNUC__
// Silence g++ "-pedantic" warnings regarding use of "long long"
// type.
@@ -308,29 +290,22 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
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)
#if defined (ACE_UINT64_TYPE)
typedef ACE_UINT64_TYPE ACE_UINT64;
# elif defined (ACE_HAS_UINT64_T)
#elif defined (ACE_HAS_UINT64_T)
typedef uint64_t ACE_UINT64;
# elif ACE_SIZEOF_LONG == 8
#elif ACE_SIZEOF_LONG == 8
typedef unsigned long ACE_UINT64;
# elif ACE_SIZEOF_LONG_LONG == 8
#elif ACE_SIZEOF_LONG_LONG == 8
# ifdef __GNUC__
// Silence g++ "-pedantic" warnings regarding use of "long long"
// type.
__extension__
# endif /* __GNUC__ */
typedef unsigned long long ACE_UINT64;
# endif /* defined (ACE_UINT64_TYPE) */
#endif /* !(ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T) */
#endif /* defined (ACE_UINT64_TYPE) */
typedef ACE_UINT16 ACE_USHORT16; // @@ Backward compatibility.
// Define a generic byte for use in codecs
/// 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
@@ -428,240 +403,11 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# 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
// support 64-bit integers.
# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
reinterpret_cast<PTR_TYPE> (L.lo ())
#elif defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64))
# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
reinterpret_cast<PTR_TYPE> (static_cast<int> (L))
#else /* ! ACE_LACKS_LONGLONG_T */
# 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"
reinterpret_cast<PTR_TYPE> (static_cast<intptr_t> (L))
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_U_LongLong
*
* @brief Unsigned long long for platforms that don't have one.
*
* Provide our own unsigned long long. This is intended to be
* use with ACE_High_Res_Timer, so the division operator assumes
* that the quotient fits into a u_long.
* Please note that the constructor takes (optionally) two values.
* The high one contributes 0x100000000 times its value. So,
* for example, (0, 2) is _not_ 20000000000, but instead
* 0x200000000. To emphasize this, the default values are expressed
* in hex, and output () dumps the value in hex.
*/
class ACE_Export ACE_U_LongLong
{
public:
// = Initialization and termination methods.
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
ACE_U_LongLong (const long long value = 0x0);
#else
ACE_U_LongLong (const ACE_UINT32 lo = 0x0, const ACE_UINT32 hi = 0x0);
#endif
ACE_U_LongLong (const ACE_U_LongLong &);
ACE_U_LongLong &operator= (const ACE_U_LongLong &);
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;
bool operator!= (const ACE_U_LongLong &) const;
bool operator!= (const ACE_UINT32) const;
bool operator< (const ACE_U_LongLong &) const;
bool operator< (const ACE_UINT32) const;
bool operator<= (const ACE_U_LongLong &) const;
bool operator<= (const ACE_UINT32) const;
bool operator> (const ACE_U_LongLong &) const;
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 &);
ACE_U_LongLong &operator-= (const ACE_UINT32);
ACE_U_LongLong &operator++ ();
ACE_U_LongLong &operator-- ();
const ACE_U_LongLong operator++ (int);
const ACE_U_LongLong operator-- (int);
ACE_U_LongLong &operator|= (const ACE_U_LongLong);
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.
ACE_U_LongLong operator* (const ACE_INT32) const;
ACE_U_LongLong &operator*= (const ACE_INT32);
ACE_UINT32 operator/ (const ACE_INT32) const;
# if ACE_SIZEOF_INT == 4
ACE_UINT32 operator/ (const unsigned long) const;
ACE_UINT32 operator/ (const long) const;
# else /* ACE_SIZEOF_INT != 4 */
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
public:
struct ace_hi_lo_correct_endian
{
# if defined (ACE_BIG_ENDIAN)
/// High 32 bits.
ACE_UINT32 hi_;
/// Low 32 bits.
ACE_UINT32 lo_;
# else
/// Low 32 bits.
ACE_UINT32 lo_;
/// High 32 bits.
ACE_UINT32 hi_;
# endif /* ! ACE_BIG_ENDIAN */
};
private:
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,
ACE_UINT32 *c_out) const;
ACE_U_LongLong ull_shift (ACE_U_LongLong a,
ACE_UINT32 c_in,
ACE_UINT32 *c_out) const;
ACE_U_LongLong ull_add (ACE_U_LongLong a,
ACE_U_LongLong b,
ACE_UINT32 *carry) const;
ACE_U_LongLong ull_mult (ACE_U_LongLong a,
ACE_UINT32 b,
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)
inline ACE_UINT32
ACE_U64_TO_U32 (ACE_U_LongLong const & n)
{
/**
* @note We could add a cast operator to ACE_U_LongLong but that may
* cause more problems than it solves. Force users to perform
* an explicit cast via ACE_{C}U64_TO_{C}U32.
*/
return n.lo ();
}
inline ACE_UINT32
ACE_CU64_TO_CU32 (ACE_U_LongLong const & n)
{
return ACE_U64_TO_U32 (n);
}
# else /* ! ACE_LACKS_LONGLONG_T */
inline ACE_UINT32
ACE_U64_TO_U32 (ACE_UINT64 n)
{
@@ -673,32 +419,24 @@ 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.
# define ACE_UINT64_LITERAL(n) n ## UL
// This one won't really work, but it'll keep
// some compilers happy until we have better support
# define ACE_INT64_LITERAL(n) n ## L
# elif defined (ACE_WIN32)
# if defined (__MINGW32__)
# define ACE_UINT64_LITERAL(n) n ## ull
# define ACE_INT64_LITERAL(n) n ## ll
# else
# define ACE_UINT64_LITERAL(n) n ## ui64
# define ACE_INT64_LITERAL(n) n ## i64
# endif /* defined (__MINGW32__) */
# elif defined (__TANDEM)
#if defined (ACE_WIN32)
# if defined (__MINGW32__)
# define ACE_UINT64_LITERAL(n) n ## ull
# define ACE_INT64_LITERAL(n) n ## ll
# else
# define ACE_UINT64_LITERAL(n) n ## ui64
# define ACE_INT64_LITERAL(n) n ## i64
# endif /* defined (__MINGW32__) */
#elif defined (__TANDEM)
# define ACE_UINT64_LITERAL(n) n ## LL
# define ACE_INT64_LITERAL(n) n ## LL
# else /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
#else /* ! ACE_WIN32 */
# define ACE_UINT64_LITERAL(n) n ## ull
# define ACE_INT64_LITERAL(n) n ## ll
# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
#endif /* ! ACE_WIN32*/
#if !defined (ACE_INT8_FORMAT_SPECIFIER_ASCII)
# if defined (PRId8)
@@ -839,6 +577,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII)
# if defined (ACE_WIN64)
# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%I64d"
# elif defined (_WRS_CONFIG_LP64)
# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld"
# else
# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%d"
# endif /* ACE_WIN64 */
@@ -851,6 +591,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII)
# if defined (ACE_WIN64)
# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%I64u"
# elif defined (_WRS_CONFIG_LP64)
# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu"
# else
# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%u"
# endif /* ACE_WIN64 */
@@ -862,16 +604,11 @@ ACE_END_VERSIONED_NAMESPACE_DECL
// Cast from UINT64 to a double requires an intermediate cast to INT64
// on some platforms.
# if defined (ACE_LACKS_LONGLONG_T)
// Only use the low 32 bits.
# define ACE_UINT64_DBLCAST_ADAPTER(n) ACE_U64_TO_U32 (n)
# elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
# define ACE_UINT64_DBLCAST_ADAPTER(n) ((n).to_int64 ())
# elif defined (ACE_WIN32)
# define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n)
# else /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
# define ACE_UINT64_DBLCAST_ADAPTER(n) (n)
# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
#if defined (ACE_WIN32)
# define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n)
#else /* ! ACE_WIN32 && */
# define ACE_UINT64_DBLCAST_ADAPTER(n) (n)
#endif /* ! ACE_WIN32 && */
// The number of bytes in a float.
@@ -934,19 +671,7 @@ 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
// long (-1) is the same as the maximum unsigned long long value.
# define ACE_UINT64_MAX ACE_U_LongLong (ACE_INT64_LITERAL (0xFFFFFFFFFFFFFFFF))
#elif defined (ACE_LACKS_LONGLONG_T)
// ACE_U_LongLong's constructor accepts an ACE_UINT32 low and high
// pair of parameters.
# define ACE_UINT64_MAX ACE_U_LongLong (0xFFFFFFFFu, 0xFFFFFFFFu)
#else
# define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF)
#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */
#define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF)
// These use ANSI/IEEE format.
#define ACE_FLT_MAX 3.402823466e+38F
@@ -954,9 +679,5 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#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 */
-954
View File
@@ -1,954 +0,0 @@
// -*- 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
{
if (data_ > 0)
if (n.data_ > 0)
return data_ < n.data_;
else
return true;
else
if (n.data_ > 0)
return false;
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
{
if (data_ > 0)
if (n.data_ > 0)
return data_ > n.data_;
else
return false;
else
if (n.data_ > 0)
return true;
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)
{
if (rhs >= 0)
{
data_ = rhs;
data_ &= 0xFFFFFFFF;
}
else
{
// We do not handle the case where a negative 32 bit integer is
// assigned to this representation of a 64 bit unsigned integer.
// The "undefined behavior" behavior performed by this
// 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)
{
// Post-increment operator should always be implemented in terms of
// the pre-increment operator to enforce consistent semantics.
ACE_U_LongLong temp (*this);
++*this;
return temp;
}
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator-- (int)
{
// Post-decrement operator should always be implemented in terms of
// the pre-decrement operator to enforce consistent semantics.
ACE_U_LongLong temp (*this);
--*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
{
return h_ () < n.h_ () ? 1
: 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
{
return h_ () < n.h_ () ? 1
: 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
{
return h_ () > n.h_ () ? 1
: 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
{
return h_ () > n.h_ () ? 1
: 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)
{
if (rhs >= 0)
{
l_ () = static_cast<ACE_UINT32> (rhs);
h_ () = 0;
}
else
{
// We do not handle the case where a negative 32 bit integer is
// assigned to this representation of a 64 bit unsigned integer.
// The "undefined behavior" behavior performed by this
// implementation is to simply set all bits to zero.
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
{
register ACE_UINT32 mask = ACE_HIGHBIT;
const ACE_U_LongLong zero (0, 0);
ACE_U_LongLong accum (0, 0);
ACE_UINT32 c;
*carry = 0;
if (b > 0)
do
{
accum = ull_shift (accum, 0U, carry);
if (b & mask)
accum = ull_add (accum, a, &c);
else
accum = ull_add (accum, zero, &c);
*carry += c;
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)
{
// Post-increment operator should always be implemented in terms of
// the pre-increment operator to enforce consistent semantics.
ACE_U_LongLong temp (*this);
++*this;
return temp;
}
ACE_INLINE const ACE_U_LongLong
ACE_U_LongLong::operator-- (int)
{
// Post-decrement operator should always be implemented in terms of
// the pre-decrement operator to enforce consistent semantics.
ACE_U_LongLong temp (*this);
--*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
{
// This takes advantage of the fact that the return type has only 32
// bits. Replace 0x100000000 with 0xffffffff + 1 because the former
// has 33 bits.
// Quotient = (0x100000000u * hi_ + lo_) / n
// = ((0x100000000u - n + n) * hi_ + lo_) / n
// = ((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
{
// Because the argument is an ACE_UINT32, the result can never be
// bigger than 32 bits. Replace 0x100000000 with 0xffffffff + 1
// because the former has 33 bits.
// Mod = (0x100000000u * hi_ + lo_) % n
// = (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 */
+1 -1
View File
@@ -1,4 +1,4 @@
// $Id: CDR_Base.cpp 91685 2010-09-09 09:35:14Z johnnyw $
// $Id: CDR_Base.cpp 94251 2011-06-22 18:03:25Z parsons $
#include "ace/CDR_Base.h"
+2 -2
View File
@@ -4,7 +4,7 @@
/**
* @file CDR_Base.h
*
* $Id: CDR_Base.h 91685 2010-09-09 09:35:14Z johnnyw $
* $Id: CDR_Base.h 95761 2012-05-15 18:23:04Z johnnyw $
*
* ACE Common Data Representation (CDR) basic types.
*
@@ -213,7 +213,7 @@ public:
typedef long LongLong;
# elif defined(__TANDEM)
typedef long long LongLong;
# elif ACE_SIZEOF_LONG_LONG == 8 && !defined (ACE_LACKS_LONGLONG_T)
# elif ACE_SIZEOF_LONG_LONG == 8
# if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T)
// sun #defines u_longlong_t, maybe other platforms do also.
// Use it, at least with g++, so that its -pedantic doesn't
+2 -2
View File
@@ -4,7 +4,7 @@
/**
* @file CDR_Size.h
*
* $Id: CDR_Size.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: CDR_Size.h 93359 2011-02-11 11:33:12Z mcorino $
*
*
* ACE Common Data Representation (CDR) size-calculating stream.
@@ -13,7 +13,7 @@
* The current implementation assumes that the host has 1-byte,
* 2-byte and 4-byte integral types, and that it has single
* precision and double precision IEEE floats.
* Those assumptions are pretty good these days, with Crays beign
* Those assumptions are pretty good these days, with Crays being
* the only known exception.
*
*
+241 -2
View File
@@ -1,4 +1,4 @@
// $Id: CDR_Stream.cpp 91373 2010-08-17 07:35:27Z mhengstmengel $
// $Id: CDR_Stream.cpp 95896 2012-06-18 20:42:07Z hillj $
#include "ace/CDR_Stream.h"
#include "ace/SString.h"
@@ -723,6 +723,72 @@ ACE_OutputCDR::write_short_placeholder (void)
return buf;
}
char *
ACE_OutputCDR::write_boolean_placeholder (void)
{
char *buf = 0;
if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0)
*reinterpret_cast<ACE_CDR::Boolean*> (buf) = 0;
else
buf = 0;
return buf;
}
char *
ACE_OutputCDR::write_char_placeholder (void)
{
char *buf = 0;
if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0)
*reinterpret_cast<ACE_CDR::Char*> (buf) = 0;
else
buf = 0;
return buf;
}
char *
ACE_OutputCDR::write_octet_placeholder (void)
{
char *buf = 0;
if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0)
*reinterpret_cast<ACE_CDR::Octet*> (buf) = 0;
else
buf = 0;
return buf;
}
char *
ACE_OutputCDR::write_longlong_placeholder (void)
{
char *buf = 0;
if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0)
*reinterpret_cast<ACE_CDR::ULongLong*> (buf) = 0;
else
buf = 0;
return buf;
}
char *
ACE_OutputCDR::write_float_placeholder (void)
{
char *buf = 0;
if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0)
*reinterpret_cast<ACE_CDR::ULong*> (buf) = 0;
else
buf = 0;
return buf;
}
char *
ACE_OutputCDR::write_double_placeholder (void)
{
char *buf = 0;
if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0)
*reinterpret_cast<ACE_CDR::ULongLong*> (buf) = 0;
else
buf = 0;
return buf;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc)
{
@@ -745,6 +811,27 @@ ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc)
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::ULong x, char* loc)
{
if (this->find (loc) == 0)
return false;
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*reinterpret_cast<ACE_CDR::ULong*> (loc) = x;
#else
if (!this->do_byte_swap_)
{
*reinterpret_cast<ACE_CDR::ULong *> (loc) = x;
}
else
{
ACE_CDR::swap_4 (reinterpret_cast<const char*> (&x), loc);
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Short x, char* loc)
@@ -768,6 +855,148 @@ ACE_OutputCDR::replace (ACE_CDR::Short x, char* loc)
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::UShort x, char* loc)
{
if (this->find (loc) == 0)
return false;
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*reinterpret_cast<ACE_CDR::UShort*> (loc) = x;
#else
if (!this->do_byte_swap_)
{
*reinterpret_cast<ACE_CDR::UShort *> (loc) = x;
}
else
{
ACE_CDR::swap_2 (reinterpret_cast<const char*> (&x), loc);
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Boolean x, char* loc)
{
if (this->find (loc) == 0)
return false;
*reinterpret_cast<ACE_CDR::Boolean*> (loc) = x;
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Char x, char* loc)
{
if (this->find (loc) == 0)
return false;
*reinterpret_cast<ACE_CDR::Char*> (loc) = x;
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Octet x, char* loc)
{
if (this->find (loc) == 0)
return false;
*reinterpret_cast<ACE_CDR::Octet*> (loc) = x;
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::LongLong x, char* loc)
{
if (this->find (loc) == 0)
return false;
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*reinterpret_cast<ACE_CDR::LongLong*> (loc) = x;
#else
if (!this->do_byte_swap_)
{
*reinterpret_cast<ACE_CDR::LongLong*> (loc) = x;
}
else
{
ACE_CDR::swap_8 (reinterpret_cast<const char*> (&x), loc);
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::ULongLong x, char* loc)
{
if (this->find (loc) == 0)
return false;
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*reinterpret_cast<ACE_CDR::ULongLong*> (loc) = x;
#else
if (!this->do_byte_swap_)
{
*reinterpret_cast<ACE_CDR::ULongLong*> (loc) = x;
}
else
{
ACE_CDR::swap_8 (reinterpret_cast<const char*> (&x), loc);
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Float x, char* loc)
{
if (this->find (loc) == 0)
return false;
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*reinterpret_cast<ACE_CDR::Float*> (loc) = x;
#else
if (!this->do_byte_swap_)
{
*reinterpret_cast<ACE_CDR::Float*> (loc) = x;
}
else
{
ACE_CDR::swap_4 (reinterpret_cast<const char*> (&x), loc);
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
return true;
}
ACE_CDR::Boolean
ACE_OutputCDR::replace (ACE_CDR::Double x, char* loc)
{
if (this->find (loc) == 0)
return false;
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
*reinterpret_cast<ACE_CDR::Double*> (loc) = x;
#else
if (!this->do_byte_swap_)
{
*reinterpret_cast<ACE_CDR::Double*> (loc) = x;
}
else
{
ACE_CDR::swap_8 (reinterpret_cast<const char*> (&x), loc);
}
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
return true;
}
int
ACE_OutputCDR::consolidate (void)
@@ -1682,7 +1911,17 @@ ACE_InputCDR::skip_string (void)
ACE_CDR::ULong len = 0;
if (this->read_ulong (len))
{
if (this->rd_ptr () + len <= this->wr_ptr ())
if (static_cast<ACE_CDR::ULong> (~0u) == len)
{
// Indirection, next Long in stream is signed offset to actual
// string location (backwards in same stream from here).
ACE_CDR::Long offset = 0;
if (this->read_long (offset))
{
return true;
}
}
else if (this->rd_ptr () + len <= this->wr_ptr ())
{
this->rd_ptr (len);
return true;
+22 -7
View File
@@ -4,7 +4,7 @@
/**
* @file CDR_Stream.h
*
* $Id: CDR_Stream.h 84527 2009-02-19 14:01:42Z johnnyw $
* $Id: CDR_Stream.h 95896 2012-06-18 20:42:07Z hillj $
*
* ACE Common Data Representation (CDR) marshaling and demarshaling
* classes.
@@ -318,6 +318,12 @@ public:
*/
char* write_long_placeholder (void);
char* write_short_placeholder (void);
char* write_boolean_placeholder (void);
char* write_char_placeholder (void);
char* write_longlong_placeholder (void);
char* write_octet_placeholder (void);
char* write_float_placeholder (void);
char* write_double_placeholder (void);
/**
* Writes a new value into a specific location. This is commonly
@@ -336,7 +342,16 @@ public:
* @sa write_long_placeholder(), write_short_placeholder ()
*/
ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::ULong x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::Short x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::UShort x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::Boolean x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::Char x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::LongLong x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::ULongLong x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::Octet x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::Float x, char* loc);
ACE_CDR::Boolean replace (ACE_CDR::Double x, char* loc);
//@}
/**
@@ -1224,7 +1239,7 @@ protected:
const ACE_CDR::ULong *x);
/// Efficiently read @a length elements of size @a size each from
/// <input> into <x>; the data must be aligned to <align>.
/// @a input into @a x; the data must be aligned to @a align.
ACE_CDR::Boolean read_array (ACE_InputCDR& input,
void* x,
size_t size,
@@ -1232,9 +1247,9 @@ protected:
ACE_CDR::ULong length);
/**
* Efficiently write @a length elements of size @a size from <x> into
* <output>. Before inserting the elements enough padding is added
* to ensure that the elements will be aligned to <align> in the
* Efficiently write @a length elements of size @a size from @a x into
* @a output. Before inserting the elements enough padding is added
* to ensure that the elements will be aligned to @a align in the
* stream.
*/
ACE_CDR::Boolean write_array (ACE_OutputCDR& output,
@@ -1244,10 +1259,10 @@ protected:
ACE_CDR::ULong length);
/**
* Exposes the stream implementation of <adjust>, this is useful in
* Exposes the stream implementation of @a adjust, this is useful in
* many cases to minimize memory allocations during marshaling.
* On success @a buf will contain a contiguous area in the CDR stream
* that can hold @a size bytes aligned to <align>.
* that can hold @a size bytes aligned to @a align.
* Results
*/
int adjust (ACE_OutputCDR& out,
+2 -2
View File
@@ -4,7 +4,7 @@
/**
* @file CE_Screen_Output.h
*
* $Id: CE_Screen_Output.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: CE_Screen_Output.h 94271 2011-06-23 14:52:31Z johnnyw $
*
* @author Si Mong Park <spark@ociweb.com>
*/
@@ -39,7 +39,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*
* This class allows standard text output to be displayed on
* text window for Windows CE. Generally, all ACE output will
* go through under CE if and only if user uses WindozeCE
* go through under CE if and only if user uses Windows CE
* implementation by using main_ce instead of main.
* Also, for the easier debugging purpose, object pointer of
* this class can be gotten from ACE_Log_Msg::msg_callback()
+3 -2
View File
@@ -46,6 +46,7 @@ set(ace_STAT_SRCS
Codeset_IBM1047.cpp
Codeset_Registry.cpp
Codeset_Registry_db.cpp
Condition_Attributes.cpp
Condition_Recursive_Thread_Mutex.cpp
Condition_Thread_Mutex.cpp
Configuration.cpp
@@ -53,7 +54,6 @@ set(ace_STAT_SRCS
Connection_Recycling_Strategy.cpp
Containers.cpp
Copy_Disabled.cpp
Countdown_Time.cpp
Date_Time.cpp
DEV.cpp
DEV_Addr.cpp
@@ -73,6 +73,7 @@ set(ace_STAT_SRCS
Encoding_Converter_Factory.cpp
Event.cpp
Event_Handler.cpp
Event_Handler_Handle_Timeout_Upcall.cpp
FIFO.cpp
FIFO_Recv.cpp
FIFO_Recv_Msg.cpp
@@ -89,7 +90,6 @@ set(ace_STAT_SRCS
Functor.cpp
Functor_String.cpp
Get_Opt.cpp
gethrtime.cpp
Handle_Ops.cpp
Handle_Set.cpp
Hashable.cpp
@@ -289,6 +289,7 @@ set(ace_STAT_SRCS
Thread_Mutex.cpp
Thread_Semaphore.cpp
Throughput_Stats.cpp
Time_Policy.cpp
Time_Value.cpp
Timeprobe.cpp
TLI.cpp
+30 -36
View File
@@ -1,4 +1,4 @@
// $Id: Cache_Map_Manager_T.cpp 92097 2010-09-30 05:41:49Z msmit $
// $Id: Cache_Map_Manager_T.cpp 95790 2012-05-24 15:06:21Z shuston $
#ifndef ACE_CACHE_MAP_MANAGER_T_CPP
#define ACE_CACHE_MAP_MANAGER_T_CPP
@@ -24,11 +24,8 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Iterator)
ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Reverse_Iterator)
#define ACE_T1 class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES
#define ACE_T2 KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES
template <ACE_T1>
ACE_Cache_Map_Manager<ACE_T2>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s,
size_t size,
ACE_Allocator *alloc)
: caching_strategy_ (caching_s)
@@ -40,28 +37,28 @@ ACE_Cache_Map_Manager<ACE_T2>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_
}
template <ACE_T1>
ACE_Cache_Map_Manager<ACE_T2>::~ACE_Cache_Map_Manager (void)
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES>
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::~ACE_Cache_Map_Manager (void)
{
this->close ();
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::open (size_t length,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::open (size_t length,
ACE_Allocator *alloc)
{
return this->map_.open (length,
alloc);
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::close (void)
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::close (void)
{
return this->map_.close ();
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::bind (const KEY &key,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::bind (const KEY &key,
const VALUE &value)
{
// Insert an entry which has the <key> and the <cache_value> which
@@ -96,8 +93,8 @@ ACE_Cache_Map_Manager<ACE_T2>::bind (const KEY &key,
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rebind (const KEY &key,
const VALUE &value)
{
CACHE_VALUE cache_value (value,
@@ -133,8 +130,8 @@ ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rebind (const KEY &key,
const VALUE &value,
VALUE &old_value)
{
@@ -180,8 +177,8 @@ ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
return rebind_result;
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rebind (const KEY &key,
const VALUE &value,
KEY &old_key,
VALUE &old_value)
@@ -229,8 +226,8 @@ ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key,
return rebind_result;
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::trybind (const KEY &key,
VALUE &value)
{
CACHE_VALUE cache_value (value,
@@ -271,8 +268,8 @@ ACE_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key,
return trybind_result;
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::find (const KEY &key,
VALUE &value)
{
// Lookup the key and populate the <value>.
@@ -310,8 +307,8 @@ ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key,
return find_result;
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key)
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::find (const KEY &key)
{
// Lookup the key and populate the <value>.
CACHE_VALUE cache_value;
@@ -323,7 +320,7 @@ ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key)
{
int result = this->caching_strategy_.notify_find (find_result,
cache_value.second ());
cache_value.second);
// Unless the find and notification operations go thru, this
// method is not successful.
@@ -348,8 +345,8 @@ ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key)
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key)
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::unbind (const KEY &key)
{
// Remove the entry from the cache.
CACHE_VALUE cache_value;
@@ -371,8 +368,8 @@ ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key)
return unbind_result;
}
template <ACE_T1> int
ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key,
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::unbind (const KEY &key,
VALUE &value)
{
// Remove the entry from the cache.
@@ -397,8 +394,8 @@ ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key,
return unbind_result;
}
template <ACE_T1> void
ACE_Cache_Map_Manager<ACE_T2>::dump (void) const
template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> void
ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
this->map_.dump ();
@@ -407,9 +404,6 @@ ACE_Cache_Map_Manager<ACE_T2>::dump (void) const
#endif /* ACE_HAS_DUMP */
}
#undef ACE_T1
#undef ACE_T2
template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES>
ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::~ACE_Cache_Map_Iterator (void)
{
+46 -49
View File
@@ -1,4 +1,4 @@
//$Id: Cached_Connect_Strategy_T.cpp 92097 2010-09-30 05:41:49Z msmit $
//$Id: Cached_Connect_Strategy_T.cpp 95630 2012-03-22 13:04:47Z johnnyw $
#ifndef ACE_CACHED_CONNECT_STRATEGY_T_CPP
#define ACE_CACHED_CONNECT_STRATEGY_T_CPP
@@ -15,13 +15,10 @@
#include "ace/Thread_Manager.h"
#include "ace/WFMO_Reactor.h"
#define ACE_T1 class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX
#define ACE_T2 SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <ACE_T1>
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::ACE_Cached_Connect_Strategy_Ex
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::ACE_Cached_Connect_Strategy_Ex
(CACHING_STRATEGY &caching_s,
ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
@@ -34,18 +31,18 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::ACE_Cached_Connect_Strategy_Ex
if (this->open (cre_s, con_s, rec_s) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Cached_Connect_Strategy_Ex<ACE_T2>\n")));
ACE_TEXT ("ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>\n")));
}
template <ACE_T1>
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::~ACE_Cached_Connect_Strategy_Ex (void)
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::~ACE_Cached_Connect_Strategy_Ex (void)
{
cleanup ();
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::check_hint_i
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::check_hint_i
(SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -134,8 +131,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::check_hint_i
return 0;
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find_or_create_svc_handler_i
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::find_or_create_svc_handler_i
(SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -250,8 +247,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find_or_create_svc_handler_i
return 0;
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cached_connect (SVC_HANDLER *&sh,
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cached_connect (SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
const ACE_PEER_CONNECTOR_ADDR &local_addr,
@@ -312,8 +309,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cached_connect (SVC_HANDLER *&sh,
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::connect_svc_handler_i
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::connect_svc_handler_i
(SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -361,16 +358,19 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::connect_svc_handler_i
entry->ext_id_.increment ();
}
// For all successful cases: mark the <svc_handler> in the cache
// as being <in_use>. Therefore recyclable is BUSY.
entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY);
if (entry)
{
// For all successful cases: mark the <svc_handler> in the cache
// as being <in_use>. Therefore recyclable is BUSY.
entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY);
}
return 0;
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cache_i (const void *recycling_act)
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cache_i (const void *recycling_act)
{
// The wonders and perils of ACT
CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
@@ -382,8 +382,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cache_i (const void *recycling_act)
return 0;
}
template<ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_act,
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::recycle_state_i (const void *recycling_act,
ACE_Recyclable_State new_state)
{
// The wonders and perils of ACT
@@ -396,8 +396,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_a
return 0;
}
template<ACE_T1> ACE_Recyclable_State
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_act) const
template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> ACE_Recyclable_State
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::recycle_state_i (const void *recycling_act) const
{
// The wonders and perils of ACT
CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
@@ -407,8 +407,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_a
return entry->ext_id_.recycle_state ();
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::purge_i (const void *recycling_act)
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::purge_i (const void *recycling_act)
{
// The wonders and perils of ACT
CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
@@ -417,8 +417,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::purge_i (const void *recycling_act)
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::mark_as_closed_i (const void *recycling_act)
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::mark_as_closed_i (const void *recycling_act)
{
// The wonders and perils of ACT
CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act;
@@ -429,8 +429,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::mark_as_closed_i (const void *recycling_
return 0;
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup_hint_i (const void *recycling_act,
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cleanup_hint_i (const void *recycling_act,
void **act_holder)
{
// Reset the <*act_holder> in the confines and protection of the
@@ -457,20 +457,20 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup_hint_i (const void *recycling_ac
return 0;
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::purge_connections (void)
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::purge_connections (void)
{
return this->connection_cache_.purge ();
}
template <ACE_T1> CACHING_STRATEGY &
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::caching_strategy (void)
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> CACHING_STRATEGY &
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::caching_strategy (void)
{
return this->connection_cache_.caching_strategy ();
}
template <ACE_T1> int
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find (ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR> &search_addr,
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::find (ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR> &search_addr,
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, std::pair<SVC_HANDLER *, ATTRIBUTES> > *&entry)
{
typedef ACE_Hash_Map_Bucket_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDRESS,
@@ -522,8 +522,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find (ACE_Refcounted_Hash_Recyclable<ACE
return -1;
}
template <ACE_T1> void
ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup (void)
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> void
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cleanup (void)
{
// Excluded other threads from changing the cache while we cleanup
ACE_GUARD (MUTEX, ace_mon, *this->lock_);
@@ -560,8 +560,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup (void)
ACE_ALLOC_HOOK_DEFINE(ACE_Cached_Connect_Strategy_Ex)
/////////////////////////////////////////////////////////////////////////
template <ACE_T1>
ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::ACE_Bounded_Cached_Connect_Strategy
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Bounded_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::ACE_Bounded_Cached_Connect_Strategy
(size_t max_size,
CACHING_STRATEGY &caching_s,
ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
@@ -574,14 +574,14 @@ ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::ACE_Bounded_Cached_Connect_Strategy
{
}
template <ACE_T1>
ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::~ACE_Bounded_Cached_Connect_Strategy(void)
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
ACE_Bounded_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::~ACE_Bounded_Cached_Connect_Strategy(void)
{
}
template <ACE_T1>
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX>
int
ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::find_or_create_svc_handler_i
ACE_Bounded_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::find_or_create_svc_handler_i
(SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
@@ -727,7 +727,4 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Cached_Connect_Strategy)
ACE_END_VERSIONED_NAMESPACE_DECL
#undef ACE_T1
#undef ACE_T2
#endif /* ACE_CACHED_CONNECT_STRATEGY_T_CPP */
+1 -5
View File
@@ -3,7 +3,7 @@
/**
* @file Codeset_Registry.h
*
* $Id: Codeset_Registry.h 81348 2008-04-14 09:00:32Z johnnyw $
* $Id: Codeset_Registry.h 93651 2011-03-28 08:49:11Z johnnyw $
*
* ACE wrapper around access functions for the OSF's DCE codeset registry
* access functions
@@ -33,10 +33,6 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_HAS_DCE_CODESET_REGISTRY)
#include /**/ <dce/rpc.h>
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Codeset_Registry
+1 -37
View File
@@ -3,7 +3,7 @@
/**
* @file Codeset_Registry.inl
*
* $Id: Codeset_Registry.inl 80826 2008-03-04 14:51:23Z wotte $
* $Id: Codeset_Registry.inl 93651 2011-03-28 08:49:11Z johnnyw $
*
* ACE wrapper around access functions for the OSF's DCE codeset registry
* access functions - the inline functions either call the system supplied
@@ -23,20 +23,10 @@ ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale,
ACE_CDR::UShort *num_sets,
ACE_CDR::UShort **char_sets)
{
#if defined (ACE_HAS_DCE_CODESET_REGISTRY)
error_status_t result;
dce_cs_loc_to_rgy (locale.c_str(),
&codeset_id,
num_sets,
char_sets,
&result);
return (result == dce_cs_c_ok) ? 1 : 0;
#else
return ACE_Codeset_Registry::locale_to_registry_i (locale,
codeset_id,
num_sets,
char_sets);
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
}
// based on a registry value, find the locale string and optional codeset
@@ -48,23 +38,10 @@ ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id,
ACE_CDR::UShort *num_sets,
ACE_CDR::UShort **char_sets)
{
#if defined (ACE_HAS_DCE_CODESET_REGISTRY)
error_status_t result;
char *buffer;
dce_cs_rgy_to_loc (codeset_id,
&buffer,
num_sets,
char_sets,
&result);
locale.set(buffer); // does a copy :-(
free (buffer);
return (result == dce_cs_c_ok) ? 1 : 0;
#else
return ACE_Codeset_Registry::registry_to_locale_i (codeset_id,
locale,
num_sets,
char_sets);
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
}
// Tell if two codesets are compatible. This wraps the
@@ -74,13 +51,7 @@ int
ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id,
ACE_CDR::ULong other)
{
#if defined (ACE_HAS_DCE_CODESET_REGISTRY)
error_status_t result;
rpc_cs_char_set_compat_check(codeset_id,other,&result);
return (result == rpc_s_ok) ? 1 : 0;
#else
return ACE_Codeset_Registry::is_compatible_i (codeset_id,other);
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
}
// Return the max number of bytes required to represent a single character.
@@ -89,14 +60,7 @@ ACE_INLINE
ACE_CDR::Short
ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id)
{
#if defined (ACE_HAS_DCE_CODESET_REGISTRY)
error_status_t result;
short max_bytes;
rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result);
return (result == rpc_s_ok) ? (short)max_bytes : 0;
#else
return ACE_Codeset_Registry::get_max_bytes_i (codeset_id);
#endif /* ACE_HAS_DCE_CODESET_REGISTRY */
}
ACE_END_VERSIONED_NAMESPACE_DECL
@@ -0,0 +1,58 @@
// -*- C++ -*-
// $Id: ACE_Compression_export.h 95545 2012-02-23 07:57:08Z johnnyw $
// Definition for Win32 Export directives.
// This file is generated automatically by generate_export_file.pl ACE_Compression
// ------------------------------
#ifndef ACE_COMPRESSION_EXPORT_H
#define ACE_COMPRESSION_EXPORT_H
#include "ace/config-all.h"
#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_COMPRESSION_HAS_DLL)
# define ACE_COMPRESSION_HAS_DLL 0
#endif /* ACE_AS_STATIC_LIBS && ACE_COMPRESSION_HAS_DLL */
#if !defined (ACE_COMPRESSION_HAS_DLL)
# define ACE_COMPRESSION_HAS_DLL 1
#endif /* ! ACE_COMPRESSION_HAS_DLL */
#if defined (ACE_COMPRESSION_HAS_DLL) && (ACE_COMPRESSION_HAS_DLL == 1)
# if defined (ACE_COMPRESSION_BUILD_DLL)
# define ACE_Compression_Export ACE_Proper_Export_Flag
# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# else /* ACE_COMPRESSION_BUILD_DLL */
# define ACE_Compression_Export ACE_Proper_Import_Flag
# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# endif /* ACE_COMPRESSION_BUILD_DLL */
#else /* ACE_COMPRESSION_HAS_DLL == 1 */
# define ACE_Compression_Export
# define ACE_COMPRESSION_SINGLETON_DECLARATION(T)
# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* ACE_COMPRESSION_HAS_DLL == 1 */
// Set ACE_COMPRESSION_NTRACE = 0 to turn on library specific tracing even if
// tracing is turned off for ACE.
#if !defined (ACE_COMPRESSION_NTRACE)
# if (ACE_NTRACE == 1)
# define ACE_COMPRESSION_NTRACE 1
# else /* (ACE_NTRACE == 1) */
# define ACE_COMPRESSION_NTRACE 0
# endif /* (ACE_NTRACE == 1) */
#endif /* !ACE_COMPRESSION_NTRACE */
#if (ACE_COMPRESSION_NTRACE == 1)
# define ACE_COMPRESSION_TRACE(X)
#else /* (ACE_COMPRESSION_NTRACE == 1) */
# if !defined (ACE_HAS_TRACE)
# define ACE_HAS_TRACE
# endif /* ACE_HAS_TRACE */
# define ACE_COMPRESSION_TRACE(X) ACE_TRACE_IMPL(X)
# include "ace/Trace.h"
#endif /* (ACE_COMPRESSION_NTRACE == 1) */
#endif /* ACE_COMPRESSION_EXPORT_H */
// End of auto generated file.
@@ -0,0 +1,63 @@
// $Id: Compressor.cpp 95556 2012-02-24 09:14:51Z johnnyw $
#include "Compressor.h"
#if !defined (__ACE_INLINE__)
#include "Compressor.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Compressor::ACE_Compressor( ACE_CompressorId compressor_id,
ACE_UINT32 compression_level )
: compressor_id_ (compressor_id)
, compression_level_ (compression_level)
, compressed_bytes_ (0)
, uncompressed_bytes_ (0)
{}
ACE_Compressor::~ACE_Compressor ()
{
}
ACE_UINT64
ACE_Compressor::compressed_bytes(void) const
{
ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0 );
return this->compressed_bytes_;
}
ACE_UINT64
ACE_Compressor::uncompressed_bytes(void) const
{
ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0 );
return this->uncompressed_bytes_;
}
void
ACE_Compressor::reset_stats(void)
{
ACE_GUARD( ACE_SYNCH_MUTEX, ace_mon, this->mutex_ );
this->compressed_bytes_ = 0;
this->uncompressed_bytes_ = 0;
}
void
ACE_Compressor::update_stats(ACE_UINT64 uncompressed_bytes, ACE_UINT64 compressed_bytes)
{
ACE_GUARD( ACE_SYNCH_MUTEX, ace_mon, this->mutex_ );
this->compressed_bytes_ += compressed_bytes;
this->uncompressed_bytes_ += uncompressed_bytes;
}
float
ACE_Compressor::compression_ratio(void) const
{
ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0.0f );
if (this->uncompressed_bytes_ > 0) {
return static_cast<float>(this->compressed_bytes_) / this->uncompressed_bytes_;
}
return 0.0f;
}
ACE_END_VERSIONED_NAMESPACE_DECL
+137
View File
@@ -0,0 +1,137 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Compressor.h
*
* $Id: Compressor.h
*
* @author ACE version by
* @author Derek Dominish <derek.dominish@dsto.defence.gov.au>
*/
//=============================================================================
#ifndef ACE_COMPRESSOR_H
#define ACE_COMPRESSOR_H
#include /**/ "ace/pre.h"
#include /**/ "ACE_Compression_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Guard_T.h"
#include "ace/Thread_Mutex.h"
#include "ace/Synch_Traits.h"
#include "ace/Copy_Disabled.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* CompressorId from OMG Compression::CompressorId
* see $(TAO_ROOT)/tao/Compression.pidl
*/
enum ACE_CompressorId
{
ACE_COMPRESSORID_NONE = 0,
ACE_COMPRESSORID_GZIP = 1,
ACE_COMPRESSORID_PKZIP = 2,
ACE_COMPRESSORID_BZIP2 = 3,
ACE_COMPRESSORID_ZLIB = 4,
ACE_COMPRESSORID_LZMA = 5,
ACE_COMPRESSORID_LZO = 6,
ACE_COMPRESSORID_RZIP = 7,
ACE_COMPRESSORID_7X = 8,
ACE_COMPRESSORID_XAR = 9,
ACE_COMPRESSORID_RLE = 10
};
class ACE_Compression_Export ACE_Compressor : private ACE_Copy_Disabled
{
public:
ACE_CompressorId get_compressor_id(void) const;
ACE_UINT32 get_compression_level(void) const;
/**
* Compress the @a in_ptr buffer for @a in_len into the
* @a dest_ptr buffer with a maximum @a max_out_len. If the
* @a max_out_len is exhausted through the compress process
* then a value of -1 will be returned from the function,
* otherwise the return value will indicate the resultant
* @a out_ptr compressed buffer length.
*
* NOTE: it is advisable that the @max_out_len be slightly
* larger of the input @a in_len (i.e. x 1.1F) to cater
* for the possibility that a reduced compressed length
* is not possible.
*/
virtual ACE_UINT64 compress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len ) = 0;
/**
* DeCompress the @a in_ptr buffer for @a in_len into the
* @a out_ptr buffer with a maximum @a max_out_len. If the
* @a max_out_len is exhausted during decompression
* then a value of -1 will be returned from the function,
* otherwise the return value will indicate the resultant
* @a out_ptr decompressed buffer length.
*/
virtual ACE_UINT64 decompress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len ) = 0;
/**
* Return the current compressed bytes statistics counter.
*/
virtual ACE_UINT64 compressed_bytes(void) const;
/**
* Return the current uncompressed bytes statistics counter.
*/
virtual ACE_UINT64 uncompressed_bytes(void) const;
/**
* Return the current compression ratio statistics.
*/
virtual float compression_ratio(void) const;
/**
* Reset the statistics to zero.
*/
virtual void reset_stats(void);
virtual ~ACE_Compressor (void);
protected:
ACE_Compressor(ACE_CompressorId compressor_id,
ACE_UINT32 compression_level = 0); // Must be inherited.
virtual void update_stats( ACE_UINT64 uncompressed_bytes,
ACE_UINT64 compressed_bytes );
private:
ACE_CompressorId compressor_id_;
ACE_UINT32 compression_level_;
// Ensure we can lock with imutability (i.e. const)
mutable ACE_SYNCH_MUTEX mutex_;
ACE_UINT64 compressed_bytes_;
ACE_UINT64 uncompressed_bytes_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "Compressor.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif // ACE_COMPRESSOR_H
@@ -0,0 +1,18 @@
// -*- C++ -*-
// $Id: Compressor.inl 95545 2012-02-23 07:57:08Z johnnyw $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE ACE_CompressorId
ACE_Compressor::get_compressor_id(void) const
{
return this->compressor_id_;
}
ACE_INLINE ACE_UINT32
ACE_Compressor::get_compression_level(void) const
{
return this->compression_level_;
}
ACE_END_VERSIONED_NAMESPACE_DECL
@@ -0,0 +1,57 @@
// -*- C++ -*-
// $Id: ACE_RLECompression_export.h 95545 2012-02-23 07:57:08Z johnnyw $
// Definition for Win32 Export directives.
// This file is generated automatically by generate_export_file.pl ACE_RLECompression
// ------------------------------
#ifndef ACE_RLECOMPRESSION_EXPORT_H
#define ACE_RLECOMPRESSION_EXPORT_H
#include "ace/config-all.h"
#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_RLECOMPRESSION_HAS_DLL)
# define ACE_RLECOMPRESSION_HAS_DLL 0
#endif /* ACE_AS_STATIC_LIBS && ACE_RLECOMPRESSION_HAS_DLL */
#if !defined (ACE_RLECOMPRESSION_HAS_DLL)
# define ACE_RLECOMPRESSION_HAS_DLL 1
#endif /* ! ACE_RLECOMPRESSION_HAS_DLL */
#if defined (ACE_RLECOMPRESSION_HAS_DLL) && (ACE_RLECOMPRESSION_HAS_DLL == 1)
# if defined (ACE_RLECOMPRESSION_BUILD_DLL)
# define ACE_RLECompression_Export ACE_Proper_Export_Flag
# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# else /* ACE_RLECOMPRESSION_BUILD_DLL */
# define ACE_RLECompression_Export ACE_Proper_Import_Flag
# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# endif /* ACE_RLECOMPRESSION_BUILD_DLL */
#else /* ACE_RLECOMPRESSION_HAS_DLL == 1 */
# define ACE_RLECompression_Export
# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T)
# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* ACE_RLECOMPRESSION_HAS_DLL == 1 */
// Set ACE_RLECOMPRESSION_NTRACE = 0 to turn on library specific tracing even if
// tracing is turned off for ACE.
#if !defined (ACE_RLECOMPRESSION_NTRACE)
# if (ACE_NTRACE == 1)
# define ACE_RLECOMPRESSION_NTRACE 1
# else /* (ACE_NTRACE == 1) */
# define ACE_RLECOMPRESSION_NTRACE 0
# endif /* (ACE_NTRACE == 1) */
#endif /* !ACE_RLECOMPRESSION_NTRACE */
#if (ACE_RLECOMPRESSION_NTRACE == 1)
# define ACE_RLECOMPRESSION_TRACE(X)
#else /* (ACE_RLECOMPRESSION_NTRACE == 1) */
# if !defined (ACE_HAS_TRACE)
# define ACE_HAS_TRACE
# endif /* ACE_HAS_TRACE */
# define ACE_RLECOMPRESSION_TRACE(X) ACE_TRACE_IMPL(X)
# include "ace/Trace.h"
#endif /* (ACE_RLECOMPRESSION_NTRACE == 1) */
#endif /* ACE_RLECOMPRESSION_EXPORT_H */
// End of auto generated file.
@@ -0,0 +1,158 @@
// $Id: RLECompressor.cpp 95560 2012-02-27 08:11:54Z johnnyw $
#include "RLECompressor.h"
#include "ace/OS_NS_string.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_RLECompressor::ACE_RLECompressor(void)
: ACE_Compressor(ACE_COMPRESSORID_RLE)
{
}
ACE_RLECompressor::~ACE_RLECompressor(void)
{
}
ACE_UINT64
ACE_RLECompressor::compress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len )
{
const ACE_UINT8 *in_p = static_cast<const ACE_UINT8*>(in_ptr);
ACE_UINT8 *out_p = static_cast<ACE_UINT8*>(out_ptr);
ACE_UINT64 src_len = in_len; // Save for stats
ACE_UINT64 out_len = 0;
ACE_UINT64 out_index = 0;
ACE_UINT64 out_base = 0;
ACE_UINT32 run_count = 0;
ACE_UINT32 dup_count = 0;
bool run_code = false;
ACE_UINT8 nxt_byte, cur_byte;
if (in_p && out_p) while (in_len-- > 0) {
if (run_code) switch (run_count) {
default:
out_p[out_index = out_base] = ACE_UINT8(run_count++ | 0x80);
out_p[++out_index] = cur_byte = *in_p++;
if (in_len ? cur_byte == (nxt_byte = *in_p) : true) {
continue;
}
// Fall Through
case 128:
if (++out_index >= max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
} else if (in_len == 0) {
continue;
}
run_code = false;
out_p[out_base = out_index] = 0;
dup_count = run_count = 0;
continue;
}
switch (run_count) {
case 128:
if (++out_index >= max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
}
out_p[out_base = out_index] = 0;
dup_count = run_count = 0;
// Fall Through
default :
cur_byte = *in_p++;
if (in_len > 0) {
if (cur_byte == (nxt_byte = *in_p)) {
if (dup_count++ == 1) {
if (run_count >= dup_count) {
out_p[out_base] = static_cast<ACE_UINT8>(run_count - dup_count);
out_base += run_count;
}
run_code = true;
run_count = dup_count - 1;
dup_count = 0;
out_p[out_index = out_base] = static_cast<ACE_UINT8>(run_count++ | 0x80);
break;
}
} else dup_count = 0;
}
out_p[out_base] = char(run_count++);
break;
}
if (++out_index >= max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
}
out_p[out_index] = cur_byte;
}
out_len = ++out_index; // Update our output length
this->update_stats(src_len, out_len);
return out_len;
}
// Decompress using Run Length Encoding (RLE)
ACE_UINT64
ACE_RLECompressor::decompress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len )
{
ACE_UINT64 out_len = 0;
const ACE_UINT8 *in_p = static_cast<const ACE_UINT8*>(in_ptr);
ACE_UINT8 *out_p = static_cast<ACE_UINT8*>(out_ptr);
if (in_p && out_p) while(in_len-- > 0) {
ACE_UINT8 cur_byte = *in_p++;
ACE_UINT32 cpy_len = ACE_UINT32((cur_byte & 0x7F) + 1);
if (cpy_len > max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
} else if ((cur_byte & 0x80) != 0) { // compressed
if (in_len-- > 0) {
ACE_OS::memset(out_p, *in_p++, cpy_len);
} else {
return ACE_UINT64(-1); // Output Exhausted
}
} else if (in_len >= cpy_len) {
ACE_OS::memcpy(out_p, in_p, cpy_len);
in_p += cpy_len;
in_len -= cpy_len;
} else {
return ACE_UINT64(-1); // Output Exhausted
}
out_p += cpy_len;
max_out_len -= cpy_len;
out_len += cpy_len;
}
return out_len;
}
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
@@ -0,0 +1,108 @@
// -*- C++ -*-
//=============================================================================
/**
* @file RLECompressor.h
*
* $Id: RLECompressor.h
*
* @author TAO version by
* @author Derek Dominish <derek.dominish@dsto.defence.gov.au>
* @author ACE version by
* @author Derek Dominish <derek.dominish@dsto.defence.gov.au>
*
* Run-length encoding (RLE) is a very simple form of data compression
* in which runs of data (that is, sequences in which the same data value
* occurs in many consecutive data elements) are stored as a single data
* value and count, rather than as the original run. This is most useful
* on data that contains many such runs: for example, simple graphic
* images such as icons, line drawings, and animations. It is not useful
* with files that don't have many runs as it could slightly increase the
* output size.
* ALGORITHM: This algorithm is an optimized version of the traditional
* RLE algorithm in that it behaves better with very few runs.
*
* With a run of a character where that run is >= 3 this is
* replaced with the repeat indicator 0X80 and then the repeat count OR'd
* over this ident. This repeat count is therefore has a maximum value
* of 127 (0x7F) which is to be interpreted as the next character repeated
* another 'repeat count' times (i.e. a maximum of 128 characters can be
* represented in any single dupal). if the repeat ident is not present
* then the count is to be interpreted as a copy of the next repeat count
* characters + 1.
*
* EXAMPLE: the following arbitary string of 67 bytes:-
* WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW
* will produce (as a HEXDUMP) of 14 bytes
* 8B 57 00 42 8B 57 82 42 97 57 00 42 8D 57 .W.B.W.B.W.B.W
*/
//=============================================================================
#ifndef ACE_RLECOMPRESSOR_H
#define ACE_RLECOMPRESSOR_H
#include /**/ "ace/pre.h"
#include "ACE_RLECompression_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Compression/Compressor.h"
#include "ace/Singleton.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_RLECompression_Export ACE_RLECompressor : public ACE_Compressor
{
public:
/**
* Default constructor. Should use instance() to get global instance.
*/
ACE_RLECompressor(void);
virtual ~ACE_RLECompressor(void);
/**
* Compress the @a in_ptr buffer for @a in_len into the
* @a dest_ptr buffer with a maximum @a max_out_len using
* the Run Length Ecoding (RLE) algorithm. If the
* @a max_out_len is exhausted through the compress process
* then a value of -1 will be returned from the function,
* otherwise the return value will indicate the resultant
* @a out_ptr compressed buffer length.
*
* @note It is advisable that the @max_out_len be slightly
* larger of the input @a in_len (i.e. x 1.1F) to cater
* for the possibility that a reduced compressed length
* is not possible.
*/
virtual ACE_UINT64 compress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len );
/**
* DeCompress the @a in_ptr buffer for @a in_len into the
* @a out_ptr buffer with a maximum @a max_out_len using
* the Run Length Ecoding (RLE) algorithm. If the
* @a max_out_len is exhausted during decompression
* then a value of -1 will be returned from the function,
* otherwise the return value will indicate the resultant
* @a out_ptr decompressed buffer length.
*/
virtual ACE_UINT64 decompress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len );
};
ACE_RLECOMPRESSION_SINGLETON_DECLARE(ACE_Singleton, ACE_RLECompressor, ACE_SYNCH_MUTEX);
typedef class ACE_Singleton<ACE_RLECompressor, ACE_SYNCH_MUTEX> ACE_RLECompression;
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif // ACE_RLECOMPRESSOR_H
+21
View File
@@ -0,0 +1,21 @@
/* -*- C++ -*- */
/**
* @file Condition_Attributes.cpp
*
* $Id: Condition_Attributes.cpp 96061 2012-08-16 09:36:07Z mcorino $
*
* Originally in Synch.cpp
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
#include "ace/Condition_Thread_Mutex.h"
#include "ace/Condition_Attributes.h"
#if defined (ACE_HAS_THREADS)
#if !defined (__ACE_INLINE__)
#include "ace/Condition_Attributes.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_THREADS */
+101
View File
@@ -0,0 +1,101 @@
// -*- C++ -*-
//==========================================================================
/**
* @file Condition_Attributes.h
*
* $Id: Condition_Attributes.h 96077 2012-08-20 08:13:23Z johnnyw $
*
* Moved from Synch.h.
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//==========================================================================
#ifndef ACE_CONDITION_ATTRIBUTES_H
#define ACE_CONDITION_ATTRIBUTES_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/OS_NS_Thread.h"
#if defined (ACE_HAS_THREADS)
// ACE platform supports some form of threading.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Condition_Attributes
{
public:
/// Constructor
ACE_Condition_Attributes (int type = ACE_DEFAULT_SYNCH_TYPE);
/// Destructor
~ACE_Condition_Attributes (void);
/// Accessor for retrieving the current attributes
const ACE_condattr_t& attributes (void) const;
protected:
/// The attributes
ACE_condattr_t attributes_;
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Condition_Attributes &);
ACE_Condition_Attributes (const ACE_Condition_Attributes &);
};
template <class TIME_POLICY>
class ACE_Condition_Attributes_T : public ACE_Condition_Attributes
{
public:
/// Constructor
ACE_Condition_Attributes_T (int type = ACE_DEFAULT_SYNCH_TYPE)
: ACE_Condition_Attributes (type)
{}
/// Destructor
~ACE_Condition_Attributes_T (void) {}
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Condition_Attributes_T<TIME_POLICY> &);
ACE_Condition_Attributes_T (const ACE_Condition_Attributes_T<TIME_POLICY> &);
};
class ACE_Monotonic_Time_Policy;
template <>
class ACE_Export ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy>
: public ACE_Condition_Attributes
{
public:
/// Constructor
ACE_Condition_Attributes_T (int type = ACE_DEFAULT_SYNCH_TYPE);
/// Destructor
~ACE_Condition_Attributes_T (void);
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy> &);
ACE_Condition_Attributes_T (const ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy> &);
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Condition_Attributes.inl"
#endif /* __ACE_INLINE__ */
#endif /* !ACE_HAS_THREADS */
#include /**/ "ace/post.h"
#endif /* ACE_CONDITION_ATTRIBUTES_H */
+40
View File
@@ -0,0 +1,40 @@
// -*- C++ -*-
//
// $Id: Condition_Attributes.inl 96096 2012-08-23 12:34:02Z johnnyw $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Condition_Attributes::ACE_Condition_Attributes (int type)
{
(void) ACE_OS::condattr_init (this->attributes_, type);
}
ACE_INLINE
ACE_Condition_Attributes::~ACE_Condition_Attributes (void)
{
ACE_OS::condattr_destroy (this->attributes_);
}
ACE_INLINE
const ACE_condattr_t&
ACE_Condition_Attributes::attributes (void) const
{
return this->attributes_;
}
ACE_INLINE
ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy>::ACE_Condition_Attributes_T (int type)
: ACE_Condition_Attributes (type)
{
#if (defined (_POSIX_MONOTONIC_CLOCK) && !defined (ACE_LACKS_MONOTONIC_TIME)) || defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC)
(void) ACE_OS::condattr_setclock (this->attributes_, CLOCK_MONOTONIC);
#endif
}
ACE_INLINE
ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy>::~ACE_Condition_Attributes_T (void)
{
}
ACE_END_VERSIONED_NAMESPACE_DECL
@@ -3,7 +3,7 @@
/**
* @file Condition_Recursive_Thread_Mutex.cpp
*
* $Id: Condition_Recursive_Thread_Mutex.cpp 89127 2010-02-22 19:58:18Z schmidt $
* $Id: Condition_Recursive_Thread_Mutex.cpp 96077 2012-08-20 08:13:23Z johnnyw $
*
* Originally in Synch.cpp
*
@@ -14,9 +14,7 @@
#if defined (ACE_HAS_THREADS)
#if defined (ACE_HAS_DUMP)
# include "ace/Log_Msg.h"
#endif /* ACE_HAS_DUMP */
#include "ace/Log_Msg.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -49,7 +47,19 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::~ACE_Condition (void)
ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition (ACE_Recursive_Thread_Mutex &m)
: mutex_ (m)
{
ACE_OS::cond_init (&this->cond_);
if (ACE_OS::cond_init (&this->cond_) != 0)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition<ACE_Recursive_Thread_Mutex>")));
}
ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition (ACE_Recursive_Thread_Mutex &m,
const ACE_Condition_Attributes &attributes)
: mutex_ (m)
{
if (ACE_OS::cond_init (&this->cond_,
const_cast<ACE_condattr_t &> (attributes.attributes ())) != 0)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition<ACE_Recursive_Thread_Mutex>")));
}
int
@@ -118,12 +128,6 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::mutex (void)
return this->mutex_;
}
ACE_Condition_Recursive_Thread_Mutex::ACE_Condition_Recursive_Thread_Mutex (
ACE_Recursive_Thread_Mutex &m) :
ACE_Condition<ACE_Recursive_Thread_Mutex> (m)
{
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_THREADS */
@@ -4,7 +4,7 @@
/**
* @file Condition_Recursive_Thread_Mutex.h
*
* $Id: Condition_Recursive_Thread_Mutex.h 86731 2009-09-17 12:23:48Z johnnyw $
* $Id: Condition_Recursive_Thread_Mutex.h 96073 2012-08-17 13:39:55Z mcorino $
*
* Moved from Synch.h.
*
@@ -26,11 +26,11 @@
# include "ace/Null_Condition.h"
#else /* ACE_HAS_THREADS */
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Condition_Attributes.h"
#include "ace/Condition_T.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <class ACE_LOCK> class ACE_Condition;
/**
* @brief ACE_Condition template specialization written using
* @a ACE_Recursive_Thread_Mutex. This allows threads to block until
@@ -43,6 +43,10 @@ public:
/// Initialize the condition variable with a recursive mutex.
ACE_Condition (ACE_Recursive_Thread_Mutex &m);
/// Initialize the condition variable.
ACE_Condition (ACE_Recursive_Thread_Mutex &m,
const ACE_Condition_Attributes &attributes);
/// Implicitly destroy the condition variable.
~ACE_Condition (void);
@@ -65,7 +69,7 @@ public:
* Block on condition or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" wait() semantics on the recursive @a mutex
* passed as a parameter (this is useful if you need to store the
* <Condition> in shared memory). Else, if <abstime> != 0 and the
* <Condition> in shared memory). Else, if @a abstime != 0 and the
* call times out before the condition is signaled <wait> returns -1
* and sets errno to ETIME.
*/
@@ -100,13 +104,7 @@ private:
};
class ACE_Export ACE_Condition_Recursive_Thread_Mutex
: public ACE_Condition<ACE_Recursive_Thread_Mutex>
{
public:
/// Initialize the condition variable with a recursive mutex.
ACE_Condition_Recursive_Thread_Mutex (ACE_Recursive_Thread_Mutex &m);
};
typedef ACE_Condition<ACE_Recursive_Thread_Mutex> ACE_Condition_Recursive_Thread_Mutex;
ACE_END_VERSIONED_NAMESPACE_DECL
+18 -1
View File
@@ -1,4 +1,4 @@
// $Id: Condition_T.cpp 89127 2010-02-22 19:58:18Z schmidt $
// $Id: Condition_T.cpp 96077 2012-08-20 08:13:23Z johnnyw $
#ifndef ACE_CONDITION_T_CPP
#define ACE_CONDITION_T_CPP
@@ -15,6 +15,7 @@
#if !defined (__ACE_INLINE__)
#include "ace/Condition_T.inl"
#include "ace/Time_Value.h"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -71,6 +72,22 @@ ACE_Condition<MUTEX>::ACE_Condition (MUTEX &m,
ACE_TEXT ("ACE_Condition::ACE_Condition")));
}
template <class MUTEX>
ACE_Condition<MUTEX>::ACE_Condition (MUTEX &m,
const ACE_Condition_Attributes &attributes,
const ACE_TCHAR *name,
void *arg)
: mutex_ (m)
{
// ACE_TRACE ("ACE_Condition<MUTEX>::ACE_Condition<MUTEX>");
if (ACE_OS::cond_init (&this->cond_,
const_cast<ACE_condattr_t &> (attributes.attributes ()),
name, arg) != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Condition::ACE_Condition")));
}
template <class MUTEX>
ACE_Condition<MUTEX>::~ACE_Condition (void)
{
+14 -9
View File
@@ -4,7 +4,7 @@
/**
* @file Condition_T.h
*
* $Id: Condition_T.h 81462 2008-04-28 11:39:40Z johnnyw $
* $Id: Condition_T.h 96061 2012-08-16 09:36:07Z mcorino $
*
* Moved from Synch.h.
*
@@ -18,7 +18,7 @@
#include /**/ "ace/pre.h"
#include "ace/OS_NS_Thread.h"
#include "ace/Lock.h"
#include "ace/Condition_Attributes.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -37,8 +37,8 @@ class ACE_Time_Value;
* until shared data changes state.
*
* A condition variable enables threads to atomically block and
* test the condition under the protection of a mutual exclu-
* sion lock (mutex) until the condition is satisfied. That is,
* test the condition under the protection of a mutual exclusion
* lock (mutex) until the condition is satisfied. That is,
* the mutex must have been held by the thread before calling
* wait or signal on the condition. If the condition is false,
* a thread blocks on a condition variable and atomically
@@ -54,11 +54,16 @@ template <class MUTEX>
class ACE_Condition
{
public:
// = Initialiation and termination methods.
/// Initialize the condition variable.
ACE_Condition (MUTEX &m, int type = USYNC_THREAD,
const ACE_TCHAR *name = 0, void *arg = 0);
/// Initialize the condition variable.
ACE_Condition (MUTEX &m,
const ACE_Condition_Attributes &attributes,
const ACE_TCHAR *name = 0,
void *arg = 0);
/// Implicitly destroy the condition variable.
~ACE_Condition (void);
@@ -67,7 +72,7 @@ public:
* Block on condition, or until absolute time-of-day has passed. If
* @a abstime == 0 use "blocking" <wait> semantics. Else, if @a abstime
* != 0 and the call times out before the condition is signaled
* <wait> returns -1 and sets errno to ETIME.
* wait() returns -1 and sets errno to ETIME.
*/
int wait (const ACE_Time_Value *abstime);
@@ -76,10 +81,10 @@ public:
/**
* Block on condition or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" wait() semantics on the <mutex>
* @a abstime == 0 use "blocking" wait() semantics on the @a mutex
* passed as a parameter (this is useful if you need to store the
* <Condition> in shared memory). Else, if <abstime> != 0 and the
* call times out before the condition is signaled <wait> returns -1
* <Condition> in shared memory). Else, if @a abstime != 0 and the
* call times out before the condition is signaled wait() returns -1
* and sets errno to ETIME.
*/
int wait (MUTEX &mutex, const ACE_Time_Value *abstime = 0);
+31 -33
View File
@@ -2,7 +2,7 @@
/**
* @file Condition_Thread_Mutex.cpp
*
* $Id: Condition_Thread_Mutex.cpp 91286 2010-08-05 09:04:31Z johnnyw $
* $Id: Condition_Thread_Mutex.cpp 96077 2012-08-20 08:13:23Z johnnyw $
*
* Originally in Synch.cpp
*
@@ -19,17 +19,15 @@
#include "ace/Log_Msg.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_ALLOC_HOOK_DEFINE(ACE_Condition_Thread_Mutex)
ACE_ALLOC_HOOK_DEFINE(ACE_Condition<ACE_Thread_Mutex>)
void
ACE_Condition_Thread_Mutex::dump (void) const
ACE_Condition<ACE_Thread_Mutex>::dump (void) const
{
#if defined (ACE_HAS_DUMP)
// ACE_TRACE ("ACE_Condition_Thread_Mutex::dump");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::dump");
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
@@ -42,40 +40,40 @@ ACE_Condition_Thread_Mutex::dump (void) const
#endif /* ACE_HAS_DUMP */
}
ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
const ACE_TCHAR *name,
void *arg)
ACE_Condition<ACE_Thread_Mutex>::ACE_Condition (ACE_Thread_Mutex &m,
const ACE_TCHAR *name,
void *arg)
: mutex_ (m),
removed_ (false)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>");
if (ACE_OS::cond_init (&this->cond_,
(short) USYNC_THREAD,
name,
arg) != 0)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex")));
ACE_TEXT ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>")));
}
ACE_Condition_Thread_Mutex::
ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
ACE_Condition_Attributes &attributes,
const ACE_TCHAR *name,
void *arg)
ACE_Condition<ACE_Thread_Mutex>::ACE_Condition (ACE_Thread_Mutex &m,
const ACE_Condition_Attributes &attributes,
const ACE_TCHAR *name,
void *arg)
: mutex_ (m),
removed_ (false)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex");
if (ACE_OS::cond_init (&this->cond_, attributes.attributes_,
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>");
if (ACE_OS::cond_init (&this->cond_,
const_cast<ACE_condattr_t &> (attributes.attributes ()),
name, arg) != 0)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex")));
ACE_TEXT ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>")));
}
ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex (void)
ACE_Condition<ACE_Thread_Mutex>::~ACE_Condition (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::~ACE_Condition<ACE_Thread_Mutex>");
this->remove ();
}
@@ -84,40 +82,40 @@ ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex (void)
// <abstime> using the <cond_timedwait> function.
int
ACE_Condition_Thread_Mutex::wait (void)
ACE_Condition<ACE_Thread_Mutex>::wait (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait");
return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock_);
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait");
return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock ());
}
int
ACE_Condition_Thread_Mutex::wait (ACE_Thread_Mutex &mutex,
ACE_Condition<ACE_Thread_Mutex>::wait (ACE_Thread_Mutex &mutex,
const ACE_Time_Value *abstime)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait");
return ACE_OS::cond_timedwait (&this->cond_,
&mutex.lock_,
&mutex.lock (),
const_cast <ACE_Time_Value *> (abstime));
}
int
ACE_Condition_Thread_Mutex::wait (const ACE_Time_Value *abstime)
ACE_Condition<ACE_Thread_Mutex>::wait (const ACE_Time_Value *abstime)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait");
return this->wait (this->mutex_, abstime);
}
int
ACE_Condition_Thread_Mutex::signal (void)
ACE_Condition<ACE_Thread_Mutex>::signal (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::signal");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::signal");
return ACE_OS::cond_signal (&this->cond_);
}
int
ACE_Condition_Thread_Mutex::broadcast (void)
ACE_Condition<ACE_Thread_Mutex>::broadcast (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::broadcast");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::broadcast");
return ACE_OS::cond_broadcast (&this->cond_);
}
+21 -41
View File
@@ -4,7 +4,7 @@
/**
* @file Condition_Thread_Mutex.h
*
* $Id: Condition_Thread_Mutex.h 92069 2010-09-28 11:38:59Z johnnyw $
* $Id: Condition_Thread_Mutex.h 96073 2012-08-17 13:39:55Z mcorino $
*
* Moved from Synch.h.
*
@@ -28,37 +28,17 @@
// ACE platform supports some form of threading.
#include "ace/Thread_Mutex.h"
#include "ace/Condition_Attributes.h"
#include "ace/Condition_T.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Time_Value;
class ACE_Export ACE_Condition_Attributes
{
public:
/// Constructor
ACE_Condition_Attributes (int type = ACE_DEFAULT_SYNCH_TYPE);
/// Destructor
~ACE_Condition_Attributes (void);
private:
friend class ACE_Condition_Thread_Mutex;
/// The attributes
ACE_condattr_t attributes_;
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Condition_Attributes &);
ACE_Condition_Attributes (const ACE_Condition_Attributes &);
};
/**
* @class ACE_Condition_Thread_Mutex
*
* @brief ACE_Condition variable wrapper written using ACE_Mutexes This
* allows threads to block until shared data changes state.
* @brief ACE_Condition template specialization written using
* ACE_Mutexes. This allows threads to block until shared data
* changes state.
* A condition variable enables threads to atomically block and
* test the condition under the protection of a mutual exclu-
* sion lock (mutex) until the condition is satisfied. That is,
@@ -70,26 +50,24 @@ private:
* up waiting threads by signaling the associated condition
* variable. The waiting threads, upon awakening, reacquire the
* mutex and re-evaluate the condition.
*
* This should be an instantiation of ACE_Condition but problems
* with compilers precludes this...
*/
class ACE_Export ACE_Condition_Thread_Mutex
template <>
class ACE_Export ACE_Condition<ACE_Thread_Mutex>
{
public:
/// Initialize the condition variable.
ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
const ACE_TCHAR *name = 0,
void *arg = 0);
ACE_Condition (ACE_Thread_Mutex &m,
const ACE_TCHAR *name = 0,
void *arg = 0);
/// Initialize the condition variable.
ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m,
ACE_Condition_Attributes &attributes,
const ACE_TCHAR *name = 0,
void *arg = 0);
ACE_Condition (ACE_Thread_Mutex &m,
const ACE_Condition_Attributes &attributes,
const ACE_TCHAR *name = 0,
void *arg = 0);
/// Implicitly destroy the condition variable.
~ACE_Condition_Thread_Mutex (void);
~ACE_Condition (void);
/**
* Explicitly destroy the condition variable. Note that only one
@@ -111,7 +89,7 @@ public:
/**
* Block on condition or until absolute time-of-day has passed. If
* abstime == 0 use "blocking" wait() semantics on the <mutex>
* abstime == 0 use "blocking" wait() semantics on the @a mutex
* passed as a parameter (this is useful if you need to store the
* <Condition> in shared memory). Else, if @a abstime != 0 and the
* call times out before the condition is signaled <wait> returns -1
@@ -150,10 +128,12 @@ protected:
private:
// = Prevent assignment and initialization.
void operator= (const ACE_Condition_Thread_Mutex &);
ACE_Condition_Thread_Mutex (const ACE_Condition_Thread_Mutex &);
void operator= (const ACE_Condition<ACE_Thread_Mutex> &);
ACE_Condition (const ACE_Condition<ACE_Thread_Mutex> &);
};
typedef ACE_Condition<ACE_Thread_Mutex> ACE_Condition_Thread_Mutex;
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
+5 -17
View File
@@ -1,25 +1,13 @@
// -*- C++ -*-
//
// $Id: Condition_Thread_Mutex.inl 92069 2010-09-28 11:38:59Z johnnyw $
// $Id: Condition_Thread_Mutex.inl 96061 2012-08-16 09:36:07Z mcorino $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Condition_Attributes::ACE_Condition_Attributes (int type)
{
(void) ACE_OS::condattr_init (this->attributes_, type);
}
ACE_INLINE
ACE_Condition_Attributes::~ACE_Condition_Attributes (void)
{
ACE_OS::condattr_destroy (this->attributes_);
}
ACE_INLINE int
ACE_Condition_Thread_Mutex::remove (void)
ACE_Condition<ACE_Thread_Mutex>::remove (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::remove");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::remove");
// <cond_destroy> is called in a loop if the condition variable is
// BUSY. This avoids a condition where a condition is signaled and
@@ -44,9 +32,9 @@ ACE_Condition_Thread_Mutex::remove (void)
}
ACE_INLINE ACE_Thread_Mutex &
ACE_Condition_Thread_Mutex::mutex (void)
ACE_Condition<ACE_Thread_Mutex>::mutex (void)
{
// ACE_TRACE ("ACE_Condition_Thread_Mutex::mutex");
// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::mutex");
return this->mutex_;
}
+2 -2
View File
@@ -1,4 +1,4 @@
// $Id: Configuration.cpp 91688 2010-09-09 11:21:50Z johnnyw $
// $Id: Configuration.cpp 92828 2010-12-08 09:38:57Z mcorino $
#include "ace/Configuration.h"
#include "ace/Auto_Ptr.h"
#include "ace/SString.h"
@@ -1632,7 +1632,7 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key
// Now remove subkey from parent key
ACE_Configuration_ExtId SubSExtId (sub_section);
SUBSECTION_HASH::ENTRY* subsection_entry;
SUBSECTION_HASH::ENTRY* subsection_entry = 0;
if (((SUBSECTION_HASH*)ParentIntId.section_hash_map_)->
find (SubSExtId, subsection_entry))
return -1;
@@ -1,4 +1,4 @@
// $Id: Configuration_Import_Export.cpp 84565 2009-02-23 08:20:39Z johnnyw $
// $Id: Configuration_Import_Export.cpp 96017 2012-08-08 22:18:09Z mitza $
#include "ace/Configuration_Import_Export.h"
#include "ace/OS_Errno.h"
@@ -138,7 +138,8 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
// number type
ACE_TCHAR* endptr = 0;
unsigned long value = ACE_OS::strtoul (end + 6, &endptr, 16);
if (config_.set_integer_value (section, name, value))
if (config_.set_integer_value (section, name,
static_cast<u_int> (value)))
{
ACE_OS::fclose (in);
delete [] buffer;
@@ -4,7 +4,7 @@
/**
* @file Configuration_Import_Export.h
*
* $Id: Configuration_Import_Export.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: Configuration_Import_Export.h 93359 2011-02-11 11:33:12Z mcorino $
*
* @author Jerry D. Odenwelder Jr. <jerry.o@mindspring.com>
* Chris Hafey <chris@stentorsoft.com>
@@ -83,12 +83,12 @@ private:
* using the Win32 Registry file export format. This format looks like
* [Section]
* "key"="String Data"
* "key"=dword: numeric data in hexidecimal format
* "key"=dword: numeric data in hexadecimal format
* "key"=hex: binary data
*
* @todo
* - Add dynamic buffer when importing. currently it will not allow
* importing of values greater than a fixed ammount (4096 bytes)
* importing of values greater than a fixed amount (4096 bytes)
*
*/
class ACE_Export ACE_Registry_ImpExp : public ACE_Config_ImpExp_Base
@@ -101,7 +101,7 @@ public:
virtual ~ACE_Registry_ImpExp (void);
/**
* Imports the configuration database from filename.
* Imports the configuration database from @a filename.
* No existing data is removed.
*/
virtual int import_config (const ACE_TCHAR* filename);
@@ -149,7 +149,7 @@ private:
* Justification = left_justified
*
* The caller can then retrieve the string with the regular
* <get_string_value> function and convert the string to the
* get_string_value() function and convert the string to the
* desired data type.
*
* @todo
@@ -157,7 +157,7 @@ private:
* - Strings with embedded quotes " cause the import to fail
* - Importing/exporting for values in the root section does not work
* - Add dynamic buffer when importing. currently it will not allow
* importing of values greater than a fixed ammount (4096 bytes)
* importing of values greater than a fixed amount (4096 bytes)
*/
class ACE_Export ACE_Ini_ImpExp : public ACE_Config_ImpExp_Base
{
@@ -173,7 +173,7 @@ public:
virtual ~ACE_Ini_ImpExp (void);
/**
* Imports the configuration database from filename.
* Imports the configuration database from @a filename.
* No existing data is removed.
*/
virtual int import_config (const ACE_TCHAR* filename);
+4 -3
View File
@@ -1,4 +1,4 @@
// $Id: Connector.cpp 91527 2010-08-27 15:03:31Z shuston $
// $Id: Connector.cpp 93433 2011-02-23 10:34:01Z vzykov $
#ifndef ACE_CONNECTOR_CPP
#define ACE_CONNECTOR_CPP
@@ -829,7 +829,7 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open
else if (this->creation_strategy_ == 0)
{
ACE_NEW_RETURN (this->creation_strategy_,
CREATION_STRATEGY,
CREATION_STRATEGY (0, r),
-1);
this->delete_creation_strategy_ = true;
}
@@ -887,7 +887,8 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Strategy_Connecto
ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s,
ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
int flags)
: creation_strategy_ (0),
: base_type (reactor),
creation_strategy_ (0),
delete_creation_strategy_ (false),
connect_strategy_ (0),
delete_connect_strategy_ (false),
-57
View File
@@ -1,57 +0,0 @@
// $Id: Countdown_Time.cpp 91287 2010-08-05 10:30:49Z johnnyw $
#include "ace/Countdown_Time.h"
#include "ace/OS_NS_sys_time.h"
#if !defined (__ACE_INLINE__)
#include "ace/Countdown_Time.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time)
: max_wait_time_ (max_wait_time),
stopped_ (false)
{
this->start ();
}
ACE_Countdown_Time::~ACE_Countdown_Time (void)
{
this->stop ();
}
void
ACE_Countdown_Time::start (void)
{
if (this->max_wait_time_ != 0)
{
this->start_time_ = ACE_OS::gettimeofday ();
this->stopped_ = false;
}
}
void
ACE_Countdown_Time::stop (void)
{
if (this->max_wait_time_ != 0 && !this->stopped_)
{
ACE_Time_Value const elapsed_time =
ACE_OS::gettimeofday () - this->start_time_;
if (elapsed_time >= ACE_Time_Value::zero &&
*this->max_wait_time_ > elapsed_time)
{
*this->max_wait_time_ -= elapsed_time;
}
else
{
// Used all of timeout.
*this->max_wait_time_ = ACE_Time_Value::zero;
// errno = ETIME;
}
this->stopped_ = true;
}
}
ACE_END_VERSIONED_NAMESPACE_DECL
+7 -52
View File
@@ -4,9 +4,10 @@
/**
* @file Countdown_Time.h
*
* $Id: Countdown_Time.h 85365 2009-05-18 08:27:42Z johnnyw $
* $Id: Countdown_Time.h 95332 2011-12-15 11:09:41Z mcorino $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
* @author Irfan Pyarali <irfan@cs.wustl.edu>
*/
//=============================================================================
@@ -15,67 +16,21 @@
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Time_Value.h"
#include "ace/Copy_Disabled.h"
#include "ace/Countdown_Time_T.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Countdown_Time
*
* @brief Keeps track of the amount of elapsed time.
*
* This class has a side-effect on the @c max_wait_time -- every
* time the stop() method is called the @c max_wait_time is
* updated.
*/
class ACE_Export ACE_Countdown_Time : private ACE_Copy_Disabled
{
public:
/// Cache the @a max_wait_time and call @c start().
ACE_Countdown_Time (ACE_Time_Value *max_wait_time);
/// Destructor, makes sure the max_wait_time that got passed as pointer
/// to the constructor is updated with the time elapsed.
~ACE_Countdown_Time (void);
/// Cache the current time and enter a start state.
void start (void);
/// Subtract the elapsed time from max_wait_time_ and enter a stopped
/// state.
void stop (void);
/// Calls stop and then start. max_wait_time_ is modified by the
/// call to stop.
void update (void);
/// Returns true if we've already been stopped, else false.
bool stopped (void) const;
private:
/// Maximum time we were willing to wait.
ACE_Time_Value *max_wait_time_;
/// Beginning of the start time.
ACE_Time_Value start_time_;
/// Keeps track of whether we've already been stopped.
bool stopped_;
};
// The following typedef is here for ease of use and backward
// compatibility.
typedef ACE_Countdown_Time_T<ACE_Default_Time_Policy>
ACE_Countdown_Time;
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#if defined (__ACE_INLINE__)
#include "ace/Countdown_Time.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_COUNTDOWN_TIME_H */
-20
View File
@@ -1,20 +0,0 @@
// -*- C++ -*-
//
// $Id: Countdown_Time.inl 85368 2009-05-18 10:23:19Z johnnyw $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE bool
ACE_Countdown_Time::stopped (void) const
{
return stopped_;
}
ACE_INLINE void
ACE_Countdown_Time::update (void)
{
this->stop ();
this->start ();
}
ACE_END_VERSIONED_NAMESPACE_DECL
+65
View File
@@ -0,0 +1,65 @@
// $Id: Countdown_Time_T.cpp 95332 2011-12-15 11:09:41Z mcorino $
#ifndef ACE_COUNTDOWN_TIME_T_CPP
#define ACE_COUNTDOWN_TIME_T_CPP
#include "ace/Countdown_Time_T.h"
#if !defined (__ACE_INLINE__)
#include "ace/Countdown_Time_T.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <typename TIME_POLICY> ACE_INLINE
ACE_Countdown_Time_T<TIME_POLICY>::ACE_Countdown_Time_T (ACE_Time_Value *max_wait_time,
TIME_POLICY const & time_policy)
: time_policy_ (time_policy),
max_wait_time_ (max_wait_time),
stopped_ (false)
{
this->start ();
}
template <typename TIME_POLICY> ACE_INLINE
ACE_Countdown_Time_T<TIME_POLICY>::~ACE_Countdown_Time_T (void)
{
this->stop ();
}
template <typename TIME_POLICY> ACE_INLINE void
ACE_Countdown_Time_T<TIME_POLICY>::start (void)
{
if (this->max_wait_time_ != 0)
{
this->start_time_ = this->time_policy_ ();
this->stopped_ = false;
}
}
template <typename TIME_POLICY> ACE_INLINE void
ACE_Countdown_Time_T<TIME_POLICY>::stop (void)
{
if (this->max_wait_time_ != 0 && !this->stopped_)
{
ACE_Time_Value const elapsed_time =
this->time_policy_ () - this->start_time_;
if (elapsed_time >= ACE_Time_Value::zero &&
*this->max_wait_time_ > elapsed_time)
{
*this->max_wait_time_ -= elapsed_time;
}
else
{
// Used all of timeout.
*this->max_wait_time_ = ACE_Time_Value::zero;
// errno = ETIME;
}
this->stopped_ = true;
}
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_COUNTDOWN_TIME_T_CPP */
+100
View File
@@ -0,0 +1,100 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Countdown_Time_T.h
*
* $Id: Countdown_Time_T.h 95345 2011-12-15 19:46:06Z johnnyw $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
//=============================================================================
#ifndef ACE_COUNTDOWN_TIME_T_H
#define ACE_COUNTDOWN_TIME_T_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/Time_Value.h"
#include "ace/Time_Policy.h"
#include "ace/Copy_Disabled.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Countdown_Time
*
* @brief Keeps track of the amount of elapsed time.
*
* This class has a side-effect on the @c max_wait_time -- every
* time the stop() method is called the @c max_wait_time is
* updated.
*/
template <typename TIME_POLICY = ACE_Default_Time_Policy>
class ACE_Countdown_Time_T : private ACE_Copy_Disabled
{
public:
/// Cache the @a max_wait_time and call @c start().
ACE_Countdown_Time_T (ACE_Time_Value *max_wait_time,
TIME_POLICY const & time_policy = TIME_POLICY());
/// Destructor, makes sure the max_wait_time that got passed as pointer
/// to the constructor is updated with the time elapsed.
~ACE_Countdown_Time_T (void);
/// Cache the current time and enter a start state.
void start (void);
/// Subtract the elapsed time from max_wait_time_ and enter a stopped
/// state.
void stop (void);
/// Calls stop and then start. max_wait_time_ is modified by the
/// call to stop.
void update (void);
/// Returns true if we've already been stopped, else false.
bool stopped (void) const;
/// Allows applications to control how the timer queue gets the time
/// of day.
void set_time_policy(TIME_POLICY const & time_policy);
private:
/// The policy to return the current time of day
TIME_POLICY time_policy_;
/// Maximum time we were willing to wait.
ACE_Time_Value *max_wait_time_;
/// Beginning of the start time.
ACE_Time_Value start_time_;
/// Keeps track of whether we've already been stopped.
bool stopped_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#if defined (__ACE_INLINE__)
#include "ace/Countdown_Time_T.inl"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Countdown_Time_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Countdown_Time_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#endif /* ACE_COUNTDOWN_TIME_T_H */
+26
View File
@@ -0,0 +1,26 @@
// -*- C++ -*-
//
// $Id: Countdown_Time_T.inl 95332 2011-12-15 11:09:41Z mcorino $
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <typename TIME_POLICY> ACE_INLINE bool
ACE_Countdown_Time_T<TIME_POLICY>::stopped (void) const
{
return stopped_;
}
template <typename TIME_POLICY> ACE_INLINE void
ACE_Countdown_Time_T<TIME_POLICY>::update (void)
{
this->stop ();
this->start ();
}
template <typename TIME_POLICY> ACE_INLINE void
ACE_Countdown_Time_T<TIME_POLICY>::set_time_policy(TIME_POLICY const & time_policy)
{
this->time_policy_ = time_policy;
}
ACE_END_VERSIONED_NAMESPACE_DECL
+26 -13
View File
@@ -4,7 +4,7 @@
/**
* @file DLL.h
*
* $Id: DLL.h 91064 2010-07-12 10:11:24Z johnnyw $
* $Id: DLL.h 95913 2012-06-21 17:14:36Z johnnyw $
*
* @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
*/
@@ -88,24 +88,37 @@ public:
/**
* This method opens and dynamically links a specified DLL.
* @param dll_name The filename or path of the DLL to load.
* If a filename is given to @c open(), the @c ACE::ldfind() is used
* to locate DLLs via the following algorithms: (1) DLL filename
* expansion: @c ACE::ldfind() determines the name of the DLL by
* adding the appropriate prefix and suffix, e.g., it adds the @c lib
* prefix and @c .so suffix for Solaris and the @c .dll suffix for
* Windows and (2) DLL search path: @c ACE::ldfind() will also search
* for the designated DLL using the platform's DLL search path
* environment variable, e.g., it searches for DLLs using @c
* LD_LIBRARY_PATH on many UNIX systems and @c PATH on Windows.
* @param dll_name The filename or path of the DLL to load. ACE will
* attempt to apply the platform's standard library/DLL prefixes
* and suffixes, allowing a simple, unadorned name to be passed
* regardless of platform. The set of name transforms is listed
* below. A @i decorator is a platform's name designator for a debug
* vs release build. For example, on Windows it is usually "d".
* @li Prefix + name + decorator + suffix
* @li Prefix + name + suffix
* @li Name + decorator + suffix
* @li Name + suffix
* @li Name
* Note that the transforms with @i decorator will be avoided if
* ACE is built with the @c ACE_DISABLE_DEBUG_DLL_CHECK config macro.
*
* @Note There is another mode for locating library/DLL files that
* was used in old versions of ACE. The alternate method builds
* more combinations of pathname by combining the names transforms
* above with locations listed in the platform's standard "path"
* locations (e.g., @c LD_LIBRARY_PATH). It can be enabled by building
* ACE with the @c ACE_MUST_HELP_DLOPEN_SEARCH_PATH config macro.
* Use of this option is discouraged since it avoids the standard
* platform search options and security mechanisms.
*
* @param open_mode Flags to alter the actions taken when loading the DLL.
* The possible values are:
* @li @c RTLD_LAZY (this the default): loads identifier symbols but
* not the symbols for functions, which are loaded dynamically
* on-demand.
* on demand.
* @li @c RTLD_NOW: performs all necessary relocations when
* @a dll_name is first loaded
* @li RTLD_GLOBAL: makes symbols available for relocation
* @li @c RTLD_GLOBAL: makes symbols available for relocation
* processing of any other DLLs.
* @param close_handle_on_destruction Indicates whether or not the
* close() method will be called to close an open DLL when this
+8 -8
View File
@@ -1,4 +1,4 @@
// $Id: DLL_Manager.cpp 91286 2010-08-05 09:04:31Z johnnyw $
// $Id: DLL_Manager.cpp 95913 2012-06-21 17:14:36Z johnnyw $
#include "ace/DLL_Manager.h"
@@ -415,10 +415,10 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
// 3. Build the combinations to try for this platform.
// Try these combinations:
// - name with decorator and platform's suffix appended (if not supplied)
// - name with platform's suffix appended (if not supplied)
// - name with platform's dll prefix (if it has one) and suffix
// - name with platform's dll prefix, decorator, and suffix.
// - name with decorator and platform's suffix appended (if not supplied)
// - name with platform's suffix appended (if not supplied)
// - name as originally given
// We first try to find the file using the decorator so that when a
// filename with and without decorator is used, we get the file with
@@ -443,10 +443,10 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
size_t const j = try_names.size ();
switch (i)
{
case 0: // Name + decorator + suffix
case 1: // Name + suffix
case 2: // Prefix + name + decorator + suffix
case 3: // Prefix + name + suffix
case 0: // Prefix + name + decorator + suffix
case 1: // Prefix + name + suffix
case 2: // Name + decorator + suffix
case 3: // Name + suffix
if (
base_suffix.length () > 0
#if !(defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK))
@@ -455,7 +455,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name,
)
break;
try_this = base_dir;
if (i > 1)
if (i < 2)
try_this += prefix;
try_this += base_file;
if (base_suffix.length () > 0)
+39 -9
View File
@@ -4,7 +4,7 @@
/**
* @file DLL_Manager.h
*
* $Id: DLL_Manager.h 91064 2010-07-12 10:11:24Z johnnyw $
* $Id: DLL_Manager.h 95913 2012-06-21 17:14:36Z johnnyw $
*
* @author Don Hinton <dhinton@ieee.org>
*/
@@ -68,14 +68,44 @@ public:
const ACE_TCHAR *dll_name () const;
/**
* This method opens and dynamically links @a dll_name. The default
* mode is @c RTLD_LAZY, which loads identifier symbols but not the
* symbols for functions, which are loaded dynamically on-demand.
* Other supported modes include: @c RTLD_NOW, which performs all
* necessary relocations when @a dll_name is first loaded and
* @c RTLD_GLOBAL, which makes symbols available for relocation
* processing of any other DLLs. Returns -1 on failure and 0 on
* success.
* This method opens and dynamically links a library/DLL.
* @param dll_name The filename or path of the DLL to load. ACE will
* attempt to apply the platform's standard library/DLL prefixes
* and suffixes, allowing a simple, unadorned name to be passed
* regardless of platform. The set of name transforms is listed
* below. A @i decorator is a platform's name designator for a debug
* vs release build. For example, on Windows it is usually "d".
* @li Prefix + name + decorator + suffix
* @li Prefix + name + suffix
* @li Name + decorator + suffix
* @li Name + suffix
* @li Name
* Note that the transforms with @i decorator will be avoided if
* ACE is built with the @c ACE_DISABLE_DEBUG_DLL_CHECK config macro.
*
* @Note There is another mode for locating library/DLL files that
* was used in old versions of ACE. The alternate method builds
* more combinations of pathname by combining the names transforms
* above with locations listed in the platform's standard "path"
* locations (e.g., @c LD_LIBRARY_PATH). It can be enabled by building
* ACE with the @c ACE_MUST_HELP_DLOPEN_SEARCH_PATH config macro.
* Use of this option is discouraged since it avoids the standard
* platform search options and security mechanisms.
*
* @param open_mode Flags to alter the actions taken when loading the DLL.
* The possible values are:
* @li @c RTLD_LAZY (this the default): loads identifier symbols but
* not the symbols for functions, which are loaded dynamically
* on demand.
* @li @c RTLD_NOW: performs all necessary relocations when
* @a dll_name is first loaded
* @li @c RTLD_GLOBAL: makes symbols available for relocation
* processing of any other DLLs.
* @param handle If a value other than @c ACE_INVALID_HANDLE is supplied,
* this object is assigned the specified handle instead of attempting
* to open the specified @a dll_name.
* @retval -1 On failure
* @retval 0 On success.
*/
int open (const ACE_TCHAR *dll_name,
int open_mode,
+2 -2
View File
@@ -4,7 +4,7 @@
/**
* @file Default_Constants.h
*
* $Id: Default_Constants.h 91688 2010-09-09 11:21:50Z johnnyw $
* $Id: Default_Constants.h 95517 2012-01-30 10:05:01Z sma $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
* @author Jesper S. M|ller<stophph@diku.dk>
@@ -392,7 +392,7 @@
/// Max udp packet size
#if !defined (ACE_MAX_UDP_PACKET_SIZE)
#define ACE_MAX_UDP_PACKET_SIZE 65536
#define ACE_MAX_UDP_PACKET_SIZE 65507
#endif
/**
+21 -38
View File
@@ -1,4 +1,4 @@
// $Id: Dev_Poll_Reactor.cpp 92199 2010-10-11 11:58:35Z johnnyw $
// $Id: Dev_Poll_Reactor.cpp 95738 2012-05-11 19:16:53Z shuston $
#include "ace/OS_NS_errno.h"
#include "ace/Dev_Poll_Reactor.h"
@@ -12,13 +12,13 @@
# include "ace/OS_NS_stropts.h"
# if defined (ACE_HAS_DEV_POLL)
# if defined (linux)
# if defined (ACE_LINUX)
# include /**/ <linux/devpoll.h>
# elif defined (HPUX_VERS) && HPUX_VERS < 1123
# include /**/ <devpoll.h>
# else
# include /**/ <sys/devpoll.h>
# endif /* linux */
# endif /* ACE_LINUX */
# endif /* ACE_HAS_DEV_POLL */
#if !defined (__ACE_INLINE__)
@@ -39,6 +39,7 @@
#include "ace/Guard_T.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/Functor_T.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -801,12 +802,13 @@ ACE_Dev_Poll_Reactor::timer_queue (ACE_Timer_Queue *tq)
{
if (this->delete_timer_queue_)
delete this->timer_queue_;
else if (this->timer_queue_)
this->timer_queue_->close ();
this->timer_queue_ = tq;
this->delete_timer_queue_ = false;
return 0;
}
ACE_Timer_Queue *
@@ -858,6 +860,11 @@ ACE_Dev_Poll_Reactor::close (void)
this->timer_queue_ = 0;
this->delete_timer_queue_ = false;
}
else if (this->timer_queue_)
{
this->timer_queue_->close ();
this->timer_queue_ = 0;
}
if (this->notify_handler_ != 0)
this->notify_handler_->close ();
@@ -1007,7 +1014,10 @@ ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value *max_wait_time)
return result;
if (this->deactivated_)
return -1;
{
errno = ESHUTDOWN;
return -1;
}
// Update the countdown to reflect time waiting for the mutex.
ACE_MT (countdown.update ());
@@ -1087,37 +1097,10 @@ ACE_Dev_Poll_Reactor::dispatch (Token_Guard &guard)
int
ACE_Dev_Poll_Reactor::dispatch_timer_handler (Token_Guard &guard)
{
if (this->timer_queue_->is_empty ())
return 0; // Empty timer queue so cannot have any expired timers.
typedef ACE_Member_Function_Command<Token_Guard> Guard_Release;
// Get the current time
ACE_Time_Value cur_time (this->timer_queue_->gettimeofday () +
this->timer_queue_->timer_skew ());
// Look for a node in the timer queue whose timer <= the present
// time.
ACE_Timer_Node_Dispatch_Info info;
if (this->timer_queue_->dispatch_info (cur_time, info))
{
const void *upcall_act = 0;
// Preinvoke (handles refcount if needed, etc.)
this->timer_queue_->preinvoke (info, cur_time, upcall_act);
// Release the token before expiration upcall.
guard.release_token ();
// call the functor
this->timer_queue_->upcall (info, cur_time);
// Postinvoke (undo refcount if needed, etc.)
this->timer_queue_->postinvoke (info, cur_time, upcall_act);
// We have dispatched a timer
return 1;
}
return 0;
Guard_Release release(guard, &Token_Guard::release_token);
return this->timer_queue_->expire_single(release);
}
#if 0
@@ -1950,7 +1933,7 @@ ACE_Dev_Poll_Reactor::resumable_handler (void)
{
// @@ Is this correct?
return 0;
return 1;
}
bool
@@ -2395,8 +2378,8 @@ ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle,
// If a handle is closed, epoll removes it from the poll set
// automatically - we may not know about it yet. If that's the
// case, a mod operation will fail with ENOENT. Retry it as
// an add.
if (op == EPOLL_CTL_MOD && errno == ENOENT &&
// an add. If it's any other failure, just fail outright.
if (op != EPOLL_CTL_MOD || errno != ENOENT ||
::epoll_ctl (this->poll_fd_, EPOLL_CTL_ADD, handle, &epev) == -1)
return -1;
}
+5 -5
View File
@@ -4,7 +4,7 @@
/**
* @file Dev_Poll_Reactor.h
*
* $Id: Dev_Poll_Reactor.h 91462 2010-08-25 20:29:17Z shuston $
* $Id: Dev_Poll_Reactor.h 94549 2011-10-03 06:31:27Z johnnyw $
*
* @c /dev/poll (or Linux @c sys_epoll) based Reactor implementation.
*
@@ -563,7 +563,7 @@ public:
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask);
/// Register @a event_handler> with all the @a handles> in the @c
/// Register @a event_handler with all the @a handles in the @c
/// Handle_Set.
virtual int register_handler (const ACE_Handle_Set &handles,
ACE_Event_Handler *event_handler,
@@ -815,7 +815,7 @@ public:
/// Wake up all threads waiting in the event loop.
virtual void wakeup_all_threads (void);
/// Transfers ownership of Reactor_Impl to the new_owner.
/// Transfers ownership of Reactor_Impl to the @a new_owner.
/**
* @note There is no need to set the owner of the event loop for the
* ACE_Dev_Poll_Reactor. Multiple threads may invoke the
@@ -828,7 +828,7 @@ public:
/**
* @note There is no need to set the owner of the event loop for the
* ACE_Dev_Poll_Reactor. Multiple threads may invoke the
* event loop simulataneously. As such, this method is a
* event loop simultaneously. As such, this method is a
* no-op.
*/
virtual int owner (ACE_thread_t *owner);
@@ -1123,7 +1123,7 @@ protected:
/// 2) wait quietly for the token, not waking another thread. This
/// is appropriate for cases where a thread wants to wait for and
/// dispatch an event, not causing an existing waiter to relinquish the
/// token, and also queueing up behind other threads waiting to modify
/// token, and also queuing up behind other threads waiting to modify
/// event records.
int acquire_quietly (ACE_Time_Value *max_wait = 0);
+2 -2
View File
@@ -4,7 +4,7 @@
/**
* @file Dump.h
*
* $Id: Dump.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: Dump.h 94034 2011-05-09 19:11:03Z johnnyw $
*
*
* A prototype mechanism that allow all ACE objects to be registered
@@ -149,7 +149,7 @@ private:
/// and we'll have to check for that).
const ACE_Dumpable_Ptr dumper_;
Tuple (void) : dumper_(0) {}
Tuple (void) : this_ (0), dumper_(0) {}
};
/// Singleton instance of this class.
+7 -9
View File
@@ -4,7 +4,7 @@
/**
* @file Dynamic_Message_Strategy.h
*
* $Id: Dynamic_Message_Strategy.h 80826 2008-03-04 14:51:23Z wotte $
* $Id: Dynamic_Message_Strategy.h 95839 2012-06-07 10:13:33Z johnnyw $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
*/
@@ -43,17 +43,15 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
* priority field of 10 bits. This corresponds to the initial
* values of the static class members. To provide a different
* partitioning, assign a different set of values to the static
* class memebers before using the static member functions.
* class members before using the static member functions.
*/
class ACE_Export ACE_Dynamic_Message_Strategy
{
public:
// = Message priority status
// Values are defined as bit flags so that status combinations may
// be specified easily.
/// Message priority status
/// Values are defined as bit flags so that status combinations may
/// be specified easily.
enum Priority_Status
{
/// Message can still make its deadline
@@ -154,13 +152,13 @@ protected:
class ACE_Export ACE_Deadline_Message_Strategy : public ACE_Dynamic_Message_Strategy
{
public:
/// Ctor, with all arguments defaulted.
/// Constructor with all arguments defaulted.
ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1
unsigned long static_bit_field_shift = 10, // 10 low order bits
unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1
unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1)
/// Virtual dtor.
/// Virtual destructor.
virtual ~ACE_Deadline_Message_Strategy (void);
/// Dynamic priority conversion function based on time to deadline.
+655
View File
@@ -0,0 +1,655 @@
// -*- C++ -*-
// $Id: ETCL_Constraint.cpp 92173 2010-10-07 12:36:17Z olli $
#include "ace/ACE.h"
#include "ace/ETCL/ETCL_Constraint.h"
#include "ace/ETCL/ETCL_Constraint_Visitor.h"
#if ! defined (__ACE_INLINE__)
#include "ace/ETCL/ETCL_Constraint.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ETCL_Constraint::ETCL_Constraint (void)
{
}
ETCL_Constraint::~ETCL_Constraint (void)
{
}
int
ETCL_Constraint::accept (ETCL_Constraint_Visitor * /* visitor */)
{
return 0;
}
// ****************************************************************
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
const ETCL_Literal_Constraint & lit
)
: ETCL_Constraint(),
type_ (ACE_ETCL_UNKNOWN)
{
this->copy (lit);
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
ACE_CDR::ULong uinteger) : type_ (ACE_ETCL_UNSIGNED)
{
this->op_.uinteger_ = uinteger;
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
ACE_CDR::Long integer) : type_ (ACE_ETCL_SIGNED)
{
this->op_.integer_ = integer;
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
ACE_CDR::Boolean boolean
)
: type_ (ACE_ETCL_BOOLEAN)
{
this->op_.bool_ = boolean;
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
ACE_CDR::Double doub) : type_ (ACE_ETCL_DOUBLE)
{
this->op_.double_ = doub;
}
ETCL_Literal_Constraint::ETCL_Literal_Constraint (
const char* str) : type_ (ACE_ETCL_STRING)
{
this->op_.str_ = ACE::strnew (str);
}
ETCL_Literal_Constraint::~ETCL_Literal_Constraint (void)
{
if (this->type_ == ACE_ETCL_STRING)
{
ACE::strdelete (this->op_.str_);
}
}
int
ETCL_Literal_Constraint::accept (ETCL_Constraint_Visitor* visitor)
{
return visitor->visit_literal (this);
}
Literal_Type
ETCL_Literal_Constraint::expr_type (void) const
{
return this->type_;
}
void
ETCL_Literal_Constraint::operator= (const ETCL_Literal_Constraint& co)
{
this->copy (co);
}
ETCL_Literal_Constraint::operator ACE_CDR::Boolean (void) const
{
return (this->type_ == ACE_ETCL_BOOLEAN) ? this->op_.bool_ : false;
}
ETCL_Literal_Constraint::operator ACE_CDR::ULong (void) const
{
switch (this->type_)
{
case ACE_ETCL_UNSIGNED:
return this->op_.uinteger_;
case ACE_ETCL_SIGNED:
case ACE_ETCL_INTEGER:
return
(this->op_.integer_ > 0) ? (ACE_CDR::ULong) this->op_.integer_ : 0;
case ACE_ETCL_DOUBLE:
return
(this->op_.double_ > 0) ?
((this->op_.double_ > ACE_UINT32_MAX) ?
ACE_UINT32_MAX :
(ACE_CDR::ULong) this->op_.double_)
: 0;
default:
return 0;
}
}
ETCL_Literal_Constraint::operator ACE_CDR::Long (void) const
{
switch (this->type_)
{
case ACE_ETCL_SIGNED:
case ACE_ETCL_INTEGER:
return this->op_.integer_;
case ACE_ETCL_UNSIGNED:
return
(this->op_.uinteger_ > (ACE_CDR::ULong) ACE_INT32_MAX) ?
ACE_INT32_MAX : (ACE_CDR::Long) this->op_.uinteger_;
case ACE_ETCL_DOUBLE:
return
(this->op_.double_ > 0) ?
((this->op_.double_ > ACE_INT32_MAX) ?
ACE_INT32_MAX :
(ACE_CDR::Long) this->op_.double_) :
((this->op_.double_ < ACE_INT32_MIN) ?
ACE_INT32_MIN :
(ACE_CDR::Long) this->op_.double_);
default:
return 0;
}
}
ETCL_Literal_Constraint::operator ACE_CDR::Double (void) const
{
switch (this->type_)
{
case ACE_ETCL_DOUBLE:
return this->op_.double_;
case ACE_ETCL_SIGNED:
case ACE_ETCL_INTEGER:
return (ACE_CDR::Double) this->op_.integer_;
case ACE_ETCL_UNSIGNED:
return (ACE_CDR::Double) this->op_.uinteger_;
default:
return 0.0;
}
}
ETCL_Literal_Constraint::operator const char* (void) const
{
switch (this->type_)
{
case ACE_ETCL_STRING:
return this->op_.str_;
default:
return 0;
}
}
bool
ETCL_Literal_Constraint::operator== (const ETCL_Literal_Constraint & rhs)
{
bool return_value = false;
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_STRING:
return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) == 0);
break;
case ACE_ETCL_DOUBLE:
return_value = ACE::is_equal ((ACE_CDR::Double) *this, (ACE_CDR::Double) rhs);
break;
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
return_value = (ACE_CDR::Long) *this == (ACE_CDR::Long) rhs;
break;
case ACE_ETCL_UNSIGNED:
return_value = (ACE_CDR::ULong) *this == (ACE_CDR::ULong) rhs;
break;
case ACE_ETCL_BOOLEAN:
return_value = (ACE_CDR::Boolean) *this == (ACE_CDR::Boolean) rhs;
break;
default:
break;
}
return return_value;
}
bool
ETCL_Literal_Constraint::operator< (const ETCL_Literal_Constraint & rhs)
{
bool return_value = false;
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_STRING:
return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) < 0);
break;
case ACE_ETCL_DOUBLE:
return_value = (ACE_CDR::Double) *this < (ACE_CDR::Double) rhs;
break;
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
return_value = (ACE_CDR::Long) *this < (ACE_CDR::Long) rhs;
break;
case ACE_ETCL_UNSIGNED:
return_value = (ACE_CDR::ULong) *this < (ACE_CDR::ULong) rhs;
break;
case ACE_ETCL_BOOLEAN:
return_value = (ACE_CDR::Boolean) *this < (ACE_CDR::Boolean) rhs;
break;
default:
break;
}
return return_value;
}
bool
ETCL_Literal_Constraint::operator> (const ETCL_Literal_Constraint & rhs)
{
bool return_value = false;
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_STRING:
return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) > 0);
break;
case ACE_ETCL_DOUBLE:
return_value = (ACE_CDR::Double) *this > (ACE_CDR::Double) rhs;
break;
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
return_value = (ACE_CDR::Long) *this > (ACE_CDR::Long) rhs;
break;
case ACE_ETCL_UNSIGNED:
return_value = (ACE_CDR::ULong) *this > (ACE_CDR::ULong) rhs;
break;
default:
break;
}
return return_value;
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator+ (const ETCL_Literal_Constraint & rhs)
{
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_DOUBLE:
{
ACE_CDR::Double result = (ACE_CDR::Double) *this + (ACE_CDR::Double) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Double) result);
}
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
{
ACE_CDR::Long result = (ACE_CDR::Long) *this + (ACE_CDR::Long) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Long) result);
}
case ACE_ETCL_UNSIGNED:
{
ACE_CDR::ULong result = (ACE_CDR::ULong) *this + (ACE_CDR::ULong) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::ULong) result);
}
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator- (const ETCL_Literal_Constraint & rhs)
{
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_DOUBLE:
{
ACE_CDR::Double result = (ACE_CDR::Double) *this - (ACE_CDR::Double) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Double) result);
}
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
{
ACE_CDR::Long result = (ACE_CDR::Long) *this - (ACE_CDR::Long) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Long) result);
}
case ACE_ETCL_UNSIGNED:
{
ACE_CDR::ULong result = (ACE_CDR::ULong) *this - (ACE_CDR::ULong) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::ULong) result);
}
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator* (const ETCL_Literal_Constraint & rhs)
{
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_DOUBLE:
{
ACE_CDR::Double result = (ACE_CDR::Double) *this * (ACE_CDR::Double) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Double) result);
}
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
{
ACE_CDR::Long result = (ACE_CDR::Long) *this * (ACE_CDR::Long) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Long) result);
}
case ACE_ETCL_UNSIGNED:
{
ACE_CDR::ULong result = (ACE_CDR::ULong) *this * (ACE_CDR::ULong) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::ULong) result);
}
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator/ (const ETCL_Literal_Constraint & rhs)
{
Literal_Type widest_type = this->widest_type (rhs);
switch (widest_type)
{
case ACE_ETCL_DOUBLE:
{
if (ACE::is_equal ((ACE_CDR::Double) rhs, 0.0))
return ETCL_Literal_Constraint ((ACE_CDR::Double) 0.0);
ACE_CDR::Double result = (ACE_CDR::Double) *this / (ACE_CDR::Double) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Double) result);
}
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
{
if ((ACE_CDR::Long) rhs == 0)
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
ACE_CDR::Long result = (ACE_CDR::Long) *this / (ACE_CDR::Long) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::Long) result);
}
case ACE_ETCL_UNSIGNED:
{
if ((ACE_CDR::ULong) rhs == 0)
return ETCL_Literal_Constraint ((ACE_CDR::ULong) 0);
ACE_CDR::ULong result = (ACE_CDR::ULong) *this / (ACE_CDR::ULong) rhs;
return ETCL_Literal_Constraint ((ACE_CDR::ULong) result);
}
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
ETCL_Literal_Constraint
ETCL_Literal_Constraint::operator- (void)
{
switch (this->type_)
{
case ACE_ETCL_DOUBLE:
return ETCL_Literal_Constraint (- this->op_.double_);
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
return ETCL_Literal_Constraint (- this->op_.integer_);
case ACE_ETCL_UNSIGNED:
return ETCL_Literal_Constraint (- (ACE_CDR::Long) this->op_.uinteger_);
default:
return ETCL_Literal_Constraint ((ACE_CDR::Long) 0);
}
}
Literal_Type
ETCL_Literal_Constraint::widest_type (const ETCL_Literal_Constraint & rhs)
{
Literal_Type rhs_type = rhs.expr_type ();
Literal_Type return_value = rhs_type;
if (rhs_type != this->type_)
{
if (rhs_type > this->type_)
{
return_value = rhs_type;
}
else
{
return_value = this->type_;
}
}
return return_value;
}
void
ETCL_Literal_Constraint::copy (const ETCL_Literal_Constraint &lit)
{
if (this->type_ == ACE_ETCL_STRING)
{
ACE::strdelete (this->op_.str_);
}
this->type_ = lit.type_;
switch (this->type_)
{
case ACE_ETCL_STRING:
this->op_.str_ = ACE::strnew (lit.op_.str_);
break;
case ACE_ETCL_DOUBLE:
this->op_.double_ = lit.op_.double_;
break;
case ACE_ETCL_UNSIGNED:
this->op_.uinteger_ = lit.op_.uinteger_;
break;
case ACE_ETCL_INTEGER:
case ACE_ETCL_SIGNED:
this->op_.integer_ = lit.op_.integer_;
break;
case ACE_ETCL_BOOLEAN:
this->op_.bool_ = lit.op_.bool_;
break;
default:
this->type_ = ACE_ETCL_UNKNOWN;
break;
}
}
// ****************************************************************
int
ETCL_Identifier::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_identifier (this);
}
// ****************************************************************
ETCL_Union_Value::~ETCL_Union_Value (void)
{
delete this->string_;
delete this->integer_;
}
int
ETCL_Union_Value::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_union_value (this);
}
// ****************************************************************
ETCL_Union_Pos::~ETCL_Union_Pos (void)
{
delete this->component_;
delete this->union_value_;
}
int
ETCL_Union_Pos::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_union_pos (this);
}
// ****************************************************************
ETCL_Component_Pos::~ETCL_Component_Pos (void)
{
delete this->component_;
delete this->integer_;
}
int
ETCL_Component_Pos::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_pos (this);
}
// ****************************************************************
ETCL_Component_Assoc::~ETCL_Component_Assoc (void)
{
delete this->component_;
delete this->identifier_;
}
int
ETCL_Component_Assoc::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_assoc (this);
}
// ****************************************************************
ETCL_Component_Array::~ETCL_Component_Array (void)
{
delete this->component_;
delete this->integer_;
}
int
ETCL_Component_Array::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component_array (this);
}
// ****************************************************************
ETCL_Special::~ETCL_Special (void)
{}
int
ETCL_Special::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_special (this);
}
// ****************************************************************
ETCL_Component::~ETCL_Component (void)
{
delete this->component_;
delete this->identifier_;
}
int
ETCL_Component::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_component (this);
}
// ****************************************************************
ETCL_Dot::~ETCL_Dot (void)
{
delete this->component_;
}
int
ETCL_Dot::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_dot (this);
}
// ****************************************************************
ETCL_Eval::~ETCL_Eval (void)
{
delete this->component_;
}
int
ETCL_Eval::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_eval (this);
}
// ****************************************************************
ETCL_Default::~ETCL_Default (void)
{
delete this->component_;
}
int
ETCL_Default::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_default (this);
}
// ****************************************************************
ETCL_Exist::~ETCL_Exist (void)
{
delete this->component_;
}
int
ETCL_Exist::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_exist (this);
}
// ****************************************************************
ETCL_Unary_Expr::~ETCL_Unary_Expr (void)
{
delete this->subexpr_;
}
int
ETCL_Unary_Expr::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_unary_expr (this);
}
// ****************************************************************
ETCL_Binary_Expr::~ETCL_Binary_Expr (void)
{
delete this->lhs_;
delete this->rhs_;
}
int
ETCL_Binary_Expr::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_binary_expr (this);
}
// ****************************************************************
ETCL_Preference::~ETCL_Preference (void)
{
delete this->subexpr_;
}
int
ETCL_Preference::accept (ETCL_Constraint_Visitor *visitor)
{
return visitor->visit_preference (this);
}
ACE_END_VERSIONED_NAMESPACE_DECL
+416
View File
@@ -0,0 +1,416 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ETCL_Constraint.h
*
* $Id: ETCL_Constraint.h 94030 2011-05-08 17:58:47Z johnnyw $
*
* @author Carlos O'Ryan (coryan@cs.wustl.edu)
* @author Jeff Parsons (j.parsons@vanderbilt.edu)
*/
//=============================================================================
#ifndef ACE_ETCL_CONSTRAINT_H
#define ACE_ETCL_CONSTRAINT_H
#include /**/ "ace/pre.h"
#include "ace/SString.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/CDR_Base.h"
#include "ace/ETCL/ace_etcl_export.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef unsigned long Literal_Type;
class ETCL_Constraint_Visitor;
class ACE_ETCL_Export ETCL_Constraint
{
public:
/// Constructor and destructor
ETCL_Constraint (void);
virtual ~ETCL_Constraint (void);
virtual int accept (ETCL_Constraint_Visitor *visitor);
protected:
enum
{
ACE_ETCL_STRING,
ACE_ETCL_DOUBLE,
ACE_ETCL_UNSIGNED,
ACE_ETCL_SIGNED,
ACE_ETCL_INTEGER,
ACE_ETCL_BOOLEAN,
ACE_ETCL_COMPONENT,
ACE_ETCL_UNKNOWN
};
};
// ****************************************************************
class ACE_ETCL_Export ETCL_Literal_Constraint
: public ETCL_Constraint
{
public:
ETCL_Literal_Constraint (void);
// = Constructors for each of the various types of literals.
explicit ETCL_Literal_Constraint (ACE_CDR::ULong uinteger);
explicit ETCL_Literal_Constraint (ACE_CDR::Long integer);
explicit ETCL_Literal_Constraint (ACE_CDR::Boolean boolean);
explicit ETCL_Literal_Constraint (ACE_CDR::Double doub);
explicit ETCL_Literal_Constraint (const char* str);
/// Copy constructor
ETCL_Literal_Constraint (const ETCL_Literal_Constraint& lit);
/// Destructor.
virtual ~ETCL_Literal_Constraint(void);
/// Visitor accept method.
virtual int accept (ETCL_Constraint_Visitor* visitor);
Literal_Type expr_type (void) const;
/// Assignment operator.
void operator= (const ETCL_Literal_Constraint& co);
// Conversion routines.
operator ACE_CDR::Boolean (void) const;
operator ACE_CDR::ULong (void) const;
operator ACE_CDR::Long (void) const;
operator ACE_CDR::Double (void) const;
operator const char* (void) const;
// Return the type represented by this MysteryOperand.
// = Boolean operators.
bool
operator< (const ETCL_Literal_Constraint& rhs);
bool
operator<= (const ETCL_Literal_Constraint& rhs);
bool
operator> (const ETCL_Literal_Constraint& rhs);
bool
operator>= (const ETCL_Literal_Constraint& rhs);
bool
operator== (const ETCL_Literal_Constraint& rhs);
bool
operator!= (const ETCL_Literal_Constraint& rhs);
// = Arithmetic operators.
ETCL_Literal_Constraint
operator+ (const ETCL_Literal_Constraint& rhs);
ETCL_Literal_Constraint
operator- (const ETCL_Literal_Constraint& rhs);
ETCL_Literal_Constraint
operator* (const ETCL_Literal_Constraint& rhs);
ETCL_Literal_Constraint
operator/ (const ETCL_Literal_Constraint& rhs);
// Unary minus.
ETCL_Literal_Constraint
operator- (void);
/// Ensure both operands are of the same simple numeric type.
virtual Literal_Type
widest_type (const ETCL_Literal_Constraint& rhs);
protected:
/// Private copy method.
void copy (const ETCL_Literal_Constraint& co);
/// Union of the possible literal types.
union
{
char* str_;
ACE_CDR::ULong uinteger_;
ACE_CDR::Long integer_;
ACE_CDR::Boolean bool_;
ACE_CDR::Double double_;
} op_;
/// The actual types of the ETCL_Literal_Constraint.
Literal_Type type_;
};
// ****************************************************************
class ACE_ETCL_Export ETCL_Identifier : public ETCL_Constraint
{
public:
ETCL_Identifier (const char *value);
/// Get the value
const char *value (void) const;
// = The Constraint methods.
int accept (ETCL_Constraint_Visitor *visitor);
private:
/// The value
ACE_CString string_;
};
// ****************************************************************
class ACE_ETCL_Export ETCL_Union_Value : public ETCL_Constraint
{
public:
ETCL_Union_Value (int sign,
ETCL_Constraint *integer);
explicit ETCL_Union_Value (ETCL_Constraint *string = 0);
virtual ~ETCL_Union_Value (void);
int sign (void) const;
ETCL_Literal_Constraint *integer (void) const;
ETCL_Literal_Constraint *string (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
int sign_;
ETCL_Literal_Constraint *integer_;
ETCL_Literal_Constraint *string_;
};
class ACE_ETCL_Export ETCL_Union_Pos : public ETCL_Constraint
{
public:
ETCL_Union_Pos (ETCL_Constraint *union_value = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Union_Pos (void);
ETCL_Union_Value *union_value (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Union_Value *union_value_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Component_Pos : public ETCL_Constraint
{
public:
ETCL_Component_Pos (ETCL_Constraint *integer = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Component_Pos (void);
ETCL_Literal_Constraint *integer (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Literal_Constraint *integer_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Component_Assoc : public ETCL_Constraint
{
public:
ETCL_Component_Assoc (ETCL_Constraint *identifier = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Component_Assoc (void);
ETCL_Identifier *identifier (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Identifier *identifier_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Component_Array : public ETCL_Constraint
{
public:
ETCL_Component_Array (ETCL_Constraint *integer = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Component_Array (void);
ETCL_Literal_Constraint *integer (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Literal_Constraint *integer_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Special : public ETCL_Constraint
{
public:
ETCL_Special (void);
ETCL_Special (int type);
virtual ~ETCL_Special (void);
int type (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
int type_;
};
class ACE_ETCL_Export ETCL_Component : public ETCL_Constraint
{
public:
ETCL_Component (ETCL_Constraint *identifier = 0,
ETCL_Constraint *component = 0);
virtual ~ETCL_Component (void);
ETCL_Identifier *identifier (void) const;
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Identifier *identifier_;
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Dot : public ETCL_Constraint
{
public:
explicit ETCL_Dot (ETCL_Constraint *component = 0);
virtual ~ETCL_Dot (void);
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Eval : public ETCL_Constraint
{
public:
explicit ETCL_Eval (ETCL_Constraint *component = 0);
virtual ~ETCL_Eval (void);
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Default : public ETCL_Constraint
{
public:
explicit ETCL_Default (ETCL_Constraint *component = 0);
virtual ~ETCL_Default (void);
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Exist : public ETCL_Constraint
{
public:
explicit ETCL_Exist (ETCL_Constraint *component = 0);
virtual ~ETCL_Exist (void);
ETCL_Constraint *component (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
ETCL_Constraint *component_;
};
class ACE_ETCL_Export ETCL_Unary_Expr : public ETCL_Constraint
{
public:
ETCL_Unary_Expr (int type,
ETCL_Constraint *subexpr);
virtual ~ETCL_Unary_Expr (void);
int type (void) const;
ETCL_Constraint *subexpr (void) const;
int accept (ETCL_Constraint_Visitor *visitor);
private:
int type_;
ETCL_Constraint *subexpr_;
};
class ACE_ETCL_Export ETCL_Binary_Expr : public ETCL_Constraint
{
public:
ETCL_Binary_Expr (int type,
ETCL_Constraint *lhs,
ETCL_Constraint *rhs);
virtual ~ETCL_Binary_Expr (void);
int type (void) const;
ETCL_Constraint *rhs (void) const;
ETCL_Constraint *lhs (void) const;
int accept (ETCL_Constraint_Visitor *visitor);
private:
int type_;
ETCL_Constraint *lhs_;
ETCL_Constraint *rhs_;
};
class ACE_ETCL_Export ETCL_Preference : public ETCL_Constraint
{
public:
ETCL_Preference (void);
ETCL_Preference (int type,
ETCL_Constraint *subexpr = 0);
virtual ~ETCL_Preference (void);
int type (void) const;
ETCL_Constraint *subexpr (void) const;
virtual int accept (ETCL_Constraint_Visitor *visitor);
private:
int type_;
ETCL_Constraint *subexpr_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/ETCL/ETCL_Constraint.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif // ACE_ETCL_CONSTRAINT_H
+349
View File
@@ -0,0 +1,349 @@
// -*- C++ -*-
// $Id: ETCL_Constraint.inl 95595 2012-03-07 13:33:25Z johnnyw $
// ****************************************************************
ACE_INLINE
ETCL_Literal_Constraint::ETCL_Literal_Constraint (void)
: type_ (ACE_ETCL_UNKNOWN)
{
}
// ****************************************************************
ACE_INLINE
ETCL_Identifier::ETCL_Identifier (const char *value)
: string_ (value)
{
}
ACE_INLINE const char *
ETCL_Identifier::value (void) const
{
return this->string_.c_str ();
}
// ****************************************************************
ACE_INLINE
ETCL_Union_Value::ETCL_Union_Value (int sign,
ETCL_Constraint *integer)
: sign_ (sign),
string_ (0)
{
this->integer_ =
dynamic_cast<ETCL_Literal_Constraint*> (integer);
}
ACE_INLINE
ETCL_Union_Value::ETCL_Union_Value (ETCL_Constraint *string)
: sign_ (0),
integer_ (0)
{
this->string_ =
dynamic_cast<ETCL_Literal_Constraint*> (string);
}
ACE_INLINE int
ETCL_Union_Value::sign (void) const
{
return this->sign_;
}
ACE_INLINE ETCL_Literal_Constraint *
ETCL_Union_Value::integer (void) const
{
return this->integer_;
}
ACE_INLINE ETCL_Literal_Constraint *
ETCL_Union_Value::string (void) const
{
return this->string_;
}
// ****************************************************************
ACE_INLINE
ETCL_Union_Pos::ETCL_Union_Pos (ETCL_Constraint *union_value,
ETCL_Constraint *component)
: component_ (component)
{
this->union_value_ =
dynamic_cast<ETCL_Union_Value*> (union_value);
}
ACE_INLINE ETCL_Union_Value *
ETCL_Union_Pos::union_value (void) const
{
return this->union_value_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Union_Pos::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Component_Pos::ETCL_Component_Pos (
ETCL_Constraint *integer,
ETCL_Constraint *component)
: component_ (component)
{
this->integer_ =
dynamic_cast<ETCL_Literal_Constraint*> (integer);
}
ACE_INLINE ETCL_Literal_Constraint *
ETCL_Component_Pos::integer (void) const
{
return this->integer_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Component_Pos::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Component_Assoc::ETCL_Component_Assoc (
ETCL_Constraint *identifier,
ETCL_Constraint *component)
: component_ (component)
{
this->identifier_ =
dynamic_cast<ETCL_Identifier*> (identifier);
}
ACE_INLINE ETCL_Identifier *
ETCL_Component_Assoc::identifier (void) const
{
return this->identifier_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Component_Assoc::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Component_Array::ETCL_Component_Array (
ETCL_Constraint *integer,
ETCL_Constraint *component)
: component_ (component)
{
this->integer_ =
dynamic_cast<ETCL_Literal_Constraint*> (integer);
}
ACE_INLINE ETCL_Literal_Constraint *
ETCL_Component_Array::integer (void) const
{
return this->integer_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Component_Array::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Special::ETCL_Special (void)
: type_ (0)
{}
ACE_INLINE
ETCL_Special::ETCL_Special (int type)
: type_ (type)
{}
ACE_INLINE int
ETCL_Special::type (void) const
{
return this->type_;
}
// ****************************************************************
ACE_INLINE
ETCL_Component::ETCL_Component (ETCL_Constraint *identifier,
ETCL_Constraint *component)
: component_ (component)
{
this->identifier_ =
dynamic_cast<ETCL_Identifier*> (identifier);
}
ACE_INLINE ETCL_Identifier *
ETCL_Component::identifier (void) const
{
return this->identifier_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Component::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Dot::ETCL_Dot (ETCL_Constraint *component)
: component_ (component)
{
}
ACE_INLINE ETCL_Constraint *
ETCL_Dot::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Eval::ETCL_Eval (ETCL_Constraint *component)
: component_ (component)
{
}
ACE_INLINE ETCL_Constraint *
ETCL_Eval::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Default::ETCL_Default (ETCL_Constraint *component)
: component_ (component)
{
}
ACE_INLINE ETCL_Constraint *
ETCL_Default::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Exist::ETCL_Exist (ETCL_Constraint *component)
: component_ (component)
{
}
ACE_INLINE ETCL_Constraint *
ETCL_Exist::component (void) const
{
return this->component_;
}
// ****************************************************************
ACE_INLINE
ETCL_Unary_Expr::ETCL_Unary_Expr (int type,
ETCL_Constraint *subexpr)
: type_ (type),
subexpr_ (subexpr)
{}
ACE_INLINE int
ETCL_Unary_Expr::type (void) const
{
return this->type_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Unary_Expr::subexpr (void) const
{
return this->subexpr_;
}
// ****************************************************************
ACE_INLINE
ETCL_Binary_Expr::ETCL_Binary_Expr (int type,
ETCL_Constraint *lhs,
ETCL_Constraint *rhs)
: type_ (type),
lhs_ (lhs),
rhs_ (rhs)
{}
ACE_INLINE int
ETCL_Binary_Expr::type (void) const
{
return this->type_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Binary_Expr::rhs (void) const
{
return this->rhs_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Binary_Expr::lhs (void) const
{
return this->lhs_;
}
// ****************************************************************
ACE_INLINE
ETCL_Preference::ETCL_Preference (void)
{}
ACE_INLINE
ETCL_Preference::ETCL_Preference (int type,
ETCL_Constraint *subexpr)
: type_ (type),
subexpr_ (subexpr)
{}
ACE_INLINE int
ETCL_Preference::type (void) const
{
return this->type_;
}
ACE_INLINE ETCL_Constraint *
ETCL_Preference::subexpr (void) const
{
return this->subexpr_;
}
ACE_INLINE bool
ETCL_Literal_Constraint::operator!= (const ETCL_Literal_Constraint & rhs)
{
return !(*this == rhs);
}
ACE_INLINE bool
ETCL_Literal_Constraint::operator<= (const ETCL_Literal_Constraint & rhs)
{
return !(*this > rhs);
}
ACE_INLINE bool
ETCL_Literal_Constraint::operator>= (const ETCL_Literal_Constraint & rhs)
{
return !(*this < rhs);
}
@@ -0,0 +1,117 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ETCL_Constraint_Visitor.cpp
*
* $Id: ETCL_Constraint_Visitor.cpp 81653 2008-05-08 21:08:49Z parsons $
*
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
#include "ace/ETCL/ETCL_Constraint_Visitor.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ETCL_Constraint_Visitor::~ETCL_Constraint_Visitor (void)
{
}
int
ETCL_Constraint_Visitor::visit_literal (ETCL_Literal_Constraint *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_identifier (ETCL_Identifier *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_union_value (ETCL_Union_Value *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_union_pos (ETCL_Union_Pos *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_component_pos (ETCL_Component_Pos *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_component_assoc (ETCL_Component_Assoc *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_component_array (ETCL_Component_Array *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_special (ETCL_Special *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_component (ETCL_Component *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_dot (ETCL_Dot *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_eval (ETCL_Eval *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_default (ETCL_Default *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_exist (ETCL_Exist *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_unary_expr (ETCL_Unary_Expr *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_binary_expr (ETCL_Binary_Expr *)
{
return 0;
}
int
ETCL_Constraint_Visitor::visit_preference (ETCL_Preference *)
{
return 0;
}
ACE_END_VERSIONED_NAMESPACE_DECL
@@ -0,0 +1,70 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ETCL_Constraint_Visitor.h
*
* $Id: ETCL_Constraint_Visitor.h 81653 2008-05-08 21:08:49Z parsons $
*
* @author Carlos O'Ryan <coryan@cs.wustl.edu>
* @author Jeff Parsons <j.parsons@vanderbilt.edu>
*/
//=============================================================================
#ifndef ACE_ETCL_CONSTRAINT_VISITOR_H
#define ACE_ETCL_CONSTRAINT_VISITOR_H
#include /**/ "ace/pre.h"
#include "ace/ETCL/ace_etcl_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ETCL_Literal_Constraint;
class ETCL_Identifier;
class ETCL_Union_Value;
class ETCL_Union_Pos;
class ETCL_Component_Pos;
class ETCL_Component_Assoc;
class ETCL_Component_Array;
class ETCL_Special;
class ETCL_Component;
class ETCL_Dot;
class ETCL_Eval;
class ETCL_Default;
class ETCL_Exist;
class ETCL_Unary_Expr;
class ETCL_Binary_Expr;
class ETCL_Preference;
class ACE_ETCL_Export ETCL_Constraint_Visitor
{
public:
virtual ~ETCL_Constraint_Visitor (void);
virtual int visit_literal (ETCL_Literal_Constraint *);
virtual int visit_identifier (ETCL_Identifier *);
virtual int visit_union_value (ETCL_Union_Value *);
virtual int visit_union_pos (ETCL_Union_Pos *);
virtual int visit_component_pos (ETCL_Component_Pos *);
virtual int visit_component_assoc (ETCL_Component_Assoc *);
virtual int visit_component_array (ETCL_Component_Array *);
virtual int visit_special (ETCL_Special *);
virtual int visit_component (ETCL_Component *);
virtual int visit_dot (ETCL_Dot *);
virtual int visit_eval (ETCL_Eval *);
virtual int visit_default (ETCL_Default *);
virtual int visit_exist (ETCL_Exist *);
virtual int visit_unary_expr (ETCL_Unary_Expr *);
virtual int visit_binary_expr (ETCL_Binary_Expr *);
virtual int visit_preference (ETCL_Preference *);
};
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif // ACE_ETCL_CONSTRAINT_VISITOR_H
+113
View File
@@ -0,0 +1,113 @@
// -*- C++ -*-
// $Id: ETCL_Interpreter.cpp 91813 2010-09-17 07:52:52Z johnnyw $
#include "ace/Guard_T.h"
#include "ace/Truncate.h"
#include "ace/ETCL/ETCL_Interpreter.h"
#include "ace/ETCL/ETCL_Constraint.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ETCL_Parser_Export ACE_SYNCH_MUTEX ETCL_Interpreter::parserMutex__;
ETCL_Interpreter::ETCL_Interpreter (void)
: root_ (0)
{
}
ETCL_Interpreter::~ETCL_Interpreter (void)
{
delete this->root_;
}
int
ETCL_Interpreter::build_tree (const char* constraints)
{
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
guard,
ETCL_Interpreter::parserMutex__,
-1);
Lex_String_Input::reset ((char*)constraints);
yyval.constraint = 0;
int return_value = ::yyparse ();
if (return_value == 0 && yyval.constraint != 0)
{
this->root_ = yyval.constraint;
}
else
{
this->root_ = 0;
}
return return_value;
}
int
ETCL_Interpreter::is_empty_string (const char* str)
{
int return_value = 0;
if (str != 0)
{
int i = 0;
while (str[i] != '\0')
{
if (str[i] != ' ')
{
break;
}
++i;
}
if (str[i] == '\0')
{
return_value = 1;
}
}
return return_value;
}
char* Lex_String_Input::string_ = 0;
char* Lex_String_Input::current_ = 0;
char* Lex_String_Input::end_ = 0;
// Routine to have Lex read its input from the constraint string.
int
Lex_String_Input::copy_into (char* buf,
int max_size)
{
int const chars_left =
ACE_Utils::truncate_cast<int> (
Lex_String_Input::end_ - Lex_String_Input::current_);
int const n = max_size > chars_left ? chars_left : max_size;
if (n > 0)
{
ACE_OS::memcpy (buf,
Lex_String_Input::current_,
n);
Lex_String_Input::current_ += n;
}
return n;
}
void
Lex_String_Input::reset (char* input_string)
{
Lex_String_Input::string_ = input_string;
Lex_String_Input::current_ = input_string;
Lex_String_Input::end_ =
input_string + ACE_OS::strlen (Lex_String_Input::string_);
}
ACE_END_VERSIONED_NAMESPACE_DECL
+117
View File
@@ -0,0 +1,117 @@
// -*- C++ -*-
//=============================================================================
/**
* @file ETCL_Interpreter.h
*
* $Id: ETCL_Interpreter.h 82434 2008-07-28 11:40:36Z johnnyw $
*
* @author Jeff Parsons <parsons@cs.wustl.edu> based on previous work by
* @author Seth Widoff <sbw1@cs.wustl.edu>
*/
//=============================================================================
#ifndef ETCL_INTERPRETER_H
#define ETCL_INTERPRETER_H
#include /**/ "ace/pre.h"
#include "ace/Thread_Mutex.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Synch_Traits.h"
#include "etcl_parser_export.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ETCL_Constraint;
ACE_END_VERSIONED_NAMESPACE_DECL
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ETCL_Interpreter
*
* @brief ETCL_Interpreter is the superclass for all ETCL interpreters.
* Its build tree method invokes the yacc parser to parse a constraint
* or preference string.
*/
class ETCL_Parser_Export ETCL_Interpreter
{
protected:
// = Initialization and termination methods.
/// Constructor.
ETCL_Interpreter (void);
/// Destructor.
virtual ~ETCL_Interpreter (void);
/// Using the Yacc generated parser, construct an expression tree
/// representing @a constraints from the tokens returned by it.
int build_tree (const char* constraints);
static int is_empty_string (const char* str);
/// The root of the expression tree, not equal to null if build_tree
/// successfully builds a tree from the constraints.
ETCL_Constraint* root_;
private:
/// This mutex protects the <build_tree> method from reentrance.
static ACE_SYNCH_MUTEX parserMutex__;
};
// Functions we need for parsing.
extern int yyparse (void);
extern void yyrestart (FILE*);
extern int yylex (void);
// Have yylex read from the constraint string, not from stdin.
#undef YY_INPUT
#define YY_INPUT(b, r, ms) (r = Lex_String_Input::copy_into(b, ms))
/**
* @class Lex_String_Input
*
* @brief Have Lex read from a string and not from stdin. Essentially,
* the interpreter needs to call yylex() until EOF, and call
* TAO_Lex_String_Input::reset() with the new string, prior to
* calling yyparse.
*/
class Lex_String_Input
{
public:
/// Reset the lex input.
static void reset (char* input_string);
/// Method lex will call to read from the input string.
static int copy_into (char* buf, int max_size);
private:
/// Pointers to keep track of the input string.
static char* string_;
static char* current_;
static char* end_;
};
/// The union used by lex and bison to build the Abstract Syntax Tree.
typedef union
{
ACE_VERSIONED_NAMESPACE_NAME::ETCL_Constraint* constraint;
} YYSTYPE;
extern YYSTYPE yylval;
extern YYSTYPE yyval;
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif // ETCL_INTERPRETER_H
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+45
View File
@@ -0,0 +1,45 @@
// $Id: ETCL_y.h 81458 2008-04-28 11:31:49Z johnnyw $
#define ETCL_GT 257
#define ETCL_GE 258
#define ETCL_LT 259
#define ETCL_LE 260
#define ETCL_EQ 261
#define ETCL_NE 262
#define ETCL_EXIST 263
#define ETCL_DEFAULT 264
#define ETCL_AND 265
#define ETCL_OR 266
#define ETCL_NOT 267
#define ETCL_IN 268
#define ETCL_TWIDDLE 269
#define ETCL_BOOLEAN 270
#define ETCL_PLUS 271
#define ETCL_MINUS 272
#define ETCL_MULT 273
#define ETCL_DIV 274
#define ETCL_UMINUS 275
#define ETCL_INTEGER 276
#define ETCL_FLOAT 277
#define ETCL_STRING 278
#define ETCL_RPAREN 279
#define ETCL_LPAREN 280
#define ETCL_RBRA 281
#define ETCL_LBRA 282
#define ETCL_IDENT 283
#define ETCL_UNSIGNED 284
#define ETCL_SIGNED 285
#define ETCL_DOUBLE 286
#define ETCL_CONSTRAINT 287
#define ETCL_COMPONENT 288
#define ETCL_WITH 289
#define ETCL_MAX 290
#define ETCL_MIN 291
#define ETCL_FIRST 292
#define ETCL_RANDOM 293
#define ETCL_DOLLAR 294
#define ETCL_DOT 295
#define ETCL_DISCRIMINANT 296
#define ETCL_LENGTH 297
#define ETCL_TYPE_ID 298
#define ETCL_REPOS_ID 299

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