diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-04-19 09:10:19 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-04-19 09:10:19 +0000 |
commit | f9606f4f257e642e04f8c84315b0c8f323fe65e6 (patch) | |
tree | a681f895cf5a9b8a4f7ab6603ee4fd3a55ca0305 | |
parent | 10fc1a52ad4bc0d1d3d6716d18f77d04022bd2a8 (diff) | |
download | ATCD-f9606f4f257e642e04f8c84315b0c8f323fe65e6.tar.gz |
ChangeLogTag: Wed Apr 19 07:44:49 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
226 files changed, 6180 insertions, 11232 deletions
diff --git a/ChangeLog b/ChangeLog index 544ca2476c1..b1d6786345c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,72 @@ Wed Apr 19 07:48:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/config-osf1-3.2.h: + Removed, very old + + * ace/config-tru64.h: + Removed include of config-osf1-3.2.h + + * ace/OS_Dirent.cpp: + * ace/OS_Memory.{cpp,inl}: + * ace/OS_String.{cpp,inl}: + * ace/Sync.cpp: + Removed these files, where not build for a long time already + + * ace/ace.mpc: + Removed files above + + * ace/OS_Memory.h: + * ace/OS_String.h: + Removed include of inline files + + * ace/config-win32-msvc6.h: + * ace/config-kcc-common.h: + Removed these files, vc6 and kcc are deprecated + + * ace/config-irix6.x-kcc.h: + * ace/config-osf1-4.0.h: + * ace/config-sunos5.5.h: + Removed support for KCC + + * ace/Asynch_IO_Impl.h: + Removed workarounds for KCC + + * ace/config-win32-msvc.h: + Removed support for vc6 and vc7.0 + + * ace/Array_Base.cpp: + * ace/Array_Map.{h,cpp}: + * ace/Base_Thread_Adapter.h: + * ace/Cleanup.h: + * ace/Log_Msg.h: + * ace/Versioned_Namespace.h: + * ace/Get_Opt.cpp: + * ace/WIN32_Proactor.cpp: + * ace/Message_Queue.cpp: + * ace/CDR_Base.h: + Removed work arounds for vc6 + + * ace/README + * ace/config-win32-msvc6.h: + * ace/Global_Macros.h: + Deprecated ACE_HAS_BROKEN_NAMESPACES, we drop msvc6 and I am + removing the workarounds for this compiler one by one as part of the + new sequence implementation. Because we deprecate this also + ACE_NESTED_CLASS is deprecated + + * ace/config-win32-msvc6.h: + * ace/config-win32-msvc7.h: + * ace/config-win32-msvc8.h: + Removed ACE_HAS_BROKEN_IMPLICIT_CONST_CAST, not used in ACE + + * ace/config-win32-msvc6.h: + * ace/config-win32-visualage.h: + * ace/Registry.h + Removed ACE_HAS_BROKEN_NESTED_TEMPLATES, only used for msvc6 and + visual age, both are being dropped + +Wed Apr 19 07:48:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> + * bin/tao_orb_tests.lst: Added Bug_2503_Regression diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 163ed028ef4..36aa9911929 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,20 @@ +Wed Apr 19 07:48:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> + + * tools/Config_Handlers/Basic_Deployment_Data.hpp + * tools/Config_Handlers/Deployment.hpp + * tools/Config_Handlers/ccd.hpp + * tools/Config_Handlers/cdd.hpp + * tools/Config_Handlers/cdp.hpp + * tools/Config_Handlers/cid.hpp + * tools/Config_Handlers/cpd.hpp + * tools/Config_Handlers/iad.hpp + * tools/Config_Handlers/pcd.hpp + * tools/Config_Handlers/toplevel.hpp + Removed vc6 workarounds + + * tools/Config_Handlers/vc6-4786.h + Removed + Tue Apr 18 20:55:05 2006 Wallace Zhang <zhangw@ociweb.com> * CIAO version 0.5.1 released. diff --git a/TAO/CIAO/tools/Config_Handlers/Basic_Deployment_Data.hpp b/TAO/CIAO/tools/Config_Handlers/Basic_Deployment_Data.hpp index 2a0fd3d5919..9fe9eda89a7 100644 --- a/TAO/CIAO/tools/Config_Handlers/Basic_Deployment_Data.hpp +++ b/TAO/CIAO/tools/Config_Handlers/Basic_Deployment_Data.hpp @@ -9,10 +9,6 @@ * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ diff --git a/TAO/CIAO/tools/Config_Handlers/Deployment.hpp b/TAO/CIAO/tools/Config_Handlers/Deployment.hpp index d58335dfcb6..d0255a22c33 100644 --- a/TAO/CIAO/tools/Config_Handlers/Deployment.hpp +++ b/TAO/CIAO/tools/Config_Handlers/Deployment.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ diff --git a/TAO/CIAO/tools/Config_Handlers/ccd.hpp b/TAO/CIAO/tools/Config_Handlers/ccd.hpp index ab460a46a7d..303ab428006 100644 --- a/TAO/CIAO/tools/Config_Handlers/ccd.hpp +++ b/TAO/CIAO/tools/Config_Handlers/ccd.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ @@ -49,7 +45,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // label - // + // public: bool label_p () const; ::XMLSchema::string< ACE_TCHAR > const& label () const; @@ -59,7 +55,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > label_; // UUID - // + // public: bool UUID_p () const; ::XMLSchema::string< ACE_TCHAR > const& UUID () const; @@ -69,7 +65,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > UUID_; // specificType - // + // public: bool specificType_p () const; ::XMLSchema::string< ACE_TCHAR > const& specificType () const; @@ -79,7 +75,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > specificType_; // supportedType - // + // public: typedef ::std::list< ::XMLSchema::string< ACE_TCHAR > >::iterator supportedType_iterator; typedef ::std::list< ::XMLSchema::string< ACE_TCHAR > >::const_iterator supportedType_const_iterator; @@ -94,7 +90,7 @@ namespace CIAO ::std::list< ::XMLSchema::string< ACE_TCHAR > > supportedType_; // idlFile - // + // public: typedef ::std::list< ::XMLSchema::string< ACE_TCHAR > >::iterator idlFile_iterator; typedef ::std::list< ::XMLSchema::string< ACE_TCHAR > >::const_iterator idlFile_const_iterator; @@ -109,7 +105,7 @@ namespace CIAO ::std::list< ::XMLSchema::string< ACE_TCHAR > > idlFile_; // configProperty - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::Property >::iterator configProperty_iterator; typedef ::std::list< ::CIAO::Config_Handlers::Property >::const_iterator configProperty_const_iterator; @@ -124,7 +120,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::Property > configProperty_; // port - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::ComponentPortDescription >::iterator port_iterator; typedef ::std::list< ::CIAO::Config_Handlers::ComponentPortDescription >::const_iterator port_const_iterator; @@ -139,7 +135,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::ComponentPortDescription > port_; // property - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::ComponentPropertyDescription >::iterator property_iterator; typedef ::std::list< ::CIAO::Config_Handlers::ComponentPropertyDescription >::const_iterator property_const_iterator; @@ -154,7 +150,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::ComponentPropertyDescription > property_; // infoProperty - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::Property >::iterator infoProperty_iterator; typedef ::std::list< ::CIAO::Config_Handlers::Property >::const_iterator infoProperty_const_iterator; @@ -169,7 +165,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::Property > infoProperty_; // contentLocation - // + // public: bool contentLocation_p () const; ::XMLSchema::string< ACE_TCHAR > const& contentLocation () const; @@ -179,7 +175,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > contentLocation_; // href - // + // public: bool href_p () const; ::XMLSchema::string< ACE_TCHAR > const& href () const; diff --git a/TAO/CIAO/tools/Config_Handlers/cdd.hpp b/TAO/CIAO/tools/Config_Handlers/cdd.hpp index 27ea37d4160..29eedd95b84 100644 --- a/TAO/CIAO/tools/Config_Handlers/cdd.hpp +++ b/TAO/CIAO/tools/Config_Handlers/cdd.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ @@ -20,7 +16,7 @@ #endif #include "XSC_XML_Handlers_Export.h" - + #ifndef CDD_HPP #define CDD_HPP @@ -54,7 +50,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // UUID - // + // public: bool UUID_p () const; ::XMLSchema::string< ACE_TCHAR > const& UUID () const; @@ -64,7 +60,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > UUID_; // label - // + // public: bool label_p () const; ::XMLSchema::string< ACE_TCHAR > const& label () const; @@ -74,7 +70,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > label_; // node - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::Node >::iterator node_iterator; typedef ::std::list< ::CIAO::Config_Handlers::Node >::const_iterator node_const_iterator; @@ -89,7 +85,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::Node > node_; // interconnect - // + // public: ::CIAO::Config_Handlers::Interconnect const& interconnect () const; void interconnect (::CIAO::Config_Handlers::Interconnect const& ); @@ -98,7 +94,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Interconnect > interconnect_; // bridge - // + // public: ::CIAO::Config_Handlers::Bridge const& bridge () const; void bridge (::CIAO::Config_Handlers::Bridge const& ); @@ -107,7 +103,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Bridge > bridge_; // sharedResource - // + // public: bool sharedResource_p () const; ::CIAO::Config_Handlers::SharedResource const& sharedResource () const; @@ -117,7 +113,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::SharedResource > sharedResource_; // infoProperty - // + // public: bool infoProperty_p () const; ::CIAO::Config_Handlers::Property const& infoProperty () const; @@ -147,7 +143,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // name - // + // public: ::XMLSchema::string< ACE_TCHAR > const& name () const; void name (::XMLSchema::string< ACE_TCHAR > const& ); @@ -156,7 +152,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > name_; // label - // + // public: bool label_p () const; ::XMLSchema::string< ACE_TCHAR > const& label () const; @@ -166,7 +162,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > label_; // connect - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::Interconnect >::iterator connect_iterator; typedef ::std::list< ::CIAO::Config_Handlers::Interconnect >::const_iterator connect_const_iterator; @@ -181,7 +177,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::Interconnect > connect_; // resource - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::Resource >::iterator resource_iterator; typedef ::std::list< ::CIAO::Config_Handlers::Resource >::const_iterator resource_const_iterator; diff --git a/TAO/CIAO/tools/Config_Handlers/cdp.hpp b/TAO/CIAO/tools/Config_Handlers/cdp.hpp index dc449ab6031..ca9e0c507f6 100644 --- a/TAO/CIAO/tools/Config_Handlers/cdp.hpp +++ b/TAO/CIAO/tools/Config_Handlers/cdp.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ @@ -50,7 +46,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // label - // + // public: bool label_p () const; ::XMLSchema::string< ACE_TCHAR > const& label () const; @@ -60,7 +56,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > label_; // UUID - // + // public: bool UUID_p () const; ::XMLSchema::string< ACE_TCHAR > const& UUID () const; @@ -70,7 +66,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > UUID_; // realizes - // + // public: bool realizes_p () const; ::CIAO::Config_Handlers::ComponentInterfaceDescription const& realizes () const; @@ -80,7 +76,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::ComponentInterfaceDescription > realizes_; // implementation - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::MonolithicDeploymentDescription >::iterator implementation_iterator; typedef ::std::list< ::CIAO::Config_Handlers::MonolithicDeploymentDescription >::const_iterator implementation_const_iterator; @@ -95,7 +91,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::MonolithicDeploymentDescription > implementation_; // instance - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::InstanceDeploymentDescription >::iterator instance_iterator; typedef ::std::list< ::CIAO::Config_Handlers::InstanceDeploymentDescription >::const_iterator instance_const_iterator; @@ -110,7 +106,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::InstanceDeploymentDescription > instance_; // connection - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::PlanConnectionDescription >::iterator connection_iterator; typedef ::std::list< ::CIAO::Config_Handlers::PlanConnectionDescription >::const_iterator connection_const_iterator; @@ -125,7 +121,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::PlanConnectionDescription > connection_; // dependsOn - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::ImplementationDependency >::iterator dependsOn_iterator; typedef ::std::list< ::CIAO::Config_Handlers::ImplementationDependency >::const_iterator dependsOn_const_iterator; @@ -140,7 +136,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::ImplementationDependency > dependsOn_; // artifact - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::ArtifactDeploymentDescription >::iterator artifact_iterator; typedef ::std::list< ::CIAO::Config_Handlers::ArtifactDeploymentDescription >::const_iterator artifact_const_iterator; @@ -155,7 +151,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::ArtifactDeploymentDescription > artifact_; // infoProperty - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::Property >::iterator infoProperty_iterator; typedef ::std::list< ::CIAO::Config_Handlers::Property >::const_iterator infoProperty_const_iterator; diff --git a/TAO/CIAO/tools/Config_Handlers/cid.hpp b/TAO/CIAO/tools/Config_Handlers/cid.hpp index 7439935c8df..9b0068a7985 100644 --- a/TAO/CIAO/tools/Config_Handlers/cid.hpp +++ b/TAO/CIAO/tools/Config_Handlers/cid.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ @@ -58,7 +54,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // name - // + // public: ::XMLSchema::string< ACE_TCHAR > const& name () const; void name (::XMLSchema::string< ACE_TCHAR > const& ); @@ -67,7 +63,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > name_; // package - // + // public: ::CIAO::Config_Handlers::ComponentPackageDescription const& package () const; void package (::CIAO::Config_Handlers::ComponentPackageDescription const& ); @@ -76,7 +72,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::ComponentPackageDescription > package_; // configProperty - // + // public: bool configProperty_p () const; ::CIAO::Config_Handlers::Property const& configProperty () const; @@ -86,7 +82,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Property > configProperty_; // selectRequirement - // + // public: bool selectRequirement_p () const; ::CIAO::Config_Handlers::Requirement const& selectRequirement () const; @@ -96,7 +92,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Requirement > selectRequirement_; // reference - // + // public: bool reference_p () const; ::CIAO::Config_Handlers::ComponentPackageReference const& reference () const; @@ -106,7 +102,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::ComponentPackageReference > reference_; // id - // + // public: bool id_p () const; ::XMLSchema::ID< ACE_TCHAR > const& id () const; @@ -137,7 +133,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // propertyName - // + // public: ::XMLSchema::string< ACE_TCHAR > const& propertyName () const; void propertyName (::XMLSchema::string< ACE_TCHAR > const& ); @@ -146,7 +142,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > propertyName_; // instance - // + // public: ::CIAO::Config_Handlers::SubcomponentInstantiationDescription const& instance () const; void instance (::CIAO::Config_Handlers::SubcomponentInstantiationDescription const& ); @@ -175,7 +171,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // name - // + // public: ::XMLSchema::string< ACE_TCHAR > const& name () const; void name (::XMLSchema::string< ACE_TCHAR > const& ); @@ -184,7 +180,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > name_; // externalName - // + // public: ::XMLSchema::string< ACE_TCHAR > const& externalName () const; void externalName (::XMLSchema::string< ACE_TCHAR > const& ); @@ -193,7 +189,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > externalName_; // delegatesTo - // + // public: ::CIAO::Config_Handlers::SubcomponentPropertyReference const& delegatesTo () const; void delegatesTo (::CIAO::Config_Handlers::SubcomponentPropertyReference const& ); diff --git a/TAO/CIAO/tools/Config_Handlers/cpd.hpp b/TAO/CIAO/tools/Config_Handlers/cpd.hpp index 5fc156ff616..f001bfe1ad4 100644 --- a/TAO/CIAO/tools/Config_Handlers/cpd.hpp +++ b/TAO/CIAO/tools/Config_Handlers/cpd.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ @@ -52,7 +48,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // name - // + // public: ::XMLSchema::string< ACE_TCHAR > const& name () const; void name (::XMLSchema::string< ACE_TCHAR > const& ); @@ -61,7 +57,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > name_; // referencedImplementation - // + // public: ::CIAO::Config_Handlers::ComponentImplementationDescription const& referencedImplementation () const; void referencedImplementation (::CIAO::Config_Handlers::ComponentImplementationDescription const& ); @@ -90,7 +86,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // label - // + // public: bool label_p () const; ::XMLSchema::string< ACE_TCHAR > const& label () const; @@ -100,7 +96,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > label_; // UUID - // + // public: bool UUID_p () const; ::XMLSchema::string< ACE_TCHAR > const& UUID () const; @@ -110,7 +106,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > UUID_; // realizes - // + // public: bool realizes_p () const; ::CIAO::Config_Handlers::ComponentInterfaceDescription const& realizes () const; @@ -120,7 +116,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::ComponentInterfaceDescription > realizes_; // configProperty - // + // public: bool configProperty_p () const; ::CIAO::Config_Handlers::Property const& configProperty () const; @@ -130,7 +126,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Property > configProperty_; // implementation - // + // public: bool implementation_p () const; ::CIAO::Config_Handlers::PackagedComponentImplementation const& implementation () const; @@ -140,7 +136,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::PackagedComponentImplementation > implementation_; // infoProperty - // + // public: bool infoProperty_p () const; ::CIAO::Config_Handlers::Property const& infoProperty () const; @@ -150,7 +146,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Property > infoProperty_; // contentLocation - // + // public: bool contentLocation_p () const; ::XMLSchema::string< ACE_TCHAR > const& contentLocation () const; @@ -160,7 +156,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > contentLocation_; // href - // + // public: bool href_p () const; ::XMLSchema::string< ACE_TCHAR > const& href () const; diff --git a/TAO/CIAO/tools/Config_Handlers/iad.hpp b/TAO/CIAO/tools/Config_Handlers/iad.hpp index c45b689338e..dca2e75c6e3 100644 --- a/TAO/CIAO/tools/Config_Handlers/iad.hpp +++ b/TAO/CIAO/tools/Config_Handlers/iad.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ @@ -50,7 +46,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // name - // + // public: ::XMLSchema::string< ACE_TCHAR > const& name () const; void name (::XMLSchema::string< ACE_TCHAR > const& ); @@ -59,7 +55,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > name_; // referencedArtifact - // + // public: ::CIAO::Config_Handlers::ImplementationArtifactDescription const& referencedArtifact () const; void referencedArtifact (::CIAO::Config_Handlers::ImplementationArtifactDescription const& ); @@ -88,7 +84,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // label - // + // public: bool label_p () const; ::XMLSchema::string< ACE_TCHAR > const& label () const; @@ -98,7 +94,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > label_; // UUID - // + // public: bool UUID_p () const; ::XMLSchema::string< ACE_TCHAR > const& UUID () const; @@ -108,7 +104,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > UUID_; // location - // + // public: typedef ::std::list< ::XMLSchema::string< ACE_TCHAR > >::iterator location_iterator; typedef ::std::list< ::XMLSchema::string< ACE_TCHAR > >::const_iterator location_const_iterator; @@ -123,7 +119,7 @@ namespace CIAO ::std::list< ::XMLSchema::string< ACE_TCHAR > > location_; // dependsOn - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::NamedImplementationArtifact >::iterator dependsOn_iterator; typedef ::std::list< ::CIAO::Config_Handlers::NamedImplementationArtifact >::const_iterator dependsOn_const_iterator; @@ -138,7 +134,7 @@ namespace CIAO ::std::list< ::CIAO::Config_Handlers::NamedImplementationArtifact > dependsOn_; // execParameter - // + // public: bool execParameter_p () const; ::CIAO::Config_Handlers::Property const& execParameter () const; @@ -148,7 +144,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Property > execParameter_; // deployRequirement - // + // public: bool deployRequirement_p () const; ::CIAO::Config_Handlers::Requirement const& deployRequirement () const; @@ -158,7 +154,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Requirement > deployRequirement_; // infoProperty - // + // public: bool infoProperty_p () const; ::CIAO::Config_Handlers::Property const& infoProperty () const; @@ -168,7 +164,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Property > infoProperty_; // contentLocation - // + // public: bool contentLocation_p () const; ::XMLSchema::string< ACE_TCHAR > const& contentLocation () const; @@ -178,7 +174,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > contentLocation_; // href - // + // public: bool href_p () const; ::XMLSchema::string< ACE_TCHAR > const& href () const; diff --git a/TAO/CIAO/tools/Config_Handlers/pcd.hpp b/TAO/CIAO/tools/Config_Handlers/pcd.hpp index ff4d123c6b0..dacfad1a182 100644 --- a/TAO/CIAO/tools/Config_Handlers/pcd.hpp +++ b/TAO/CIAO/tools/Config_Handlers/pcd.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ @@ -51,7 +47,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // label - // + // public: bool label_p () const; ::XMLSchema::string< ACE_TCHAR > const& label () const; @@ -61,7 +57,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > label_; // UUID - // + // public: bool UUID_p () const; ::XMLSchema::string< ACE_TCHAR > const& UUID () const; @@ -71,7 +67,7 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > UUID_; // basePackage - // + // public: bool basePackage_p () const; ::CIAO::Config_Handlers::ComponentPackageDescription const& basePackage () const; @@ -81,7 +77,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::ComponentPackageDescription > basePackage_; // reference - // + // public: bool reference_p () const; ::CIAO::Config_Handlers::ComponentPackageReference const& reference () const; @@ -91,7 +87,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::ComponentPackageReference > reference_; // selectRequirement - // + // public: bool selectRequirement_p () const; ::CIAO::Config_Handlers::Requirement const& selectRequirement () const; @@ -101,7 +97,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Requirement > selectRequirement_; // configProperty - // + // public: bool configProperty_p () const; ::CIAO::Config_Handlers::Property const& configProperty () const; @@ -111,7 +107,7 @@ namespace CIAO ::std::auto_ptr< ::CIAO::Config_Handlers::Property > configProperty_; // contentLocation - // + // public: bool contentLocation_p () const; ::XMLSchema::string< ACE_TCHAR > const& contentLocation () const; diff --git a/TAO/CIAO/tools/Config_Handlers/toplevel.hpp b/TAO/CIAO/tools/Config_Handlers/toplevel.hpp index 559700357f6..4c0df294347 100644 --- a/TAO/CIAO/tools/Config_Handlers/toplevel.hpp +++ b/TAO/CIAO/tools/Config_Handlers/toplevel.hpp @@ -3,16 +3,12 @@ * * Changes made to this code will most likely be overwritten * when the handlers are recompiled. - * + * * If you find errors or feel that there are bugfixes to be made, * please contact the current XSC maintainer: * Will Otte <wotte@dre.vanderbilt.edu> */ - -// Fixes the VC6 warning 4786. -#include "vc6-4786.h" - // Fix for Borland compilers, which seem to have a broken // <string> include. #ifdef __BORLANDC__ @@ -49,7 +45,7 @@ namespace CIAO typedef ::XSCRT::Type Base__; // package - // + // public: typedef ::std::list< ::CIAO::Config_Handlers::PackageConfiguration >::iterator package_iterator; typedef ::std::list< ::CIAO::Config_Handlers::PackageConfiguration >::const_iterator package_const_iterator; @@ -149,13 +145,13 @@ namespace CIAO { namespace Writer { - struct TopLevelPackageDescription : Traversal::TopLevelPackageDescription, + struct TopLevelPackageDescription : Traversal::TopLevelPackageDescription, virtual ::XSCRT::Writer< ACE_TCHAR > { typedef ::CIAO::Config_Handlers::TopLevelPackageDescription Type; TopLevelPackageDescription (::XSCRT::XML::Element< ACE_TCHAR >&); - virtual void + virtual void traverse (Type &o) { @@ -166,7 +162,7 @@ namespace CIAO virtual void traverse (Type const&); - virtual void + virtual void package_pre (Type &o) { @@ -177,7 +173,7 @@ namespace CIAO virtual void package_pre (Type const&); - virtual void + virtual void package_next (Type &o) { @@ -188,7 +184,7 @@ namespace CIAO virtual void package_next (Type const&); - virtual void + virtual void package_post (Type &o) { diff --git a/TAO/CIAO/tools/Config_Handlers/vc6-4786.h b/TAO/CIAO/tools/Config_Handlers/vc6-4786.h deleted file mode 100644 index ab8457de1cd..00000000000 --- a/TAO/CIAO/tools/Config_Handlers/vc6-4786.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @file vc6-4786.h - * @author Will Otte <wotte@dre.vanderbilt.edu - * $Id$ - * Silences that nefarious 4786 warning in a bit cleaner way - * than sprinkling the same preprocessor directives all over the code. - */ - -#ifndef VC6_4786_H_ -# define VC6_4786_H_ -# if defined (_MSC_VER) && (_MSC_VER < 1300) -# pragma warning (disable: 4786) -# endif -#endif /* VC6_4786_H_ */ diff --git a/TAO/tao/Acceptor_Filter.h b/TAO/tao/Acceptor_Filter.h index bfb1a189dd0..c628731eba5 100644 --- a/TAO/tao/Acceptor_Filter.h +++ b/TAO/tao/Acceptor_Filter.h @@ -49,9 +49,9 @@ public: virtual ~TAO_Acceptor_Filter (void); /** - * Populate <mprofile> with profiles. Profiles are created for + * Populate @a mprofile with profiles. Profiles are created for * selected acceptors (endpoints) from the array delimited by - * <acceptors_begin> and <acceptors_end>. + * @a acceptors_begin and @a acceptors_end. */ virtual int fill_profile (const TAO::ObjectKey &object_key, TAO_MProfile &mprofile, diff --git a/TAO/tao/Acceptor_Registry.h b/TAO/tao/Acceptor_Registry.h index 7d7bee02a2d..8b6ab5acc24 100644 --- a/TAO/tao/Acceptor_Registry.h +++ b/TAO/tao/Acceptor_Registry.h @@ -82,7 +82,7 @@ public: /// Returns the total number of endpoints in all of its acceptors. size_t endpoint_count (void); - /// Check if there is at least one profile in <mprofile> that + /// Check if there is at least one profile in @a mprofile that /// corresponds to a collocated object. int is_collocated (const TAO_MProfile& mprofile); diff --git a/TAO/tao/Adapter_Registry.cpp b/TAO/tao/Adapter_Registry.cpp index 4096cb515bb..16aa66007e0 100644 --- a/TAO/tao/Adapter_Registry.cpp +++ b/TAO/tao/Adapter_Registry.cpp @@ -37,7 +37,6 @@ TAO_Adapter_Registry::~TAO_Adapter_Registry (void) void TAO_Adapter_Registry::close (int wait_for_completion ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (()) { ACE_TRY { @@ -65,30 +64,15 @@ TAO_Adapter_Registry::close (int wait_for_completion void TAO_Adapter_Registry::check_close (int wait_for_completion ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (()) { - ACE_TRY - { - for (size_t i = 0; i != this->adapters_count_; ++i) - { - this->adapters_[i]->check_close (wait_for_completion - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - } - ACE_CATCHALL + for (size_t i = 0; i != this->adapters_count_; ++i) { - if (TAO_debug_level > 3) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Exception in TAO_Adapter_Registry::check_close () \n"))); - } - return; + this->adapters_[i]->check_close (wait_for_completion + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; } - ACE_ENDTRY; - - return; } + void TAO_Adapter_Registry::insert (TAO_Adapter *adapter ACE_ENV_ARG_DECL) @@ -96,7 +80,7 @@ TAO_Adapter_Registry::insert (TAO_Adapter *adapter if (this->adapters_capacity_ == this->adapters_count_) { this->adapters_capacity_ *= 2; - TAO_Adapter **tmp; + TAO_Adapter **tmp = 0; ACE_NEW_THROW_EX (tmp, TAO_Adapter*[this->adapters_capacity_], CORBA::NO_MEMORY ()); @@ -108,7 +92,7 @@ TAO_Adapter_Registry::insert (TAO_Adapter *adapter this->adapters_ = tmp; } - int priority = adapter->priority (); + int const priority = adapter->priority (); for (size_t i = 0; i != this->adapters_count_; ++i) { if (this->adapters_[i]->priority () >= priority) @@ -120,7 +104,7 @@ TAO_Adapter_Registry::insert (TAO_Adapter *adapter this->adapters_[j] = this->adapters_[j - 1]; } this->adapters_[i] = adapter; - this->adapters_count_++; + ++this->adapters_count_; return; } } @@ -135,10 +119,10 @@ TAO_Adapter_Registry::dispatch (TAO::ObjectKey &key, { for (size_t i = 0; i != this->adapters_count_; ++i) { - int r = this->adapters_[i]->dispatch (key, - request, - forward_to - ACE_ENV_ARG_PARAMETER); + int const r = this->adapters_[i]->dispatch (key, + request, + forward_to + ACE_ENV_ARG_PARAMETER); ACE_CHECK; if (r != TAO_Adapter::DS_MISMATCHED_KEY) @@ -187,7 +171,7 @@ TAO_Adapter_Registry::initialize_collocated_object (TAO_Stub *stub) { for (size_t i = 0; i != this->adapters_count_; ++i) { - int retval = + int const retval = this->adapters_[i]->initialize_collocated_object (stub); if (retval == 0) { diff --git a/TAO/tao/Adapter_Registry.h b/TAO/tao/Adapter_Registry.h index 5572d422a3f..9625a257fbd 100644 --- a/TAO/tao/Adapter_Registry.h +++ b/TAO/tao/Adapter_Registry.h @@ -63,8 +63,7 @@ public: * POA while performing an upcall). */ void close (int wait_for_completion - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (()); + ACE_ENV_ARG_DECL); /** * Verify if the close() call can be invoked in the current @@ -72,8 +71,7 @@ public: * Raise the right exception if not. */ void check_close (int wait_for_completion - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (()); + ACE_ENV_ARG_DECL); /// Insert a new adapter into the registry. void insert (TAO_Adapter *adapter diff --git a/TAO/tao/AnyTypeCode/AnySeqC.cpp b/TAO/tao/AnyTypeCode/AnySeqC.cpp index da850503e43..8100e8ddadf 100644 --- a/TAO/tao/AnyTypeCode/AnySeqC.cpp +++ b/TAO/tao/AnyTypeCode/AnySeqC.cpp @@ -47,7 +47,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_ANYSEQ_CS_) @@ -59,7 +59,7 @@ CORBA::AnySeq::AnySeq (void) CORBA::AnySeq::AnySeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Any > (max) @@ -71,7 +71,7 @@ CORBA::AnySeq::AnySeq ( CORBA::Any * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Any > (max, length, buffer, release) @@ -80,7 +80,7 @@ CORBA::AnySeq::AnySeq ( CORBA::AnySeq::AnySeq ( const AnySeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Any > (seq) @@ -111,22 +111,7 @@ CORBA::Boolean operator<< ( const CORBA::AnySeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -134,40 +119,7 @@ CORBA::Boolean operator>> ( CORBA::AnySeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_AnySeq_CPP_ */ diff --git a/TAO/tao/AnyTypeCode/AnySeqC.h b/TAO/tao/AnyTypeCode/AnySeqC.h index bb18f8e402a..20ac1a20c3e 100644 --- a/TAO/tao/AnyTypeCode/AnySeqC.h +++ b/TAO/tao/AnyTypeCode/AnySeqC.h @@ -82,22 +82,19 @@ namespace CORBA typedef TAO_VarSeq_Var_T< - AnySeq, - CORBA::Any + AnySeq > AnySeq_var; typedef TAO_Seq_Out_T< - AnySeq, - AnySeq_var, - CORBA::Any + AnySeq > AnySeq_out; class TAO_AnyTypeCode_Export AnySeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Any > { @@ -108,7 +105,7 @@ namespace CORBA CORBA::ULong max, CORBA::ULong length, CORBA::Any* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); AnySeq (const AnySeq &); ~AnySeq (void); diff --git a/TAO/tao/AnyTypeCode/BoundsC.cpp b/TAO/tao/AnyTypeCode/BoundsC.cpp index a4e520aa372..fcf15a8094e 100644 --- a/TAO/tao/AnyTypeCode/BoundsC.cpp +++ b/TAO/tao/AnyTypeCode/BoundsC.cpp @@ -75,7 +75,7 @@ CORBA::Bounds::Bounds (const ::CORBA::Bounds &_tao_excp) CORBA::Bounds& CORBA::Bounds::operator= (const ::CORBA::Bounds &_tao_excp) { - this->ACE_NESTED_CLASS (CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); return *this; } diff --git a/TAO/tao/AnyTypeCode/DynamicC.cpp b/TAO/tao/AnyTypeCode/DynamicC.cpp index bb693ede9b8..4cd49b59b28 100644 --- a/TAO/tao/AnyTypeCode/DynamicC.cpp +++ b/TAO/tao/AnyTypeCode/DynamicC.cpp @@ -58,7 +58,7 @@ Dynamic::ParameterList::ParameterList (void) Dynamic::ParameterList::ParameterList ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< Dynamic::Parameter > (max) @@ -70,7 +70,7 @@ Dynamic::ParameterList::ParameterList ( Dynamic::Parameter * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< Dynamic::Parameter > (max, length, buffer, release) @@ -79,7 +79,7 @@ Dynamic::ParameterList::ParameterList ( Dynamic::ParameterList::ParameterList ( const ParameterList &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< Dynamic::Parameter > (seq) @@ -112,7 +112,7 @@ Dynamic::ExceptionList::ExceptionList (void) Dynamic::ExceptionList::ExceptionList ( CORBA::ULong max ) - : TAO_Unbounded_Object_Sequence< + : TAO::unbounded_object_reference_sequence< CORBA::TypeCode, CORBA::TypeCode_var > @@ -125,7 +125,7 @@ Dynamic::ExceptionList::ExceptionList ( CORBA::TypeCode_ptr * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Object_Sequence< + : TAO::unbounded_object_reference_sequence< CORBA::TypeCode, CORBA::TypeCode_var > @@ -135,7 +135,7 @@ Dynamic::ExceptionList::ExceptionList ( Dynamic::ExceptionList::ExceptionList ( const ExceptionList &seq ) - : TAO_Unbounded_Object_Sequence< + : TAO::unbounded_object_reference_sequence< CORBA::TypeCode, CORBA::TypeCode_var > @@ -167,22 +167,7 @@ CORBA::Boolean operator<< ( const Dynamic::ParameterList &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -190,40 +175,7 @@ CORBA::Boolean operator>> ( Dynamic::ParameterList &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_Dynamic_ParameterList_CPP_ */ @@ -240,25 +192,7 @@ CORBA::Boolean operator<< ( const Dynamic::ExceptionList &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = - TAO::Objref_Traits<CORBA::TypeCode>::marshal ( - _tao_sequence[i].in (), strm - ); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -266,40 +200,7 @@ CORBA::Boolean operator>> ( Dynamic::ExceptionList &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_Dynamic_ExceptionList_CPP_ */ diff --git a/TAO/tao/AnyTypeCode/DynamicC.h b/TAO/tao/AnyTypeCode/DynamicC.h index 0bdd3a59057..92e2d9ba9b9 100644 --- a/TAO/tao/AnyTypeCode/DynamicC.h +++ b/TAO/tao/AnyTypeCode/DynamicC.h @@ -98,22 +98,19 @@ namespace Dynamic typedef TAO_VarSeq_Var_T< - ParameterList, - Parameter + ParameterList > ParameterList_var; typedef TAO_Seq_Out_T< - ParameterList, - ParameterList_var, - Parameter + ParameterList > ParameterList_out; class TAO_AnyTypeCode_Export ParameterList : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< Parameter > { @@ -124,7 +121,7 @@ namespace Dynamic CORBA::ULong max, CORBA::ULong length, Parameter* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); ParameterList (const ParameterList &); ~ParameterList (void); @@ -153,29 +150,20 @@ namespace Dynamic class ExceptionList; typedef - TAO_MngSeq_Var_T< - ExceptionList, - TAO_Object_Manager< - CORBA::TypeCode, - CORBA::TypeCode_var - > + TAO_VarSeq_Var_T< + ExceptionList > ExceptionList_var; typedef - TAO_MngSeq_Out_T< - ExceptionList, - ExceptionList_var, - TAO_Object_Manager< - CORBA::TypeCode, - CORBA::TypeCode_var - > + TAO_Seq_Out_T< + ExceptionList > ExceptionList_out; class TAO_AnyTypeCode_Export ExceptionList : public - TAO_Unbounded_Object_Sequence< + TAO::unbounded_object_reference_sequence< CORBA::TypeCode, CORBA::TypeCode_var > @@ -187,7 +175,7 @@ namespace Dynamic CORBA::ULong max, CORBA::ULong length, CORBA::TypeCode_ptr* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); ExceptionList (const ExceptionList &); ~ExceptionList (void); diff --git a/TAO/tao/Array_Traits_T.h b/TAO/tao/Array_Traits_T.h new file mode 100644 index 00000000000..f7c25d4ebd5 --- /dev/null +++ b/TAO/tao/Array_Traits_T.h @@ -0,0 +1,65 @@ +#ifndef guard_array_traits_hpp +#define guard_array_traits_hpp +/** + * @file + * + * @brief Implement the element manipulation traits for types with + * array-like semantics. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include <algorithm> +#include "tao/Array_VarOut_T.h" + +namespace TAO +{ +namespace details +{ + +template <typename T_array, typename T_slice, typename T_tag> +struct array_traits +{ + typedef T_array value_type; + typedef T_array const const_value_type; + + typedef T_slice slice_type; + typedef T_tag TAG; + + inline static void zero_range( + value_type * begin, value_type * end) + { + std::for_each( + begin, end, &TAO::Array_Traits<value_type,slice_type,TAG>::zero); + } + + inline static void initialize_range( + value_type * begin, value_type * end) + { + std::for_each( + begin, end, &TAO::Array_Traits<value_type,slice_type,TAG>::zero); + } + + inline static void copy_range( + value_type * begin, value_type * end, value_type *dst) + { + for(value_type * i = begin; i != end; ++i, ++dst) + { + TAO::Array_Traits<value_type,slice_type,TAG>::copy(*dst, *i); + } + } + + inline static void release_range( + value_type * begin, value_type * end, value_type *dst) + { + std::for_each( + begin, end, &TAO::Array_Traits<value_type,slice_type,TAG>::zero); + } +}; + +} // namespace details +} // namespace CORBA + +#endif // guard_array_traits_hpp diff --git a/TAO/tao/Array_VarOut_T.h b/TAO/tao/Array_VarOut_T.h index 3a923436eba..f2cfdb03934 100644 --- a/TAO/tao/Array_VarOut_T.h +++ b/TAO/tao/Array_VarOut_T.h @@ -25,20 +25,13 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { /** - * struct Array_Traits + * @struct Array_Traits * * @brief Specialized for each array in generated code. * */ template<typename T, typename T_slice, typename TAG> - struct Array_Traits - { - static T_slice * alloc (void); - static void free (T_slice * _tao_slice); - static T_slice * dup (const T_slice * _tao_slice); - static void copy (T_slice * _tao_to, - const T_slice * _tao_from); - }; + struct Array_Traits; } /** @@ -73,7 +66,6 @@ public: // TAO extension. _retn_type ptr (void) const; - protected: T_slice * ptr_; }; @@ -100,7 +92,6 @@ public: typedef T_slice * _out_type; _out_type out (void); - }; /** diff --git a/TAO/tao/Array_VarOut_T.inl b/TAO/tao/Array_VarOut_T.inl index 13c9f923572..b1b38964d53 100644 --- a/TAO/tao/Array_VarOut_T.inl +++ b/TAO/tao/Array_VarOut_T.inl @@ -225,18 +225,18 @@ TAO_Array_Out_T<T,T_var,T_slice,TAG>::operator T_slice *& () template<typename T, typename T_var, typename T_slice, typename TAG> ACE_INLINE -T_slice *& -TAO_Array_Out_T<T,T_var,T_slice,TAG>::ptr (void) +T_slice & +TAO_Array_Out_T<T,T_var,T_slice,TAG>::operator[] (CORBA::ULong index) { - return this->ptr_; + return this->ptr_[index]; } template<typename T, typename T_var, typename T_slice, typename TAG> ACE_INLINE -T_slice & -TAO_Array_Out_T<T,T_var,T_slice,TAG>::operator[] (CORBA::ULong index) +T_slice *& +TAO_Array_Out_T<T,T_var,T_slice,TAG>::ptr (void) { - return this->ptr_[index]; + return this->ptr_; } // ************************************************************* @@ -314,24 +314,8 @@ ACE_INLINE const T_slice & TAO_Array_Forany_T<T,T_slice,TAG>::operator[] (CORBA::ULong index) const { -#if defined (ACE_HAS_BROKEN_IMPLICIT_CONST_CAST) -# if defined (_MSC_VER) && _MSC_VER <= 1200 - // @@ (OO) MSVC++ 6 can't handle the const_cast<> in the - // multi-dimensional array case so reinterpret_cast<> cast - // instead. It's not clear if this is really the right - // thing to do but the code won't compile with MSVC++ 6 - // without it. We use a reinterpret_cast<> instead of a - // C-style "sledgehammer" cast to make it obvious that this - // code may have unresolved issues, and also to make it - // easier for others to find this code. - return reinterpret_cast<const T_slice &> (this->ptr_[index]); -# else - return const_cast<const T_slice &> (this->ptr_[index]); -# endif /* _MSC_VER <= 1200 */ -#else const T_slice & tmp = this->ptr_[index]; return tmp; -#endif /* ACE_HAS_BROKEN_IMPLICIT_CONST_CAST */ } template<typename T, typename T_slice, typename TAG> @@ -347,34 +331,7 @@ ACE_INLINE const T_slice * TAO_Array_Forany_T<T,T_slice,TAG>::in (void) const { - // @@@ (JP) This looks scary I know but it helps MSVC understand - // things better when the array is multi-dimensional. -#if (defined (_MSC_VER) && _MSC_VER <= 1200) - // @@ (OO) MSVC++ 6 can't handle the const_cast<> in the - // multi-dimensional array case so reinterpret_cast<> cast - // instead. It's not clear if this is really the right - // thing to do but the code won't compile with MSVC++ 6 - // without it. We use a reinterpret_cast<> instead of a - // C-style "sledgehammer" cast to make it obvious that this - // code may have unresolved issues, and also to make it - // easier for others to find this code. - // @@ (RLS) It is not the const_cast<> that VC6 can't handle, it is - // just confused. The ptr_ is seen as int (* const) and - // the desired type is const int *. const_cast<> is used - // to cast away const'ness and it does on VC6, yeilding - // int * where const int * is desired, and specifically - // directing the user to use either a reinterpret_cast<> - // or a C-style cast. - // @@ (RLS) The IBM compiler was complaining about a bad cast only. - // return const_cast<const T_slice *> (this->ptr_); - // It is perfectly happy with the #else part below, as - // is every other compiler I've tried it on. - return reinterpret_cast<const T_slice *> (this->ptr_); -#else - // This should work on all platforms. If a platform fails that it is - // that compiler that's wrong, not everyone else. RLS - return (this->ptr_); -#endif /* _MSC_VER <= 1200 */ + return this->ptr_; } template<typename T, typename T_slice, typename TAG> @@ -403,18 +360,18 @@ TAO_Array_Forany_T<T,T_slice,TAG>::_retn (void) template<typename T, typename T_slice, typename TAG> ACE_INLINE -T_slice * -TAO_Array_Forany_T<T,T_slice,TAG>::ptr (void) const +CORBA::Boolean +TAO_Array_Forany_T<T,T_slice,TAG>::nocopy (void) const { - return this->ptr_; + return this->nocopy_; } template<typename T, typename T_slice, typename TAG> ACE_INLINE -CORBA::Boolean -TAO_Array_Forany_T<T,T_slice,TAG>::nocopy (void) const +T_slice * +TAO_Array_Forany_T<T,T_slice,TAG>::ptr (void) const { - return this->nocopy_; + return this->ptr_; } template<typename T, typename T_slice, typename TAG> diff --git a/TAO/tao/Asynch_Queued_Message.cpp b/TAO/tao/Asynch_Queued_Message.cpp index 74412e8db1a..fd7187e4919 100644 --- a/TAO/tao/Asynch_Queued_Message.cpp +++ b/TAO/tao/Asynch_Queued_Message.cpp @@ -156,7 +156,7 @@ TAO_Asynch_Queued_Message::clone (ACE_Allocator *alloc) // Set the flag to indicate that <qm> is created on the heap. if (qm) - qm->is_heap_created_ = 1; + qm->is_heap_created_ = true; return qm; } diff --git a/TAO/tao/Asynch_Queued_Message.h b/TAO/tao/Asynch_Queued_Message.h index 99c2ddf2718..62b7afb84cd 100644 --- a/TAO/tao/Asynch_Queued_Message.h +++ b/TAO/tao/Asynch_Queued_Message.h @@ -37,7 +37,7 @@ public: /** * @param contents The message block chain that must be sent. * - * @param alloc Allocator used for creating <this> object. + * @param alloc Allocator used for creating @c this object. * * @todo I'm almost sure this class will require a callback * interface for AMIs sent with SYNC_NONE policy. Those guys diff --git a/TAO/tao/Basic_Types.h b/TAO/tao/Basic_Types.h index 5276a3e0ba6..e9686f535e3 100644 --- a/TAO/tao/Basic_Types.h +++ b/TAO/tao/Basic_Types.h @@ -25,6 +25,12 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL +namespace TAO +{ + template <typename charT> class String_var; + template <typename charT> class String_out; +} + namespace CORBA { /** @@ -73,11 +79,10 @@ namespace CORBA typedef WChar &WChar_out; //@} - class String_var; - class String_out; - - class WString_var; - class WString_out; + typedef TAO::String_var<CORBA::Char> String_var; + typedef TAO::String_out<CORBA::Char> String_out; + typedef TAO::String_var<CORBA::WChar> WString_var; + typedef TAO::String_out<CORBA::WChar> WString_out; class TypeCode; typedef TypeCode *TypeCode_ptr; diff --git a/TAO/tao/BiDir_Adapter.h b/TAO/tao/BiDir_Adapter.h index fd5270b769c..a1a394d8b5b 100644 --- a/TAO/tao/BiDir_Adapter.h +++ b/TAO/tao/BiDir_Adapter.h @@ -23,15 +23,8 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -class TAO_ORB_Core; class TAO_Policy_Validator; -namespace CORBA -{ - class ORB; - typedef ORB *ORB_ptr; -} - /** * @class TAO_BiDir_Adapter * diff --git a/TAO/tao/Bind_Dispatcher_Guard.cpp b/TAO/tao/Bind_Dispatcher_Guard.cpp index c88d3af1783..624d5344f22 100644 --- a/TAO/tao/Bind_Dispatcher_Guard.cpp +++ b/TAO/tao/Bind_Dispatcher_Guard.cpp @@ -22,7 +22,7 @@ TAO_Bind_Dispatcher_Guard::TAO_Bind_Dispatcher_Guard ( rd_(rd), tms_(tms) { - int retval = + int const retval = this->tms_->bind_dispatcher (this->request_id_, this->rd_); diff --git a/TAO/tao/Bind_Dispatcher_Guard.i b/TAO/tao/Bind_Dispatcher_Guard.i index f5ccc4a8d23..c4a3477f7ee 100644 --- a/TAO/tao/Bind_Dispatcher_Guard.i +++ b/TAO/tao/Bind_Dispatcher_Guard.i @@ -33,7 +33,7 @@ TAO_Bind_Dispatcher_Guard::status (void) const ACE_INLINE int TAO_Bind_Dispatcher_Guard::unbind_dispatcher (void) { - int retval = + int const retval = this->tms_->unbind_dispatcher (this->request_id_); // Already unbound and so do not try again during destruction. diff --git a/TAO/tao/Block_Flushing_Strategy.cpp b/TAO/tao/Block_Flushing_Strategy.cpp index c56ecbe7ef0..8e0282ecfdd 100644 --- a/TAO/tao/Block_Flushing_Strategy.cpp +++ b/TAO/tao/Block_Flushing_Strategy.cpp @@ -13,8 +13,7 @@ TAO_Block_Flushing_Strategy::schedule_output (TAO_Transport *transport) { while (!transport->queue_is_empty_i ()) { - int result = transport->drain_queue_i (); - if (result == -1) + if (transport->drain_queue_i () == -1) return -1; } return 0; @@ -33,8 +32,7 @@ TAO_Block_Flushing_Strategy::flush_message (TAO_Transport *transport, { while (!msg->all_data_sent ()) { - int result = transport->handle_output (); - if (result == -1) + if (transport->handle_output () == -1) return -1; } return 0; @@ -45,8 +43,7 @@ TAO_Block_Flushing_Strategy::flush_transport (TAO_Transport *transport) { while (!transport->queue_is_empty ()) { - int result = transport->handle_output (); - if (result == -1) + if (transport->handle_output () == -1) return -1; } return 0; diff --git a/TAO/tao/BooleanSeqC.cpp b/TAO/tao/BooleanSeqC.cpp index 1b8ef457532..1e51a578c91 100644 --- a/TAO/tao/BooleanSeqC.cpp +++ b/TAO/tao/BooleanSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_BOOLEANSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::BooleanSeq::BooleanSeq (void) CORBA::BooleanSeq::BooleanSeq ( ::CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Boolean > (max) @@ -67,7 +67,7 @@ CORBA::BooleanSeq::BooleanSeq ( ::CORBA::Boolean * buffer, ::CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Boolean > (max, length, buffer, release) @@ -76,7 +76,7 @@ CORBA::BooleanSeq::BooleanSeq ( CORBA::BooleanSeq::BooleanSeq ( const BooleanSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Boolean > (seq) @@ -107,15 +107,7 @@ void CORBA::BooleanSeq::_tao_any_destructor ( const CORBA::BooleanSeq &_tao_sequence ) { - const ::CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_boolean_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } ::CORBA::Boolean operator>> ( @@ -123,33 +115,7 @@ void CORBA::BooleanSeq::_tao_any_destructor ( CORBA::BooleanSeq &_tao_sequence ) { - ::CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_boolean_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_BooleanSeq_CPP_ */ diff --git a/TAO/tao/BooleanSeqC.h b/TAO/tao/BooleanSeqC.h index 58218300078..58c8a97c5ad 100644 --- a/TAO/tao/BooleanSeqC.h +++ b/TAO/tao/BooleanSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_BOOLEANSEQ_CH_) #define _CORBA_BOOLEANSEQ_CH_ - + class BooleanSeq; - + typedef TAO_FixedSeq_Var_T< - BooleanSeq, - CORBA::Boolean + BooleanSeq > BooleanSeq_var; - + typedef TAO_Seq_Out_T< - BooleanSeq, - BooleanSeq_var, - CORBA::Boolean + BooleanSeq > BooleanSeq_out; - + class TAO_Export BooleanSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Boolean > { @@ -95,14 +92,14 @@ namespace CORBA BooleanSeq ( ::CORBA::ULong max, ::CORBA::ULong length, - ::CORBA::Boolean* buffer, - ::CORBA::Boolean release = 0 + ::CORBA::Boolean* buffer, + ::CORBA::Boolean release = false ); BooleanSeq (const BooleanSeq &); ~BooleanSeq (void); - + static void _tao_any_destructor (void *); - + typedef BooleanSeq_var _var_type; }; diff --git a/TAO/tao/Bounded_Array_Allocation_Traits_T.h b/TAO/tao/Bounded_Array_Allocation_Traits_T.h new file mode 100644 index 00000000000..af6849f407c --- /dev/null +++ b/TAO/tao/Bounded_Array_Allocation_Traits_T.h @@ -0,0 +1,55 @@ +#ifndef guard_bounded_array_allocation_traits_hpp +#define guard_bounded_array_allocation_traits_hpp +/** + * @file + * + * @brief Details can be found in the documentation for + * TAO::details::generic_sequence + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, CORBA::ULong MAX, bool dummy> +struct bounded_array_allocation_traits +{ + typedef T value_type; + + inline static CORBA::ULong default_maximum() + { + return MAX; + } + + inline static value_type * default_buffer_allocation() + { + return allocbuf(MAX); + } + + inline static value_type * allocbuf(CORBA::ULong /* maximum */) + { + return new value_type[MAX]; + } + + inline static void freebuf(value_type * buffer) + { + delete[] buffer; + } +}; + +} // namespace details +} // namespace TAO + + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_array_allocation_traits_hpp diff --git a/TAO/tao/Bounded_Array_Sequence_T.h b/TAO/tao/Bounded_Array_Sequence_T.h new file mode 100644 index 00000000000..8850a9dfe8e --- /dev/null +++ b/TAO/tao/Bounded_Array_Sequence_T.h @@ -0,0 +1,145 @@ +#ifndef guard_bounded_array_sequence_hpp +#define guard_bounded_array_sequence_hpp +/** + * @file + * + * @brief Implement unbounded sequences for arrays. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "Bounded_Array_Allocation_Traits_T.h" +#include "Generic_Sequence_T.h" +#include "Array_Traits_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +template<typename T_array, typename T_slice, typename T_tag, CORBA::ULong MAX> +class bounded_array_sequence +{ +public: + typedef T_array * element_type; + typedef T_array value_type; + typedef T_slice * T_slice_ptr; + typedef T_slice_ptr * const_value_type; + typedef value_type & subscript_type; + typedef value_type const & const_subscript_type; + + typedef details::bounded_array_allocation_traits<value_type,MAX,true> allocation_traits; + typedef details::array_traits <T_array, T_slice, T_tag> element_traits; + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + + inline bounded_array_sequence() + : impl_() + {} + inline bounded_array_sequence( + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) + : impl_(MAX, length, data, release) + {} + inline CORBA::ULong maximum() const { + return impl_.maximum(); + } + inline CORBA::Boolean release() const { + return impl_.release(); + } + inline CORBA::ULong length() const { + return impl_.length(); + } + inline void length(CORBA::ULong length) { + impl_.length(length); + } + inline value_type const & operator[](CORBA::ULong i) const { + return impl_[i]; + } + inline value_type & operator[](CORBA::ULong i) { + return impl_[i]; + } + inline void replace( + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + impl_.replace(MAX, length, data, release); + } + inline value_type const * get_buffer() const { + return impl_.get_buffer(); + } + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + return impl_.get_buffer(orphan); + } + inline void swap(bounded_array_sequence & rhs) throw() { + impl_.swap(rhs.impl_); + } + static value_type * allocbuf(CORBA::ULong maximum) { + return implementation_type::allocbuf(maximum); + } + static void freebuf(value_type * buffer) { + implementation_type::freebuf(buffer); + } + +private: + implementation_type impl_; +}; +} + +namespace TAO +{ + template <typename stream, typename T_array, typename T_slice, typename T_tag, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> & target) { + typedef TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> sequence; + typedef TAO::Array_Traits<T_array, T_slice, T_tag> array_traits; + typedef TAO_Array_Forany_T <T_array, T_slice, T_tag> forany; + + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + for(CORBA::ULong i = 0; i < new_length; ++i) { + forany tmp (array_traits::alloc ()); + bool const _tao_marshal_flag = (strm >> tmp); + if (_tao_marshal_flag) { + array_traits::copy (buffer[i], tmp.in ()); + } + array_traits::free (tmp.inout ()); + if (!_tao_marshal_flag) { + return false; + } + } + tmp.swap(target); + return true; + } + + template <typename stream, typename T_array, typename T_slice, typename T_tag, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> & source) { + typedef TAO_FixedArray_Var_T <T_array, T_slice, T_tag> fixed_array; + typedef TAO::Array_Traits<T_array, T_slice, T_tag> array_traits; + typedef TAO_Array_Forany_T <T_array, T_slice, T_tag> forany; + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + for(CORBA::ULong i = 0; i < length; ++i) { + fixed_array tmp_array = array_traits::dup (source[i]); + forany tmp (tmp_array.inout ()); + if (!(strm << tmp)) { + return false; + } + } + return true; + } +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_array_sequence_hpp diff --git a/TAO/tao/Bounded_Basic_String_Sequence_T.h b/TAO/tao/Bounded_Basic_String_Sequence_T.h new file mode 100644 index 00000000000..da573662bc7 --- /dev/null +++ b/TAO/tao/Bounded_Basic_String_Sequence_T.h @@ -0,0 +1,118 @@ +#ifndef guard_bounded_basic_string_sequence_hpp +#define guard_bounded_basic_string_sequence_hpp +/** + * @file + * + * @brief Implement bounded sequences for strings and wide-strings. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "tao/Bounded_Reference_Allocation_Traits_T.h" +#include "tao/String_Traits_T.h" +#include "tao/Generic_Sequence_T.h" +#include "tao/String_Sequence_Element_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename charT, CORBA::ULong MAX> +class bounded_basic_string_sequence +{ +public: + typedef charT character_type; + typedef charT * value_type; + typedef charT const * const_value_type; + + typedef details::string_traits<charT,true> element_traits; + typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits; + + typedef details::string_sequence_element<element_traits> element_type; + typedef element_type subscript_type; + typedef const_value_type const_subscript_type; + + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + + /// @copydoc generic_sequence::generic_sequence + inline bounded_basic_string_sequence() + : impl_() + {} + /// @copydoc generic_sequence::generic_sequence + inline bounded_basic_string_sequence( + CORBA::ULong length, + value_type * data, + CORBA::Boolean release) + : impl_(MAX, length, data, release) + {} + /// @copydoc generic_sequence::maximum + inline CORBA::ULong maximum() const { + return impl_.maximum(); + } + /// @copydoc generic_sequence::release + inline CORBA::Boolean release() const { + return impl_.release(); + } + /// @copydoc generic_sequence::length + inline CORBA::ULong length() const { + return impl_.length(); + } + + /// @copydoc generic_sequence::length + inline void length(CORBA::ULong length) { + implementation_type::range::check_length(length, MAX); + impl_.length(length); + } + /// @copydoc generic_sequence::operator[] + inline const_value_type operator[](CORBA::ULong i) const { + return impl_[i]; + } + /// @copydoc generic_sequence::operator[] + inline element_type operator[](CORBA::ULong i) { + return element_type(impl_[i], release()); + } + /// @copydoc generic_sequence::get_buffer + inline const_value_type const * get_buffer() const { + return impl_.get_buffer(); + } + /// @copydoc generic_sequence::replace + inline void replace( + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + impl_.replace(MAX, length, data, release); + } + /// @copydoc generic_sequence::get_buffer(CORBA::Boolean) + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + return impl_.get_buffer(orphan); + } + inline void swap(bounded_basic_string_sequence & rhs) throw() { + impl_.swap(rhs.impl_); + } + + static value_type * allocbuf(CORBA::ULong maximum) + { + return implementation_type::allocbuf(maximum); + } + static value_type * allocbuf() { + return implementation_type::allocbuf(MAX); + } + static void freebuf(value_type * buffer) + { + implementation_type::freebuf(buffer); + } + +private: + implementation_type impl_; +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_basic_string_sequence_hpp diff --git a/TAO/tao/Bounded_Object_Reference_Sequence_T.h b/TAO/tao/Bounded_Object_Reference_Sequence_T.h new file mode 100644 index 00000000000..9754820576c --- /dev/null +++ b/TAO/tao/Bounded_Object_Reference_Sequence_T.h @@ -0,0 +1,105 @@ +#ifndef guard_bounded_object_reference_sequence_hpp +#define guard_bounded_object_reference_sequence_hpp +/** + * @file + * + * @brief Implement bounded sequences for object references. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "Bounded_Reference_Allocation_Traits_T.h" +#include "Object_Reference_Traits_T.h" +#include "Generic_Sequence_T.h" +#include "Object_Reference_Sequence_Element_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +template<typename object_t, typename object_t_var, CORBA::ULong MAX> +class bounded_object_reference_sequence +{ +public: + typedef object_t object_type; + typedef object_type * value_type; + typedef value_type const const_value_type; + typedef object_t_var object_type_var; + + typedef details::object_reference_traits<object_type,object_type_var,true> element_traits; + typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits; + + typedef details::object_reference_sequence_element<element_traits> element_type; + typedef element_type subscript_type; + typedef value_type const & const_subscript_type; + + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + + inline bounded_object_reference_sequence() + : impl_() + {} + inline bounded_object_reference_sequence( + CORBA::ULong length, + value_type * data, + CORBA::Boolean release) + : impl_(MAX, length, data, release) + {} + + /* Use default ctor, operator= and dtor */ + inline CORBA::ULong maximum() const { + return impl_.maximum(); + } + inline CORBA::Boolean release() const { + return impl_.release(); + } + inline CORBA::ULong length() const { + return impl_.length(); + } + + inline void length(CORBA::ULong length) { + implementation_type::range::check_length(length, MAX); + impl_.length(length); + } + inline value_type const & operator[](CORBA::ULong i) const { + return impl_[i]; + } + inline element_type operator[](CORBA::ULong i) { + return element_type(impl_[i], release()); + } + inline value_type const * get_buffer() const { + return impl_.get_buffer(); + } + inline void replace( + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + impl_.replace(MAX, length, data, release); + } + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + return impl_.get_buffer(orphan); + } + inline void swap(bounded_object_reference_sequence & rhs) throw() { + impl_.swap(rhs.impl_); + } + + static value_type * allocbuf(CORBA::ULong maximum) + { + return implementation_type::allocbuf(maximum); + } + static void freebuf(value_type * buffer) + { + implementation_type::freebuf(buffer); + } + + +private: + implementation_type impl_; +}; + +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_object_reference_sequence_hpp diff --git a/TAO/tao/Bounded_Reference_Allocation_Traits_T.h b/TAO/tao/Bounded_Reference_Allocation_Traits_T.h new file mode 100644 index 00000000000..b5ff17fca98 --- /dev/null +++ b/TAO/tao/Bounded_Reference_Allocation_Traits_T.h @@ -0,0 +1,65 @@ +#ifndef guard_bounded_reference_allocation_traits_hpp +#define guard_bounded_reference_allocation_traits_hpp +/** + * @file + * + * @brief Details can be found in the documentation for + * TAO::details::generic_sequence + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, class ref_traits, CORBA::ULong MAX, bool dummy> +struct bounded_reference_allocation_traits +{ + typedef T value_type; + typedef ref_traits reference_traits; + + inline static CORBA::ULong default_maximum() + { + return MAX; + } + + inline static value_type * default_buffer_allocation() + { + return allocbuf(MAX); + } + + inline static value_type * allocbuf(CORBA::ULong /* maximum */) + { + value_type * buffer = new value_type[MAX]; + // no throw + reference_traits::zero_range(buffer, buffer + MAX); + + return buffer; + } + + inline static void freebuf(value_type * buffer) + { + reference_traits::release_range(buffer, buffer + MAX); + delete[] buffer; + } + + inline static CORBA::ULong maximum() + { + return MAX; + } +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_reference_allocation_traits_hpp diff --git a/TAO/tao/Bounded_Sequence_CDR_T.h b/TAO/tao/Bounded_Sequence_CDR_T.h new file mode 100644 index 00000000000..b853eca2ea4 --- /dev/null +++ b/TAO/tao/Bounded_Sequence_CDR_T.h @@ -0,0 +1,485 @@ +#ifndef guard_bounded_sequence_cdr +#define guard_bounded_sequence_cdr +/** + * @file + * + * @brief Extract the sequence + * + * $Id$ + * + * @author Carlos O'Ryan + * @author Johnny Willemsen + */ + +#include "tao/Bounded_Basic_String_Sequence_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO { + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Short, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::Short, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_short_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Long, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::Long, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_long_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::ULong, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::ULong, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_ulong_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::UShort, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::UShort, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_ushort_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Octet, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::Octet, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_octet_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Char, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::Char, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_char_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + +# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::WChar, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::WChar, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_wchar_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } +#endif + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Float, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::Float, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_float_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Double, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::Double, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_double_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::ULongLong, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::ULongLong, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_ulonglong_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::LongDouble, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::LongDouble, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_longdouble_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <CORBA::Boolean, MAX> & target) { + typedef TAO::bounded_value_sequence <CORBA::Boolean, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_boolean_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, typename value_t, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_value_sequence <value_t, MAX> & target) { + typedef TAO::bounded_value_sequence <value_t, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + for(CORBA::ULong i = 0; i < new_length; ++i) { + if (!(strm >> buffer[i])) { + return false; + } + } + tmp.swap(target); + return true; + } + + template <typename stream, typename charT, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::details::bounded_basic_string_sequence <charT, MAX> & target) { + typedef typename TAO::details::bounded_basic_string_sequence <charT, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + for(CORBA::ULong i = 0; i < new_length; ++i) { + if (!(strm >> buffer[i])) { + return false; + } + } + tmp.swap(target); + return true; + } + + template <typename stream, typename object_t, typename object_t_var, CORBA::ULong MAX> + bool demarshal_sequence(stream & strm, TAO::bounded_object_reference_sequence<object_t, object_t_var, MAX> & target) { + typedef typename TAO::bounded_object_reference_sequence<object_t, object_t_var, MAX> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if ((new_length > strm.length()) || (new_length > target.maximum ())) { + return false; + } + sequence tmp; + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + for(CORBA::ULong i = 0; i < new_length; ++i) { + if (!(strm >> buffer[i])) { + return false; + } + } + tmp.swap(target); + return true; + } +} + +namespace TAO { + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Short, MAX> & source) { + const ::CORBA::ULong length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_short_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Long, MAX> & source) { + const ::CORBA::ULong length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_long_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::ULong, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_ulong_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::UShort, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_ushort_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Octet, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_octet_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Char, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_char_array (source.get_buffer (), length); + } + +# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::WChar, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_wchar_array (source.get_buffer (), length); + } +#endif + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Float, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_float_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Double, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_double_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::ULongLong, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_ulonglong_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::LongDouble, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_longdouble_array (source.get_buffer (), length); + } + + template <typename stream, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <CORBA::Boolean, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_boolean_array (source.get_buffer (), length); + } + + template <typename stream, typename value_t, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_value_sequence <value_t, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + for(CORBA::ULong i = 0; i < length; ++i) { + if (!(strm << source[i])) { + return false; + } + } + return true; + } + + template <typename stream, typename charT, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::details::bounded_basic_string_sequence <charT, MAX> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + for(CORBA::ULong i = 0; i < length; ++i) { + if (!(strm << source[i])) { + return false; + } + } + return true; + } + + template <typename stream, typename object_t, typename object_t_var, CORBA::ULong MAX> + bool marshal_sequence(stream & strm, const TAO::bounded_object_reference_sequence<object_t, object_t_var, MAX> & source) { + typedef typename TAO::bounded_object_reference_sequence<object_t, object_t_var, MAX>::object_type object_type; + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + for(CORBA::ULong i = 0; i < length; ++i) { + if (!TAO::Objref_Traits<object_type>::marshal (source[i], strm)) { + return false; + } + } + return true; + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif /* guard_bounded_sequence_cdr */ diff --git a/TAO/tao/Bounded_String_Sequence_T.h b/TAO/tao/Bounded_String_Sequence_T.h new file mode 100644 index 00000000000..9f6373343b6 --- /dev/null +++ b/TAO/tao/Bounded_String_Sequence_T.h @@ -0,0 +1,42 @@ +#ifndef guard_bounded_string_sequence_hpp +#define guard_bounded_string_sequence_hpp +/** + * @file + * + * @brief Implement bounded sequences for strings. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Bounded_Basic_String_Sequence_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +template<CORBA::ULong MAX> +class bounded_string_sequence + : public details::bounded_basic_string_sequence<char,MAX> +{ +public: + inline bounded_string_sequence() + : details::bounded_basic_string_sequence<char,MAX>() + {} + inline bounded_string_sequence( + CORBA::ULong length, + char * * data, + CORBA::Boolean release = false) + : details::bounded_basic_string_sequence<char,MAX>( + length, data, release) + {} +}; + + +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_string_sequence_hpp diff --git a/TAO/tao/Bounded_Value_Allocation_Traits_T.h b/TAO/tao/Bounded_Value_Allocation_Traits_T.h new file mode 100644 index 00000000000..aa94641e539 --- /dev/null +++ b/TAO/tao/Bounded_Value_Allocation_Traits_T.h @@ -0,0 +1,60 @@ +#ifndef guard_bounded_value_allocation_traits_hpp +#define guard_bounded_value_allocation_traits_hpp +/** + * @file + * + * @brief Details can be found in the documentation for + * TAO::details::generic_sequence + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, CORBA::ULong MAX, bool dummy> +struct bounded_value_allocation_traits +{ + typedef T value_type; + + inline static CORBA::ULong default_maximum() + { + return MAX; + } + + inline static value_type * default_buffer_allocation() + { + return allocbuf(MAX); + } + + inline static value_type * allocbuf(CORBA::ULong /* maximum */) + { + return new value_type[MAX]; + } + + inline static void freebuf(value_type * buffer) + { + delete[] buffer; + } + + inline static CORBA::ULong maximum() + { + return MAX; + } + /* static CORBA::ULong const MAXIMUM = MAX; */ +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_value_allocation_traits_hpp diff --git a/TAO/tao/Bounded_Value_Sequence_T.h b/TAO/tao/Bounded_Value_Sequence_T.h new file mode 100644 index 00000000000..dbb466fac3a --- /dev/null +++ b/TAO/tao/Bounded_Value_Sequence_T.h @@ -0,0 +1,100 @@ +#ifndef guard_bounded_value_sequence_hpp +#define guard_bounded_value_sequence_hpp +/** + * @file + * + * @brief Implement bounded sequences for types with value-like + * semantics. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Bounded_Value_Allocation_Traits_T.h" +#include "tao/Value_Traits_T.h" +#include "tao/Generic_Sequence_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +template<class T, CORBA::ULong MAX> +class bounded_value_sequence +{ +public: + typedef T value_type; + typedef T element_type; + typedef T const const_value_type; + typedef value_type & subscript_type; + typedef value_type const & const_subscript_type; + + typedef details::bounded_value_allocation_traits<value_type,MAX,true> allocation_traits; + typedef details::value_traits<value_type,true> element_traits; + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + + inline bounded_value_sequence() + : impl_() + {} + inline bounded_value_sequence( + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) + : impl_(MAX, length, data, release) + {} + /* Use default ctor, operator= and dtor */ + inline CORBA::ULong maximum() const { + return impl_.maximum(); + } + inline CORBA::Boolean release() const { + return impl_.release(); + } + inline CORBA::ULong length() const { + return impl_.length(); + } + inline void length(CORBA::ULong length) { + implementation_type::range::check_length(length, MAX); + impl_.length(length); + } + inline value_type const & operator[](CORBA::ULong i) const { + return impl_[i]; + } + inline value_type & operator[](CORBA::ULong i) { + return impl_[i]; + } + inline void replace( + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + impl_.replace(MAX, length, data, release); + } + inline value_type const * get_buffer() const { + return impl_.get_buffer(); + } + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + return impl_.get_buffer(orphan); + } + inline void swap(bounded_value_sequence & rhs) throw() { + impl_.swap(rhs.impl_); + } + static value_type * allocbuf(CORBA::ULong maximum) { + return implementation_type::allocbuf(maximum); + } + static value_type * allocbuf() { + return implementation_type::allocbuf(MAX); + } + static void freebuf(value_type * buffer) + { + implementation_type::freebuf(buffer); + } + +private: + implementation_type impl_; +}; + +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_string_sequence_hpp diff --git a/TAO/tao/Bounded_Wstring_Sequence_T.h b/TAO/tao/Bounded_Wstring_Sequence_T.h new file mode 100644 index 00000000000..c0ed84f289e --- /dev/null +++ b/TAO/tao/Bounded_Wstring_Sequence_T.h @@ -0,0 +1,42 @@ +#ifndef guard_bounded_wstring_sequence_hpp +#define guard_bounded_wstring_sequence_hpp +/** + * @file + * + * @brief Implement bounded sequences for wstrings. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Bounded_Basic_String_Sequence_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +template<CORBA::ULong MAX> +class bounded_wstring_sequence + : public details::bounded_basic_string_sequence<CORBA::WChar,MAX> +{ +public: + inline bounded_wstring_sequence() + : details::bounded_basic_string_sequence<CORBA::WChar,MAX>() + {} + inline bounded_wstring_sequence( + CORBA::ULong length, + CORBA::WChar * * data, + CORBA::Boolean release = false) + : details::bounded_basic_string_sequence<CORBA::WChar,MAX>( + length, data, release) + {} +}; + + +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_bounded_wstring_sequence_hpp diff --git a/TAO/tao/Buffering_Constraint_Policy.cpp b/TAO/tao/Buffering_Constraint_Policy.cpp index 89c04ea640a..a3d9ddd3cd0 100644 --- a/TAO/tao/Buffering_Constraint_Policy.cpp +++ b/TAO/tao/Buffering_Constraint_Policy.cpp @@ -11,7 +11,6 @@ ACE_RCSID (tao, Buffering_Constraint_Policy, "$Id$") - #if ! defined (__ACE_INLINE__) #include "tao/Buffering_Constraint_Policy.i" #endif /* __ACE_INLINE__ */ @@ -19,9 +18,9 @@ ACE_RCSID (tao, TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Buffering_Constraint_Policy::TAO_Buffering_Constraint_Policy (const TAO::BufferingConstraint &buffering_constraint) - : ACE_NESTED_CLASS (CORBA, Object) () - , ACE_NESTED_CLASS (CORBA, Policy) () - , ACE_NESTED_CLASS (CORBA, LocalObject) () + : ::CORBA::Object () + , ::CORBA::Policy () + , ::CORBA::LocalObject () , TAO::BufferingConstraintPolicy () , TAO_Local_RefCounted_Object () , buffering_constraint_ (buffering_constraint) @@ -30,9 +29,9 @@ TAO_Buffering_Constraint_Policy::TAO_Buffering_Constraint_Policy (const TAO::Buf TAO_Buffering_Constraint_Policy::TAO_Buffering_Constraint_Policy (const TAO_Buffering_Constraint_Policy &rhs) - : ACE_NESTED_CLASS (CORBA, Object) () - , ACE_NESTED_CLASS (CORBA, Policy) () - , ACE_NESTED_CLASS (CORBA, LocalObject) () + : ::CORBA::Object () + , ::CORBA::Policy () + , ::CORBA::LocalObject () , TAO::BufferingConstraintPolicy () , TAO_Local_RefCounted_Object () , buffering_constraint_ (rhs.buffering_constraint_) diff --git a/TAO/tao/Buffering_Constraint_Policy.h b/TAO/tao/Buffering_Constraint_Policy.h index f6b336801cc..4c7c107a01a 100644 --- a/TAO/tao/Buffering_Constraint_Policy.h +++ b/TAO/tao/Buffering_Constraint_Policy.h @@ -58,6 +58,7 @@ public: virtual TAO::BufferingConstraint buffering_constraint (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); + void get_buffering_constraint (TAO::BufferingConstraint &) const; virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) diff --git a/TAO/tao/CONV_FRAMEC.cpp b/TAO/tao/CONV_FRAMEC.cpp index 42f84796b58..ba3c2fe9440 100644 --- a/TAO/tao/CONV_FRAMEC.cpp +++ b/TAO/tao/CONV_FRAMEC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CONV_FRAME_CODESETIDSEQ_CS_) @@ -55,7 +55,7 @@ CONV_FRAME::CodeSetIdSeq::CodeSetIdSeq (void) CONV_FRAME::CodeSetIdSeq::CodeSetIdSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CodeSetId > (max) @@ -67,7 +67,7 @@ CONV_FRAME::CodeSetIdSeq::CodeSetIdSeq ( CORBA::ULong * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CodeSetId > (max, length, buffer, release) @@ -76,7 +76,7 @@ CONV_FRAME::CodeSetIdSeq::CodeSetIdSeq ( CONV_FRAME::CodeSetIdSeq::CodeSetIdSeq ( const CodeSetIdSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CodeSetId > (seq) @@ -96,10 +96,10 @@ void CONV_FRAME::CodeSetIdSeq::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void CONV_FRAME::CodeSetComponent::_tao_any_destructor ( void *_tao_void_pointer ) @@ -109,10 +109,10 @@ CONV_FRAME::CodeSetComponent::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void CONV_FRAME::CodeSetComponentInfo::_tao_any_destructor ( void *_tao_void_pointer ) @@ -122,10 +122,10 @@ CONV_FRAME::CodeSetComponentInfo::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void CONV_FRAME::CodeSetContext::_tao_any_destructor ( void *_tao_void_pointer ) @@ -146,15 +146,7 @@ CORBA::Boolean operator<< ( const CONV_FRAME::CodeSetIdSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -162,33 +154,7 @@ CORBA::Boolean operator>> ( CONV_FRAME::CodeSetIdSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CONV_FRAME_CodeSetIdSeq_CPP_ */ diff --git a/TAO/tao/CONV_FRAMEC.h b/TAO/tao/CONV_FRAMEC.h index 8e76fe5ec34..5a5df45164f 100644 --- a/TAO/tao/CONV_FRAMEC.h +++ b/TAO/tao/CONV_FRAMEC.h @@ -65,39 +65,36 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CONV_FRAME { - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::ULong CodeSetId; typedef CORBA::ULong_out CodeSetId_out; - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CONV_FRAME_CODESETIDSEQ_CH_) #define _CONV_FRAME_CODESETIDSEQ_CH_ - + class CodeSetIdSeq; - + typedef TAO_FixedSeq_Var_T< - CodeSetIdSeq, - CodeSetId + CodeSetIdSeq > CodeSetIdSeq_var; - + typedef TAO_Seq_Out_T< - CodeSetIdSeq, - CodeSetIdSeq_var, - CodeSetId + CodeSetIdSeq > CodeSetIdSeq_out; - + class TAO_Export CodeSetIdSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CodeSetId > { @@ -107,101 +104,101 @@ namespace CONV_FRAME CodeSetIdSeq ( CORBA::ULong max, CORBA::ULong length, - CORBA::ULong* buffer, - CORBA::Boolean release = 0 + CORBA::ULong* buffer, + CORBA::Boolean release = false ); CodeSetIdSeq (const CodeSetIdSeq &); ~CodeSetIdSeq (void); - + static void _tao_any_destructor (void *); - + typedef CodeSetIdSeq_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct CodeSetComponent; - + typedef TAO_Var_Var_T< CodeSetComponent > CodeSetComponent_var; - + typedef TAO_Out_T< CodeSetComponent, CodeSetComponent_var > CodeSetComponent_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export CodeSetComponent { typedef CodeSetComponent_var _var_type; - + static void _tao_any_destructor (void *); CONV_FRAME::CodeSetId native_code_set; CONV_FRAME::CodeSetIdSeq conversion_code_sets; }; - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct CodeSetComponentInfo; - + typedef TAO_Var_Var_T< CodeSetComponentInfo > CodeSetComponentInfo_var; - + typedef TAO_Out_T< CodeSetComponentInfo, CodeSetComponentInfo_var > CodeSetComponentInfo_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export CodeSetComponentInfo { typedef CodeSetComponentInfo_var _var_type; - + static void _tao_any_destructor (void *); CONV_FRAME::CodeSetComponent ForCharData; CONV_FRAME::CodeSetComponent ForWcharData; }; - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct CodeSetContext; - + typedef TAO_Fixed_Var_T< CodeSetContext > CodeSetContext_var; - + typedef CodeSetContext & CodeSetContext_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export CodeSetContext { typedef CodeSetContext_var _var_type; - + static void _tao_any_destructor (void *); CONV_FRAME::CodeSetId char_data; CONV_FRAME::CodeSetId wchar_data; diff --git a/TAO/tao/CORBA_String.cpp b/TAO/tao/CORBA_String.cpp index 583be67aded..f1787d50852 100644 --- a/TAO/tao/CORBA_String.cpp +++ b/TAO/tao/CORBA_String.cpp @@ -1,5 +1,5 @@ #include "tao/CORBA_String.h" -#include "tao/Managed_Types.h" +#include "tao/String_Manager_T.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_wchar.h" @@ -18,216 +18,6 @@ ACE_RCSID (tao, TAO_BEGIN_VERSIONED_NAMESPACE_DECL -char * -CORBA::string_dup (const char *str) -{ - if (!str) - { - errno = EINVAL; - return 0; - } - - const size_t len = ACE_OS::strlen (str); - - // This allocates an extra byte for the '\0'; - char * copy = CORBA::string_alloc (static_cast<CORBA::ULong> (len)); - - // The memcpy() below assumes that the destination is a valid buffer. - if (copy == 0) - { - return 0; - } - - ACE_OS::memcpy (copy, - str, - len + 1); - return copy; -} - -char * -CORBA::string_alloc (CORBA::ULong len) -{ - // Allocate 1 + strlen to accomodate the null terminating character. - - char *s = 0; - ACE_NEW_RETURN (s, - char[size_t (len + 1)], - 0); - - s[0]= '\0'; - - return s; -} - -void -CORBA::string_free (char *str) -{ - delete [] str; -} - -// **************************************************************** - -CORBA::WChar* -CORBA::wstring_dup (const WChar *const str) -{ - if (!str) - { - errno = EINVAL; - return 0; - } - - CORBA::WChar* retval = - CORBA::wstring_alloc (static_cast <CORBA::ULong> (ACE_OS::strlen (str))); - - // The wscpy() below assumes that the destination is a valid buffer. - if (retval == 0) - { - return 0; - } - - return ACE_OS::wscpy (retval, - str); -} - -CORBA::WChar* -CORBA::wstring_alloc (CORBA::ULong len) -{ - CORBA::WChar *s = 0; - ACE_NEW_RETURN (s, - CORBA::WChar [(size_t) (len + 1)], - 0); - - return s; -} - -void -CORBA::wstring_free (CORBA::WChar *const str) -{ - delete [] str; -} - -// **************************************************************** - -CORBA::String_var::String_var (char *p) - : ptr_ (p) -{ - // NOTE: According to the CORBA spec this string must *not* be - // copied, but it is non-compliant to use it/release it in the - // calling code. argument is consumed. p should never be NULL -} - -CORBA::String_var::String_var (const CORBA::String_var& r) -{ - this->ptr_ = CORBA::string_dup (r.ptr_); -} - -CORBA::String_var::~String_var (void) -{ - CORBA::string_free (this->ptr_); - this->ptr_ = 0; -} - -CORBA::String_var & -CORBA::String_var::operator= (char *p) -{ - if (this->ptr_ != p) - { - CORBA::string_free (this->ptr_); - this->ptr_ = p; - } - return *this; -} - -CORBA::String_var & -CORBA::String_var::operator= (const char *p) -{ - CORBA::string_free (this->ptr_); - - this->ptr_ = CORBA::string_dup (p); - return *this; -} - -CORBA::String_var & -CORBA::String_var::operator= (const CORBA::String_var& r) -{ - if (this != &r) - { - CORBA::string_free (this->ptr_); - this->ptr_ = CORBA::string_dup (r.ptr_); - } - return *this; -} - -// **************************************************************** - -CORBA::WString_var::WString_var (CORBA::WChar *p) - : ptr_ (p) -{ - // NOTE: According to the CORBA spec this string must *not* be - // copied, but it is non-compliant to use it/release it in the - // calling code. argument is consumed. p should never be NULL -} - -CORBA::WString_var::WString_var (const CORBA::WString_var& r) -{ - this->ptr_ = CORBA::wstring_dup (r.ptr_); -} - -CORBA::WString_var::~WString_var (void) -{ - CORBA::wstring_free (this->ptr_); - this->ptr_ = 0; -} - -CORBA::WString_var & -CORBA::WString_var::operator= (CORBA::WChar *p) -{ - if (this->ptr_ != p) - { - CORBA::wstring_free (this->ptr_); - this->ptr_ = p; - } - return *this; -} - -CORBA::WString_var & -CORBA::WString_var::operator= (const CORBA::WChar *p) -{ - CORBA::wstring_free (this->ptr_); - - this->ptr_ = CORBA::wstring_dup (p); - return *this; -} - -CORBA::WString_var & -CORBA::WString_var::operator= (const CORBA::WString_var& r) -{ - if (this != &r) - { - CORBA::wstring_free (this->ptr_); - this->ptr_ = CORBA::wstring_dup (r.ptr_); - } - return *this; -} - -// These methods moved to the CPP file to avoid cyclic dependencies. -// ---------------------------------------------------- -// String_out type -// ---------------------------------------------------- -CORBA::String_out::String_out (TAO_String_Manager &s) - : ptr_ (s.out ()) -{ -} - -// ---------------------------------------------------- -// WString_out type -// ---------------------------------------------------- -CORBA::WString_out::WString_out (TAO_WString_Manager &s) - : ptr_ (s.out ()) -{ -} - - // ************************************************************* // C++ iostream operators for (W)String_var and (W)String_out // ************************************************************* @@ -275,7 +65,7 @@ operator>> (istream &is, CORBA::String_out &so) ostream & operator<< (ostream &os, const CORBA::WString_var &wsv) { - const CORBA::ULong len = + CORBA::ULong const len = static_cast <CORBA::ULong> (ACE_OS::strlen (wsv.in ())); for (CORBA::ULong i = 0; i < len; ++i) @@ -291,7 +81,7 @@ operator>> (istream &is, CORBA::WString_var &wsv) { is.seekg (0, ios::end); // @@ is.tellg()/sizeof(CORBA::WChar) instead? - const CORBA::ULong len = is.tellg (); + CORBA::ULong const len = is.tellg (); wsv = CORBA::wstring_alloc (len); is.seekg (0, ios::beg); diff --git a/TAO/tao/CORBA_String.h b/TAO/tao/CORBA_String.h index d4c8f58fa51..810a73e0424 100644 --- a/TAO/tao/CORBA_String.h +++ b/TAO/tao/CORBA_String.h @@ -23,106 +23,143 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/String_Traits_Base_T.h" // For the (W)String_var and (W)String_out iostream operators. #include "ace/iosfwd.h" -TAO_BEGIN_VERSIONED_NAMESPACE_DECL +#include <algorithm> -class TAO_String_Manager; -class TAO_WString_Manager; +TAO_BEGIN_VERSIONED_NAMESPACE_DECL -namespace CORBA +namespace TAO { - /** - * @name CORBA String Memory Management - * - * CORBA string memory management functions. - */ - //@{ - TAO_Export char * string_alloc (ULong len); - TAO_Export char * string_dup (const char *); - TAO_Export void string_free (char *); - //@} - - /** - * @name CORBA Wide String Memory Management - * - * CORBA wide string memory management functions. - */ - //@{ - TAO_Export WChar * wstring_alloc (ULong len); - TAO_Export WChar * wstring_dup (const WChar * const); - TAO_Export void wstring_free (WChar * const); - //@} + template <typename charT> class String_Manager_T; // Forward declaration. + typedef String_Manager_T<CORBA::Char> String_Manager; + typedef String_Manager_T<CORBA::WChar> WString_Manager; +} +namespace TAO +{ /** * @class String_var * - * @brief CORBA::String var class. - * * Provides automatic deallocation of storage for the string once it * goes out of scope. */ - class TAO_Export String_var + template <typename charT> + class String_var { public: + typedef charT character_type; + typedef TAO::details::string_traits_base <character_type> s_traits; + /// Default constructor. - String_var (void); + inline String_var (void) : ptr_ (0) + { + } /// Constructor, owns p. - String_var (char *p); - - /// constructor. Makes a copy of p. - String_var (const char *p); - - /// copy constructor. - String_var (const String_var &s); + inline String_var (character_type *p) : ptr_ (p) + { + } - /// destructor. - ~String_var (void); + /// Constructor. Makes a copy of p. + inline String_var (const character_type *p) : ptr_ (s_traits::duplicate (p)) + { + } - /// assignment operator. - String_var &operator= (char *p); - - /// assignment to a const char*. Makes a copy. - String_var &operator= (const char *p); - - /// assignment operator. - String_var &operator= (const String_var &s); + /// Copy constructor. + inline String_var (String_var<charT> const &s) : ptr_(s_traits::duplicate(s.ptr_)) + { + } + + /// Destructor. + inline ~String_var (void) + { + s_traits::release (this->ptr_); + } + + /// Assignment operator. + inline String_var &operator= (character_type *p) + { + String_var <charT> tmp (p); + std::swap (this->ptr_, tmp.ptr_); + return *this; + } + + /// Assignment to a const char*. Makes a copy. + inline String_var &operator= (const character_type *p) + { + String_var <charT> tmp (p); + std::swap (this->ptr_, tmp.ptr_); + return *this; + } + + /// Assignment operator. + inline String_var &operator= (String_var<character_type> const &s) + { + String_var <charT> tmp (s); + std::swap (this->ptr_, tmp.ptr_); + return *this; + } /// Spec-defined read/write version. - operator char *&(); - - /// only read privileges. - operator const char *() const; - - /// allows access and modification using an slot. - char &operator[] (CORBA::ULong slot); - - /// allows only accessing thru an slot. - char operator[] (CORBA::ULong slot) const; - - // = in, out, out, and _retn operations. - // ORBOS/97-05-15, Appendix C.2 - - /// for in parameter. - const char *in (void) const; - - /// for inout parameter. - char *&inout (void); - - /// for out parameter. - char *&out (void); - - /// for string of return type. - char *_retn (void); - - /// TAO extension. - char *ptr (void); + inline operator character_type *&() + { + return this->ptr_; + } + + /// Only read privileges. + inline operator const character_type *() const + { + return this->ptr_; + } + + /// Allows access and modification using an slot. + inline character_type &operator[] (CORBA::ULong slot) + { + // We need to verify bounds else raise some exception. + return this->ptr_[slot]; + } + + /// Allows only accessing thru an slot. + inline character_type operator[] (CORBA::ULong slot) const + { + // We need to verify bounds else raise some exception. + return this->ptr_[slot]; + } + + /// For in parameter. + inline const character_type *in (void) const + { + return this->ptr_; + } + + /// For inout parameter. + inline character_type *&inout (void) + { + return this->ptr_; + } + + /// For out parameter. + inline character_type *&out (void) + { + s_traits::release (this->ptr_); + this->ptr_ = 0; + return this->ptr_; + } + + /// For string of return type. + inline character_type *_retn (void) + { + character_type *temp = this->ptr_; + this->ptr_ = 0; + return temp; + } private: - /// instance. - char *ptr_; + /// Instance. + character_type *ptr_; }; /** @@ -131,171 +168,78 @@ namespace CORBA * @brief String_out * * To support the memory management for "out" parameter passing - * mode. ORBOS/97-05-15, Appendix C.2 defines a CORBA::String_out - * class + * mode. */ - class TAO_Export String_out + template <typename charT> + class String_out { public: + typedef charT character_type; + typedef TAO::details::string_traits_base <character_type> s_traits; + typedef typename s_traits::string_mgr string_mgr; /// Construction from a reference to a string. - String_out (char *&p); + inline String_out (character_type *&p) : ptr_ (p) + { + this->ptr_ = 0; + } /// Construction from a var. - String_out (CORBA::String_var &p); + inline String_out (String_var <character_type> &p) : ptr_ (p.out ()) + { + } - /// Construction from a TAO_String_Manager. - String_out (TAO_String_Manager &p); + /// Construction from a TAO::String_Manager. + inline String_out (string_mgr &p) : ptr_ (p.out ()) + { + } /// Copy constructor. - String_out (const String_out &s); + inline String_out (const String_out<charT> &s) : ptr_ (s.ptr_) + { + } /// Assignment from a string_out. - String_out &operator= (const String_out &s); + inline String_out &operator= (String_out<charT> const &s) + { + this->ptr_ = s.ptr_; + return *this; + } /// Assignment from a string. - String_out &operator= (char *p); + inline String_out &operator= (character_type *p) + { + this->ptr_ = p; + return *this; + } /// Assignment from a constant char*. - String_out& operator= (const char* p); - - /// Cast. - operator char *&(); - - /// Return underlying instance. - char *&ptr (void); - - private: - /// Instance. - char *&ptr_; - - // assignment from _var disallowed - void operator= (const CORBA::String_var &); - }; - - // **************************************************************** - - /** - * @class WString_var - * - * @brief CORBA::WString var class. - * - * Provides automatic deallocation of storage for wide strings. - */ - class TAO_Export WString_var - { - public: - /// default constructor. - WString_var (void); - - /// constructor, owns p. - WString_var (CORBA::WChar *p); - - /// constructor. Makes a copy of p. - WString_var (const CORBA::WChar *p); - - /// copy constructor. - WString_var (const WString_var &s); - - /// destructor. - ~WString_var (void); - - /// assignment operator. - WString_var &operator= (CORBA::WChar *p); - - /// assignment to a const char*. Makes a copy. - WString_var &operator= (const CORBA::WChar *p); - - /// assignment operator. - WString_var &operator= (const WString_var &s); - - /// access and modify. - operator CORBA::WChar *&(); - - /// only read privileges. - operator const CORBA::WChar *() const; - - /// allows access and modification using an slot. - CORBA::WChar &operator[] (CORBA::ULong slot); - - /// allows only accessing thru an slot. - CORBA::WChar operator[] (CORBA::ULong slot) const; - - // = in, out, out, and _retn operations. - // ORBOS/97-05-15, Appendix C.2 - - /// for in parameter. - const CORBA::WChar *in (void) const; - - /// for inout parameter. - CORBA::WChar *&inout (void); - - /// for out parameter. - CORBA::WChar *&out (void); - - /// for string of return type. - CORBA::WChar *_retn (void); - - /// TAO extension. - CORBA::WChar *ptr (void); - - private: - /// instance. - CORBA::WChar *ptr_; - }; - - /** - * @class WString_out - * - * @brief WString_out - * - * To support the memory management for "out" parameter passing - * mode. ORBOS/97-05-15, Appendix C.2 defines a CORBA::WString_out - * class. - */ - class TAO_Export WString_out - { - public: - - /// Construction from a reference to a string. - WString_out (CORBA::WChar *&p); - - /// Construction from a var. - WString_out (CORBA::WString_var &p); - - /// Construction from a TAO_WString_Manager. - WString_out (TAO_WString_Manager &p); - - /// Copy constructor. - WString_out (const WString_out &s); - - /// Assignment from a string_out. - WString_out &operator= (const WString_out &s); - - /// Assignment from a string. - WString_out &operator= (CORBA::WChar *p); - - /// Assignment from a constant CORBA::WChar*. - WString_out& operator= (const CORBA::WChar *p); + inline String_out& operator= (const character_type* p) + { + this->ptr_ = s_traits::duplicate (p); + return *this; + } /// Cast. - operator CORBA::WChar *&(); + inline operator character_type *&() + { + return this->ptr_; + } /// Return underlying instance. - CORBA::WChar *&ptr (void); + inline character_type *&ptr (void) + { + return this->ptr_; + } private: /// Instance. - CORBA::WChar *&ptr_; + character_type *&ptr_; - // assignment from _var disallowed - void operator= (const CORBA::WString_var &); + // Assignment from _var disallowed + void operator= (const typename s_traits::string_var &); }; -} // End CORBA namespace. - -namespace TAO -{ /** * @struct TAO-specific @c {W}String_var Equality Functor * @@ -312,6 +256,15 @@ namespace TAO }; } +namespace CORBA +{ + typedef TAO::String_var <char> String_var; + typedef TAO::String_out <char> String_out; + typedef TAO::String_var <CORBA::WChar> WString_var; + typedef TAO::String_out <CORBA::WChar> WString_out; +} + + # if !defined (ACE_LACKS_IOSTREAM_TOTALLY) TAO_Export ostream & diff --git a/TAO/tao/CORBA_String.inl b/TAO/tao/CORBA_String.inl index 90433d8095b..daeecf0628c 100644 --- a/TAO/tao/CORBA_String.inl +++ b/TAO/tao/CORBA_String.inl @@ -2,282 +2,10 @@ // // $Id$ -// ---------------------------------------------------------------------- -// String_var type -// ---------------------------------------------------------------------- - #include "ace/OS_NS_string.h" -// #include "ace/OS_NS_wchar.h" - TAO_BEGIN_VERSIONED_NAMESPACE_DECL -ACE_INLINE -CORBA::String_var::String_var (void) - : ptr_ (0) -{ -} - -ACE_INLINE -CORBA::String_var::String_var (const char *p) - : ptr_ (CORBA::string_dup (p)) -{ -} - -ACE_INLINE CORBA::Char & -CORBA::String_var::operator[] (CORBA::ULong slot) -{ - // We need to verify bounds else raise some exception. - return this->ptr_[slot]; -} - -ACE_INLINE CORBA::Char -CORBA::String_var::operator[] (CORBA::ULong slot) const -{ - // We need to verify bounds else raise some exception. - return this->ptr_[slot]; -} - -ACE_INLINE -CORBA::String_var::operator char *&() -{ - return this->ptr_; -} - -ACE_INLINE -CORBA::String_var::operator const char *() const -{ - return this->ptr_; -} - -ACE_INLINE const char * -CORBA::String_var::in (void) const -{ - return this->ptr_; -} - -ACE_INLINE char *& -CORBA::String_var::inout (void) -{ - return this->ptr_; -} - -ACE_INLINE char *& -CORBA::String_var::out (void) -{ - CORBA::string_free (this->ptr_); - this->ptr_ = 0; - return this->ptr_; -} - -ACE_INLINE char * -CORBA::String_var::_retn (void) -{ - char *temp = this->ptr_; - this->ptr_ = 0; - return temp; -} - -/// TAO extension. -ACE_INLINE char * -CORBA::String_var::ptr (void) -{ - return this->ptr_; -} - -// ---------------------------------------------------- -// String_out type -// ---------------------------------------------------- - -ACE_INLINE -CORBA::String_out::String_out (char *&s) - : ptr_ (s) -{ - this->ptr_ = 0; -} - -ACE_INLINE -CORBA::String_out::String_out (CORBA::String_var &s) - : ptr_ (s.out ()) -{ -} - -ACE_INLINE -CORBA::String_out::String_out (const CORBA::String_out &s) - : ptr_ (s.ptr_) -{ -} - -ACE_INLINE CORBA::String_out & -CORBA::String_out::operator= (const CORBA::String_out &s) -{ - this->ptr_ = s.ptr_; - return *this; -} - -ACE_INLINE CORBA::String_out & -CORBA::String_out::operator= (char *p) -{ - this->ptr_ = p; - return *this; -} - -ACE_INLINE CORBA::String_out & -CORBA::String_out::operator= (const char *p) -{ - this->ptr_ = CORBA::string_dup (p); - return *this; -} - -ACE_INLINE -CORBA::String_out::operator char *&() -{ - return this->ptr_; -} - -ACE_INLINE char *& -CORBA::String_out::ptr (void) -{ - return this->ptr_; -} - -// **************************************************************** - -// ---------------------------------------------------------------------- -// String_var type -// ---------------------------------------------------------------------- - -ACE_INLINE -CORBA::WString_var::WString_var (void) - : ptr_ (0) -{ -} - -ACE_INLINE -CORBA::WString_var::WString_var (const CORBA::WChar *p) - : ptr_ (CORBA::wstring_dup (p)) -{ -} - -ACE_INLINE CORBA::WChar & -CORBA::WString_var::operator[] (CORBA::ULong slot) -{ - // @@ We need to verify bounds else raise some exception. - return this->ptr_[slot]; -} - -ACE_INLINE CORBA::WChar -CORBA::WString_var::operator[] (CORBA::ULong slot) const -{ - // @@ We need to verify bounds else raise some exception. - return this->ptr_[slot]; -} - -ACE_INLINE -CORBA::WString_var::operator CORBA::WChar *&() -{ - return this->ptr_; -} - -ACE_INLINE -CORBA::WString_var::operator const CORBA::WChar *() const -{ - return this->ptr_; -} - -ACE_INLINE const CORBA::WChar * -CORBA::WString_var::in (void) const -{ - return this->ptr_; -} - -ACE_INLINE CORBA::WChar *& -CORBA::WString_var::inout (void) -{ - return this->ptr_; -} - -ACE_INLINE CORBA::WChar *& -CORBA::WString_var::out (void) -{ - CORBA::wstring_free (this->ptr_); - this->ptr_ = 0; - return this->ptr_; -} - -ACE_INLINE CORBA::WChar * -CORBA::WString_var::_retn (void) -{ - CORBA::WChar *temp = this->ptr_; - this->ptr_ = 0; - return temp; -} - -/// TAO extension. -ACE_INLINE CORBA::WChar * -CORBA::WString_var::ptr (void) -{ - return this->ptr_; -} - -// ---------------------------------------------------- -// String_out type -// ---------------------------------------------------- - -ACE_INLINE -CORBA::WString_out::WString_out (CORBA::WChar *&s) - : ptr_ (s) -{ - this->ptr_ = 0; -} - -ACE_INLINE -CORBA::WString_out::WString_out (CORBA::WString_var &s) - : ptr_ (s.out ()) -{ -} - -ACE_INLINE -CORBA::WString_out::WString_out (const CORBA::WString_out &s) - : ptr_ (s.ptr_) -{ -} - -ACE_INLINE CORBA::WString_out & -CORBA::WString_out::operator= (const CORBA::WString_out &s) -{ - this->ptr_ = s.ptr_; - return *this; -} - -ACE_INLINE CORBA::WString_out & -CORBA::WString_out::operator= (CORBA::WChar *p) -{ - this->ptr_ = p; - return *this; -} - -ACE_INLINE CORBA::WString_out & -CORBA::WString_out::operator= (const CORBA::WChar *p) -{ - this->ptr_ = CORBA::wstring_dup (p); - return *this; -} - -ACE_INLINE -CORBA::WString_out::operator CORBA::WChar *&() -{ - return this->ptr_; -} - -ACE_INLINE CORBA::WChar *& -CORBA::WString_out::ptr (void) -{ - return this->ptr_; -} - -// ---------------------------------------------------------------------- - ACE_INLINE bool TAO::String_Var_Equal_To::operator() (CORBA::String_var const & lhs, CORBA::String_var const & rhs) const diff --git a/TAO/tao/CharSeqC.cpp b/TAO/tao/CharSeqC.cpp index dda2d2a7878..3fe1def2892 100644 --- a/TAO/tao/CharSeqC.cpp +++ b/TAO/tao/CharSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_CHARSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::CharSeq::CharSeq (void) CORBA::CharSeq::CharSeq ( ::CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Char > (max) @@ -67,7 +67,7 @@ CORBA::CharSeq::CharSeq ( ::CORBA::Char * buffer, ::CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Char > (max, length, buffer, release) @@ -76,7 +76,7 @@ CORBA::CharSeq::CharSeq ( CORBA::CharSeq::CharSeq ( const CharSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Char > (seq) @@ -107,15 +107,7 @@ void CORBA::CharSeq::_tao_any_destructor ( const CORBA::CharSeq &_tao_sequence ) { - const ::CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_char_array ((const char *)_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } ::CORBA::Boolean operator>> ( @@ -123,33 +115,7 @@ void CORBA::CharSeq::_tao_any_destructor ( CORBA::CharSeq &_tao_sequence ) { - ::CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_char_array ((char *)_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_CharSeq_CPP_ */ diff --git a/TAO/tao/CharSeqC.h b/TAO/tao/CharSeqC.h index 39ead7275b3..310fa885715 100644 --- a/TAO/tao/CharSeqC.h +++ b/TAO/tao/CharSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_CHARSEQ_CH_) #define _CORBA_CHARSEQ_CH_ - + class CharSeq; - + typedef TAO_FixedSeq_Var_T< - CharSeq, - CORBA::Char + CharSeq > CharSeq_var; - + typedef TAO_Seq_Out_T< - CharSeq, - CharSeq_var, - CORBA::Char + CharSeq > CharSeq_out; - + class TAO_Export CharSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Char > { @@ -95,14 +92,14 @@ namespace CORBA CharSeq ( ::CORBA::ULong max, ::CORBA::ULong length, - ::CORBA::Char* buffer, - ::CORBA::Boolean release = 0 + ::CORBA::Char* buffer, + ::CORBA::Boolean release = false ); CharSeq (const CharSeq &); ~CharSeq (void); - + static void _tao_any_destructor (void *); - + typedef CharSeq_var _var_type; }; diff --git a/TAO/tao/CodecFactory/IOP_CodecC.cpp b/TAO/tao/CodecFactory/IOP_CodecC.cpp index 0445a72c755..d68677a5975 100644 --- a/TAO/tao/CodecFactory/IOP_CodecC.cpp +++ b/TAO/tao/CodecFactory/IOP_CodecC.cpp @@ -72,7 +72,7 @@ TAO::Objref_Traits<IOP::Codec>::release ( IOP::Codec_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } IOP::Codec_ptr @@ -116,7 +116,7 @@ IOP::Codec::InvalidTypeForEncoding::InvalidTypeForEncoding (const ::IOP::Codec:: IOP::Codec::InvalidTypeForEncoding& IOP::Codec::InvalidTypeForEncoding::operator= (const ::IOP::Codec::InvalidTypeForEncoding &_tao_excp) { - this->ACE_NESTED_CLASS ( ::CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); return *this; } @@ -203,7 +203,7 @@ static TAO::TypeCode::Struct<char const *, ::CORBA::TypeCode_ptr const IOP::Codec::_tc_InvalidTypeForEncoding = &_tao_tc_IOP_Codec_InvalidTypeForEncoding; -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_exception/exception_cs.cpp:63 IOP::Codec::FormatMismatch::FormatMismatch (void) @@ -229,7 +229,7 @@ IOP::Codec::FormatMismatch::FormatMismatch (const ::IOP::Codec::FormatMismatch & IOP::Codec::FormatMismatch& IOP::Codec::FormatMismatch::operator= (const ::IOP::Codec::FormatMismatch &_tao_excp) { - this->ACE_NESTED_CLASS ( ::CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); return *this; } @@ -312,11 +312,11 @@ static TAO::TypeCode::Struct<char const *, "FormatMismatch", _tao_fields_IOP_Codec_FormatMismatch, 0); - + ::CORBA::TypeCode_ptr const IOP::Codec::_tc_FormatMismatch = &_tao_tc_IOP_Codec_FormatMismatch; -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_exception/exception_cs.cpp:63 IOP::Codec::TypeMismatch::TypeMismatch (void) @@ -342,7 +342,7 @@ IOP::Codec::TypeMismatch::TypeMismatch (const ::IOP::Codec::TypeMismatch &_tao_e IOP::Codec::TypeMismatch& IOP::Codec::TypeMismatch::operator= (const ::IOP::Codec::TypeMismatch &_tao_excp) { - this->ACE_NESTED_CLASS ( ::CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); return *this; } @@ -425,7 +425,7 @@ static TAO::TypeCode::Struct<char const *, "TypeMismatch", _tao_fields_IOP_Codec_TypeMismatch, 0); - + ::CORBA::TypeCode_ptr const IOP::Codec::_tc_TypeMismatch = &_tao_tc_IOP_Codec_TypeMismatch; @@ -460,18 +460,18 @@ IOP::Codec::_unchecked_narrow ( IOP::Codec_ptr IOP::Codec::_duplicate (Codec_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } - + return obj; } void IOP::Codec::_tao_release (Codec_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } ::CORBA::Boolean @@ -523,7 +523,7 @@ static TAO::TypeCode::Objref<char const *, ::CORBA::tk_local_interface, "IDL:omg.org/IOP/Codec:1.0", "Codec"); - + namespace IOP { ::CORBA::TypeCode_ptr const _tc_Codec = @@ -543,7 +543,7 @@ static TAO::TypeCode::Alias<char const *, "IDL:omg.org/IOP/EncodingFormat:1.0", "EncodingFormat", &CORBA::_tc_short); - + namespace IOP { ::CORBA::TypeCode_ptr const _tc_EncodingFormat = @@ -560,7 +560,7 @@ static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> { "format", &IOP::_tc_EncodingFormat }, { "major_version", &CORBA::_tc_octet }, { "minor_version", &CORBA::_tc_octet } - + }; static TAO::TypeCode::Struct<char const *, ::CORBA::TypeCode_ptr const *, @@ -572,7 +572,7 @@ static TAO::TypeCode::Struct<char const *, "Encoding", _tao_fields_IOP_Encoding, 3); - + namespace IOP { ::CORBA::TypeCode_ptr const _tc_Encoding = @@ -581,10 +581,10 @@ namespace IOP -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void IOP::Encoding::_tao_any_destructor ( void *_tao_void_pointer ) @@ -604,7 +604,7 @@ static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> { "minor_version", &CORBA::_tc_octet }, { "char_codeset", &CONV_FRAME::_tc_CodeSetId }, { "wchar_codeset", &CONV_FRAME::_tc_CodeSetId } - + }; static TAO::TypeCode::Struct<char const *, ::CORBA::TypeCode_ptr const *, @@ -616,7 +616,7 @@ static TAO::TypeCode::Struct<char const *, "Encoding_1_2", _tao_fields_IOP_Encoding_1_2, 5); - + namespace IOP { ::CORBA::TypeCode_ptr const _tc_Encoding_1_2 = @@ -625,10 +625,10 @@ namespace IOP -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void IOP::Encoding_1_2::_tao_any_destructor ( void *_tao_void_pointer ) @@ -656,7 +656,7 @@ TAO::Objref_Traits<IOP::CodecFactory>::release ( IOP::CodecFactory_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } IOP::CodecFactory_ptr @@ -674,7 +674,7 @@ TAO::Objref_Traits<IOP::CodecFactory>::marshal ( return ::CORBA::Object::marshal (p, cdr); } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_exception/exception_cs.cpp:63 IOP::CodecFactory::UnknownEncoding::UnknownEncoding (void) @@ -700,7 +700,7 @@ IOP::CodecFactory::UnknownEncoding::UnknownEncoding (const ::IOP::CodecFactory:: IOP::CodecFactory::UnknownEncoding& IOP::CodecFactory::UnknownEncoding::operator= (const ::IOP::CodecFactory::UnknownEncoding &_tao_excp) { - this->ACE_NESTED_CLASS ( ::CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); return *this; } @@ -783,11 +783,11 @@ static TAO::TypeCode::Struct<char const *, "UnknownEncoding", _tao_fields_IOP_CodecFactory_UnknownEncoding, 0); - + ::CORBA::TypeCode_ptr const IOP::CodecFactory::_tc_UnknownEncoding = &_tao_tc_IOP_CodecFactory_UnknownEncoding; -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_exception/exception_cs.cpp:63 IOP::CodecFactory::UnsupportedCodeset::UnsupportedCodeset (void) @@ -814,7 +814,7 @@ IOP::CodecFactory::UnsupportedCodeset::UnsupportedCodeset (const ::IOP::CodecFac IOP::CodecFactory::UnsupportedCodeset& IOP::CodecFactory::UnsupportedCodeset::operator= (const ::IOP::CodecFactory::UnsupportedCodeset &_tao_excp) { - this->ACE_NESTED_CLASS ( ::CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); this->codeset = _tao_excp.codeset; return *this; } @@ -906,7 +906,7 @@ IOP::CodecFactory::UnsupportedCodeset::UnsupportedCodeset ( static TAO::TypeCode::Struct_Field<char const *, ::CORBA::TypeCode_ptr const *> const _tao_fields_IOP_CodecFactory_UnsupportedCodeset[] = { { "codeset", &CONV_FRAME::_tc_CodeSetId } - + }; static TAO::TypeCode::Struct<char const *, ::CORBA::TypeCode_ptr const *, @@ -918,7 +918,7 @@ static TAO::TypeCode::Struct<char const *, "UnsupportedCodeset", _tao_fields_IOP_CodecFactory_UnsupportedCodeset, 1); - + ::CORBA::TypeCode_ptr const IOP::CodecFactory::_tc_UnsupportedCodeset = &_tao_tc_IOP_CodecFactory_UnsupportedCodeset; @@ -953,18 +953,18 @@ IOP::CodecFactory::_unchecked_narrow ( IOP::CodecFactory_ptr IOP::CodecFactory::_duplicate (CodecFactory_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } - + return obj; } void IOP::CodecFactory::_tao_release (CodecFactory_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } ::CORBA::Boolean @@ -1016,7 +1016,7 @@ static TAO::TypeCode::Objref<char const *, ::CORBA::tk_local_interface, "IDL:omg.org/IOP/CodecFactory:1.0", "CodecFactory"); - + namespace IOP { ::CORBA::TypeCode_ptr const _tc_CodecFactory = @@ -1025,7 +1025,7 @@ namespace IOP -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/any_op_cs.cpp:54 // Copying insertion. @@ -1086,7 +1086,7 @@ void operator<<= ( ); } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/any_op_cs.cpp:54 // Copying insertion. diff --git a/TAO/tao/Codeset/Codeset_Manager_Factory.cpp b/TAO/tao/Codeset/Codeset_Manager_Factory.cpp index 6becf8963c0..7f89626dc47 100644 --- a/TAO/tao/Codeset/Codeset_Manager_Factory.cpp +++ b/TAO/tao/Codeset/Codeset_Manager_Factory.cpp @@ -23,10 +23,10 @@ TAO_Codeset_Manager_Factory::~TAO_Codeset_Manager_Factory () { } -int +bool TAO_Codeset_Manager_Factory::is_default() const { - return 0; + return false; } diff --git a/TAO/tao/Codeset/Codeset_Manager_Factory.h b/TAO/tao/Codeset/Codeset_Manager_Factory.h index 4651728556b..44ed6f20d8c 100644 --- a/TAO/tao/Codeset/Codeset_Manager_Factory.h +++ b/TAO/tao/Codeset/Codeset_Manager_Factory.h @@ -43,7 +43,7 @@ class TAO_Codeset_Export TAO_Codeset_Manager_Factory : public: virtual ~TAO_Codeset_Manager_Factory (); virtual TAO_Codeset_Manager *create(void); - virtual int is_default(void) const; + virtual bool is_default(void) const; }; diff --git a/TAO/tao/Codeset_Manager_Factory_Base.cpp b/TAO/tao/Codeset_Manager_Factory_Base.cpp index c7361b99079..644068d4070 100644 --- a/TAO/tao/Codeset_Manager_Factory_Base.cpp +++ b/TAO/tao/Codeset_Manager_Factory_Base.cpp @@ -14,10 +14,10 @@ TAO_Codeset_Manager_Factory_Base::~TAO_Codeset_Manager_Factory_Base (void) { } -int +bool TAO_Codeset_Manager_Factory_Base::is_default (void) const { - return 1; + return true; } TAO_Codeset_Manager * diff --git a/TAO/tao/Codeset_Manager_Factory_Base.h b/TAO/tao/Codeset_Manager_Factory_Base.h index 0577320bbae..8fcb63d51c3 100644 --- a/TAO/tao/Codeset_Manager_Factory_Base.h +++ b/TAO/tao/Codeset_Manager_Factory_Base.h @@ -57,7 +57,7 @@ public: /// to reload the factory with a dynamically linked libTAO_Codeset. /// Statically linked applications get derive implementation by /// including "tao/Codeset/Codeset.h" somewhere in their source code. - virtual int is_default (void) const; + virtual bool is_default (void) const; /// Static initializer ensures the factory is loaded static int initialize (void); diff --git a/TAO/tao/Collocated_Invocation.cpp b/TAO/tao/Collocated_Invocation.cpp index 6bb999a0a4a..80b2efca949 100644 --- a/TAO/tao/Collocated_Invocation.cpp +++ b/TAO/tao/Collocated_Invocation.cpp @@ -55,7 +55,8 @@ namespace TAO if (strat == TAO_CS_THRU_POA_STRATEGY) { // Perform invocations on the servant through the servant's ORB. - CORBA::ORB_var servant_orb = this->effective_target ()->_stubobj ()->servant_orb_ptr (); + CORBA::ORB_var servant_orb = + this->effective_target ()->_stubobj ()->servant_orb_ptr (); TAO_ORB_Core * const orb_core = servant_orb->orb_core (); TAO_ServerRequest request (orb_core, @@ -125,7 +126,7 @@ namespace TAO return TAO_INVOKE_SUCCESS; #if TAO_HAS_INTERCEPTORS == 1 - PortableInterceptor::ReplyStatus status = + PortableInterceptor::ReplyStatus const status = this->handle_any_exception (&ACE_ANY_EXCEPTION ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -144,7 +145,7 @@ namespace TAO if (this->response_expected () == false) return TAO_INVOKE_SUCCESS; #if TAO_HAS_INTERCEPTORS == 1 - PortableInterceptor::ReplyStatus st = + PortableInterceptor::ReplyStatus const st = this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/tao/Connection_Handler.cpp b/TAO/tao/Connection_Handler.cpp index 2da87ae7413..6401fac6155 100644 --- a/TAO/tao/Connection_Handler.cpp +++ b/TAO/tao/Connection_Handler.cpp @@ -40,7 +40,7 @@ TAO_Connection_Handler::TAO_Connection_Handler (TAO_ORB_Core *orb_core) TAO_Connection_Handler::~TAO_Connection_Handler (void) { - int result = + int const result = this->release_os_resources (); if (result == -1 && TAO_debug_level) @@ -228,7 +228,7 @@ TAO_Connection_Handler::handle_input_eh ( return 0; } - int result = this->handle_input_internal (h, eh); + int const result = this->handle_input_internal (h, eh); if (result == -1) { @@ -249,7 +249,7 @@ TAO_Connection_Handler::handle_input_internal ( // Grab the transport id now and use the cached value for printing // since the transport could dissappear by the time the thread // returns. - size_t t_id = + size_t const t_id = this->transport ()->id (); if (TAO_debug_level > 6) @@ -298,7 +298,7 @@ TAO_Connection_Handler::close_connection_eh (ACE_Event_Handler *eh) // Save the ID for debugging messages ACE_HANDLE handle = eh->get_handle (); - size_t id = this->transport ()->id (); + size_t const id = this->transport ()->id (); if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp index e71a35f173f..16db7f30129 100644 --- a/TAO/tao/Connector_Registry.cpp +++ b/TAO/tao/Connector_Registry.cpp @@ -54,7 +54,7 @@ TAO_Connector_Registry::get_connector (CORBA::ULong tag) int TAO_Connector_Registry::open (TAO_ORB_Core *orb_core) { - TAO_ProtocolFactorySet *pfs = + TAO_ProtocolFactorySet * const pfs = orb_core->protocol_factories (); // The array containing the TAO_Connectors will never contain more diff --git a/TAO/tao/CurrentC.cpp b/TAO/tao/CurrentC.cpp index 561ad8d1cd1..1cca9879881 100644 --- a/TAO/tao/CurrentC.cpp +++ b/TAO/tao/CurrentC.cpp @@ -62,7 +62,7 @@ TAO::Objref_Traits<CORBA::Current>::release ( CORBA::Current_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } CORBA::Current_ptr @@ -73,7 +73,7 @@ TAO::Objref_Traits<CORBA::Current>::nil (void) CORBA::Boolean TAO::Objref_Traits<CORBA::Current>::marshal ( - CORBA::Current_ptr p, + const CORBA::Current_ptr p, TAO_OutputCDR & cdr ) { @@ -111,18 +111,18 @@ CORBA::Current::_unchecked_narrow ( CORBA::Current_ptr CORBA::Current::_duplicate (Current_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } - + return obj; } void CORBA::Current::_tao_release (Current_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } CORBA::Boolean diff --git a/TAO/tao/CurrentC.h b/TAO/tao/CurrentC.h index e102b492f15..b5dedc32126 100644 --- a/TAO/tao/CurrentC.h +++ b/TAO/tao/CurrentC.h @@ -63,22 +63,22 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_interface.cpp:598 #if !defined (_CORBA_CURRENT__VAR_OUT_CH_) #define _CORBA_CURRENT__VAR_OUT_CH_ - + class Current; typedef Current *Current_ptr; - + typedef TAO_Objref_Var_T< Current > Current_var; - + typedef TAO_Objref_Out_T< Current @@ -86,63 +86,63 @@ namespace CORBA Current_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_interface/interface_ch.cpp:54 #if !defined (_CORBA_CURRENT_CH_) #define _CORBA_CURRENT_CH_ - + class TAO_Export Current : public virtual CORBA::Object { public: typedef Current_ptr _ptr_type; typedef Current_var _var_type; - + // The static operations. static Current_ptr _duplicate (Current_ptr obj); - + static void _tao_release (Current_ptr obj); - + static Current_ptr _narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + static Current_ptr _unchecked_narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + static Current_ptr _nil (void) { return static_cast<Current_ptr> (0); } - - - + + + // TAO_IDL - Generated from // be\be_visitor_interface/interface_ch.cpp:210 - + virtual CORBA::Boolean _is_a ( const char *type_id ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + virtual const char* _interface_repository_id (void) const; virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); - + protected: // Abstract or local interface only. Current (void); - + virtual ~Current (void); - + private: // Private and unimplemented for concrete interfaces. Current (const Current &); - + void operator= (const Current &); }; @@ -162,7 +162,7 @@ namespace TAO #if !defined (_CORBA_CURRENT__TRAITS_) #define _CORBA_CURRENT__TRAITS_ - + template<> struct TAO_Export Objref_Traits< ::CORBA::Current> { @@ -174,7 +174,7 @@ namespace TAO ); static ::CORBA::Current_ptr nil (void); static CORBA::Boolean marshal ( - ::CORBA::Current_ptr p, + const ::CORBA::Current_ptr p, TAO_OutputCDR & cdr ); }; diff --git a/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp b/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp index 4aecd1c6583..4c6f322ec02 100644 --- a/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp +++ b/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp @@ -40,7 +40,7 @@ TAO_Default_Thread_Lane_Resources_Manager::open_default_resources (ACE_ENV_SINGL bool ignore_address = false; - int result = + int const result = this->lane_resources_->open_acceptor_registry (endpoint_set, ignore_address ACE_ENV_ARG_PARAMETER); diff --git a/TAO/tao/DomainC.cpp b/TAO/tao/DomainC.cpp index 2b7a87fb286..cd48cc1d9f4 100644 --- a/TAO/tao/DomainC.cpp +++ b/TAO/tao/DomainC.cpp @@ -146,7 +146,7 @@ TAO::Objref_Traits<CORBA::DomainManager>::release ( CORBA::DomainManager_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } CORBA::DomainManager_ptr @@ -157,7 +157,7 @@ TAO::Objref_Traits<CORBA::DomainManager>::nil (void) CORBA::Boolean TAO::Objref_Traits<CORBA::DomainManager>::marshal ( - CORBA::DomainManager_ptr p, + const CORBA::DomainManager_ptr p, TAO_OutputCDR & cdr ) { @@ -183,7 +183,7 @@ TAO::Collocation_Proxy_Broker * { if (!this->is_evaluated ()) { - ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this); + ::CORBA::Object::tao_object_initialize (this); } if (this->the_TAO_DomainManager_Proxy_Broker_ == 0) @@ -239,7 +239,7 @@ CORBA::DomainManager::_tao_any_destructor (void *_tao_void_pointer) { DomainManager *_tao_tmp_pointer = static_cast<DomainManager *> (_tao_void_pointer); - CORBA::release (_tao_tmp_pointer); + ::CORBA::release (_tao_tmp_pointer); } CORBA::DomainManager_ptr @@ -275,7 +275,7 @@ CORBA::DomainManager::_unchecked_narrow ( CORBA::DomainManager_ptr CORBA::DomainManager::_duplicate (DomainManager_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } @@ -286,7 +286,7 @@ CORBA::DomainManager::_duplicate (DomainManager_ptr obj) void CORBA::DomainManager::_tao_release (DomainManager_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } CORBA::Boolean @@ -310,7 +310,7 @@ CORBA::DomainManager::_is_a ( } else { - return this->ACE_NESTED_CLASS (CORBA, Object)::_is_a ( + return this->::CORBA::Object::_is_a ( value ACE_ENV_ARG_PARAMETER ); @@ -346,7 +346,7 @@ TAO::Objref_Traits<CORBA::ConstructionPolicy>::release ( CORBA::ConstructionPolicy_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } CORBA::ConstructionPolicy_ptr @@ -357,7 +357,7 @@ TAO::Objref_Traits<CORBA::ConstructionPolicy>::nil (void) CORBA::Boolean TAO::Objref_Traits<CORBA::ConstructionPolicy>::marshal ( - CORBA::ConstructionPolicy_ptr p, + const CORBA::ConstructionPolicy_ptr p, TAO_OutputCDR & cdr ) { @@ -384,7 +384,7 @@ void CORBA::ConstructionPolicy::make_domain_manager ( { if (!this->is_evaluated ()) { - ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this); + ::CORBA::Object::tao_object_initialize (this); } if (this->the_TAO_ConstructionPolicy_Proxy_Broker_ == 0) @@ -442,7 +442,7 @@ CORBA::ConstructionPolicy::_tao_any_destructor (void *_tao_void_pointer) { ConstructionPolicy *_tao_tmp_pointer = static_cast<ConstructionPolicy *> (_tao_void_pointer); - CORBA::release (_tao_tmp_pointer); + ::CORBA::release (_tao_tmp_pointer); } CORBA::ConstructionPolicy_ptr @@ -478,7 +478,7 @@ CORBA::ConstructionPolicy::_unchecked_narrow ( CORBA::ConstructionPolicy_ptr CORBA::ConstructionPolicy::_duplicate (ConstructionPolicy_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } @@ -489,7 +489,7 @@ CORBA::ConstructionPolicy::_duplicate (ConstructionPolicy_ptr obj) void CORBA::ConstructionPolicy::_tao_release (ConstructionPolicy_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } CORBA::Boolean @@ -517,7 +517,7 @@ CORBA::ConstructionPolicy::_is_a ( } else { - return this->ACE_NESTED_CLASS (CORBA, Object)::_is_a ( + return this->::CORBA::Object::_is_a ( value ACE_ENV_ARG_PARAMETER ); @@ -547,9 +547,8 @@ CORBA::DomainManagerList::DomainManagerList (void) CORBA::DomainManagerList::DomainManagerList ( CORBA::ULong max ) - : TAO_Unbounded_Object_Sequence< - CORBA::DomainManager, - CORBA::DomainManager_var + : TAO::unbounded_object_reference_sequence< + CORBA::DomainManager, CORBA::DomainManager_var > (max) {} @@ -560,9 +559,8 @@ CORBA::DomainManagerList::DomainManagerList ( CORBA::DomainManager_ptr * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Object_Sequence< - CORBA::DomainManager, - CORBA::DomainManager_var + : TAO::unbounded_object_reference_sequence< + CORBA::DomainManager, CORBA::DomainManager_var > (max, length, buffer, release) {} @@ -570,9 +568,8 @@ CORBA::DomainManagerList::DomainManagerList ( CORBA::DomainManagerList::DomainManagerList ( const DomainManagerList &seq ) - : TAO_Unbounded_Object_Sequence< - CORBA::DomainManager, - CORBA::DomainManager_var + : TAO::unbounded_object_reference_sequence< + CORBA::DomainManager, CORBA::DomainManager_var > (seq) {} @@ -674,25 +671,7 @@ CORBA::Boolean operator<< ( const CORBA::DomainManagerList &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = - TAO::Objref_Traits<CORBA::DomainManager>::marshal ( - _tao_sequence[i].in (), strm - ); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -700,40 +679,7 @@ CORBA::Boolean operator>> ( CORBA::DomainManagerList &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_DomainManagerList_CPP_ */ diff --git a/TAO/tao/DomainC.h b/TAO/tao/DomainC.h index a45d7c4d805..6abc992cfd7 100644 --- a/TAO/tao/DomainC.h +++ b/TAO/tao/DomainC.h @@ -330,31 +330,21 @@ namespace CORBA class DomainManagerList; typedef - TAO_MngSeq_Var_T< - DomainManagerList, - TAO_Object_Manager< - DomainManager, - DomainManager_var - > + TAO_VarSeq_Var_T< + DomainManagerList > DomainManagerList_var; typedef - TAO_MngSeq_Out_T< - DomainManagerList, - DomainManagerList_var, - TAO_Object_Manager< - DomainManager, - DomainManager_var - > + TAO_Seq_Out_T< + DomainManagerList > DomainManagerList_out; class TAO_Export DomainManagerList : public - TAO_Unbounded_Object_Sequence< - DomainManager, - DomainManager_var + TAO::unbounded_object_reference_sequence< + DomainManager, DomainManager_var > { public: @@ -364,7 +354,7 @@ namespace CORBA CORBA::ULong max, CORBA::ULong length, DomainManager_ptr* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); DomainManagerList (const DomainManagerList &); ~DomainManagerList (void); @@ -419,7 +409,7 @@ namespace TAO ); static ::CORBA::DomainManager_ptr nil (void); static CORBA::Boolean marshal ( - ::CORBA::DomainManager_ptr p, + const ::CORBA::DomainManager_ptr p, TAO_OutputCDR & cdr ); }; @@ -440,7 +430,7 @@ namespace TAO ); static ::CORBA::ConstructionPolicy_ptr nil (void); static CORBA::Boolean marshal ( - ::CORBA::ConstructionPolicy_ptr p, + const ::CORBA::ConstructionPolicy_ptr p, TAO_OutputCDR & cdr ); }; diff --git a/TAO/tao/DomainC.inl b/TAO/tao/DomainC.inl index d46727c0132..68d8edb83aa 100644 --- a/TAO/tao/DomainC.inl +++ b/TAO/tao/DomainC.inl @@ -41,12 +41,7 @@ CORBA::DomainManager::DomainManager ( TAO_Abstract_ServantBase *servant, TAO_ORB_Core *oc ) - : ACE_NESTED_CLASS (CORBA, Object) ( - objref, - _tao_collocated, - servant, - oc - ), + : ::CORBA::Object (objref, _tao_collocated, servant, oc), the_TAO_DomainManager_Proxy_Broker_ (0) { this->CORBA_DomainManager_setup_collocation (); @@ -57,7 +52,7 @@ CORBA::DomainManager::DomainManager ( IOP::IOR *ior, TAO_ORB_Core *oc ) - : ACE_NESTED_CLASS (CORBA, Object) (ior, oc), + : ::CORBA::Object (ior, oc), the_TAO_DomainManager_Proxy_Broker_ (0) { } @@ -77,12 +72,7 @@ CORBA::ConstructionPolicy::ConstructionPolicy ( TAO_Abstract_ServantBase *servant, TAO_ORB_Core *oc ) - : ACE_NESTED_CLASS (CORBA, Object) ( - objref, - _tao_collocated, - servant, - oc - ), + : ::CORBA::Object (objref, _tao_collocated, servant, oc), the_TAO_ConstructionPolicy_Proxy_Broker_ (0) { this->CORBA_ConstructionPolicy_setup_collocation (); @@ -93,7 +83,7 @@ CORBA::ConstructionPolicy::ConstructionPolicy ( IOP::IOR *ior, TAO_ORB_Core *oc ) - : ACE_NESTED_CLASS (CORBA, Object) (ior, oc), + : ::CORBA::Object (ior, oc), the_TAO_ConstructionPolicy_Proxy_Broker_ (0) { } diff --git a/TAO/tao/DoubleSeqC.cpp b/TAO/tao/DoubleSeqC.cpp index 36f7fbb7cc5..3028c71acf4 100644 --- a/TAO/tao/DoubleSeqC.cpp +++ b/TAO/tao/DoubleSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_DOUBLESEQ_CS_) @@ -55,7 +55,7 @@ CORBA::DoubleSeq::DoubleSeq (void) CORBA::DoubleSeq::DoubleSeq ( ::CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Double > (max) @@ -67,7 +67,7 @@ CORBA::DoubleSeq::DoubleSeq ( ::CORBA::Double * buffer, ::CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Double > (max, length, buffer, release) @@ -76,7 +76,7 @@ CORBA::DoubleSeq::DoubleSeq ( CORBA::DoubleSeq::DoubleSeq ( const DoubleSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Double > (seq) @@ -107,15 +107,7 @@ void CORBA::DoubleSeq::_tao_any_destructor ( const CORBA::DoubleSeq &_tao_sequence ) { - const ::CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_double_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } ::CORBA::Boolean operator>> ( @@ -123,33 +115,7 @@ void CORBA::DoubleSeq::_tao_any_destructor ( CORBA::DoubleSeq &_tao_sequence ) { - ::CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_double_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_DoubleSeq_CPP_ */ diff --git a/TAO/tao/DoubleSeqC.h b/TAO/tao/DoubleSeqC.h index 06e04f48497..7d075f15867 100644 --- a/TAO/tao/DoubleSeqC.h +++ b/TAO/tao/DoubleSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_DOUBLESEQ_CH_) #define _CORBA_DOUBLESEQ_CH_ - + class DoubleSeq; - + typedef TAO_FixedSeq_Var_T< - DoubleSeq, - CORBA::Double + DoubleSeq > DoubleSeq_var; - + typedef TAO_Seq_Out_T< - DoubleSeq, - DoubleSeq_var, - CORBA::Double + DoubleSeq > DoubleSeq_out; - + class TAO_Export DoubleSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Double > { @@ -95,14 +92,14 @@ namespace CORBA DoubleSeq ( ::CORBA::ULong max, ::CORBA::ULong length, - ::CORBA::Double* buffer, - ::CORBA::Boolean release = 0 + ::CORBA::Double* buffer, + ::CORBA::Boolean release = false ); DoubleSeq (const DoubleSeq &); ~DoubleSeq (void); - + static void _tao_any_destructor (void *); - + typedef DoubleSeq_var _var_type; }; diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h index fbf2a092fd8..99d0102e4fc 100644 --- a/TAO/tao/Exception.h +++ b/TAO/tao/Exception.h @@ -97,28 +97,10 @@ namespace CORBA * (in the @c TypeCode) that are generated by any OMG-IDL compiler * and available through the Interface Repository. Think of it as a * "globally scoped" name distinguishing each exception. - * - * @todo According to the OMG CORBA C++ Mapping version 1.1, all - * constructors, copy constructors and assignment operators - * should be moved to "protected" section in class - * declarations. Since the current MS Visual C++ 6.0 compiler - * will cause some problems to TAO's exception mechanism, we - * defer doing this until we drop support for MSVC++ 6. */ class TAO_Export Exception { public: - - /// Copy constructor. - Exception (const Exception &src); - - /// Assignment operator. - Exception & operator = (const Exception & src); - - /// Construct from a respository id. - Exception (const char *repository_id, - const char *local_name); - /// Destructor. virtual ~Exception (void); @@ -199,6 +181,16 @@ namespace CORBA /// Default constructor. Exception (void); + /// Copy constructor. + Exception (const Exception &src); + + /// Assignment operator. + Exception & operator = (const Exception & src); + + /// Construct from a respository id. + Exception (const char *repository_id, + const char *local_name); + private: /// Repository Id @@ -221,19 +213,11 @@ namespace CORBA #endif /* (ACE_LACKS_IOSTREAM_TOTALLY) */ } // End CORBA namespace -/** - * @class TAO_Exceptions - * - * @brief This class is a namespace for exception-related static data and - * methods. - */ -class TAO_Export TAO_Exceptions +namespace TAO { -public: - /// Create a CORBA::SystemException given the interface repository ID. - static CORBA::SystemException *create_system_exception (const char *id); -}; + TAO_Export CORBA::SystemException *create_system_exception (const char *id); +} TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Fixed_Array_Argument_T.inl b/TAO/tao/Fixed_Array_Argument_T.inl index 7465933cca4..66dd21e6f03 100644 --- a/TAO/tao/Fixed_Array_Argument_T.inl +++ b/TAO/tao/Fixed_Array_Argument_T.inl @@ -12,17 +12,17 @@ ACE_INLINE TAO::In_Fixed_Array_Argument_T<S,S_slice,S_forany,Insert_Policy>:: In_Fixed_Array_Argument_T (const S_slice * x) : x_ ( -#if (defined (_MSC_VER) && _MSC_VER <= 1200) || (defined (__IBMCPP__) && (__IBMCPP__ <= 600)) - // @@ (OO) MSVC++ 6 can't handle the const_cast<> in the +#if (defined (__IBMCPP__) && (__IBMCPP__ <= 600)) + // @@ (OO) IMBCPP 6 can't handle the const_cast<> in the // multi-dimensional array case so C-style // "sledgehammer" cast instead (reinterpret_cast<> // doesn't work either). It's not clear if this is // really the right thing to do but the code won't - // compile with MSVC++ 6 without it. + // compile without it. (S_slice *) x #else const_cast<S_slice *> (x) -#endif /* _MSC_VER <= 1200 */ +#endif /* IBMCPP <= 600 */ ) { } diff --git a/TAO/tao/Fixed_Size_Argument_T.h b/TAO/tao/Fixed_Size_Argument_T.h index 88bf0938df7..a767b2e2f37 100644 --- a/TAO/tao/Fixed_Size_Argument_T.h +++ b/TAO/tao/Fixed_Size_Argument_T.h @@ -123,7 +123,7 @@ namespace TAO }; /** - * @struct Basic_Tag + * @struct Fixed_Size_Tag * * @brief Struct for fixed size IDL type arguments id tag. * diff --git a/TAO/tao/FloatSeqC.cpp b/TAO/tao/FloatSeqC.cpp index d5c32aa2f78..005a8f8663f 100644 --- a/TAO/tao/FloatSeqC.cpp +++ b/TAO/tao/FloatSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_FLOATSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::FloatSeq::FloatSeq (void) CORBA::FloatSeq::FloatSeq ( ::CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Float > (max) @@ -67,7 +67,7 @@ CORBA::FloatSeq::FloatSeq ( ::CORBA::Float * buffer, ::CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Float > (max, length, buffer, release) @@ -76,7 +76,7 @@ CORBA::FloatSeq::FloatSeq ( CORBA::FloatSeq::FloatSeq ( const FloatSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Float > (seq) @@ -107,15 +107,7 @@ void CORBA::FloatSeq::_tao_any_destructor ( const CORBA::FloatSeq &_tao_sequence ) { - const ::CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_float_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } ::CORBA::Boolean operator>> ( @@ -123,33 +115,7 @@ void CORBA::FloatSeq::_tao_any_destructor ( CORBA::FloatSeq &_tao_sequence ) { - ::CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_float_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_FloatSeq_CPP_ */ diff --git a/TAO/tao/FloatSeqC.h b/TAO/tao/FloatSeqC.h index dbab855a3b4..08a31f04fa0 100644 --- a/TAO/tao/FloatSeqC.h +++ b/TAO/tao/FloatSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_FLOATSEQ_CH_) #define _CORBA_FLOATSEQ_CH_ - + class FloatSeq; - + typedef TAO_FixedSeq_Var_T< - FloatSeq, - CORBA::Float + FloatSeq > FloatSeq_var; - + typedef TAO_Seq_Out_T< - FloatSeq, - FloatSeq_var, - CORBA::Float + FloatSeq > FloatSeq_out; - + class TAO_Export FloatSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Float > { @@ -95,14 +92,14 @@ namespace CORBA FloatSeq ( ::CORBA::ULong max, ::CORBA::ULong length, - ::CORBA::Float* buffer, - ::CORBA::Boolean release = 0 + ::CORBA::Float* buffer, + ::CORBA::Boolean release = false ); FloatSeq (const FloatSeq &); ~FloatSeq (void); - + static void _tao_any_destructor (void *); - + typedef FloatSeq_var _var_type; }; diff --git a/TAO/tao/GIOPC.cpp b/TAO/tao/GIOPC.cpp index 505bb143157..daf21691185 100644 --- a/TAO/tao/GIOPC.cpp +++ b/TAO/tao/GIOPC.cpp @@ -143,7 +143,7 @@ GIOP::TargetAddress::TargetAddress (const ::GIOP::TargetAddress &u) GIOP::TargetAddress::~TargetAddress (void) { // Finalize. - this->_reset (this->disc_, 1); + this->_reset (); } void GIOP::TargetAddress::_tao_any_destructor (void *_tao_void_pointer) @@ -161,7 +161,7 @@ GIOP::TargetAddress::operator= (const ::GIOP::TargetAddress &u) return *this; } - this->_reset (u.disc_, 0); + this->_reset (); this->disc_ = u.disc_; switch (this->disc_) @@ -222,7 +222,7 @@ GIOP::TargetAddress::operator= (const ::GIOP::TargetAddress &u) } // Reset method to reset old values of a union. -void GIOP::TargetAddress::_reset (CORBA::Short, CORBA::Boolean /*finalize*/) +void GIOP::TargetAddress::_reset (void) { switch (this->disc_) { diff --git a/TAO/tao/GIOPC.h b/TAO/tao/GIOPC.h index cdc438390d5..f60c593fa81 100644 --- a/TAO/tao/GIOPC.h +++ b/TAO/tao/GIOPC.h @@ -202,9 +202,9 @@ namespace GIOP // TAO_IDL - Generated from // be\be_visitor_union_branch/public_ch.cpp:665 - void ior (const ACE_NESTED_CLASS (GIOP, IORAddressingInfo) &); - const ACE_NESTED_CLASS (GIOP, IORAddressingInfo) &ior (void) const; - ACE_NESTED_CLASS (GIOP, IORAddressingInfo) &ior (void); + void ior (const ::GIOP::IORAddressingInfo &); + const ::GIOP::IORAddressingInfo &ior (void) const; + ::GIOP::IORAddressingInfo &ior (void); // TAO_IDL - Generated from // be\be_visitor_union/union_ch.cpp:147 @@ -224,11 +224,11 @@ namespace GIOP IOP::TaggedProfile *profile_; // TAO_IDL - Generated from // be\be_visitor_union_branch/private_ch.cpp:526 - ACE_NESTED_CLASS (GIOP, IORAddressingInfo) *ior_; + ::GIOP::IORAddressingInfo *ior_; } u_; // TAO extension - frees any allocated storage. - void _reset (CORBA::Short, CORBA::Boolean /* finalize */); + void _reset (void); }; #endif /* end #if !defined */ diff --git a/TAO/tao/GIOPC.inl b/TAO/tao/GIOPC.inl index d83b70b3c5b..ae15806ea83 100644 --- a/TAO/tao/GIOPC.inl +++ b/TAO/tao/GIOPC.inl @@ -39,7 +39,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE -void +void GIOP::TargetAddress::_default () { this->disc_ = -32768; @@ -70,7 +70,7 @@ void GIOP::TargetAddress::object_key (const CORBA::OctetSeq &val) { // Set the discriminant value. - this->_reset (0, 0); + this->_reset (); this->disc_ = 0; ACE_NEW ( this->u_.object_key_, @@ -103,7 +103,7 @@ void GIOP::TargetAddress::profile (const IOP::TaggedProfile &val) { // Set the discriminant value. - this->_reset (1, 0); + this->_reset (); this->disc_ = 1; ACE_NEW ( this->u_.profile_, @@ -136,7 +136,7 @@ void GIOP::TargetAddress::ior (const GIOP::IORAddressingInfo &val) { // Set the discriminant value. - this->_reset (2, 0); + this->_reset (); this->disc_ = 2; ACE_NEW ( this->u_.ior_, diff --git a/TAO/tao/GIOP_Message_Lite.h b/TAO/tao/GIOP_Message_Lite.h index b01f16121eb..92f18c33952 100644 --- a/TAO/tao/GIOP_Message_Lite.h +++ b/TAO/tao/GIOP_Message_Lite.h @@ -44,7 +44,6 @@ class TAO_GIOP_Message_Version; * This protocol is a modified version of GIOP. This is more suited * for homogenous platforms. */ - class TAO_Export TAO_GIOP_Message_Lite : public TAO_Pluggable_Messaging { public: @@ -88,9 +87,9 @@ public: private: /// Parse the incoming messages.. /// - /// \return -1 There was some error parsing the GIOP header - /// \return 0 The GIOP header was parsed correctly - /// \return 1 There was not enough data in the message block to + /// \retval -1 There was some error parsing the GIOP header + /// \retval 0 The GIOP header was parsed correctly + /// \retval 1 There was not enough data in the message block to /// parse the header int parse_incoming_messages (ACE_Message_Block &message_block); @@ -105,13 +104,13 @@ private: public: /// Parse the details of the next message from the @a incoming - /// and initializes attributes of @a qd. Returns 0 if the message - /// header could not be parsed completely, returns a 1 if the message + /// and initializes attributes of @a qd. Returns 0 if the message + /// header could not be parsed completely, returns a 1 if the message /// header could be parsed completely and returns -1 on error. virtual int parse_next_message (ACE_Message_Block &incoming, - TAO_Queued_Data &qd, /* out */ - size_t &mesg_length); /* out */ - + TAO_Queued_Data &qd, /* out */ + size_t &mesg_length); /* out */ + /// Extract the details of the next message from the @a incoming /// through @a qd. Returns 0 if the message header could not be @@ -287,8 +286,8 @@ private: /// The pay load size CORBA::ULong message_size_; - // The byte order.. - // NOTE: GIOP lite cannot work between heterogenous platforms.. + /// The byte order.. + /// @note GIOP lite cannot work between heterogenous platforms.. CORBA::Octet byte_order_; TAO_OutputCDR cdr_; diff --git a/TAO/tao/Generic_Sequence_T.h b/TAO/tao/Generic_Sequence_T.h new file mode 100644 index 00000000000..a9786082b5d --- /dev/null +++ b/TAO/tao/Generic_Sequence_T.h @@ -0,0 +1,319 @@ +#ifndef guard_generic_sequence_hpp +#define guard_generic_sequence_hpp +/** + * @file + * + * @brief Implement the generic version of CORBA sequences. + * + * All CORBA sequences are based on this class template. The behavior + * of this class is controlled by two sets of traits. First, the + * ALLOCATION_TRAITS control how buffers are allocated and + * initialized. Since this is where most of the variation between + * unbounded and bounded sequences is found, the ALLOCATION_TRAITS can + * be thought as the bounded aspect of the sequence. + * + * Second, the element traits control how are elements copied, + * initialized and released. Value-like types, such as integers and + * structures, have trivial initialization and release requirements + * (their constructor/destructors do the job!) But reference-like + * types, such as strings and object references, have more complicated + * requirements. This is yet another aspect of the sequences, we can + * call it the "element copy semantics" or something. + * + * Oh, and let us not forget the type that the sequences encapsulates. + * + * The intent is not for sequences to simply derive or instantiate this + * type. Instead, different each sequence type is written using + * composition. They instantiate a generic sequence with the correct + * traits, and implement the adapt the generic sequence interface to + * whatever requirements the spec may impose. For example, replace() + * has different number of arguments in bounded vs. unbounded + * sequences, and operator[] returns different types depending on the + * underlying type of the sequence. + * + * This class offers the strong exception-safety guarantee, as long as + * destructors and release operations do not throw. + * + * This class is not thread-safe. Thread-safe collections are mostly + * useless anyways. + * + * In general the performance characteristics of the class depends on + * the traits. Obviously, they can only be expressed on the number of + * element constructor and destructor calls. If the constructor takes + * O(K) time that is not the sequence fault! + * + * All accessors are O(1), single-element modifiers are O(1), multiple + * element modifiers are O(n + m) where n is the number of elements + * originally in the sequence, and m is the number of elements left in + * the sequence afterwards. + * + * Beware: + * - get_buffer(true) may modify multiple elements + * - length(CORBA::ULong) may modify multiple elements! + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Range_Checking_T.h" + +#include <algorithm> + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, + class ALLOCATION_TRAITS, + class ELEMENT_TRAITS> +class generic_sequence +{ +public: + typedef T value_type; + typedef ALLOCATION_TRAITS allocation_traits; + typedef ELEMENT_TRAITS element_traits; + typedef range_checking<value_type,true> range; + + /// Default constructor. + generic_sequence() + : maximum_(allocation_traits::default_maximum()) + , length_(0) + , buffer_(allocation_traits::default_buffer_allocation()) + , release_(true) + { + } + + /// Constructor with control of ownership. + explicit generic_sequence(CORBA::ULong maximum) + : maximum_(maximum) + , length_(0) + , buffer_(allocbuf(maximum_)) + , release_(true) + { + } + + generic_sequence( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release) + : maximum_(maximum) + , length_(length) + , buffer_(data) + , release_(release) + { + } + + /// Copy constructor + generic_sequence(generic_sequence const & rhs) + : maximum_(0) + , length_(0) + , buffer_(0) + , release_(false) + { + generic_sequence tmp(rhs.maximum_); + tmp.length_ = rhs.length_; + element_traits::copy_range( + rhs.buffer_, rhs.buffer_ + rhs.length_, tmp.buffer_); + swap(tmp); + } + + /// Assignment operator + generic_sequence & operator=(generic_sequence const & rhs) + { + generic_sequence tmp(rhs); + swap(tmp); + return * this; + } + + /// Destructor. + ~generic_sequence() + { + if (release_) + { + freebuf(buffer_); + } + } + + /// Return the maximum length of the sequence + inline CORBA::ULong maximum() const + { + return maximum_; + } + + /// Returns the state of the sequence release flag. + inline CORBA::Boolean release() const + { + return release_; + } + + /// Returns the length of the sequence + inline CORBA::ULong length() const + { + return length_; + } + + /// Set a new length for the sequence + void length(CORBA::ULong length) + { + if (length <= maximum_ || length <= length_) + { + if (length_ < length) + { + // TODO This code does not provide the strong-exception + // guarantee, but it does provide the weak-exception + // guarantee. The problem would appear when + // initialize_range() raises an exception after several + // elements have been modified. One could argue that + // this problem is irrelevant, as the elements already + // modified are unreachable to conforming applications. + element_traits::initialize_range( + buffer_ + length_, buffer_ + length); + } + length_ = length; + return; + } + + generic_sequence tmp(length); tmp.length_ = length; + element_traits::copy_range( + buffer_, buffer_ + length_, tmp.buffer_); + element_traits::initialize_range( + tmp.buffer_ + length_, tmp.buffer_ + length); + + swap(tmp); + } + + /// Get a const element from the sequence + value_type const & operator[](CORBA::ULong i) const + { + range::check(i, length_, maximum_, "operator[]() const"); + return buffer_[i]; + } + + /// Get an element from the sequence + value_type & operator[](CORBA::ULong i) + { + range::check(i, length_, maximum_, "operator[]() non-const"); + return buffer_[i]; + } + + /** + * Allows the buffer underlying a sequence to be replaced. The + * parameters to replace() are identical in type, order, and purpose + * to those for the <T *data> constructor for the sequence. + */ + void replace( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release) + { + generic_sequence tmp(maximum, length, data, release); + swap(tmp); + } + + /** + * This function allows read-only access to the sequence buffer. + * The sequence returns its buffer, allocating one of one has not + * yet been allocated. No direct modification of the returned + * buffer by the caller is permitted. + */ + value_type const * get_buffer() const + { + if (buffer_ == 0) + { + buffer_ = allocbuf(maximum_); + } + return buffer_; + } + + /// Allows read-write access to the underlying buffer. + /** + * If @a orphan is FALSE the sequence returns a pointer to its buffer, + * allocating one if it has not yet done so. The number of elements in the + * buffer can be determined from the sequence length() accessor. + * + * If the @a orphan argument to get_buffer() is FALSE, the sequence + * maintains ownership of the underlying buffer. Elements in the + * returned buffer may be directly replaced by the caller. For + * sequences of strings, wide strings, and object references, the + * caller must use the sequence <release> accessor to determine + * whether elements should be freed (using <string_free>, + * <wstring_free>, or <CORBA::release> for strings, wide strings, + * and object references, respective) before being directly assigned + * to. + * + * If the @a orphan argument to @a get_buffer is TRUE, the sequence + * yields ownership of the buffer to the caller. If @a orphan is + * TRUE and the sequence does not own its buffer (i.e., its + * release_ flag is FALSE), the return value is a null pointer. If + * the buffer is taken from the sequence using this form of + * get_buffer(), the sequence reverts to the same state it would + * have if constructed using its default constructor. The caller + * becomes responsible for eventually freeing each element of the + * returned buffer (for strings, wide string, and object + * references), and then freeing the returned buffer itself using + * freebuf(). + */ + value_type * get_buffer(CORBA::Boolean orphan) + { + if (orphan && !release_) + { + return 0; + } + if (buffer_ == 0) + { + buffer_ = allocbuf(maximum_); + } + if (!orphan) + { + return buffer_; + } + + generic_sequence tmp; + swap(tmp); + tmp.release_ = false; + + return tmp.buffer_; + } + + void swap(generic_sequence & rhs) throw() + { + std::swap(maximum_, rhs.maximum_); + std::swap(length_, rhs.length_); + std::swap(buffer_, rhs.buffer_); + std::swap(release_, rhs.release_); + } + + static value_type * allocbuf(CORBA::ULong maximum) + { + return allocation_traits::allocbuf(maximum); + } + + static void freebuf(value_type * buffer) + { + allocation_traits::freebuf(buffer); + } + +private: + /// The maximum number of elements the buffer can contain. + CORBA::ULong maximum_; + /// The current number of elements in the buffer. + CORBA::ULong length_; + /// The buffer with all the elements + mutable value_type * buffer_; + /// If true then the sequence should release the buffer when it is + /// destroyed. + CORBA::Boolean release_; +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_generic_sequence_hpp diff --git a/TAO/tao/IIOPC.cpp b/TAO/tao/IIOPC.cpp index 045812848c1..92716841944 100644 --- a/TAO/tao/IIOPC.cpp +++ b/TAO/tao/IIOPC.cpp @@ -43,10 +43,10 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void IIOP::ListenPoint::_tao_any_destructor ( void *_tao_void_pointer ) @@ -56,7 +56,7 @@ IIOP::ListenPoint::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_IIOP_LISTENPOINTLIST_CS_) @@ -68,7 +68,7 @@ IIOP::ListenPointList::ListenPointList (void) IIOP::ListenPointList::ListenPointList ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ListenPoint > (max) @@ -80,7 +80,7 @@ IIOP::ListenPointList::ListenPointList ( IIOP::ListenPoint * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ListenPoint > (max, length, buffer, release) @@ -89,7 +89,7 @@ IIOP::ListenPointList::ListenPointList ( IIOP::ListenPointList::ListenPointList ( const ListenPointList &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ListenPoint > (seq) @@ -109,10 +109,10 @@ void IIOP::ListenPointList::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void IIOP::BiDirIIOPServiceContext::_tao_any_destructor ( void *_tao_void_pointer ) @@ -156,22 +156,7 @@ CORBA::Boolean operator<< ( const IIOP::ListenPointList &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -179,40 +164,7 @@ CORBA::Boolean operator>> ( IIOP::ListenPointList &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_IIOP_ListenPointList_CPP_ */ diff --git a/TAO/tao/IIOPC.h b/TAO/tao/IIOPC.h index 69fd036e067..c2bb85cdd04 100644 --- a/TAO/tao/IIOPC.h +++ b/TAO/tao/IIOPC.h @@ -44,6 +44,7 @@ #include "tao/ORB.h" #include "tao/Environment.h" #include "tao/Sequence_T.h" +#include "tao/String_Manager_T.h" #include "tao/Seq_Var_T.h" #include "tao/Seq_Out_T.h" #include "tao/VarOut_T.h" @@ -65,63 +66,60 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace IIOP { - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct ListenPoint; - + typedef TAO_Var_Var_T< ListenPoint > ListenPoint_var; - + typedef TAO_Out_T< ListenPoint, ListenPoint_var > ListenPoint_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export ListenPoint { typedef ListenPoint_var _var_type; - + static void _tao_any_destructor (void *); - TAO_String_Manager host; + TAO::String_Manager host; CORBA::UShort port; }; - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_IIOP_LISTENPOINTLIST_CH_) #define _IIOP_LISTENPOINTLIST_CH_ - + class ListenPointList; - + typedef TAO_VarSeq_Var_T< - ListenPointList, - ListenPoint + ListenPointList > ListenPointList_var; - + typedef TAO_Seq_Out_T< - ListenPointList, - ListenPointList_var, - ListenPoint + ListenPointList > ListenPointList_out; - + class TAO_Export ListenPointList : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< ListenPoint > { @@ -131,44 +129,44 @@ namespace IIOP ListenPointList ( CORBA::ULong max, CORBA::ULong length, - ListenPoint* buffer, - CORBA::Boolean release = 0 + ListenPoint* buffer, + CORBA::Boolean release = false ); ListenPointList (const ListenPointList &); ~ListenPointList (void); - + static void _tao_any_destructor (void *); - + typedef ListenPointList_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct BiDirIIOPServiceContext; - + typedef TAO_Var_Var_T< BiDirIIOPServiceContext > BiDirIIOPServiceContext_var; - + typedef TAO_Out_T< BiDirIIOPServiceContext, BiDirIIOPServiceContext_var > BiDirIIOPServiceContext_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export BiDirIIOPServiceContext { typedef BiDirIIOPServiceContext_var _var_type; - + static void _tao_any_destructor (void *); IIOP::ListenPointList listen_points; }; diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp index d74ee12594d..e29ed3cf4d0 100644 --- a/TAO/tao/IIOP_Connection_Handler.cpp +++ b/TAO/tao/IIOP_Connection_Handler.cpp @@ -90,7 +90,7 @@ TAO_IIOP_Connection_Handler::open (void*) TAO_Protocols_Hooks *tph = this->orb_core ()->get_protocols_hooks (); - bool client = + bool const client = this->transport ()->opened_as () == TAO::TAO_CLIENT_ROLE; ACE_DECLARE_NEW_CORBA_ENV; diff --git a/TAO/tao/IIOP_EndpointsC.cpp b/TAO/tao/IIOP_EndpointsC.cpp index 8d233088ee4..11a6eb75fa7 100644 --- a/TAO/tao/IIOP_EndpointsC.cpp +++ b/TAO/tao/IIOP_EndpointsC.cpp @@ -47,10 +47,10 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void TAO::IIOP_Endpoint_Info::_tao_any_destructor ( void *_tao_void_pointer ) @@ -60,7 +60,7 @@ TAO::IIOP_Endpoint_Info::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_TAO_IIOPENDPOINTSEQUENCE_CS_) @@ -72,7 +72,7 @@ TAO::IIOPEndpointSequence::IIOPEndpointSequence (void) TAO::IIOPEndpointSequence::IIOPEndpointSequence ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TAO::IIOP_Endpoint_Info > (max) @@ -84,7 +84,7 @@ TAO::IIOPEndpointSequence::IIOPEndpointSequence ( TAO::IIOP_Endpoint_Info * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TAO::IIOP_Endpoint_Info > (max, length, buffer, release) @@ -93,7 +93,7 @@ TAO::IIOPEndpointSequence::IIOPEndpointSequence ( TAO::IIOPEndpointSequence::IIOPEndpointSequence ( const IIOPEndpointSequence &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TAO::IIOP_Endpoint_Info > (seq) @@ -149,22 +149,7 @@ CORBA::Boolean operator<< ( const TAO::IIOPEndpointSequence &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -172,40 +157,7 @@ CORBA::Boolean operator>> ( TAO::IIOPEndpointSequence &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_TAO_IIOPEndpointSequence_CPP_ */ diff --git a/TAO/tao/IIOP_EndpointsC.h b/TAO/tao/IIOP_EndpointsC.h index 6abf0ddb7e4..f9d86079b2f 100644 --- a/TAO/tao/IIOP_EndpointsC.h +++ b/TAO/tao/IIOP_EndpointsC.h @@ -44,6 +44,7 @@ #include "tao/ORB.h" #include "tao/Environment.h" #include "tao/Sequence_T.h" +#include "tao/String_Manager_T.h" #include "tao/Seq_Var_T.h" #include "tao/Seq_Out_T.h" #include "tao/VarOut_T.h" @@ -96,7 +97,7 @@ namespace TAO typedef IIOP_Endpoint_Info_var _var_type; static void _tao_any_destructor (void *); - TAO_String_Manager host; + TAO::String_Manager host; CORBA::Short port; CORBA::Short priority; }; @@ -111,22 +112,19 @@ namespace TAO typedef TAO_VarSeq_Var_T< - IIOPEndpointSequence, - IIOP_Endpoint_Info + IIOPEndpointSequence > IIOPEndpointSequence_var; typedef TAO_Seq_Out_T< - IIOPEndpointSequence, - IIOPEndpointSequence_var, - IIOP_Endpoint_Info + IIOPEndpointSequence > IIOPEndpointSequence_out; class TAO_Export IIOPEndpointSequence : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< IIOP_Endpoint_Info > { @@ -137,7 +135,7 @@ namespace TAO CORBA::ULong max, CORBA::ULong length, IIOP_Endpoint_Info* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); IIOPEndpointSequence (const IIOPEndpointSequence &); ~IIOPEndpointSequence (void); diff --git a/TAO/tao/IIOP_Lite_Factory.cpp b/TAO/tao/IIOP_Lite_Factory.cpp index 6e64599620f..5abca44ca67 100644 --- a/TAO/tao/IIOP_Lite_Factory.cpp +++ b/TAO/tao/IIOP_Lite_Factory.cpp @@ -52,7 +52,7 @@ TAO_IIOP_Lite_Protocol_Factory::make_acceptor (void) TAO_Acceptor *acceptor = 0; // We are a Lite factory - CORBA::Boolean lite_flag = 1; + CORBA::Boolean lite_flag = true; ACE_NEW_RETURN (acceptor, TAO_IIOP_Acceptor (lite_flag), 0); @@ -73,7 +73,7 @@ TAO_IIOP_Lite_Protocol_Factory::make_connector (void) TAO_Connector *connector = 0; // We are a Lite factory - CORBA::Boolean lite_flag = 1; + CORBA::Boolean lite_flag = true; ACE_NEW_RETURN (connector, TAO_IIOP_Connector (lite_flag), diff --git a/TAO/tao/IOP_IORC.cpp b/TAO/tao/IOP_IORC.cpp index 45323b2f40c..60187c0e8fc 100644 --- a/TAO/tao/IOP_IORC.cpp +++ b/TAO/tao/IOP_IORC.cpp @@ -44,10 +44,10 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void IOP::TaggedProfile::_tao_any_destructor ( void *_tao_void_pointer ) @@ -57,7 +57,7 @@ IOP::TaggedProfile::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_IOP_TAGGEDPROFILESEQ_CS_) @@ -69,7 +69,7 @@ IOP::TaggedProfileSeq::TaggedProfileSeq (void) IOP::TaggedProfileSeq::TaggedProfileSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedProfile > (max) @@ -81,7 +81,7 @@ IOP::TaggedProfileSeq::TaggedProfileSeq ( IOP::TaggedProfile * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedProfile > (max, length, buffer, release) @@ -90,7 +90,7 @@ IOP::TaggedProfileSeq::TaggedProfileSeq ( IOP::TaggedProfileSeq::TaggedProfileSeq ( const TaggedProfileSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedProfile > (seq) @@ -110,10 +110,10 @@ void IOP::TaggedProfileSeq::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void IOP::IOR::_tao_any_destructor ( void *_tao_void_pointer ) @@ -123,10 +123,10 @@ IOP::IOR::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void IOP::TaggedComponent::_tao_any_destructor ( void *_tao_void_pointer ) @@ -136,7 +136,7 @@ IOP::TaggedComponent::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_IOP_MULTIPLECOMPONENTPROFILE_CS_) @@ -148,7 +148,7 @@ IOP::MultipleComponentProfile::MultipleComponentProfile (void) IOP::MultipleComponentProfile::MultipleComponentProfile ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (max) @@ -160,7 +160,7 @@ IOP::MultipleComponentProfile::MultipleComponentProfile ( IOP::TaggedComponent * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (max, length, buffer, release) @@ -169,7 +169,7 @@ IOP::MultipleComponentProfile::MultipleComponentProfile ( IOP::MultipleComponentProfile::MultipleComponentProfile ( const MultipleComponentProfile &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (seq) @@ -189,7 +189,7 @@ void IOP::MultipleComponentProfile::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_IOP_TAGGEDCOMPONENTLIST_CS_) @@ -201,7 +201,7 @@ IOP::TaggedComponentList::TaggedComponentList (void) IOP::TaggedComponentList::TaggedComponentList ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (max) @@ -213,7 +213,7 @@ IOP::TaggedComponentList::TaggedComponentList ( IOP::TaggedComponent * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (max, length, buffer, release) @@ -222,7 +222,7 @@ IOP::TaggedComponentList::TaggedComponentList ( IOP::TaggedComponentList::TaggedComponentList ( const TaggedComponentList &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (seq) @@ -242,7 +242,7 @@ void IOP::TaggedComponentList::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_IOP_TAGGEDCOMPONENTSEQ_CS_) @@ -254,7 +254,7 @@ IOP::TaggedComponentSeq::TaggedComponentSeq (void) IOP::TaggedComponentSeq::TaggedComponentSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (max) @@ -266,7 +266,7 @@ IOP::TaggedComponentSeq::TaggedComponentSeq ( IOP::TaggedComponent * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (max, length, buffer, release) @@ -275,7 +275,7 @@ IOP::TaggedComponentSeq::TaggedComponentSeq ( IOP::TaggedComponentSeq::TaggedComponentSeq ( const TaggedComponentSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< TaggedComponent > (seq) @@ -295,10 +295,10 @@ void IOP::TaggedComponentSeq::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void IOP::ServiceContext::_tao_any_destructor ( void *_tao_void_pointer ) @@ -308,7 +308,7 @@ IOP::ServiceContext::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_IOP_SERVICECONTEXTLIST_CS_) @@ -320,7 +320,7 @@ IOP::ServiceContextList::ServiceContextList (void) IOP::ServiceContextList::ServiceContextList ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceContext > (max) @@ -332,7 +332,7 @@ IOP::ServiceContextList::ServiceContextList ( IOP::ServiceContext * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceContext > (max, length, buffer, release) @@ -341,7 +341,7 @@ IOP::ServiceContextList::ServiceContextList ( IOP::ServiceContextList::ServiceContextList ( const ServiceContextList &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceContext > (seq) @@ -395,22 +395,7 @@ CORBA::Boolean operator<< ( const IOP::TaggedProfileSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -418,40 +403,7 @@ CORBA::Boolean operator>> ( IOP::TaggedProfileSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_IOP_TaggedProfileSeq_CPP_ */ @@ -513,22 +465,7 @@ CORBA::Boolean operator<< ( const IOP::MultipleComponentProfile &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -536,40 +473,7 @@ CORBA::Boolean operator>> ( IOP::MultipleComponentProfile &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_IOP_MultipleComponentProfile_CPP_ */ @@ -585,22 +489,7 @@ CORBA::Boolean operator<< ( const IOP::TaggedComponentList &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -608,40 +497,7 @@ CORBA::Boolean operator>> ( IOP::TaggedComponentList &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_IOP_TaggedComponentList_CPP_ */ @@ -657,22 +513,7 @@ CORBA::Boolean operator<< ( const IOP::TaggedComponentSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -680,40 +521,7 @@ CORBA::Boolean operator>> ( IOP::TaggedComponentSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_IOP_TaggedComponentSeq_CPP_ */ @@ -752,22 +560,7 @@ CORBA::Boolean operator<< ( const IOP::ServiceContextList &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -775,40 +568,7 @@ CORBA::Boolean operator>> ( IOP::ServiceContextList &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_IOP_ServiceContextList_CPP_ */ diff --git a/TAO/tao/IOP_IORC.h b/TAO/tao/IOP_IORC.h index c0f8910c5e8..790ec9730a7 100644 --- a/TAO/tao/IOP_IORC.h +++ b/TAO/tao/IOP_IORC.h @@ -47,6 +47,7 @@ #include "tao/Seq_Var_T.h" #include "tao/Seq_Out_T.h" #include "tao/VarOut_T.h" +#include "tao/String_Manager_T.h" #include "tao/OctetSeqC.h" @@ -67,79 +68,76 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace IOP { - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::ULong ProfileId; typedef CORBA::ULong_out ProfileId_out; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ProfileId TAG_INTERNET_IOP = 0U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ProfileId TAG_MULTIPLE_COMPONENTS = 1U; - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct TaggedProfile; - + typedef TAO_Var_Var_T< TaggedProfile > TaggedProfile_var; - + typedef TAO_Out_T< TaggedProfile, TaggedProfile_var > TaggedProfile_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export TaggedProfile { typedef TaggedProfile_var _var_type; - + static void _tao_any_destructor (void *); IOP::ProfileId tag; CORBA::OctetSeq profile_data; }; - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_IOP_TAGGEDPROFILESEQ_CH_) #define _IOP_TAGGEDPROFILESEQ_CH_ - + class TaggedProfileSeq; - + typedef TAO_VarSeq_Var_T< - TaggedProfileSeq, - TaggedProfile + TaggedProfileSeq > TaggedProfileSeq_var; - + typedef TAO_Seq_Out_T< - TaggedProfileSeq, - TaggedProfileSeq_var, - TaggedProfile + TaggedProfileSeq > TaggedProfileSeq_out; - + class TAO_Export TaggedProfileSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< TaggedProfile > { @@ -149,111 +147,108 @@ namespace IOP TaggedProfileSeq ( CORBA::ULong max, CORBA::ULong length, - TaggedProfile* buffer, - CORBA::Boolean release = 0 + TaggedProfile* buffer, + CORBA::Boolean release = false ); TaggedProfileSeq (const TaggedProfileSeq &); ~TaggedProfileSeq (void); - + static void _tao_any_destructor (void *); - + typedef TaggedProfileSeq_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct IOR; - + typedef TAO_Var_Var_T< IOR > IOR_var; - + typedef TAO_Out_T< IOR, IOR_var > IOR_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export IOR { typedef IOR_var _var_type; - + static void _tao_any_destructor (void *); - TAO_String_Manager type_id; + TAO::String_Manager type_id; IOP::TaggedProfileSeq profiles; }; - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::ULong ComponentId; typedef CORBA::ULong_out ComponentId_out; - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct TaggedComponent; - + typedef TAO_Var_Var_T< TaggedComponent > TaggedComponent_var; - + typedef TAO_Out_T< TaggedComponent, TaggedComponent_var > TaggedComponent_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export TaggedComponent { typedef TaggedComponent_var _var_type; - + static void _tao_any_destructor (void *); IOP::ComponentId tag; CORBA::OctetSeq component_data; }; - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_IOP_MULTIPLECOMPONENTPROFILE_CH_) #define _IOP_MULTIPLECOMPONENTPROFILE_CH_ - + class MultipleComponentProfile; - + typedef TAO_VarSeq_Var_T< - MultipleComponentProfile, - TaggedComponent + MultipleComponentProfile > MultipleComponentProfile_var; - + typedef TAO_Seq_Out_T< - MultipleComponentProfile, - MultipleComponentProfile_var, - TaggedComponent + MultipleComponentProfile > MultipleComponentProfile_out; - + class TAO_Export MultipleComponentProfile : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< TaggedComponent > { @@ -263,45 +258,42 @@ namespace IOP MultipleComponentProfile ( CORBA::ULong max, CORBA::ULong length, - TaggedComponent* buffer, - CORBA::Boolean release = 0 + TaggedComponent* buffer, + CORBA::Boolean release = false ); MultipleComponentProfile (const MultipleComponentProfile &); ~MultipleComponentProfile (void); - + static void _tao_any_destructor (void *); - + typedef MultipleComponentProfile_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_IOP_TAGGEDCOMPONENTLIST_CH_) #define _IOP_TAGGEDCOMPONENTLIST_CH_ - + class TaggedComponentList; - + typedef TAO_VarSeq_Var_T< - TaggedComponentList, - TaggedComponent + TaggedComponentList > TaggedComponentList_var; - + typedef TAO_Seq_Out_T< - TaggedComponentList, - TaggedComponentList_var, - TaggedComponent + TaggedComponentList > TaggedComponentList_out; - + class TAO_Export TaggedComponentList : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< TaggedComponent > { @@ -311,45 +303,42 @@ namespace IOP TaggedComponentList ( CORBA::ULong max, CORBA::ULong length, - TaggedComponent* buffer, - CORBA::Boolean release = 0 + TaggedComponent* buffer, + CORBA::Boolean release = false ); TaggedComponentList (const TaggedComponentList &); ~TaggedComponentList (void); - + static void _tao_any_destructor (void *); - + typedef TaggedComponentList_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_IOP_TAGGEDCOMPONENTSEQ_CH_) #define _IOP_TAGGEDCOMPONENTSEQ_CH_ - + class TaggedComponentSeq; - + typedef TAO_VarSeq_Var_T< - TaggedComponentSeq, - TaggedComponent + TaggedComponentSeq > TaggedComponentSeq_var; - + typedef TAO_Seq_Out_T< - TaggedComponentSeq, - TaggedComponentSeq_var, - TaggedComponent + TaggedComponentSeq > TaggedComponentSeq_out; - + class TAO_Export TaggedComponentSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< TaggedComponent > { @@ -359,131 +348,128 @@ namespace IOP TaggedComponentSeq ( CORBA::ULong max, CORBA::ULong length, - TaggedComponent* buffer, - CORBA::Boolean release = 0 + TaggedComponent* buffer, + CORBA::Boolean release = false ); TaggedComponentSeq (const TaggedComponentSeq &); ~TaggedComponentSeq (void); - + static void _tao_any_destructor (void *); - + typedef TaggedComponentSeq_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_ORB_TYPE = 0U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_CODE_SETS = 1U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_POLICIES = 2U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_ALTERNATE_IIOP_ADDRESS = 3U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_COMPLETE_OBJECT_KEY = 5U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_ENDPOINT_ID_POSITION = 6U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_LOCATION_POLICY = 12U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_DCE_STRING_BINDING = 100U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_DCE_BINDING_NAME = 101U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_DCE_NO_PIPES = 102U; - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::ULong ServiceId; typedef CORBA::ULong_out ServiceId_out; - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct ServiceContext; - + typedef TAO_Var_Var_T< ServiceContext > ServiceContext_var; - + typedef TAO_Out_T< ServiceContext, ServiceContext_var > ServiceContext_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export ServiceContext { typedef ServiceContext_var _var_type; - + static void _tao_any_destructor (void *); IOP::ServiceId context_id; CORBA::OctetSeq context_data; }; - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_IOP_SERVICECONTEXTLIST_CH_) #define _IOP_SERVICECONTEXTLIST_CH_ - + class ServiceContextList; - + typedef TAO_VarSeq_Var_T< - ServiceContextList, - ServiceContext + ServiceContextList > ServiceContextList_var; - + typedef TAO_Seq_Out_T< - ServiceContextList, - ServiceContextList_var, - ServiceContext + ServiceContextList > ServiceContextList_out; - + class TAO_Export ServiceContextList : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< ServiceContext > { @@ -493,112 +479,112 @@ namespace IOP ServiceContextList ( CORBA::ULong max, CORBA::ULong length, - ServiceContext* buffer, - CORBA::Boolean release = 0 + ServiceContext* buffer, + CORBA::Boolean release = false ); ServiceContextList (const ServiceContextList &); ~ServiceContextList (void); - + static void _tao_any_destructor (void *); - + typedef ServiceContextList_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId TransactionService = 0U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId CodeSets = 1U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId ChainBypassCheck = 2U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId ChainBypassInfo = 3U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId LogicalThreadId = 4U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId BI_DIR_IIOP = 5U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId SendingContextRunTime = 6U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId INVOCATION_POLICIES = 7U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId UnknownExceptionInfo = 9U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId RTCorbaPriority = 10U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId RTCorbaPriorityRange = 11U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_FT_GROUP = 27U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_FT_PRIMARY = 28U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_FT_HEARTBEAT_ENABLED = 29U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId FT_GROUP_VERSION = 12U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId FT_REQUEST = 13U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ProfileId TAG_UIPMC = 3U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_GROUP = 39U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_GROUP_IIOP = 40U; // TAO_IDL - Generated from diff --git a/TAO/tao/Incoming_Message_Queue.cpp b/TAO/tao/Incoming_Message_Queue.cpp index 654a385d469..979aa167918 100644 --- a/TAO/tao/Incoming_Message_Queue.cpp +++ b/TAO/tao/Incoming_Message_Queue.cpp @@ -45,7 +45,7 @@ TAO_Incoming_Message_Queue::dequeue_head (void) return 0; // Get the node on the head of the queue... - TAO_Queued_Data *head = this->last_added_->next_; + TAO_Queued_Data * const head = this->last_added_->next_; // Reset the head node.. this->last_added_->next_ = head->next_; @@ -131,7 +131,7 @@ static ACE_Message_Block* clone_mb_nocopy_size (ACE_Message_Block *mb, size_t span_size) { // Calculate the required size of the cloned block with alignment - size_t aligned_size = ACE_CDR::first_size (span_size + ACE_CDR::MAX_ALIGNMENT); + size_t const aligned_size = ACE_CDR::first_size (span_size + ACE_CDR::MAX_ALIGNMENT); // Get the allocators ACE_Allocator *data_allocator = 0; diff --git a/TAO/tao/Incoming_Message_Queue.inl b/TAO/tao/Incoming_Message_Queue.inl index 76ba787dd8e..108a4ddbab9 100644 --- a/TAO/tao/Incoming_Message_Queue.inl +++ b/TAO/tao/Incoming_Message_Queue.inl @@ -21,7 +21,7 @@ TAO_Incoming_Message_Queue::queue_length (void) ACE_INLINE void TAO_Queued_Data::replace_data_block (ACE_Message_Block &mb) { - size_t newsize = + size_t const newsize = ACE_CDR::total_length (&mb, 0) + ACE_CDR::MAX_ALIGNMENT; ACE_Data_Block *db = diff --git a/TAO/tao/Incoming_Message_Stack.cpp b/TAO/tao/Incoming_Message_Stack.cpp index 8f704b65d9d..2d5627fd3d5 100644 --- a/TAO/tao/Incoming_Message_Stack.cpp +++ b/TAO/tao/Incoming_Message_Stack.cpp @@ -9,8 +9,3 @@ ACE_RCSID (tao, Incoming_Message_Stack, "$Id$") -TAO_BEGIN_VERSIONED_NAMESPACE_DECL -namespace TAO -{ -} -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Incoming_Message_Stack.inl b/TAO/tao/Incoming_Message_Stack.inl index 75b724c7103..fd13e03a54e 100755 --- a/TAO/tao/Incoming_Message_Stack.inl +++ b/TAO/tao/Incoming_Message_Stack.inl @@ -59,13 +59,5 @@ Incoming_Message_Stack::top (TAO_Queued_Data* &data) return 0; } -/* -ACE_INLINE bool -Incoming_Message_Stack::is_empty () -{ - return this->top_ == 0; -} -*/ - } /* namespace TAO */ TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Invocation_Endpoint_Selectors.cpp b/TAO/tao/Invocation_Endpoint_Selectors.cpp index 6d6c0957427..bdb493bd648 100644 --- a/TAO/tao/Invocation_Endpoint_Selectors.cpp +++ b/TAO/tao/Invocation_Endpoint_Selectors.cpp @@ -129,16 +129,16 @@ TAO_Default_Endpoint_Selector::select_endpoint ( if (r->blocked_connect () || (!r->blocked_connect () && r->profile ()->supports_non_blocking_oneways ())) { - const size_t endpoint_count = + size_t const endpoint_count = r->profile ()->endpoint_count (); - TAO_Endpoint *ep = + TAO_Endpoint * ep = r->profile ()->endpoint (); for (size_t i = 0; i < endpoint_count; ++i) { TAO_Base_Transport_Property desc (ep); - const bool retval = + bool const retval = r->try_connect (&desc, max_wait_time ACE_ENV_ARG_PARAMETER); diff --git a/TAO/tao/LF_Strategy_Complete.cpp b/TAO/tao/LF_Strategy_Complete.cpp index 7f6294247cc..92b29445e18 100644 --- a/TAO/tao/LF_Strategy_Complete.cpp +++ b/TAO/tao/LF_Strategy_Complete.cpp @@ -6,10 +6,6 @@ #include "ace/Guard_T.h" #include "ace/Log_Msg.h" -#if !defined (__ACE_INLINE__) -# include "tao/LF_Strategy_Complete.inl" -#endif /* __ACE_INLINE__ */ - ACE_RCSID (tao, LF_Strategy_Complete, "$Id$") diff --git a/TAO/tao/LF_Strategy_Complete.h b/TAO/tao/LF_Strategy_Complete.h index c1a2a007135..a3dfb19996e 100644 --- a/TAO/tao/LF_Strategy_Complete.h +++ b/TAO/tao/LF_Strategy_Complete.h @@ -34,9 +34,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_Export TAO_LF_Strategy_Complete : public TAO_LF_Strategy { public: - /// Constructor - TAO_LF_Strategy_Complete (void); - //@{ /** @name Virtual Methods * @@ -53,10 +50,6 @@ public: TAO_END_VERSIONED_NAMESPACE_DECL -#if defined (__ACE_INLINE__) -# include "tao/LF_Strategy_Complete.inl" -#endif /* __ACE_INLINE__ */ - #include /**/ "ace/post.h" #endif /* TAO_LF_STRATEGY_COMPLETE_H */ diff --git a/TAO/tao/LF_Strategy_Complete.inl b/TAO/tao/LF_Strategy_Complete.inl deleted file mode 100644 index 2a52ea3456a..00000000000 --- a/TAO/tao/LF_Strategy_Complete.inl +++ /dev/null @@ -1,12 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_LF_Strategy_Complete::TAO_LF_Strategy_Complete (void) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Leader_Follower.cpp b/TAO/tao/Leader_Follower.cpp index d494f48f7b3..7f0eee155e3 100644 --- a/TAO/tao/Leader_Follower.cpp +++ b/TAO/tao/Leader_Follower.cpp @@ -60,7 +60,7 @@ TAO_Leader_Follower::release_follower (TAO_LF_Follower *follower) int TAO_Leader_Follower::elect_new_leader_i (void) { - TAO_LF_Follower* follower = + TAO_LF_Follower* const follower = this->follower_set_.head (); #if defined (TAO_DEBUG_LEADER_FOLLOWER) diff --git a/TAO/tao/LocateRequest_Invocation.cpp b/TAO/tao/LocateRequest_Invocation.cpp index dac9e76cec7..203bcd5f605 100644 --- a/TAO/tao/LocateRequest_Invocation.cpp +++ b/TAO/tao/LocateRequest_Invocation.cpp @@ -66,7 +66,7 @@ namespace TAO TAO_OutputCDR &cdr = transport->out_stream (); - int retval = + int const retval = transport->generate_locate_request (tspec, this->details_, cdr); diff --git a/TAO/tao/LocateRequest_Invocation_Adapter.cpp b/TAO/tao/LocateRequest_Invocation_Adapter.cpp index 2d2e89c2f4f..a0082aa4a3e 100644 --- a/TAO/tao/LocateRequest_Invocation_Adapter.cpp +++ b/TAO/tao/LocateRequest_Invocation_Adapter.cpp @@ -24,9 +24,9 @@ namespace TAO void LocateRequest_Invocation_Adapter::invoke (ACE_ENV_SINGLE_ARG_DECL) { - CORBA::Object *effective_target = this->target_; + CORBA::Object * const effective_target = this->target_; - TAO_Stub *stub = + TAO_Stub * const stub = this->target_->_stubobj (); if (stub == 0) @@ -39,7 +39,7 @@ namespace TAO ACE_Time_Value tmp_wait_time; ACE_Time_Value *max_wait_time = 0; - bool is_timeout = + bool const is_timeout = this->get_timeout (tmp_wait_time); if (is_timeout) diff --git a/TAO/tao/LongDoubleSeqC.cpp b/TAO/tao/LongDoubleSeqC.cpp index 517b32ce0b5..44d7546418e 100644 --- a/TAO/tao/LongDoubleSeqC.cpp +++ b/TAO/tao/LongDoubleSeqC.cpp @@ -47,7 +47,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_LONGDOUBLESEQ_CS_) @@ -59,7 +59,7 @@ CORBA::LongDoubleSeq::LongDoubleSeq (void) CORBA::LongDoubleSeq::LongDoubleSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::LongDouble > (max) @@ -71,7 +71,7 @@ CORBA::LongDoubleSeq::LongDoubleSeq ( CORBA::LongDouble * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::LongDouble > (max, length, buffer, release) @@ -80,7 +80,7 @@ CORBA::LongDoubleSeq::LongDoubleSeq ( CORBA::LongDoubleSeq::LongDoubleSeq ( const LongDoubleSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::LongDouble > (seq) @@ -111,15 +111,7 @@ CORBA::Boolean operator<< ( const CORBA::LongDoubleSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_longdouble_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -127,33 +119,7 @@ CORBA::Boolean operator>> ( CORBA::LongDoubleSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_longdouble_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_LongDoubleSeq_CPP_ */ diff --git a/TAO/tao/LongDoubleSeqC.h b/TAO/tao/LongDoubleSeqC.h index 8c5eebed71f..0fe3c18f75c 100644 --- a/TAO/tao/LongDoubleSeqC.h +++ b/TAO/tao/LongDoubleSeqC.h @@ -79,22 +79,19 @@ namespace CORBA typedef TAO_FixedSeq_Var_T< - LongDoubleSeq, - CORBA::LongDouble + LongDoubleSeq > LongDoubleSeq_var; typedef TAO_Seq_Out_T< - LongDoubleSeq, - LongDoubleSeq_var, - CORBA::LongDouble + LongDoubleSeq > LongDoubleSeq_out; class TAO_Export LongDoubleSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::LongDouble > { @@ -105,7 +102,7 @@ namespace CORBA CORBA::ULong max, CORBA::ULong length, CORBA::LongDouble* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); LongDoubleSeq (const LongDoubleSeq &); ~LongDoubleSeq (void); diff --git a/TAO/tao/LongLongSeqC.cpp b/TAO/tao/LongLongSeqC.cpp index 0d0d0edc761..c36301886b4 100644 --- a/TAO/tao/LongLongSeqC.cpp +++ b/TAO/tao/LongLongSeqC.cpp @@ -47,7 +47,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_LONGLONGSEQ_CS_) @@ -59,7 +59,7 @@ CORBA::LongLongSeq::LongLongSeq (void) CORBA::LongLongSeq::LongLongSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::LongLong > (max) @@ -71,7 +71,7 @@ CORBA::LongLongSeq::LongLongSeq ( CORBA::LongLong * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::LongLong > (max, length, buffer, release) @@ -80,7 +80,7 @@ CORBA::LongLongSeq::LongLongSeq ( CORBA::LongLongSeq::LongLongSeq ( const LongLongSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::LongLong > (seq) @@ -111,15 +111,7 @@ CORBA::Boolean operator<< ( const CORBA::LongLongSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_longlong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -127,33 +119,7 @@ CORBA::Boolean operator>> ( CORBA::LongLongSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_longlong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_LongLongSeq_CPP_ */ diff --git a/TAO/tao/LongLongSeqC.h b/TAO/tao/LongLongSeqC.h index 13e708a51ad..ec3510171b1 100644 --- a/TAO/tao/LongLongSeqC.h +++ b/TAO/tao/LongLongSeqC.h @@ -79,22 +79,19 @@ namespace CORBA typedef TAO_FixedSeq_Var_T< - LongLongSeq, - CORBA::LongLong + LongLongSeq > LongLongSeq_var; typedef TAO_Seq_Out_T< - LongLongSeq, - LongLongSeq_var, - CORBA::LongLong + LongLongSeq > LongLongSeq_out; class TAO_Export LongLongSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::LongLong > { @@ -105,7 +102,7 @@ namespace CORBA CORBA::ULong max, CORBA::ULong length, CORBA::LongLong* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); LongLongSeq (const LongLongSeq &); ~LongLongSeq (void); diff --git a/TAO/tao/LongSeqC.cpp b/TAO/tao/LongSeqC.cpp index 9bcd5e632d1..3427b670d5a 100644 --- a/TAO/tao/LongSeqC.cpp +++ b/TAO/tao/LongSeqC.cpp @@ -47,7 +47,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_LONGSEQ_CS_) @@ -59,7 +59,7 @@ CORBA::LongSeq::LongSeq (void) CORBA::LongSeq::LongSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Long > (max) @@ -71,7 +71,7 @@ CORBA::LongSeq::LongSeq ( CORBA::Long * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Long > (max, length, buffer, release) @@ -80,7 +80,7 @@ CORBA::LongSeq::LongSeq ( CORBA::LongSeq::LongSeq ( const LongSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Long > (seq) @@ -111,15 +111,7 @@ CORBA::Boolean operator<< ( const CORBA::LongSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_long_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -127,33 +119,7 @@ CORBA::Boolean operator>> ( CORBA::LongSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_long_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_LongSeq_CPP_ */ diff --git a/TAO/tao/LongSeqC.h b/TAO/tao/LongSeqC.h index 98d23f21266..71702418b4c 100644 --- a/TAO/tao/LongSeqC.h +++ b/TAO/tao/LongSeqC.h @@ -79,22 +79,19 @@ namespace CORBA typedef TAO_FixedSeq_Var_T< - LongSeq, - CORBA::Long + LongSeq > LongSeq_var; typedef TAO_Seq_Out_T< - LongSeq, - LongSeq_var, - CORBA::Long + LongSeq > LongSeq_out; class TAO_Export LongSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Long > { @@ -105,7 +102,7 @@ namespace CORBA CORBA::ULong max, CORBA::ULong length, CORBA::Long* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); LongSeq (const LongSeq &); ~LongSeq (void); diff --git a/TAO/tao/MCAST_Parser.cpp b/TAO/tao/MCAST_Parser.cpp index 08a25649f56..6d182f8846b 100644 --- a/TAO/tao/MCAST_Parser.cpp +++ b/TAO/tao/MCAST_Parser.cpp @@ -54,7 +54,7 @@ TAO_MCAST_Parser::parse_string (const char *ior, */ CORBA::Object_ptr object = CORBA::Object::_nil (); - CORBA::UShort port = + CORBA::UShort const port = (CORBA::UShort) ACE_OS::atoi (this->mcast_port_.in ()); ACE_Time_Value *timeout = orb->get_timeout (); @@ -91,14 +91,14 @@ TAO_MCAST_Parser::multicast_to_service (const char *service_name, CORBA::Object::_nil (); // Use UDP multicast to locate the service. - int result = this->multicast_query (ior, - service_name, - port, - mcast_address, - mcast_ttl, - mcast_nic, - timeout, - orb); + int const result = this->multicast_query (ior, + service_name, + port, + mcast_address, + mcast_ttl, + mcast_nic, + timeout, + orb); // If the IOR didn't fit into <buf>, memory for it was dynamically // allocated - make sure it gets deallocated. diff --git a/TAO/tao/MCAST_Parser.h b/TAO/tao/MCAST_Parser.h index e4fc9560cd1..5b1c0cd58ee 100644 --- a/TAO/tao/MCAST_Parser.h +++ b/TAO/tao/MCAST_Parser.h @@ -29,9 +29,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class TAO_MCAST_Parser * - * @brief Implements the <mcast:> IOR format + * @brief Implements the @c mcast: IOR format * - * This class implements the <mcast:> IOR format. + * This class implements the @c mcast: IOR format. * It is dynamically loaded by the ORB and used to parse the * string to separate the individual <obj_addr> from the list of object * addresses <obj_addr_list>. diff --git a/TAO/tao/MProfile.cpp b/TAO/tao/MProfile.cpp index e6362be15a0..59e25c0bfb7 100644 --- a/TAO/tao/MProfile.cpp +++ b/TAO/tao/MProfile.cpp @@ -31,7 +31,8 @@ TAO_MProfile::~TAO_MProfile (void) { ACE_TRY { - (*this->policy_list_)[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::Policy_ptr policy = (*this->policy_list_)[i]; + policy->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } ACE_CATCHANY @@ -155,7 +156,8 @@ TAO_MProfile::grow (CORBA::ULong sz) return 0; // get the additional space - TAO_Profile **new_pfiles, **old_pfiles; + TAO_Profile **new_pfiles = 0; + TAO_Profile **old_pfiles = 0; ACE_NEW_RETURN (new_pfiles, TAO_Profile *[sz], -1); diff --git a/TAO/tao/MProfile.i b/TAO/tao/MProfile.i index 7992f28aa06..b3ebb70abf5 100644 --- a/TAO/tao/MProfile.i +++ b/TAO/tao/MProfile.i @@ -76,7 +76,7 @@ TAO_MProfile::get_cprev (void) else if (last_ == 1) current_=1; else if (current_ > 1) - current_--; + --current_; else // current_ == 0 or 1, 0 => list never read before and == 1 current_ = last_; @@ -90,7 +90,7 @@ TAO_MProfile::get_prev (void) // No List of BeginningOfList return 0; if (current_ > 1) - current_--; + --current_; return pfiles_[current_ - 1]; } diff --git a/TAO/tao/Makefile.am b/TAO/tao/Makefile.am index d0f636cd724..81f23d66fb9 100644 --- a/TAO/tao/Makefile.am +++ b/TAO/tao/Makefile.am @@ -235,6 +235,7 @@ libTAO_la_SOURCES = \ UShortSeqC.cpp \ UserException.cpp \ Valuetype_Adapter.cpp \ + Valuetype_Adapter_Factory.cpp \ WCharSeqC.cpp \ WStringSeqC.cpp \ Wait_On_LF_No_Upcall.cpp \ @@ -273,6 +274,7 @@ nobase_include_HEADERS = \ Any_Insert_Policy_T.h \ Arg_Traits_T.h \ Argument.h \ + Array_Traits_T.h \ Array_VarOut_T.cpp \ Array_VarOut_T.h \ Array_VarOut_T.inl \ @@ -676,6 +678,7 @@ nobase_include_HEADERS = \ UserException.h \ UserException.inl \ Valuetype_Adapter.h \ + Valuetype_Adapter_Factory.h \ VarOut_T.cpp \ VarOut_T.h \ VarOut_T.inl \ diff --git a/TAO/tao/Managed_Types.cpp b/TAO/tao/Managed_Types.cpp deleted file mode 100644 index 1334d4ac165..00000000000 --- a/TAO/tao/Managed_Types.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// $Id$ - -#include "tao/Managed_Types.h" - -#if !defined (__ACE_INLINE__) -#include "tao/Managed_Types.i" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID (tao, - Managed_Types, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// assignment from CORBA::String_var makes a copy -TAO_String_Manager& -TAO_String_Manager::operator= (const CORBA::String_var &var) -{ - // Strongly exception safe by means of copy and non-throwing swap - // technique. - TAO_String_Manager tmp (var.in ()); - - char * old_ptr = this->ptr_; - this->ptr_ = tmp.ptr_; - tmp.ptr_ = old_ptr; - - return *this; -} - -// assignment from String_var -TAO_SeqElem_String_Manager& -TAO_SeqElem_String_Manager::operator= (const CORBA::String_var &var) -{ - if (this->release_) - { - CORBA::string_free (*this->ptr_); - } - - *this->ptr_ = CORBA::string_dup (var.in ()); - return *this; -} - -// **************************************************************** - -// assignment from CORBA::WString_var makes a copy -TAO_WString_Manager& -TAO_WString_Manager::operator= (const CORBA::WString_var &var) -{ - // Strongly exception safe by means of copy and non-throwing swap - // technique. - TAO_WString_Manager tmp (var.in ()); - - CORBA::WChar * old_ptr = this->ptr_; - this->ptr_ = tmp.ptr_; - tmp.ptr_ = old_ptr; - - return *this; -} - -// assignment from WString_var -TAO_SeqElem_WString_Manager& -TAO_SeqElem_WString_Manager::operator= (const CORBA::WString_var &var) -{ - if (this->release_) - { - CORBA::wstring_free (*this->ptr_); - } - - *this->ptr_ = CORBA::wstring_dup (var.in ()); - return *this; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Managed_Types.h b/TAO/tao/Managed_Types.h deleted file mode 100644 index fef6ad3c28b..00000000000 --- a/TAO/tao/Managed_Types.h +++ /dev/null @@ -1,341 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Managed_Types.h - * - * $Id$ - * - * @author Aniruddha Gokhale - */ -//============================================================================= - -#ifndef TAO_MANAGED_TYPES_H -#define TAO_MANAGED_TYPES_H - -#include /**/ "ace/pre.h" - -#include "tao/TAO_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Basic_Types.h" -#include "tao/CORBA_String.h" - -/****************************************************************/ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_String_Manager - * - * @brief Manager for strings. - * - * This class implements the generic string manager and is used in the C++ - * mapping of "struct" members that are of type "string". The difference - * between this class and the CORBA::String_var class is that the default - * constructor initializes the underlying string to an empty string in this - * class whereas it is a NUL string for the _var class. - */ -class TAO_Export TAO_String_Manager -{ -public: - - /// default CTOR will initialize the underlying ptr_ to empty string. - TAO_String_Manager (void); - - /// copy constructor - TAO_String_Manager (const TAO_String_Manager &); - - /// constructor from const char* makes a copy. - TAO_String_Manager (const char *); - - /// destructor - ~TAO_String_Manager (void); - - /// assignment from another managed type - TAO_String_Manager &operator= (const TAO_String_Manager&); - - /// assignment from var type will make a copy - TAO_String_Manager &operator= (const CORBA::String_var&); - - /// assignment from a constant char* will make a copy - TAO_String_Manager &operator= (const char *); - - /// assignment from char* will not make a copy. The String_Manager will now - /// own the string. - TAO_String_Manager &operator= (char *); - - /// cast (read-only) - operator const char*() const; - - /// for in parameter. - const char *in (void) const; - - /// for inout parameter. - char *&inout (void); - - /// for out parameter. - char *&out (void); - - /// for string of return type. - char *_retn (void); - -private: - /// The underlying string - char *ptr_; - -}; - -/****************************************************************/ - -/** - * @class TAO_SeqElem_String_Manager - * - * @brief TAO_SeqElem_String_Manager - * - * Manager for strings that are the element type of sequences. - * Similar to the mapping for sequences of objects (and other - * pseudo objects) the mapping for sequences of strings requires - * an auxiliar class or <Manager> to handle the allocation and - * deallocation of the string. The main difference with respect - * to String_var classes is that automatic release is not - * controlled on a per-item basis, but for the sequence as a - * whole. The difference wrt Object_Manager is that strings are - * duplicated using CORBA::string_dup () as opposed to - * T::_duplicate(), and released using CORBA::string_free() - * instead of CORBA::release() - * This class implements the generic string manager and is used to - * instantiate the proper sequence types. - * This class will have the same semantics as the string manager classes - * defined earlier with respect to the various assignment - * operators. However, the freeing of old storage will be dependent on the - * "release" value of the parent sequence class. - */ -class TAO_Export TAO_SeqElem_String_Manager -{ -public: - friend class TAO_Unbounded_String_Sequence; - - // @@ Giving friendship to a template is not implemented on several - // compilers: - // friend template<CORBA::ULong MAX> - // class TAO_Bounded_String_Sequence<TAO_SeqElem_String_Manager,MAX>; - - /// copy constructor - TAO_SeqElem_String_Manager (const TAO_SeqElem_String_Manager &); - - /// constructor from address of an element - TAO_SeqElem_String_Manager (char **buffer, CORBA::Boolean release); - - /// destructor - ~TAO_SeqElem_String_Manager (void); - - /// assignment from another managed type - TAO_SeqElem_String_Manager &operator= (const TAO_SeqElem_String_Manager&); - - /// assignment from var type will make a copy - TAO_SeqElem_String_Manager &operator= (const CORBA::String_var&); - - /// assignment from a constant char* will make a copy - TAO_SeqElem_String_Manager &operator= (const char *); - - /// assignment from char* will not make a copy. The SeqElem_String_Manager will now - /// own the string. - TAO_SeqElem_String_Manager &operator= (char *); - - /// cast (read-only) - operator const char*() const; - - /// for in parameter. - const char *in (void) const; - - /// for inout parameter. - char *&inout (void); - - /// for out parameter. - char *&out (void); - - /// for string of return type. - char *_retn (void); - -private: - /// Address of string element from the parent's buffer. - char **ptr_; - - /// control memory managment semantics. - CORBA::Boolean release_; - - // following are now allowed since these managed class will be used only by - // the [] operator of the sequence class. The [] operator will not use the - // following ctors to instantiate the managed instance - - /// default ctor - TAO_SeqElem_String_Manager (void); - -}; - -// **************************************************************** - -/** - * @class TAO_WString_Manager - * - * @brief Manager for wide strings. - * - * This class implements the generic wstring manager and is used - * in the C++ mapping of "struct" members that are of type - * "wstring". - * The difference between this class and the CORBA::WString_var - * class is that the default constructor initializes the - * underlying wstring to an empty string in this class whereas it - * is a NUL wstring for the _var class. - */ -class TAO_Export TAO_WString_Manager -{ -public: - - /// default CTOR will initialize the underlying ptr_ to empty string. - TAO_WString_Manager (void); - - /// copy constructor - TAO_WString_Manager (const TAO_WString_Manager &); - - /// constructor from const whar* makes a copy. - TAO_WString_Manager (const CORBA::WChar *); - - /// destructor - ~TAO_WString_Manager (void); - - /// assignment from another managed type - TAO_WString_Manager &operator= (const TAO_WString_Manager&); - - /// assignment from var type will make a copy - TAO_WString_Manager &operator= (const CORBA::WString_var&); - - /// assignment from a constant wchar* will make a copy - TAO_WString_Manager &operator= (const CORBA::WChar *); - - /// assignment from wchar* will not make a copy. The WString_Manager - /// will now own the string. - TAO_WString_Manager &operator= (CORBA::WChar *); - - /// cast (read-only) - operator const CORBA::WChar*() const; - - /// for in parameter. - const CORBA::WChar *in (void) const; - - /// for inout parameter. - CORBA::WChar *&inout (void); - - /// for out parameter. - CORBA::WChar *&out (void); - - /// for string of return type. - CORBA::WChar *_retn (void); - -private: - /// The underlying wide string - CORBA::WChar *ptr_; - -}; - -/****************************************************************/ - -/** - * @class TAO_SeqElem_WString_Manager - * - * @brief TAO_SeqElem_WString_Manager - * - * Manager for strings that are the element type of sequences. - * Similar to the mapping for sequences of objects (and other - * pseudo objects) the mapping for sequences of strings requires - * an auxiliar class or <Manager> to handle the allocation and - * deallocation of the string. The main difference with respect - * to WString_var classes is that automatic release is not - * controlled on a per-item basis, but for the sequence as a - * whole. The difference wrt Object_Manager is that strings are - * duplicated using CORBA::WString_dup () as opposed to - * T::_duplicate(), and released using CORBA::WString_free() - * instead of CORBA::release() - * This class implements the generic string manager and is used to - * instantiate the proper sequence types. - * This class will have the same semantics as the string manager - * classes defined earlier with respect to the various assignment - * operators. However, the freeing of old storage will be - * dependent on the "release" value of the parent sequence class. - */ -class TAO_Export TAO_SeqElem_WString_Manager -{ -public: - friend class TAO_Unbounded_WString_Sequence; - - // @@ Giving friendship to a template is not implemented on several - // compilers: - // friend template<CORBA::ULong MAX> - // class TAO_Bounded_WString_Sequence<TAO_SeqElem_WString_Manager,MAX>; - - /// constructor from address of an element - TAO_SeqElem_WString_Manager (CORBA::WChar **buffer, - CORBA::Boolean release); - - /// copy constructor - TAO_SeqElem_WString_Manager (const TAO_SeqElem_WString_Manager &); - - /// destructor - ~TAO_SeqElem_WString_Manager (void); - - /// assignment from another managed type - TAO_SeqElem_WString_Manager &operator= (const TAO_SeqElem_WString_Manager&); - - /// assignment from var type will make a copy - TAO_SeqElem_WString_Manager &operator= (const CORBA::WString_var&); - - /// assignment from a constant char* will make a copy - TAO_SeqElem_WString_Manager &operator= (const CORBA::WChar *); - - /// assignment from char* will not make a copy. The - /// SeqElem_WString_Manager will now own the string. - TAO_SeqElem_WString_Manager &operator= (CORBA::WChar *); - - /// cast (read-only) - operator const CORBA::WChar*() const; - - /// for in parameter. - const CORBA::WChar *in (void) const; - - /// for inout parameter. - CORBA::WChar *&inout (void); - - /// for out parameter. - CORBA::WChar *&out (void); - - /// for string of return type. - CORBA::WChar *_retn (void); - -private: - /// Address of string element from the parent's buffer. - CORBA::WChar **ptr_; - - /// control memory managment semantics. - CORBA::Boolean release_; - - // following are now allowed since these managed class will be used only by - // the [] operator of the sequence class. The [] operator will not use the - // following ctors to instantiate the managed instance - - /// default ctor - TAO_SeqElem_WString_Manager (void); - -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -#include "tao/Managed_Types.i" -#endif /* __ACE_INLINE__ */ - -#include /**/ "ace/post.h" -#endif /* TAO_MANAGED_TYPES_H */ diff --git a/TAO/tao/Managed_Types.i b/TAO/tao/Managed_Types.i deleted file mode 100644 index aa03deb7c56..00000000000 --- a/TAO/tao/Managed_Types.i +++ /dev/null @@ -1,407 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO -// -// = FILENAME -// Managed_Types.i -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -// **************************************************************** - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// default CTOR initializes to empty string -ACE_INLINE -TAO_String_Manager::TAO_String_Manager (void) - : ptr_ (CORBA::string_dup ("")) -{ -} - -// copy ctor copies storage -ACE_INLINE -TAO_String_Manager::TAO_String_Manager (const TAO_String_Manager &rhs) - : ptr_ (CORBA::string_dup (rhs.ptr_)) -{ -} - -ACE_INLINE -TAO_String_Manager::TAO_String_Manager (const char *s) - : ptr_ (CORBA::string_dup (s)) -{ -} - -// destructor -ACE_INLINE -TAO_String_Manager::~TAO_String_Manager (void) -{ - CORBA::string_free (this->ptr_); -} - -// assignment -ACE_INLINE TAO_String_Manager& -TAO_String_Manager::operator= (const TAO_String_Manager &rhs) -{ - // Strongly exception safe by means of copy and non-throwing swap - // technique. - TAO_String_Manager tmp (rhs); - - char * old_ptr = this->ptr_; - this->ptr_ = tmp.ptr_; - tmp.ptr_ = old_ptr; - - return *this; -} - -// assignment from const char* makes a copy -ACE_INLINE TAO_String_Manager & -TAO_String_Manager::operator= (const char * p) -{ - // Strongly exception safe by means of copy and non-throwing swap - // technique. - TAO_String_Manager tmp (p); - - char * old_ptr = this->ptr_; - this->ptr_ = tmp.ptr_; - tmp.ptr_ = old_ptr; - - return *this; -} - -// assignment from char* owns the string -ACE_INLINE TAO_String_Manager & -TAO_String_Manager::operator= (char * p) -{ - CORBA::string_free (this->ptr_); - this->ptr_ = p; - return *this; -} - -ACE_INLINE -TAO_String_Manager::operator const char* (void) const -{ - return this->ptr_; -} - -ACE_INLINE const char * -TAO_String_Manager::in (void) const -{ - return this->ptr_; -} - -ACE_INLINE char *& -TAO_String_Manager::inout (void) -{ - return this->ptr_; -} - -ACE_INLINE char *& -TAO_String_Manager::out (void) -{ - CORBA::string_free (this->ptr_); - this->ptr_ = 0; - return this->ptr_; -} - -ACE_INLINE char * -TAO_String_Manager::_retn (void) -{ - char *temp = this->ptr_; - this->ptr_ = 0; - return temp; -} - -// **************************************************************** - -// copy ctor -ACE_INLINE -TAO_SeqElem_String_Manager:: -TAO_SeqElem_String_Manager (const TAO_SeqElem_String_Manager &rhs) - : ptr_ (rhs.ptr_), - release_ (rhs.release_) -{ -} - -ACE_INLINE -TAO_SeqElem_String_Manager::TAO_SeqElem_String_Manager (char **buffer, - CORBA::Boolean release) - : ptr_ (buffer), - release_ (release) -{ -} - -ACE_INLINE -TAO_SeqElem_String_Manager::~TAO_SeqElem_String_Manager (void) -{ -} - -// assignment -ACE_INLINE TAO_SeqElem_String_Manager& -TAO_SeqElem_String_Manager::operator= (const TAO_SeqElem_String_Manager &rhs) -{ - if (this == &rhs) - return *this; - - if (this->release_) - CORBA::string_free (*this->ptr_); - *this->ptr_ = CORBA::string_dup (*rhs.ptr_); - return *this; -} - -// assignment from const char* will make copy -ACE_INLINE TAO_SeqElem_String_Manager & -TAO_SeqElem_String_Manager::operator= (const char *p) -{ - if (this->release_) - CORBA::string_free (*this->ptr_); - *this->ptr_ = CORBA::string_dup (p); - return *this; -} - -// assignment from char* will own it -ACE_INLINE TAO_SeqElem_String_Manager & -TAO_SeqElem_String_Manager::operator= (char *p) -{ - if (this->release_) - CORBA::string_free (*this->ptr_); - *this->ptr_ = p; - return *this; -} - -ACE_INLINE -TAO_SeqElem_String_Manager::operator const char* (void) const -{ - return *this->ptr_; -} - -ACE_INLINE const char * -TAO_SeqElem_String_Manager::in (void) const -{ - return *this->ptr_; -} - -ACE_INLINE char *& -TAO_SeqElem_String_Manager::inout (void) -{ - return *this->ptr_; -} - -ACE_INLINE char *& -TAO_SeqElem_String_Manager::out (void) -{ - CORBA::string_free (*this->ptr_); - *this->ptr_ = 0; - return *this->ptr_; -} - -ACE_INLINE char * -TAO_SeqElem_String_Manager::_retn (void) -{ - char *temp = *this->ptr_; - *this->ptr_ = 0; - return temp; -} - -// **************************************************************** - -// default CTOR initializes to empty string -ACE_INLINE -TAO_WString_Manager::TAO_WString_Manager (void) - : ptr_ (0) // @@ CORBA::wstring_dup ("")) -{ -} - -// copy ctor copies storage -ACE_INLINE -TAO_WString_Manager::TAO_WString_Manager (const TAO_WString_Manager &rhs) - : ptr_ (CORBA::wstring_dup (rhs.ptr_)) -{ -} - -ACE_INLINE -TAO_WString_Manager::TAO_WString_Manager (const CORBA::WChar *ws) - : ptr_ (CORBA::wstring_dup (ws)) -{ -} - -// destructor -ACE_INLINE -TAO_WString_Manager::~TAO_WString_Manager (void) -{ - CORBA::wstring_free (this->ptr_); -} - -// assignment -ACE_INLINE TAO_WString_Manager& -TAO_WString_Manager::operator= (const TAO_WString_Manager &rhs) -{ - // Strongly exception safe by means of copy and non-throwing swap - // technique. - TAO_WString_Manager tmp (rhs); - - CORBA::WChar * old_ptr = this->ptr_; - this->ptr_ = tmp.ptr_; - tmp.ptr_ = old_ptr; - - return *this; -} - -// assignment from const CORBA::WChar* makes a copy -ACE_INLINE TAO_WString_Manager & -TAO_WString_Manager::operator= (const CORBA::WChar * p) -{ - // Strongly exception safe by means of copy and non-throwing swap - // technique. - TAO_WString_Manager tmp (p); - - CORBA::WChar * old_ptr = this->ptr_; - this->ptr_ = tmp.ptr_; - tmp.ptr_ = old_ptr; - - return *this; -} - -// assignment from CORBA::WChar* owns the string -ACE_INLINE TAO_WString_Manager & -TAO_WString_Manager::operator= (CORBA::WChar * p) -{ - CORBA::wstring_free (this->ptr_); - this->ptr_ = p; - return *this; -} - -ACE_INLINE -TAO_WString_Manager::operator const CORBA::WChar* (void) const -{ - return this->ptr_; -} - -ACE_INLINE const CORBA::WChar * -TAO_WString_Manager::in (void) const -{ - return this->ptr_; -} - -ACE_INLINE CORBA::WChar *& -TAO_WString_Manager::inout (void) -{ - return this->ptr_; -} - -ACE_INLINE CORBA::WChar *& -TAO_WString_Manager::out (void) -{ - CORBA::wstring_free (this->ptr_); - this->ptr_ = 0; - return this->ptr_; -} - -ACE_INLINE CORBA::WChar * -TAO_WString_Manager::_retn (void) -{ - CORBA::WChar *temp = this->ptr_; - this->ptr_ = 0; - return temp; -} - -// **************************************************************** - -// copy ctor -ACE_INLINE -TAO_SeqElem_WString_Manager:: -TAO_SeqElem_WString_Manager (const TAO_SeqElem_WString_Manager &rhs) - : ptr_ (rhs.ptr_), - release_ (rhs.release_) -{ -} - -ACE_INLINE -TAO_SeqElem_WString_Manager:: - TAO_SeqElem_WString_Manager (CORBA::WChar **buffer, - CORBA::Boolean release) - : ptr_ (buffer), - release_ (release) -{ -} - -ACE_INLINE -TAO_SeqElem_WString_Manager::~TAO_SeqElem_WString_Manager (void) -{ -} - -// assignment -ACE_INLINE TAO_SeqElem_WString_Manager& -TAO_SeqElem_WString_Manager::operator= (const TAO_SeqElem_WString_Manager &rhs) -{ - if (this == &rhs) - return *this; - - if (this->release_) - CORBA::wstring_free (*this->ptr_); - *this->ptr_ = CORBA::wstring_dup (*rhs.ptr_); - return *this; -} - -// assignment from const CORBA::WChar* will make copy -ACE_INLINE TAO_SeqElem_WString_Manager & -TAO_SeqElem_WString_Manager::operator= (const CORBA::WChar *p) -{ - if (this->release_) - CORBA::wstring_free (*this->ptr_); - *this->ptr_ = CORBA::wstring_dup (p); - return *this; -} - -// assignment from CORBA::WChar* will own it -ACE_INLINE TAO_SeqElem_WString_Manager & -TAO_SeqElem_WString_Manager::operator= (CORBA::WChar *p) -{ - if (this->release_) - CORBA::wstring_free (*this->ptr_); - *this->ptr_ = p; - return *this; -} - -ACE_INLINE -TAO_SeqElem_WString_Manager::operator const CORBA::WChar* (void) const -{ - return *this->ptr_; -} - -ACE_INLINE const CORBA::WChar * -TAO_SeqElem_WString_Manager::in (void) const -{ - return *this->ptr_; -} - -ACE_INLINE CORBA::WChar *& -TAO_SeqElem_WString_Manager::inout (void) -{ - return *this->ptr_; -} - -ACE_INLINE CORBA::WChar *& -TAO_SeqElem_WString_Manager::out (void) -{ - CORBA::wstring_free (*this->ptr_); - *this->ptr_ = 0; - return *this->ptr_; -} - -ACE_INLINE CORBA::WChar * -TAO_SeqElem_WString_Manager::_retn (void) -{ - CORBA::WChar *temp = *this->ptr_; - *this->ptr_ = 0; - return temp; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Messaging_PolicyValueC.cpp b/TAO/tao/Messaging_PolicyValueC.cpp index d9e437f2c76..3fa19255de1 100644 --- a/TAO/tao/Messaging_PolicyValueC.cpp +++ b/TAO/tao/Messaging_PolicyValueC.cpp @@ -48,10 +48,10 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void Messaging::PolicyValue::_tao_any_destructor ( void *_tao_void_pointer ) @@ -61,7 +61,7 @@ Messaging::PolicyValue::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_MESSAGING_POLICYVALUESEQ_CS_) @@ -73,7 +73,7 @@ Messaging::PolicyValueSeq::PolicyValueSeq (void) Messaging::PolicyValueSeq::PolicyValueSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< Messaging::PolicyValue > (max) @@ -85,7 +85,7 @@ Messaging::PolicyValueSeq::PolicyValueSeq ( Messaging::PolicyValue * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< Messaging::PolicyValue > (max, length, buffer, release) @@ -94,7 +94,7 @@ Messaging::PolicyValueSeq::PolicyValueSeq ( Messaging::PolicyValueSeq::PolicyValueSeq ( const PolicyValueSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< Messaging::PolicyValue > (seq) @@ -148,22 +148,7 @@ CORBA::Boolean operator<< ( const Messaging::PolicyValueSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -171,40 +156,7 @@ CORBA::Boolean operator>> ( Messaging::PolicyValueSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_Messaging_PolicyValueSeq_CPP_ */ diff --git a/TAO/tao/Messaging_PolicyValueC.h b/TAO/tao/Messaging_PolicyValueC.h index 9b48af9e2e6..7a95d8fecb0 100644 --- a/TAO/tao/Messaging_PolicyValueC.h +++ b/TAO/tao/Messaging_PolicyValueC.h @@ -68,63 +68,60 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace Messaging { - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct PolicyValue; - + typedef TAO_Var_Var_T< PolicyValue > PolicyValue_var; - + typedef TAO_Out_T< PolicyValue, PolicyValue_var > PolicyValue_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export PolicyValue { typedef PolicyValue_var _var_type; - + static void _tao_any_destructor (void *); CORBA::PolicyType ptype; CORBA::OctetSeq pvalue; }; - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_MESSAGING_POLICYVALUESEQ_CH_) #define _MESSAGING_POLICYVALUESEQ_CH_ - + class PolicyValueSeq; - + typedef TAO_VarSeq_Var_T< - PolicyValueSeq, - PolicyValue + PolicyValueSeq > PolicyValueSeq_var; - + typedef TAO_Seq_Out_T< - PolicyValueSeq, - PolicyValueSeq_var, - PolicyValue + PolicyValueSeq > PolicyValueSeq_out; - + class TAO_Export PolicyValueSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< PolicyValue > { @@ -134,27 +131,27 @@ namespace Messaging PolicyValueSeq ( CORBA::ULong max, CORBA::ULong length, - PolicyValue* buffer, - CORBA::Boolean release = 0 + PolicyValue* buffer, + CORBA::Boolean release = false ); PolicyValueSeq (const PolicyValueSeq &); ~PolicyValueSeq (void); - + static void _tao_any_destructor (void *); - + typedef PolicyValueSeq_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ComponentId TAG_POLICIES = 2U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const IOP::ServiceId INVOCATION_POLICIES = 7U; // TAO_IDL - Generated from diff --git a/TAO/tao/Muxed_TMS.h b/TAO/tao/Muxed_TMS.h index 77aa902177a..974fa62ae99 100644 --- a/TAO/tao/Muxed_TMS.h +++ b/TAO/tao/Muxed_TMS.h @@ -75,7 +75,7 @@ protected: /// Keep track of the orb core pointer. We need to this to create the /// Reply Dispatchers. - TAO_ORB_Core *orb_core_; + TAO_ORB_Core * const orb_core_; typedef ACE_Hash_Map_Manager_Ex <CORBA::ULong, TAO_Reply_Dispatcher *, diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index a4554a2ed2b..e26a0810018 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -251,7 +251,7 @@ CORBA::ORB::work_pending (ACE_Time_Value &tv ACE_ENV_ARG_DECL) this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - const int result = this->orb_core_->reactor ()->work_pending (tv); + int const result = this->orb_core_->reactor ()->work_pending (tv); if (result == 0 || (result == -1 && errno == ETIME)) return 0; @@ -1894,7 +1894,7 @@ CORBA::ORB::url_ior_string_to_object (const char* str this->orb_core_->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - int retv = + int const retv = conn_reg->make_mprofile (str, mprofile ACE_ENV_ARG_PARAMETER); @@ -1953,40 +1953,26 @@ CORBA::ORB::register_value_factory (const char *repository_id, CORBA::ValueFactory factory ACE_ENV_ARG_DECL) { - // %! guard, and ACE_Null_Mutex in the map - // do _add_ref here not in map->rebind + TAO_Valuetype_Adapter *vta = this->orb_core ()->valuetype_adapter (); - if (this->orb_core ()->valuetype_adapter () == 0) + if (vta) { + int const result = vta->vf_map_rebind (repository_id, + factory); - this->orb_core ()->valuetype_adapter () = - ACE_Dynamic_Service<TAO_Valuetype_Adapter>::instance ( - TAO_ORB_Core::valuetype_adapter_name () - ); + if (result == 0) // No previous factory found + { + return 0; + } - if (this->orb_core ()->valuetype_adapter () == 0) + if (result == -1) { - ACE_THROW_RETURN (CORBA::INTERNAL (), + // Error on bind. + ACE_THROW_RETURN (CORBA::MARSHAL (), 0); } } - int result = - this->orb_core ()->valuetype_adapter ()->vf_map_rebind (repository_id, - factory); - - if (result == 0) // No previous factory found - { - return 0; - } - - if (result == -1) - { - // Error on bind. - ACE_THROW_RETURN (CORBA::MARSHAL (), - 0); - } - return factory; // previous factory was found } @@ -1994,10 +1980,12 @@ void CORBA::ORB::unregister_value_factory (const char *repository_id ACE_ENV_ARG_DECL_NOT_USED) { - if (this->orb_core ()->valuetype_adapter ()) + TAO_Valuetype_Adapter *vta = this->orb_core ()->valuetype_adapter (); + + if (vta) { // Dont care whther it was successful or not! - (void) this->orb_core ()->valuetype_adapter ()->vf_map_unbind (repository_id); + (void) vta->vf_map_unbind (repository_id); } } @@ -2005,21 +1993,14 @@ CORBA::ValueFactory CORBA::ORB::lookup_value_factory (const char *repository_id ACE_ENV_ARG_DECL) { - if (this->orb_core ()->valuetype_adapter () == 0) - { - this->orb_core ()->valuetype_adapter () = - ACE_Dynamic_Service<TAO_Valuetype_Adapter>::instance ( - TAO_ORB_Core::valuetype_adapter_name () - ); + TAO_Valuetype_Adapter *vta = this->orb_core ()->valuetype_adapter (); - if (this->orb_core ()->valuetype_adapter () == 0) - { - ACE_THROW_RETURN (CORBA::INTERNAL (), - 0); - } + if (vta) + { + return vta->vf_map_find (repository_id); } - return this->orb_core ()->valuetype_adapter ()->vf_map_find (repository_id); + return 0; } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h index a02b90d56da..2077bad1c79 100644 --- a/TAO/tao/ORB.h +++ b/TAO/tao/ORB.h @@ -57,7 +57,6 @@ class TAO_OutputCDR; class TAO_Stub; class TAO_Valuetype_Adapter; class TAO_Acceptor_Filter; -class TAO_SeqElem_String_Manager; // **************************************************************** @@ -92,17 +91,14 @@ namespace CORBA // TODO - implement OMG's 'ORBid CORBA::ORB::id (void)'. typedef - TAO_MngSeq_Var_T< - ORB_ObjectIdList, - TAO_SeqElem_String_Manager + TAO_VarSeq_Var_T< + ORB_ObjectIdList > ORB_ObjectIdList_var; typedef - TAO_MngSeq_Out_T< - ORB_ObjectIdList, - ORB_ObjectIdList_var, - TAO_SeqElem_String_Manager + TAO_Seq_Out_T< + ORB_ObjectIdList > ORB_ObjectIdList_out; @@ -237,27 +233,20 @@ namespace CORBA // send_multiple_requests_*(). typedef - TAO_Unbounded_Pseudo_Sequence< - CORBA::Request + TAO::unbounded_object_reference_sequence< + CORBA::Request, CORBA::Request_var > RequestSeq; typedef TAO_VarSeq_Var_T< - RequestSeq, - TAO_Pseudo_Object_Manager< - CORBA::Request - > + RequestSeq > RequestSeq_var; typedef TAO_Seq_Out_T< - RequestSeq, - RequestSeq_var, - TAO_Pseudo_Object_Manager< - CORBA::Request - > + RequestSeq > RequestSeq_out; @@ -647,7 +636,7 @@ namespace CORBA CORBA::ULong refcount_; /// The ORB_Core that created us.... - TAO_ORB_Core *orb_core_; + TAO_ORB_Core * orb_core_; /// Decides whether to use the URL notation or to use IOR notation. CORBA::Boolean use_omg_ior_format_; diff --git a/TAO/tao/ORB.i b/TAO/tao/ORB.i index 81c1e4ae8e0..89ddfb694a1 100644 --- a/TAO/tao/ORB.i +++ b/TAO/tao/ORB.i @@ -23,7 +23,7 @@ CORBA::ORB::_decr_refcnt (void) { { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, 0); - this->refcount_--; + --this->refcount_; if (this->refcount_ != 0) { diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 74bca60c41d..9a5ca546c90 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -37,6 +37,9 @@ #include "tao/ORBInitializer_Registry_Adapter.h" #include "tao/Codeset_Manager.h" +#include "tao/Valuetype_Adapter.h" +#include "tao/Valuetype_Adapter_Factory.h" + #if (TAO_HAS_CORBA_MESSAGING == 1) #include "tao/Policy_Manager.h" #include "tao/Policy_Current.h" @@ -130,7 +133,7 @@ TAO_ORB_Core_Static_Resources::TAO_ORB_Core_Static_Resources (void) ifr_client_adapter_name_ ("IFR_Client_Adapter"), typecodefactory_adapter_name_ ("TypeCodeFactory_Adapter"), iorinterceptor_adapter_factory_name_ ("IORInterceptor_Adapter_Factory"), - valuetype_adapter_name_ ("Valuetype_Adapter"), + valuetype_adapter_factory_name_ ("valuetype_Adapter_Factory"), poa_factory_name_ ("TAO_Object_Adapter_Factory"), poa_factory_directive_ (ACE_TEXT_ALWAYS_CHAR (ACE_DYNAMIC_SERVICE_DIRECTIVE("TAO_Object_Adapter_Factory", "TAO_PortableServer", "_make_TAO_Object_Adapter_Factory", ""))) { @@ -268,9 +271,9 @@ TAO_ORB_Core::~TAO_ORB_Core (void) #if (TAO_HAS_CORBA_MESSAGING == 1) - CORBA::release (this->policy_manager_); + ::CORBA::release (this->policy_manager_); delete this->default_policies_; - CORBA::release (this->policy_current_); + ::CORBA::release (this->policy_current_); #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ @@ -283,7 +286,7 @@ TAO_ORB_Core::~TAO_ORB_Core (void) // Don't delete, is a process wide singleton shared by all orbs orbinitializer_registry_ = 0; - CORBA::release (this->orb_); + ::CORBA::release (this->orb_); } int @@ -1238,17 +1241,17 @@ TAO_ORB_Core::fini (void) // Wait for any server threads, ignoring any failures. (void) this->thr_mgr ()->wait (); - CORBA::release (this->implrepo_service_); + ::CORBA::release (this->implrepo_service_); - CORBA::release (this->typecode_factory_); + ::CORBA::release (this->typecode_factory_); - CORBA::release (this->codec_factory_); + ::CORBA::release (this->codec_factory_); - CORBA::release (this->dynany_factory_); + ::CORBA::release (this->dynany_factory_); - CORBA::release (this->ior_manip_factory_); + ::CORBA::release (this->ior_manip_factory_); - CORBA::release (this->ior_table_); + ::CORBA::release (this->ior_table_); if (TAO_debug_level > 2) { @@ -1372,15 +1375,15 @@ TAO_ORB_Core::iorinterceptor_adapter_factory_name (void) } void -TAO_ORB_Core::valuetype_adapter_name (const char *name) +TAO_ORB_Core::valuetype_adapter_factory_name (const char *name) { - TAO_ORB_Core_Static_Resources::instance ()->valuetype_adapter_name_ = name; + TAO_ORB_Core_Static_Resources::instance ()->valuetype_adapter_factory_name_ = name; } const char * -TAO_ORB_Core::valuetype_adapter_name (void) +TAO_ORB_Core::valuetype_adapter_factory_name (void) { - return TAO_ORB_Core_Static_Resources::instance ()->valuetype_adapter_name_.c_str(); + return TAO_ORB_Core_Static_Resources::instance ()->valuetype_adapter_factory_name_.c_str(); } TAO_Resource_Factory * @@ -2083,72 +2086,62 @@ TAO_ORB_Core::run (ACE_Time_Value *tv, void TAO_ORB_Core::shutdown (CORBA::Boolean wait_for_completion ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (()) { - ACE_TRY - { - { - ACE_GUARD (TAO_SYNCH_MUTEX, monitor, this->lock_); + { + ACE_GUARD (TAO_SYNCH_MUTEX, monitor, this->lock_); - if (this->has_shutdown () != 0) - return; + if (this->has_shutdown () != 0) + return; - // Check if we are on the right state, i.e. do not accept - // shutdowns with the 'wait_for_completion' flag set in the middle - // of an upcall (because those deadlock). - this->adapter_registry_.check_close (wait_for_completion - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + // Check if we are on the right state, i.e. do not accept + // shutdowns with the 'wait_for_completion' flag set in the middle + // of an upcall (because those deadlock). + this->adapter_registry_.check_close (wait_for_completion + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - // Set the 'has_shutdown' flag, so any further attempt to shutdown - // becomes a noop. - this->has_shutdown_ = 1; + // Set the 'has_shutdown' flag, so any further attempt to shutdown + // becomes a noop. + this->has_shutdown_ = 1; - // need to release the mutex, because some of the shutdown - // operations invoke application code, that could (and in practice - // does!) callback into ORB Core code. - } + // need to release the mutex, because some of the shutdown + // operations invoke application code, that could (and in practice + // does!) callback into ORB Core code. + } - this->adapter_registry_.close (wait_for_completion - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + this->adapter_registry_.close (wait_for_completion + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - // Shutdown reactor. - this->thread_lane_resources_manager ().shutdown_reactor (); + // Shutdown reactor. + this->thread_lane_resources_manager ().shutdown_reactor (); - // Cleanup transports that use the RW strategies - this->thread_lane_resources_manager ().cleanup_rw_transports (); + // Cleanup transports that use the RW strategies + this->thread_lane_resources_manager ().cleanup_rw_transports (); - // Grab the thread manager - ACE_Thread_Manager *tm = this->thr_mgr (); + // Grab the thread manager + ACE_Thread_Manager *tm = this->thr_mgr (); - // Try to cancel all the threads in the ORB. - tm->cancel_all (); + // Try to cancel all the threads in the ORB. + tm->cancel_all (); - // If <wait_for_completion> is set, wait for all threads to exit. - if (wait_for_completion != 0) - tm->wait (); + // If <wait_for_completion> is set, wait for all threads to exit. + if (wait_for_completion != 0) + tm->wait (); - // Explicitly destroy the object reference table since it - // contains references to objects, which themselves may contain - // reference to this ORB. - this->object_ref_table_.destroy (); + // Explicitly destroy the valuetype adapter + delete this->valuetype_adapter_; + this->valuetype_adapter_ = 0; + + // Explicitly destroy the object reference table since it + // contains references to objects, which themselves may contain + // reference to this ORB. + this->object_ref_table_.destroy (); #if (TAO_HAS_INTERCEPTORS == 1) - CORBA::release (this->pi_current_); - this->pi_current_ = CORBA::Object::_nil (); + CORBA::release (this->pi_current_); + this->pi_current_ = CORBA::Object::_nil (); #endif /* TAO_HAS_INTERCEPTORS == 1 */ - } - ACE_CATCHALL - { - // Do not allow exceptions to escape.. So catch all the - // exceptions. - // @@ Not sure what to print here for the users.. - - } - ACE_ENDTRY; - - return; } void @@ -3161,6 +3154,47 @@ TAO_ORB_Core::serverrequestinterceptor_adapter_i (void) #endif /* TAO_HAS_INTERCEPTORS == 1 */ +TAO_Valuetype_Adapter * +TAO_ORB_Core::valuetype_adapter (void) +{ + if (this->valuetype_adapter_ == 0) + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + if (this->valuetype_adapter_ == 0) + { + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + TAO_Valuetype_Adapter_Factory * vt_ap_factory = + ACE_Dynamic_Service<TAO_Valuetype_Adapter_Factory>::instance ( + TAO_ORB_Core::valuetype_adapter_factory_name () + ); + + if (vt_ap_factory) + { + this->valuetype_adapter_ = + vt_ap_factory->create (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Cannot initialize the " + "valuetype_adapter \n"); + } + ACE_ENDTRY; + ACE_CHECK_RETURN(0); + } + } + + return this->valuetype_adapter_; +} + // **************************************************************** TAO_Export TAO_ORB_Core * diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 9eb8910fac2..61bb83b499e 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -360,11 +360,11 @@ public: /// Gets the value of TAO_ORB_Core::iorinterceptor_adapter_factory_name_. static const char *iorinterceptor_adapter_factory_name (void); - /// Sets the value of TAO_ORB_Core::valuetype_adapter_name. - static void valuetype_adapter_name (const char *name); + /// Sets the value of TAO_ORB_Core::valuetype_adapter_factory_name. + static void valuetype_adapter_factory_name (const char *name); - /// Gets the value of TAO_ORB_Core::valuetype_adapter_name. - static const char *valuetype_adapter_name (void); + /// Gets the value of TAO_ORB_Core::valuetype_adapter_factory_name. + static const char *valuetype_adapter_factory_name (void); /// See if we have a collocated address, if yes, return the POA @@ -567,8 +567,7 @@ public: /// End the event loop void shutdown (CORBA::Boolean wait_for_completion - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (()); + ACE_ENV_ARG_DECL); /// Get the shutdown flag value int has_shutdown (void); @@ -825,7 +824,7 @@ public: //@} /// Return the valuetype adapter - TAO_Valuetype_Adapter *& valuetype_adapter (void); + TAO_Valuetype_Adapter *valuetype_adapter (void); /// Get the IOR Interceptor adapter. If not created, this method will try /// to create one. @@ -1353,14 +1352,14 @@ public: ACE_CString iorinterceptor_adapter_factory_name_; /** - * Name of the service object used to adapt function calls on + * Name of the factory object used to adapt function calls on * the valuetype-related interfaces. - * The default value is "Valuetype_Adapter". If the + * The default value is "Valuetype_Adapter_Factory". If the * Valuetype library is linked, the corresponding accessor - * function valuetype_adapter_name() will be called to set - * the value to "Concrete_Valuetype_Adapter". + * function valuetype_adapter_factory_name() will be called to set + * the value to "Concrete_Valuetype_Adapter_Factory". */ - ACE_CString valuetype_adapter_name_; + ACE_CString valuetype_adapter_factory_name_; /** * Name of the service object used to create the RootPOA. The diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index 1506949fb16..b78066a39eb 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -214,13 +214,6 @@ TAO_ORB_Core::not_default (const char * orb_id) table->not_default (orb_id); } -/// Return the valuetype adapter -ACE_INLINE TAO_Valuetype_Adapter *& -TAO_ORB_Core::valuetype_adapter (void) -{ - return this->valuetype_adapter_; -} - ACE_INLINE void TAO_ORB_Core::optimize_collocation_objects (CORBA::Boolean opt) { diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index 3b5b83c9c8d..0df3b311b58 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -32,7 +32,6 @@ ACE_RCSID (tao, Object, "$Id$") - TAO_BEGIN_VERSIONED_NAMESPACE_DECL CORBA::Object::~Object (void) @@ -148,7 +147,7 @@ void CORBA::Object::_tao_any_destructor (void *x) { CORBA::Object_ptr tmp = static_cast<CORBA::Object_ptr> (x); - CORBA::release (tmp); + ::CORBA::release (tmp); } // virtual -- do not inline @@ -994,7 +993,7 @@ namespace TAO void Objref_Traits<CORBA::Object>::release (CORBA::Object_ptr p) { - CORBA::release (p); + ::CORBA::release (p); } CORBA::Object_ptr @@ -1004,7 +1003,7 @@ namespace TAO } CORBA::Boolean - Objref_Traits<CORBA::Object>::marshal (CORBA::Object_ptr p, + Objref_Traits<CORBA::Object>::marshal (const CORBA::Object_ptr p, TAO_OutputCDR & cdr) { return p->marshal (cdr); diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h index fc1a51490d6..c6bd922d66a 100644 --- a/TAO/tao/Object.h +++ b/TAO/tao/Object.h @@ -276,7 +276,7 @@ namespace CORBA /// Marshalling operator used by the stub code. A long story why /// the stub code uses this, let us keep it short here. - static CORBA::Boolean marshal (Object_ptr obj, + static CORBA::Boolean marshal (const Object_ptr obj, TAO_OutputCDR &strm); /// Accessor for the cached servant reference held on the stub @@ -392,7 +392,7 @@ namespace CORBA * needs to be accessed from the stub and passed back as part of * _get_orb(). */ - TAO_ORB_Core *orb_core_; + TAO_ORB_Core * orb_core_; /** * Pointer to the protocol-specific "object" containing important @@ -434,7 +434,7 @@ namespace TAO static CORBA::Object_ptr duplicate (CORBA::Object_ptr); static void release (CORBA::Object_ptr); static CORBA::Object_ptr nil (void); - static CORBA::Boolean marshal (CORBA::Object_ptr p, + static CORBA::Boolean marshal (const CORBA::Object_ptr p, TAO_OutputCDR & cdr); }; } diff --git a/TAO/tao/ObjectIdListC.cpp b/TAO/tao/ObjectIdListC.cpp index ea194be0136..42e11786fa5 100644 --- a/TAO/tao/ObjectIdListC.cpp +++ b/TAO/tao/ObjectIdListC.cpp @@ -47,7 +47,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_ORB_OBJECTIDLIST_CS_) @@ -59,7 +59,7 @@ CORBA::ORB_ObjectIdList::ORB_ObjectIdList (void) CORBA::ORB_ObjectIdList::ORB_ObjectIdList ( CORBA::ULong max ) - : TAO_Unbounded_String_Sequence + : TAO::unbounded_string_sequence (max) {} @@ -69,14 +69,14 @@ CORBA::ORB_ObjectIdList::ORB_ObjectIdList ( char * * buffer, CORBA::Boolean release ) - : TAO_Unbounded_String_Sequence + : TAO::unbounded_string_sequence (max, length, buffer, release) {} CORBA::ORB_ObjectIdList::ORB_ObjectIdList ( const ORB_ObjectIdList &seq ) - : TAO_Unbounded_String_Sequence + : TAO::unbounded_string_sequence (seq) {} @@ -96,22 +96,7 @@ CORBA::Boolean operator<< ( const CORBA::ORB_ObjectIdList &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i].in ()); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -119,41 +104,7 @@ CORBA::Boolean operator>> ( CORBA::ORB_ObjectIdList &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); - - } - - return _tao_marshal_flag; - - } - -return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_ORB_ObjectIdList_CPP_ */ diff --git a/TAO/tao/ObjectIdListC.h b/TAO/tao/ObjectIdListC.h index 034e9d43ea3..fbe6d1304e8 100644 --- a/TAO/tao/ObjectIdListC.h +++ b/TAO/tao/ObjectIdListC.h @@ -85,23 +85,20 @@ namespace CORBA class ORB_ObjectIdList; typedef - TAO_MngSeq_Var_T< - ORB_ObjectIdList, - TAO_SeqElem_String_Manager + TAO_VarSeq_Var_T< + ORB_ObjectIdList > ORB_ObjectIdList_var; typedef - TAO_MngSeq_Out_T< - ORB_ObjectIdList, - ORB_ObjectIdList_var, - TAO_SeqElem_String_Manager + TAO_Seq_Out_T< + ORB_ObjectIdList > ORB_ObjectIdList_out; class TAO_Export ORB_ObjectIdList : public - TAO_Unbounded_String_Sequence + TAO::unbounded_string_sequence { public: ORB_ObjectIdList (void); @@ -110,7 +107,7 @@ namespace CORBA CORBA::ULong max, CORBA::ULong length, char ** buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); ORB_ObjectIdList (const ORB_ObjectIdList &); ~ORB_ObjectIdList (void); diff --git a/TAO/tao/Object_KeyC.cpp b/TAO/tao/Object_KeyC.cpp index 7e79e07d473..abd6d5ded9a 100644 --- a/TAO/tao/Object_KeyC.cpp +++ b/TAO/tao/Object_KeyC.cpp @@ -52,7 +52,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_TAO_OBJECTKEY_CS_) @@ -64,7 +64,7 @@ TAO::ObjectKey::ObjectKey (void) TAO::ObjectKey::ObjectKey ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Octet > (max) @@ -76,7 +76,7 @@ TAO::ObjectKey::ObjectKey ( CORBA::Octet * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Octet > (max, length, buffer, release) @@ -85,7 +85,7 @@ TAO::ObjectKey::ObjectKey ( TAO::ObjectKey::ObjectKey ( const ObjectKey &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Octet > (seq) @@ -98,7 +98,7 @@ TAO::ObjectKey::~ObjectKey (void) void TAO::ObjectKey::encode_sequence_to_string (char * &str, - const TAO_Unbounded_Sequence<CORBA::Octet> &seq) + const TAO::unbounded_value_sequence<CORBA::Octet> &seq) { // We must allocate a buffer which is (gag) 3 times the length // of the sequence, which is the length required in the worst-case @@ -150,7 +150,7 @@ int TAO::ObjectKey::is_legal (u_char & c) } void -TAO::ObjectKey::decode_string_to_sequence (TAO_Unbounded_Sequence<CORBA::Octet> &seq, +TAO::ObjectKey::decode_string_to_sequence (TAO::unbounded_value_sequence<CORBA::Octet> &seq, const char *str) { if (str == 0) @@ -221,10 +221,8 @@ TAO::ObjectKey::demarshal_key (TAO::ObjectKey &key, if (ACE_BIT_DISABLED (strm.start ()->flags (), ACE_Message_Block::DONT_DELETE)) { - TAO_Unbounded_Sequence<CORBA::Octet> *oseq = - static_cast<TAO_Unbounded_Sequence<CORBA::Octet>*> (&key); - oseq->replace (_tao_seq_len, strm.start ()); - oseq->mb ()->wr_ptr (oseq->mb()->rd_ptr () + _tao_seq_len); + key.replace (_tao_seq_len, strm.start ()); + key.mb ()->wr_ptr (key.mb()->rd_ptr () + _tao_seq_len); strm.skip_bytes (_tao_seq_len); return 1; } @@ -251,29 +249,7 @@ CORBA::Boolean operator<< ( const TAO::ObjectKey &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - { - TAO_Unbounded_Sequence<CORBA::Octet> *_tao_octet_seq = - static_cast<TAO_Unbounded_Sequence<CORBA::Octet> *> (const_cast<TAO::ObjectKey *> (&_tao_sequence)); - if (_tao_octet_seq->mb ()) - return strm.write_octet_array_mb (_tao_octet_seq->mb ()); - else - return strm.write_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - -#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - return strm.write_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -281,55 +257,7 @@ CORBA::Boolean operator>> ( TAO::ObjectKey &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - if (ACE_BIT_DISABLED (strm.start ()->flags (), - ACE_Message_Block::DONT_DELETE)) - { - TAO_ORB_Core* orb_core = strm.orb_core (); - if (orb_core != 0 && - strm.orb_core ()->resource_factory ()-> - input_cdr_allocator_type_locked () == 1) - { - TAO_Unbounded_Sequence<CORBA::Octet> *oseq = - static_cast<TAO_Unbounded_Sequence<CORBA::Octet> *> (&_tao_sequence); - oseq->replace (_tao_seq_len, strm.start ()); - oseq->mb ()->wr_ptr (oseq->mb()->rd_ptr () + _tao_seq_len); - strm.skip_bytes (_tao_seq_len); - return 1; - } - } - return strm.read_octet_array (_tao_sequence.get_buffer (), _tao_seq_len); -#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - return strm.read_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_TAO_ObjectKey_CPP_ */ diff --git a/TAO/tao/Object_KeyC.h b/TAO/tao/Object_KeyC.h index 6e070fcbea2..8377b60bef7 100644 --- a/TAO/tao/Object_KeyC.h +++ b/TAO/tao/Object_KeyC.h @@ -68,33 +68,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_TAO_OBJECTKEY_CH_) #define _TAO_OBJECTKEY_CH_ - + class ObjectKey; - + typedef TAO_FixedSeq_Var_T< - ObjectKey, - CORBA::Octet + ObjectKey > ObjectKey_var; - + typedef TAO_Seq_Out_T< - ObjectKey, - ObjectKey_var, - CORBA::Octet + ObjectKey > ObjectKey_out; - + class TAO_Export ObjectKey : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Octet > { @@ -104,12 +101,12 @@ namespace TAO ObjectKey ( CORBA::ULong max, CORBA::ULong length, - CORBA::Octet* buffer, - CORBA::Boolean release = 0 + CORBA::Octet* buffer, + CORBA::Boolean release = false ); ObjectKey (const ObjectKey &); ~ObjectKey (void); - + typedef ObjectKey_var _var_type; #if (TAO_NO_COPY_OCTET_SEQUENCES == 1) @@ -117,17 +114,17 @@ namespace TAO CORBA::ULong length, const ACE_Message_Block* mb ) - : TAO_Unbounded_Sequence<CORBA::Octet> (length, mb) {} + : TAO::unbounded_value_sequence<CORBA::Octet> (length, mb) {} #endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */ // Hand crafted. static void encode_sequence_to_string ( char * &str, - const TAO_Unbounded_Sequence<CORBA::Octet> &seq + const TAO::unbounded_value_sequence<CORBA::Octet> &seq ); static void decode_string_to_sequence ( - TAO_Unbounded_Sequence<CORBA::Octet> &seq, + TAO::unbounded_value_sequence<CORBA::Octet> &seq, const char *str ); static int is_legal (u_char & c); diff --git a/TAO/tao/Object_Ref_Table.cpp b/TAO/tao/Object_Ref_Table.cpp index f5f4554f1a9..f5071ad0466 100644 --- a/TAO/tao/Object_Ref_Table.cpp +++ b/TAO/tao/Object_Ref_Table.cpp @@ -14,7 +14,6 @@ ACE_RCSID (tao, Object_Ref_Table, "$Id$") - #ifndef __ACE_INLINE__ # include "tao/Object_Ref_Table.inl" #endif /* __ACE_INLINE__ */ @@ -32,7 +31,7 @@ TAO_Object_Ref_Table::bind (const char *id, // i.e. not nil. if (id == 0 || ACE_OS::strlen (id) == 0 - || CORBA::is_nil (obj)) + || ::CORBA::is_nil (obj)) { errno = EINVAL; return -1; diff --git a/TAO/tao/Object_Reference_Sequence_Element_T.h b/TAO/tao/Object_Reference_Sequence_Element_T.h new file mode 100644 index 00000000000..7e9d04a4595 --- /dev/null +++ b/TAO/tao/Object_Reference_Sequence_Element_T.h @@ -0,0 +1,127 @@ +#ifndef guard_object_reference_sequence_element_hpp +#define guard_object_reference_sequence_element_hpp +/** + * @file + * + * @brief Implement the type returned by operator[] in object_reference + * sequences. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename obj_ref_traits> +class object_reference_sequence_element +{ +public: + typedef typename obj_ref_traits::object_type object_reference_type; + typedef object_reference_type * value_type; + typedef object_reference_type const * const_value_type; + typedef typename obj_ref_traits::object_type_var object_reference_var; + +private: + inline object_reference_sequence_element<obj_ref_traits> & pseudo_copy_swap( + object_reference_var & rhs) + { + if (release()) + { + obj_ref_traits::release(*element_); + } + *element_ = rhs._retn(); + return *this; + } + +public: + object_reference_sequence_element( + value_type & e, CORBA::Boolean release) + : element_(&e) + , release_(release) + { + } + + object_reference_sequence_element( + object_reference_sequence_element const & rhs) + : element_(rhs.element_) + , release_(rhs.release_) + { + } + + ~object_reference_sequence_element() + { + } + + object_reference_sequence_element & operator=( + object_reference_var const & rhs) + { + object_reference_var tmp(rhs); + return pseudo_copy_swap(tmp); + } + + object_reference_sequence_element & operator=( + object_reference_sequence_element const & rhs) + { + object_reference_var tmp(obj_ref_traits::duplicate(*rhs.element_)); + return pseudo_copy_swap(tmp); + } + + object_reference_sequence_element & operator=(value_type rhs) + { + object_reference_var tmp(rhs); + return pseudo_copy_swap(tmp); + } + + inline operator value_type() + { + return *element_; + } + + inline operator const_value_type() const + { + return *element_; + } + + inline value_type operator->() + { + return *element_; + } + + inline value_type operator->() const + { + return *element_; + } + + void swap(object_reference_sequence_element & rhs) + { + std::swap(element_, rhs.element_); + std::swap(release_, rhs.release_); + } + + inline CORBA::Boolean release() const + { + return release_; + } + +private: + // This function is not implemented + object_reference_sequence_element(); + +private: + value_type * element_; + CORBA::Boolean release_; +}; + +} // namespace details +} // namespace CORBA + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_object_reference_sequence_element_hpp diff --git a/TAO/tao/Object_Reference_Traits_Base_T.h b/TAO/tao/Object_Reference_Traits_Base_T.h new file mode 100644 index 00000000000..91eb1d44a18 --- /dev/null +++ b/TAO/tao/Object_Reference_Traits_Base_T.h @@ -0,0 +1,56 @@ +#ifndef object_reference_traits_base_hpp +#define object_reference_traits_base_hpp +/** + * @file + * + * @brief Base class for the object reference traits. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Objref_VarOut_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename object_t, typename object_t_var> +struct object_reference_traits_base +{ + typedef object_t object_type; + typedef object_type * value_type; + typedef object_type const * const_value_type; + typedef object_t_var object_type_var; + + inline static void release(object_type * object) + { + TAO::Objref_Traits<object_type>::release(object); + } + + inline static object_type * duplicate(object_type * object) + { + return TAO::Objref_Traits<object_type>::duplicate(object); + } + + inline static object_type * nil() + { + return TAO::Objref_Traits<object_type>::nil(); + } + + inline static object_type * default_initializer() + { + return nil(); + } +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // object_reference_traits_base_hpp diff --git a/TAO/tao/Object_Reference_Traits_T.h b/TAO/tao/Object_Reference_Traits_T.h new file mode 100644 index 00000000000..004c191fe28 --- /dev/null +++ b/TAO/tao/Object_Reference_Traits_T.h @@ -0,0 +1,83 @@ +#ifndef guard_object_reference_traits_hpp +#define guard_object_reference_traits_hpp +/** + * @file + * + * @brief Implement the element manipulation traits for object + * reference types. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "Object_Reference_Traits_Base_T.h" + +#include <algorithm> +#include <functional> + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<class object_t, class object_t_var, class derived> +struct object_reference_traits_decorator +{ + typedef object_t object_type; + typedef object_type * value_type; + typedef object_type const * const_value_type; + typedef object_t_var object_type_var; + + inline static void zero_range( + object_type ** begin, object_type ** end) + { + std::fill(begin, end, derived::nil()); + } + + inline static void initialize_range( + object_type ** begin, object_type ** end) + { + std::generate(begin, end, &derived::default_initializer); + } + + inline static void copy_range( + object_type ** begin, object_type ** end, object_type ** dst) + { + std::transform(begin, end, dst, &derived::duplicate); + } + + inline static void release_range( + object_type ** begin, object_type ** end) + { + std::for_each(begin, end, &derived::release); + } + + inline static object_type const * initialize_if_zero(object_type * & element) + { + if (element == 0) + { + element = derived::nil(); + } + return element; + } +}; + +template<typename object_t, typename object_t_var, bool dummy> +struct object_reference_traits + : public object_reference_traits_base<object_t, object_t_var> + , public object_reference_traits_decorator<object_t, object_t_var, object_reference_traits<object_t,object_t_var,dummy> > +{ + typedef object_t object_type; + typedef object_type * value_type; + typedef object_type const * const_value_type; + typedef object_t_var object_type_var; +}; + +} // namespace details +} // namespace CORBA + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_object_reference_traits_hpp diff --git a/TAO/tao/Object_T.cpp b/TAO/tao/Object_T.cpp index 706d9d3dbee..9ff642cda69 100644 --- a/TAO/tao/Object_T.cpp +++ b/TAO/tao/Object_T.cpp @@ -99,7 +99,7 @@ namespace TAO stub->_incr_refcnt (); bool collocated = - !CORBA::is_nil (stub->servant_orb_var ().ptr ()) + !CORBA::is_nil (stub->servant_orb_var ().in ()) && stub->optimize_collocation_objects () && obj->_is_collocated () && pbf != 0; diff --git a/TAO/tao/Objref_VarOut_T.cpp b/TAO/tao/Objref_VarOut_T.cpp index 6c3ab3e046c..c8b86b6e406 100644 --- a/TAO/tao/Objref_VarOut_T.cpp +++ b/TAO/tao/Objref_VarOut_T.cpp @@ -164,16 +164,6 @@ TAO_Objref_Out_T<T>::operator= ( template <typename T> TAO_Objref_Out_T<T> & -TAO_Objref_Out_T<T>::operator= ( - const TAO_Objref_Var_T<T> & p - ) -{ - this->ptr_ = TAO::Objref_Traits<T>::duplicate (p.ptr ()); - return *this; -} - -template <typename T> -TAO_Objref_Out_T<T> & TAO_Objref_Out_T<T>::operator= (T * p) { this->ptr_ = p; @@ -181,14 +171,14 @@ TAO_Objref_Out_T<T>::operator= (T * p) } template <typename T> -TAO_Objref_Out_T<T>::operator T *& () +T *& +TAO_Objref_Out_T<T>::ptr (void) { return this->ptr_; } template <typename T> -T *& -TAO_Objref_Out_T<T>::ptr (void) +TAO_Objref_Out_T<T>::operator T *& () { return this->ptr_; } diff --git a/TAO/tao/Objref_VarOut_T.h b/TAO/tao/Objref_VarOut_T.h index 55f876160a0..2ecfcd75efc 100644 --- a/TAO/tao/Objref_VarOut_T.h +++ b/TAO/tao/Objref_VarOut_T.h @@ -33,18 +33,11 @@ namespace TAO /** * struct Objref_Traits * - * @brief Specialized for each interface in generated code. - * + * @brief Specialized for each interface in generated code. Just forward + * declare, a specialization must always be there, if not, we get a + * compile error. */ - template<typename T> - struct Objref_Traits - { - static T * duplicate (T *); - static void release (T *); - static T * nil (void); - static CORBA::Boolean marshal (T *, - TAO_OutputCDR &); - }; + template<typename T> struct Objref_Traits; } /** @@ -113,7 +106,6 @@ public: TAO_Objref_Out_T (const TAO_Objref_Out_T<T> &); TAO_Objref_Out_T &operator= (const TAO_Objref_Out_T<T> &); - TAO_Objref_Out_T &operator= (const TAO_Objref_Var_T<T> &); TAO_Objref_Out_T &operator= (T *); // Cast operator. @@ -123,8 +115,10 @@ public: T * operator-> (void); private: - typedef TAO_Objref_Out_T<T> THIS_OUT_TYPE; T *& ptr_; + + /// Assignment from _var not allowed. + TAO_Objref_Out_T &operator= (const TAO_Objref_Var_T<T> &); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/OctetSeqC.cpp b/TAO/tao/OctetSeqC.cpp index c788364a799..93c712762cb 100644 --- a/TAO/tao/OctetSeqC.cpp +++ b/TAO/tao/OctetSeqC.cpp @@ -44,7 +44,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_OCTETSEQ_CS_) @@ -56,7 +56,7 @@ CORBA::OctetSeq::OctetSeq (void) CORBA::OctetSeq::OctetSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Octet > (max) @@ -68,7 +68,7 @@ CORBA::OctetSeq::OctetSeq ( CORBA::Octet * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Octet > (max, length, buffer, release) @@ -77,7 +77,7 @@ CORBA::OctetSeq::OctetSeq ( CORBA::OctetSeq::OctetSeq ( const OctetSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Octet > (seq) @@ -108,29 +108,7 @@ CORBA::Boolean operator<< ( const CORBA::OctetSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - { - TAO_Unbounded_Sequence<CORBA::Octet> *_tao_octet_seq = - static_cast<TAO_Unbounded_Sequence<CORBA::Octet> *> (const_cast<CORBA::OctetSeq *> (&_tao_sequence)); - if (_tao_octet_seq->mb ()) - return strm.write_octet_array_mb (_tao_octet_seq->mb ()); - else - return strm.write_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - -#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - return strm.write_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -138,55 +116,7 @@ CORBA::Boolean operator>> ( CORBA::OctetSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - if (ACE_BIT_DISABLED (strm.start ()->flags (), - ACE_Message_Block::DONT_DELETE)) - { - TAO_ORB_Core* orb_core = strm.orb_core (); - if (orb_core != 0 && - strm.orb_core ()->resource_factory ()-> - input_cdr_allocator_type_locked () == 1) - { - TAO_Unbounded_Sequence<CORBA::Octet> *oseq = - static_cast<TAO_Unbounded_Sequence<CORBA::Octet> *> (&_tao_sequence); - oseq->replace (_tao_seq_len, strm.start ()); - oseq->mb ()->wr_ptr (oseq->mb()->rd_ptr () + _tao_seq_len); - strm.skip_bytes (_tao_seq_len); - return 1; - } - } - return strm.read_octet_array (_tao_sequence.get_buffer (), _tao_seq_len); -#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - return strm.read_octet_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_OctetSeq_CPP_ */ diff --git a/TAO/tao/OctetSeqC.h b/TAO/tao/OctetSeqC.h index 341cc5ad84f..8e3970a97d6 100644 --- a/TAO/tao/OctetSeqC.h +++ b/TAO/tao/OctetSeqC.h @@ -75,22 +75,19 @@ namespace CORBA typedef TAO_FixedSeq_Var_T< - OctetSeq, - CORBA::Octet + OctetSeq > OctetSeq_var; typedef TAO_Seq_Out_T< - OctetSeq, - OctetSeq_var, - CORBA::Octet + OctetSeq > OctetSeq_out; class TAO_Export OctetSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Octet > { @@ -101,7 +98,7 @@ namespace CORBA CORBA::ULong max, CORBA::ULong length, CORBA::Octet* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); OctetSeq (const OctetSeq &); ~OctetSeq (void); @@ -115,7 +112,7 @@ namespace CORBA CORBA::ULong length, const ACE_Message_Block* mb ) - : TAO_Unbounded_Sequence<CORBA::Octet> (length, mb) {} + : TAO::unbounded_value_sequence<CORBA::Octet> (length, mb) {} #endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */ }; @@ -143,7 +140,7 @@ namespace TAO // but we put the instantiation here because the application will // need to see it in *C.h to avoid the error. #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT - template class TAO_Export TAO_Unbounded_Sequence<CORBA::OctetSeq>; +// template class TAO_Export TAO_Unbounded_Sequence<CORBA::OctetSeq>; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ diff --git a/TAO/tao/PolicyC.cpp b/TAO/tao/PolicyC.cpp index 0fdcb87dd8b..f5a8d53ed0c 100644 --- a/TAO/tao/PolicyC.cpp +++ b/TAO/tao/PolicyC.cpp @@ -121,7 +121,7 @@ CORBA::PolicyError::PolicyError (const ::CORBA::PolicyError &_tao_excp) CORBA::PolicyError& CORBA::PolicyError::operator= (const ::CORBA::PolicyError &_tao_excp) { - this->ACE_NESTED_CLASS (CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); this->reason = _tao_excp.reason; return *this; } @@ -257,7 +257,7 @@ CORBA::InvalidPolicies::InvalidPolicies (const ::CORBA::InvalidPolicies &_tao_ex CORBA::InvalidPolicies& CORBA::InvalidPolicies::operator= (const ::CORBA::InvalidPolicies &_tao_excp) { - this->ACE_NESTED_CLASS (CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); this->indices = _tao_excp.indices; return *this; } @@ -384,7 +384,7 @@ TAO::Objref_Traits<CORBA::Policy>::release ( CORBA::Policy_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } CORBA::Policy_ptr @@ -395,7 +395,7 @@ TAO::Objref_Traits<CORBA::Policy>::nil (void) CORBA::Boolean TAO::Objref_Traits<CORBA::Policy>::marshal ( - CORBA::Policy_ptr p, + const CORBA::Policy_ptr p, TAO_OutputCDR & cdr ) { @@ -420,7 +420,7 @@ CORBA::PolicyType CORBA::Policy::policy_type ( { if (!this->is_evaluated ()) { - ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this); + ::CORBA::Object::tao_object_initialize (this); } if (this->the_TAO_Policy_Proxy_Broker_ == 0) @@ -462,7 +462,7 @@ CORBA::PolicyType CORBA::Policy::policy_type ( { if (!this->is_evaluated ()) { - ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this); + ::CORBA::Object::tao_object_initialize (this); } if (this->the_TAO_Policy_Proxy_Broker_ == 0) @@ -504,7 +504,7 @@ void CORBA::Policy::destroy ( { if (!this->is_evaluated ()) { - ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this); + ::CORBA::Object::tao_object_initialize (this); } if (this->the_TAO_Policy_Proxy_Broker_ == 0) @@ -556,7 +556,7 @@ CORBA::Policy::_tao_any_destructor (void *_tao_void_pointer) { Policy *_tao_tmp_pointer = static_cast<Policy *> (_tao_void_pointer); - CORBA::release (_tao_tmp_pointer); + ::CORBA::release (_tao_tmp_pointer); } CORBA::Policy_ptr @@ -592,7 +592,7 @@ CORBA::Policy::_unchecked_narrow ( CORBA::Policy_ptr CORBA::Policy::_duplicate (Policy_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } @@ -603,7 +603,7 @@ CORBA::Policy::_duplicate (Policy_ptr obj) void CORBA::Policy::_tao_release (Policy_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } CORBA::Boolean @@ -627,7 +627,7 @@ CORBA::Policy::_is_a ( } else { - return this->ACE_NESTED_CLASS (CORBA, Object)::_is_a ( + return this->::CORBA::Object::_is_a ( value ACE_ENV_ARG_PARAMETER ); @@ -663,7 +663,7 @@ TAO::Objref_Traits<CORBA::PolicyManager>::release ( CORBA::PolicyManager_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } CORBA::PolicyManager_ptr @@ -674,7 +674,7 @@ TAO::Objref_Traits<CORBA::PolicyManager>::nil (void) CORBA::Boolean TAO::Objref_Traits<CORBA::PolicyManager>::marshal ( - CORBA::PolicyManager_ptr p, + const CORBA::PolicyManager_ptr p, TAO_OutputCDR & cdr ) { @@ -692,7 +692,7 @@ CORBA::PolicyManager::_tao_any_destructor (void *_tao_void_pointer) { PolicyManager *_tao_tmp_pointer = static_cast<PolicyManager *> (_tao_void_pointer); - CORBA::release (_tao_tmp_pointer); + ::CORBA::release (_tao_tmp_pointer); } CORBA::PolicyManager_ptr @@ -720,7 +720,7 @@ CORBA::PolicyManager::_unchecked_narrow ( CORBA::PolicyManager_ptr CORBA::PolicyManager::_duplicate (PolicyManager_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } @@ -731,7 +731,7 @@ CORBA::PolicyManager::_duplicate (PolicyManager_ptr obj) void CORBA::PolicyManager::_tao_release (PolicyManager_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } CORBA::Boolean @@ -792,7 +792,7 @@ TAO::Objref_Traits<CORBA::PolicyCurrent>::release ( CORBA::PolicyCurrent_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } CORBA::PolicyCurrent_ptr @@ -803,7 +803,7 @@ TAO::Objref_Traits<CORBA::PolicyCurrent>::nil (void) CORBA::Boolean TAO::Objref_Traits<CORBA::PolicyCurrent>::marshal ( - CORBA::PolicyCurrent_ptr p, + const CORBA::PolicyCurrent_ptr p, TAO_OutputCDR & cdr ) { @@ -821,7 +821,7 @@ CORBA::PolicyCurrent::_tao_any_destructor (void *_tao_void_pointer) { PolicyCurrent *_tao_tmp_pointer = static_cast<PolicyCurrent *> (_tao_void_pointer); - CORBA::release (_tao_tmp_pointer); + ::CORBA::release (_tao_tmp_pointer); } CORBA::PolicyCurrent_ptr @@ -849,7 +849,7 @@ CORBA::PolicyCurrent::_unchecked_narrow ( CORBA::PolicyCurrent_ptr CORBA::PolicyCurrent::_duplicate (PolicyCurrent_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } @@ -860,7 +860,7 @@ CORBA::PolicyCurrent::_duplicate (PolicyCurrent_ptr obj) void CORBA::PolicyCurrent::_tao_release (PolicyCurrent_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } CORBA::Boolean diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h index a0cd05df25e..60e773570cc 100644 --- a/TAO/tao/PolicyC.h +++ b/TAO/tao/PolicyC.h @@ -155,7 +155,7 @@ namespace CORBA // be\be_visitor_exception/exception_ctor.cpp:66 PolicyError ( - ACE_NESTED_CLASS (CORBA, PolicyErrorCode) _tao_reason + ::CORBA::PolicyErrorCode _tao_reason ); // TAO_IDL - Generated from @@ -208,7 +208,7 @@ namespace CORBA // be\be_visitor_exception/exception_ctor.cpp:66 InvalidPolicies ( - const ACE_NESTED_CLASS (CORBA, UShortSeq) & _tao_indices + const ::CORBA::UShortSeq & _tao_indices ); // TAO_IDL - Generated from @@ -593,7 +593,7 @@ namespace TAO ); static ::CORBA::Policy_ptr nil (void); static CORBA::Boolean marshal ( - ::CORBA::Policy_ptr p, + const ::CORBA::Policy_ptr p, TAO_OutputCDR & cdr ); }; @@ -614,7 +614,7 @@ namespace TAO ); static ::CORBA::PolicyManager_ptr nil (void); static CORBA::Boolean marshal ( - ::CORBA::PolicyManager_ptr p, + const ::CORBA::PolicyManager_ptr p, TAO_OutputCDR & cdr ); }; @@ -635,7 +635,7 @@ namespace TAO ); static ::CORBA::PolicyCurrent_ptr nil (void); static CORBA::Boolean marshal ( - ::CORBA::PolicyCurrent_ptr p, + const ::CORBA::PolicyCurrent_ptr p, TAO_OutputCDR & cdr ); }; diff --git a/TAO/tao/PolicyC.inl b/TAO/tao/PolicyC.inl index 3b97e162307..f9aac3d9fae 100644 --- a/TAO/tao/PolicyC.inl +++ b/TAO/tao/PolicyC.inl @@ -41,12 +41,7 @@ CORBA::Policy::Policy ( TAO_Abstract_ServantBase *servant, TAO_ORB_Core *oc ) - : ACE_NESTED_CLASS (CORBA, Object) ( - objref, - _tao_collocated, - servant, - oc - ), + : ::CORBA::Object (objref, _tao_collocated, servant, oc), the_TAO_Policy_Proxy_Broker_ (0) { this->CORBA_Policy_setup_collocation (); @@ -57,7 +52,7 @@ CORBA::Policy::Policy ( IOP::IOR *ior, TAO_ORB_Core *oc ) - : ACE_NESTED_CLASS (CORBA, Object) (ior, oc), + : ::CORBA::Object (ior, oc), the_TAO_Policy_Proxy_Broker_ (0) { } diff --git a/TAO/tao/Policy_ForwardC.cpp b/TAO/tao/Policy_ForwardC.cpp index b2e78c363e3..0f127073c73 100644 --- a/TAO/tao/Policy_ForwardC.cpp +++ b/TAO/tao/Policy_ForwardC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_POLICYLIST_CS_) @@ -55,9 +55,8 @@ CORBA::PolicyList::PolicyList (void) CORBA::PolicyList::PolicyList ( CORBA::ULong max ) - : TAO_Unbounded_Object_Sequence< - Policy, - Policy_var + : TAO::unbounded_object_reference_sequence< + CORBA::Policy, CORBA::Policy_var > (max) {} @@ -68,9 +67,8 @@ CORBA::PolicyList::PolicyList ( CORBA::Policy_ptr * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Object_Sequence< - Policy, - Policy_var + : TAO::unbounded_object_reference_sequence< + CORBA::Policy, CORBA::Policy_var > (max, length, buffer, release) {} @@ -78,9 +76,8 @@ CORBA::PolicyList::PolicyList ( CORBA::PolicyList::PolicyList ( const PolicyList &seq ) - : TAO_Unbounded_Object_Sequence< - Policy, - Policy_var + : TAO::unbounded_object_reference_sequence< + CORBA::Policy, CORBA::Policy_var > (seq) {} @@ -99,7 +96,7 @@ void CORBA::PolicyList::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_POLICYTYPESEQ_CS_) @@ -111,7 +108,7 @@ CORBA::PolicyTypeSeq::PolicyTypeSeq (void) CORBA::PolicyTypeSeq::PolicyTypeSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< PolicyType > (max) @@ -123,7 +120,7 @@ CORBA::PolicyTypeSeq::PolicyTypeSeq ( CORBA::ULong * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< PolicyType > (max, length, buffer, release) @@ -132,7 +129,7 @@ CORBA::PolicyTypeSeq::PolicyTypeSeq ( CORBA::PolicyTypeSeq::PolicyTypeSeq ( const PolicyTypeSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< PolicyType > (seq) @@ -163,25 +160,7 @@ CORBA::Boolean operator<< ( const CORBA::PolicyList &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = - TAO::Objref_Traits<CORBA::Policy>::marshal ( - _tao_sequence[i].in (), strm - ); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -189,40 +168,7 @@ CORBA::Boolean operator>> ( CORBA::PolicyList &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_PolicyList_CPP_ */ @@ -238,15 +184,7 @@ CORBA::Boolean operator<< ( const CORBA::PolicyTypeSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -254,33 +192,7 @@ CORBA::Boolean operator>> ( CORBA::PolicyTypeSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_PolicyTypeSeq_CPP_ */ @@ -297,12 +209,12 @@ CORBA::Boolean operator>> (TAO_InputCDR & strm, CORBA::SetOverrideType & _tao_en { CORBA::ULong _tao_temp = 0; CORBA::Boolean const _tao_success = strm >> _tao_temp; - + if (_tao_success) { _tao_enumerator = static_cast<CORBA::SetOverrideType> (_tao_temp); } - + return _tao_success; } diff --git a/TAO/tao/Policy_ForwardC.h b/TAO/tao/Policy_ForwardC.h index 3ad266dc05d..8aa498a11fd 100644 --- a/TAO/tao/Policy_ForwardC.h +++ b/TAO/tao/Policy_ForwardC.h @@ -60,28 +60,28 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::ULong PolicyType; typedef CORBA::ULong_out PolicyType_out; - + // TAO_IDL - Generated from // be\be_interface.cpp:598 #if !defined (_CORBA_POLICY__VAR_OUT_CH_) #define _CORBA_POLICY__VAR_OUT_CH_ - + class Policy; typedef Policy *Policy_ptr; - + typedef TAO_Objref_Var_T< Policy > Policy_var; - + typedef TAO_Objref_Out_T< Policy @@ -89,39 +89,30 @@ namespace CORBA Policy_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_POLICYLIST_CH_) #define _CORBA_POLICYLIST_CH_ - + class PolicyList; - + typedef - TAO_MngSeq_Var_T< - PolicyList, - TAO_Object_Manager< - Policy, - Policy_var - > + TAO_VarSeq_Var_T< + PolicyList > PolicyList_var; - + typedef - TAO_MngSeq_Out_T< - PolicyList, - PolicyList_var, - TAO_Object_Manager< - Policy, - Policy_var - > + TAO_Seq_Out_T< + PolicyList > PolicyList_out; - + class TAO_Export PolicyList : public - TAO_Unbounded_Object_Sequence< + TAO::unbounded_object_reference_sequence< Policy, Policy_var > @@ -132,45 +123,42 @@ namespace CORBA PolicyList ( CORBA::ULong max, CORBA::ULong length, - Policy_ptr* buffer, - CORBA::Boolean release = 0 + Policy_ptr* buffer, + CORBA::Boolean release = false ); PolicyList (const PolicyList &); ~PolicyList (void); - + static void _tao_any_destructor (void *); - + typedef PolicyList_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_POLICYTYPESEQ_CH_) #define _CORBA_POLICYTYPESEQ_CH_ - + class PolicyTypeSeq; - + typedef TAO_FixedSeq_Var_T< - PolicyTypeSeq, - PolicyType + PolicyTypeSeq > PolicyTypeSeq_var; - + typedef TAO_Seq_Out_T< - PolicyTypeSeq, - PolicyTypeSeq_var, - PolicyType + PolicyTypeSeq > PolicyTypeSeq_out; - + class TAO_Export PolicyTypeSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< PolicyType > { @@ -180,34 +168,35 @@ namespace CORBA PolicyTypeSeq ( CORBA::ULong max, CORBA::ULong length, - CORBA::ULong* buffer, - CORBA::Boolean release = 0 + CORBA::ULong* buffer, + CORBA::Boolean release = false ); PolicyTypeSeq (const PolicyTypeSeq &); ~PolicyTypeSeq (void); - + static void _tao_any_destructor (void *); - + typedef PolicyTypeSeq_var _var_type; + typedef PolicyTypeSeq_out _out_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_interface.cpp:598 #if !defined (_CORBA_POLICYCURRENT__VAR_OUT_CH_) #define _CORBA_POLICYCURRENT__VAR_OUT_CH_ - + class PolicyCurrent; typedef PolicyCurrent *PolicyCurrent_ptr; - + typedef TAO_Objref_Var_T< PolicyCurrent > PolicyCurrent_var; - + typedef TAO_Objref_Out_T< PolicyCurrent @@ -215,16 +204,16 @@ namespace CORBA PolicyCurrent_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_enum/enum_ch.cpp:57 - + enum SetOverrideType { SET_OVERRIDE, ADD_OVERRIDE }; - + typedef SetOverrideType &SetOverrideType_out; // TAO_IDL - Generated from @@ -241,7 +230,7 @@ namespace TAO #if !defined (_CORBA_POLICY__TRAITS_) #define _CORBA_POLICY__TRAITS_ - + template<> struct TAO_Export Objref_Traits< ::CORBA::Policy> { @@ -253,7 +242,7 @@ namespace TAO ); static ::CORBA::Policy_ptr nil (void); static CORBA::Boolean marshal ( - ::CORBA::Policy_ptr p, + const ::CORBA::Policy_ptr p, TAO_OutputCDR & cdr ); }; @@ -262,7 +251,7 @@ namespace TAO #if !defined (_CORBA_POLICYCURRENT__TRAITS_) #define _CORBA_POLICYCURRENT__TRAITS_ - + template<> struct TAO_Export Objref_Traits< ::CORBA::PolicyCurrent> { @@ -274,7 +263,7 @@ namespace TAO ); static ::CORBA::PolicyCurrent_ptr nil (void); static CORBA::Boolean marshal ( - ::CORBA::PolicyCurrent_ptr p, + const ::CORBA::PolicyCurrent_ptr p, TAO_OutputCDR & cdr ); }; diff --git a/TAO/tao/Policy_Set.cpp b/TAO/tao/Policy_Set.cpp index 4dfd0946f19..b5f791c5be8 100644 --- a/TAO/tao/Policy_Set.cpp +++ b/TAO/tao/Policy_Set.cpp @@ -120,7 +120,7 @@ TAO_Policy_Set::copy_from (TAO_Policy_Set *source policy->copy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - CORBA::ULong length = this->policy_list_.length (); + CORBA::ULong const length = this->policy_list_.length (); this->policy_list_.length (length + 1); // Add the "cacheable" policies into the cache. @@ -180,16 +180,9 @@ TAO_Policy_Set::set_policy_overrides (const CORBA::PolicyList &policies, for (CORBA::ULong i = 0; i < plen; ++i) { -#if defined (__INTEL_COMPILER) && defined (_MSC_VER) && (_MSC_VER <= 1200) - // The XICL6 compiler (Intel C++ 7.1 in Visual C++ compatible - // mode) has a bug and can't handle the normal construct - CORBA::Policy_ptr temp = policies[i]; - CORBA::Policy_var policy = CORBA::Policy::_duplicate (temp); -#else - CORBA::Policy_var policy = policies[i]; -#endif - - if (CORBA::is_nil (policy.in ())) + CORBA::Policy_ptr policy = policies[i]; + + if (CORBA::is_nil (policy)) { continue; } @@ -214,14 +207,14 @@ TAO_Policy_Set::set_policy_overrides (const CORBA::PolicyList &policies, server_protocol_set = true; } - this->set_policy (policy.in () ACE_ENV_ARG_PARAMETER); + this->set_policy (policy ACE_ENV_ARG_PARAMETER); ACE_CHECK; } } void TAO_Policy_Set::set_policy (const CORBA::Policy_ptr policy - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { if (! this->compatible_scope (policy->_tao_scope())) { @@ -319,7 +312,7 @@ TAO_Policy_Set::get_policy_overrides (const CORBA::PolicyTypeSeq &types } policy_list[n++] = - CORBA::Policy::_duplicate (this->policy_list_[i].in ()); + CORBA::Policy::_duplicate (this->policy_list_[i]); break; } } @@ -346,7 +339,7 @@ TAO_Policy_Set::get_policy (CORBA::PolicyType type continue; } - return CORBA::Policy::_duplicate (this->policy_list_[i].in ()); + return CORBA::Policy::_duplicate (this->policy_list_[i]); } return CORBA::Policy::_nil (); diff --git a/TAO/tao/Policy_Set.h b/TAO/tao/Policy_Set.h index db5bc837520..d5176c720b7 100644 --- a/TAO/tao/Policy_Set.h +++ b/TAO/tao/Policy_Set.h @@ -100,7 +100,7 @@ public: /// Returns the policy at the specified index. /// @c CORBA::Policy::_nil () is returned if the policy doesn't /// exist. - CORBA::Policy *get_policy_by_index (CORBA::ULong index); + CORBA::Policy *get_policy_by_index (CORBA::ULong index) const; CORBA::ULong num_policies (void) const; private: diff --git a/TAO/tao/Policy_Set.i b/TAO/tao/Policy_Set.i index a8767177029..2263ccd4fad 100644 --- a/TAO/tao/Policy_Set.i +++ b/TAO/tao/Policy_Set.i @@ -13,7 +13,7 @@ TAO_Policy_Set::compatible_scope (TAO_Policy_Scope policy_scope) const } ACE_INLINE CORBA::Policy * -TAO_Policy_Set::get_policy_by_index (CORBA::ULong index) +TAO_Policy_Set::get_policy_by_index (CORBA::ULong index) const { return CORBA::Policy::_duplicate (this->policy_list_[index]); } diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h index cc7fd7fea0a..d31e55b6257 100644 --- a/TAO/tao/Profile.h +++ b/TAO/tao/Profile.h @@ -334,10 +334,10 @@ protected: private: /// IOP protocol tag. - CORBA::ULong tag_; + CORBA::ULong const tag_; /// Pointer to the ORB core - TAO_ORB_Core *orb_core_; + TAO_ORB_Core * const orb_core_; /// The TAO_MProfile which contains the profiles for the forwarded /// object. @@ -357,7 +357,7 @@ private: // A helper class to handle the various kinds of octet sequences used // inside the ORB. -typedef TAO_Unbounded_Sequence<CORBA::Octet> TAO_opaque; +typedef TAO::unbounded_value_sequence<CORBA::Octet> TAO_opaque; TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR&, const TAO_opaque&); diff --git a/TAO/tao/Profile_Transport_Resolver.cpp b/TAO/tao/Profile_Transport_Resolver.cpp index 2fafd42c511..fd1f4355871 100644 --- a/TAO/tao/Profile_Transport_Resolver.cpp +++ b/TAO/tao/Profile_Transport_Resolver.cpp @@ -112,7 +112,7 @@ namespace TAO if (!this->transport_->is_tcs_set ()) { - TAO_Codeset_Manager *tcm = + TAO_Codeset_Manager * const tcm = this->stub_->orb_core ()->codeset_manager (); if (tcm) tcm->set_tcs (*this->profile_, *this->transport_); @@ -144,7 +144,7 @@ namespace TAO ACE_Time_Value connection_timeout; - const bool is_conn_timeout = + bool const is_conn_timeout = this->get_connection_timeout (connection_timeout); @@ -225,7 +225,7 @@ namespace TAO int Profile_Transport_Resolver::find_transport (TAO_Transport_Descriptor_Interface *desc) { - TAO::Transport_Cache_Manager &cache = + TAO::Transport_Cache_Manager & const cache = this->profile_->orb_core()->lane_resources ().transport_cache(); // the cache increments the reference count on the transport if the diff --git a/TAO/tao/Pseudo_VarOut_T.cpp b/TAO/tao/Pseudo_VarOut_T.cpp index 9d325bfb89a..b63c21b6db9 100644 --- a/TAO/tao/Pseudo_VarOut_T.cpp +++ b/TAO/tao/Pseudo_VarOut_T.cpp @@ -17,7 +17,7 @@ TAO_Pseudo_Var_T<T>::operator= (const TAO_Pseudo_Var_T<T> & p) { if (this != &p) { - CORBA::release (this->ptr_); + ::CORBA::release (this->ptr_); this->ptr_ = T::_duplicate (p.ptr ()); } diff --git a/TAO/tao/Pseudo_VarOut_T.h b/TAO/tao/Pseudo_VarOut_T.h index 431e464d079..1e55c7bc78f 100644 --- a/TAO/tao/Pseudo_VarOut_T.h +++ b/TAO/tao/Pseudo_VarOut_T.h @@ -83,7 +83,6 @@ public: // TAO extension. _retn_type ptr (void) const; - private: // Unimplemented - prevents widening assignment. @@ -115,9 +114,7 @@ public: TAO_Pseudo_Out_T<T,T_var> & operator= (T *); operator T *& (); - T *& ptr (void); - T * operator-> (void); private: diff --git a/TAO/tao/Pseudo_VarOut_T.inl b/TAO/tao/Pseudo_VarOut_T.inl index 8e5867beac6..cf2df832afc 100644 --- a/TAO/tao/Pseudo_VarOut_T.inl +++ b/TAO/tao/Pseudo_VarOut_T.inl @@ -27,7 +27,7 @@ template <typename T> ACE_INLINE TAO_Pseudo_Var_T<T>::~TAO_Pseudo_Var_T (void) { - CORBA::release (this->ptr_); + ::CORBA::release (this->ptr_); } template <typename T> @@ -35,7 +35,7 @@ ACE_INLINE TAO_Pseudo_Var_T<T> & TAO_Pseudo_Var_T<T>::operator= (T * p) { - CORBA::release (this->ptr_); + ::CORBA::release (this->ptr_); this->ptr_ = p; return *this; } @@ -83,7 +83,7 @@ ACE_INLINE T *& TAO_Pseudo_Var_T<T>::out (void) { - CORBA::release (this->ptr_); + ::CORBA::release (this->ptr_); this->ptr_ = T::_nil (); return this->ptr_; } @@ -121,7 +121,7 @@ ACE_INLINE TAO_Pseudo_Out_T<T,T_var>::TAO_Pseudo_Out_T (T_var & p) : ptr_ (p.out ()) { - CORBA::release (this->ptr_); + ::CORBA::release (this->ptr_); this->ptr_ = T::_nil (); } @@ -153,15 +153,15 @@ TAO_Pseudo_Out_T<T,T_var>::operator= (T * p) template <typename T, typename T_var> ACE_INLINE -TAO_Pseudo_Out_T<T,T_var>::operator T *& () +T *& +TAO_Pseudo_Out_T<T,T_var>::ptr (void) { return this->ptr_; } template <typename T, typename T_var> ACE_INLINE -T *& -TAO_Pseudo_Out_T<T,T_var>::ptr (void) +TAO_Pseudo_Out_T<T,T_var>::operator T *& () { return this->ptr_; } diff --git a/TAO/tao/QtResource_Factory.cpp b/TAO/tao/QtResource_Factory.cpp index ec50933e935..2c25a88cf7b 100644 --- a/TAO/tao/QtResource_Factory.cpp +++ b/TAO/tao/QtResource_Factory.cpp @@ -31,7 +31,6 @@ namespace TAO if (!this->reactor_impl_) { - ACE_NEW_RETURN (this->reactor_impl_, ACE_QtReactor (qapp_), 0); diff --git a/TAO/tao/Queued_Message.cpp b/TAO/tao/Queued_Message.cpp index c7caef37cc0..8b4b73072c9 100644 --- a/TAO/tao/Queued_Message.cpp +++ b/TAO/tao/Queued_Message.cpp @@ -11,7 +11,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Queued_Message::TAO_Queued_Message (TAO_ORB_Core *oc, ACE_Allocator *alloc, - int is_heap_allocated) + bool is_heap_allocated) : allocator_ (alloc) , is_heap_created_ (is_heap_allocated) , orb_core_ (oc) @@ -72,13 +72,14 @@ TAO_Queued_Message::push_back (TAO_Queued_Message *&head, head = this; this->next_ = 0; this->prev_ = 0; - return; } - - tail->next_ = this; - this->prev_ = tail; - this->next_ = 0; - tail = this; + else + { + tail->next_ = this; + this->prev_ = tail; + this->next_ = 0; + tail = this; + } } void @@ -91,13 +92,14 @@ TAO_Queued_Message::push_front (TAO_Queued_Message *&head, head = this; this->next_ = 0; this->prev_ = 0; - return; } - - head->prev_ = this; - this->next_ = head; - this->prev_ = 0; - head = this; + else + { + head->prev_ = this; + this->next_ = head; + this->prev_ = 0; + head = this; + } } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Queued_Message.h b/TAO/tao/Queued_Message.h index d2b1ec6c888..70defaa15cd 100644 --- a/TAO/tao/Queued_Message.h +++ b/TAO/tao/Queued_Message.h @@ -77,7 +77,7 @@ public: /// Constructor TAO_Queued_Message (TAO_ORB_Core *oc, ACE_Allocator *alloc = 0, - int is_heap_allocated = 0); + bool is_heap_allocated = false); /// Destructor virtual ~TAO_Queued_Message (void); @@ -204,11 +204,10 @@ protected: ACE_Allocator *allocator_; /* - * A flag that acts as a boolean to indicate whether @a this is on - * stack or heap. A non-zero value indicates that @a this was created - * on heap. + * A flag to indicate whether @a this is on stack or heap. A true value + * indicates that @a this was created on heap. */ - int is_heap_created_; + bool is_heap_created_; /// Cached copy of ORB_Core pointer TAO_ORB_Core *orb_core_; diff --git a/TAO/tao/Range_Checking_T.h b/TAO/tao/Range_Checking_T.h new file mode 100644 index 00000000000..bcd4aa42b5d --- /dev/null +++ b/TAO/tao/Range_Checking_T.h @@ -0,0 +1,146 @@ +#ifndef guard_range_checking_hpp +#define guard_range_checking_hpp +/** + * @file + * + * @brief Details can be found in the documentation for + * TAO::details::generic_sequence + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +namespace TAO +{ +namespace details +{ + +/** + * @struct range_checking + * + * @brief Configurable traits to tradeoff safety vs. performance in + * the implementation of TAO sequences. + * + * The CORBA specification grants certain latitude to implementors by + * not defining the behavior of sequences under certain conditions. + * Probably the most clear example is the operator[] access, where the + * application <b>must</b> set the length to a high enough value + * before using the operator[]. + * + * Implementors that cater to high-performance applications tend to + * exploit this latitude to the extreme, basically reasoning that + * correct applications will behave normally, while incorrect + * applications will crash, but those crashes will be detected during + * development/testing. + * + * Realizing that this may be a bad tradeoff some implementors offer + * compile-time hooks to control the behavior of sequences when used + * improperly, some implementors may go as far as using run-time + * hooks. + * + * The implementation of sequences calls the following template class + * in points where the application may trigger undefined behavior. + * The application developer can use partial (or full) template + * specialization to introduce her own code at these critical points. + * + * Some examples may help, suppose you want to change your application + * so for all sequence types the operator[] raises an exception if the + * index is out of range. Then you would provide the following + * (partial) template specialization: + * + * <PRE> + * template<typename T> + * struct range_checking<T,true> { + * void check(CORBA::ULong index, CORBA::ULong length) { + * if (index < length) + * return; + * throw std::range_error("CORBA sequence range error"); + * }; + * ... + * .. + * }; + * </PRE> + * + * This specialization must be introduced before any sequence code is + * seen, therefore, the application would also need to define the + * following macro in their $ACE_ROOT/ace/config.h file: + * + * - #define TAO_USER_DEFINED_SEQUENCE_SAFETY_TRAITS_INCLUDE "<filename here>" + * + * Likewise, if the application only wanted to check the range for a + * special type, say some structure MyStruct, then they would provide + * a full specialization. Just for giggles, we will also introduce + * run-time controls to this example: + * + * <PRE> + * template<> + * struct safety_traits<tao::details::value_traits<MyStruct>,true> { + * bool enable_range_checking; + * void check_range(CORBA::ULong index, CORBA::ULong length) { + * if (!enable_range_checking || index < length) + * return; + * throw std::range_error("CORBA sequence range error"); + * }; + * ... + * .. + * }; + * </PRE> + * + * + * + * @todo There is no control on a per-sequence type basis, only on a + * per-underlying type basis, for example, the following two IDL + * sequences would get the same behavior: + * // IDL + * typedef sequence<MyStruct> MyStructSequence; + * typedef sequence<MyStruct> MyStructList; + * + * @todo There is no way to control behavior on a per-sequence basis, + * i.e. to have some sequences of longs checked while others are + * not. This is easy to fix, simply: + * - make all members of safety_traits non-static + * - have each sequence contain their own instance of + * safety_traits + * - grant users read/write access to the safety_traits of each + * sequence + * but there are footprint consequences to that approach. Until + * there is more demand to justify the cost, I will not + * implement such a change. + */ +template<typename T, bool dummy> +struct range_checking +{ + typedef T value_type; + + inline static void check( + CORBA::ULong /* index */, + CORBA::ULong /* length */, + CORBA::ULong /* maximum */, + char const * /* function_name */) + { + // Applications and tests can specialize this function to define + // their own behavior + } + + inline static void check_length( + CORBA::ULong & /* new_length */, + CORBA::ULong /* maximum */) + { + /* + if (maximum < new_length) + new_length = maximum; + */ + } +}; + +} // namespace details +} // namespace TAO + +#if defined(TAO_USER_DEFINED_SEQUENCE_RANGE_CHECKING_INCLUDE) +# include TAO_USER_DEFINED_SEQUENCE_RANGE_CHECKING_INCLUDE +#endif // TAO_USER_DEFINED_SEQUENCE_RANGE_CHECKING_INCLUDE + +#endif // guard_range_checking_hpp diff --git a/TAO/tao/Reactive_Flushing_Strategy.cpp b/TAO/tao/Reactive_Flushing_Strategy.cpp index ab76a31f168..085779f99ed 100644 --- a/TAO/tao/Reactive_Flushing_Strategy.cpp +++ b/TAO/tao/Reactive_Flushing_Strategy.cpp @@ -6,8 +6,8 @@ #include "tao/ORB_Core.h" #include "tao/Queued_Message.h" -ACE_RCSID (tao, - Reactive_Flushing_Strategy, +ACE_RCSID (tao, + Reactive_Flushing_Strategy, "$Id$") @@ -36,7 +36,7 @@ TAO_Reactive_Flushing_Strategy::flush_message (TAO_Transport *transport, ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - TAO_ORB_Core *orb_core = transport->orb_core (); + TAO_ORB_Core * const orb_core = transport->orb_core (); while (!msg->all_data_sent () && result >= 0) { @@ -60,11 +60,11 @@ TAO_Reactive_Flushing_Strategy::flush_transport (TAO_Transport *transport) ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - TAO_ORB_Core *orb_core = transport->orb_core (); + TAO_ORB_Core * const orb_core = transport->orb_core (); while (!transport->queue_is_empty ()) { - int result = orb_core->run (0, 1 ACE_ENV_ARG_PARAMETER); + int const result = orb_core->run (0, 1 ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; if (result == -1) diff --git a/TAO/tao/Remote_Invocation.cpp b/TAO/tao/Remote_Invocation.cpp index 1e6ea8b5426..7ff6e461339 100644 --- a/TAO/tao/Remote_Invocation.cpp +++ b/TAO/tao/Remote_Invocation.cpp @@ -78,7 +78,7 @@ namespace TAO // index that we need. CORBA::ULong index = 0; IOP::IOR *ior_info = 0; - const int retval = + int const retval = this->resolver_.stub ()->create_ior_info (ior_info, index ACE_ENV_ARG_PARAMETER); @@ -158,7 +158,7 @@ namespace TAO connection_handler->set_dscp_codepoint (set_client_network_priority); - const int retval = + int const retval = this->resolver_.transport ()->send_request ( this->resolver_.stub (), this->resolver_.stub ()->orb_core (), diff --git a/TAO/tao/Seq_Out_T.h b/TAO/tao/Seq_Out_T.h index 1544f24c9ee..baaf937394a 100644 --- a/TAO/tao/Seq_Out_T.h +++ b/TAO/tao/Seq_Out_T.h @@ -26,66 +26,34 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * @brief Parametrized implementation of _out class for sequences. * */ -template <typename T, typename T_var, typename T_elem> +template <typename T> class TAO_Seq_Out_T { public: + typedef typename T::subscript_type T_elem; + typedef typename T::_var_type T_var; + TAO_Seq_Out_T (T *&); TAO_Seq_Out_T (T_var &); - TAO_Seq_Out_T (const TAO_Seq_Out_T<T,T_var,T_elem> &); + TAO_Seq_Out_T (const TAO_Seq_Out_T<T> &); - TAO_Seq_Out_T &operator= (const TAO_Seq_Out_T<T,T_var,T_elem> &); + TAO_Seq_Out_T &operator= (const TAO_Seq_Out_T<T> &); TAO_Seq_Out_T &operator= (T *); operator T *& (); - T *& ptr (void); T * operator-> (void); - T_elem & operator[] (CORBA::ULong index); - -private: - typedef TAO_Seq_Out_T<T,T_var,T_elem> THIS_OUT_TYPE; - T *& ptr_; - // Assignment from T_var not allowed. - void operator= (const T_var &); -}; - - -/** - * @class TAO_MngSeq_Out_T - * - * @brief Parametrized implementation of _out class for sequences - * having managed types. - * - */ -template <typename T, typename T_var, typename T_elem> -class TAO_MngSeq_Out_T -{ -public: - TAO_MngSeq_Out_T (T *&); - TAO_MngSeq_Out_T (T_var &); - TAO_MngSeq_Out_T (const TAO_MngSeq_Out_T<T,T_var,T_elem> &); - - TAO_MngSeq_Out_T &operator= (const TAO_MngSeq_Out_T<T,T_var,T_elem> &); - TAO_MngSeq_Out_T &operator= (T *); - - operator T *& (); + T_elem operator[] (CORBA::ULong index); T *& ptr (void); - T * operator-> (void); - - T_elem operator[] (CORBA::ULong index); private: - typedef TAO_MngSeq_Out_T<T,T_var,T_elem> THIS_OUT_TYPE; T *& ptr_; // Assignment from T_var not allowed. void operator= (const T_var &); }; - TAO_END_VERSIONED_NAMESPACE_DECL - #if defined (__ACE_INLINE__) #include "tao/Seq_Out_T.inl" #endif /* defined INLINE */ diff --git a/TAO/tao/Seq_Out_T.inl b/TAO/tao/Seq_Out_T.inl index da3a0e8b95b..80e460f6cf2 100644 --- a/TAO/tao/Seq_Out_T.inl +++ b/TAO/tao/Seq_Out_T.inl @@ -4,155 +4,78 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Out_T<T,T_var,T_elem>::TAO_Seq_Out_T (T *& p) +TAO_Seq_Out_T<T>::TAO_Seq_Out_T (T *& p) : ptr_ (p) { this->ptr_ = 0; } -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Out_T<T,T_var,T_elem>::TAO_Seq_Out_T (T_var & p) +TAO_Seq_Out_T<T>::TAO_Seq_Out_T (T_var & p) : ptr_ (p.out ()) { delete this->ptr_; this->ptr_ = 0; } -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Out_T<T,T_var,T_elem>::TAO_Seq_Out_T ( - const TAO_Seq_Out_T<T,T_var,T_elem> & p +TAO_Seq_Out_T<T>::TAO_Seq_Out_T ( + const TAO_Seq_Out_T<T> & p ) : ptr_ (p.ptr_) {} -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Out_T<T,T_var,T_elem> & -TAO_Seq_Out_T<T,T_var,T_elem>::operator= ( - const TAO_Seq_Out_T<T,T_var,T_elem> & p +TAO_Seq_Out_T<T> & +TAO_Seq_Out_T<T>::operator= ( + const TAO_Seq_Out_T<T> & p ) { this->ptr_ = p.ptr_; return *this; } -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Out_T<T,T_var,T_elem> & -TAO_Seq_Out_T<T,T_var,T_elem>::operator= (T * p) +TAO_Seq_Out_T<T> & +TAO_Seq_Out_T<T>::operator= (T * p) { this->ptr_ = p; return *this; } -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Out_T<T,T_var,T_elem>::operator T *& () +TAO_Seq_Out_T<T>::operator T *& () { return this->ptr_; } -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE T *& -TAO_Seq_Out_T<T,T_var,T_elem>::ptr (void) +TAO_Seq_Out_T<T>::ptr (void) { return this->ptr_; } -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE T * -TAO_Seq_Out_T<T,T_var,T_elem>::operator-> (void) +TAO_Seq_Out_T<T>::operator-> (void) { return this->ptr_; } -template<typename T, typename T_var, typename T_elem> +template<typename T> ACE_INLINE -T_elem & -TAO_Seq_Out_T<T,T_var,T_elem>::operator[] (CORBA::ULong index) -{ - return this->ptr_->operator[] (index); -} - -// **************************************************************** -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -TAO_MngSeq_Out_T<T,T_var,T_elem>::TAO_MngSeq_Out_T (T *& p) - : ptr_ (p) -{ - this->ptr_ = 0; -} - -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -TAO_MngSeq_Out_T<T,T_var,T_elem>::TAO_MngSeq_Out_T (T_var & p) - : ptr_ (p.out ()) -{ - delete this->ptr_; - this->ptr_ = 0; -} - -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -TAO_MngSeq_Out_T<T,T_var,T_elem>::TAO_MngSeq_Out_T ( - const TAO_MngSeq_Out_T<T,T_var,T_elem> & p - ) - : ptr_ (p.ptr_) -{} - -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -TAO_MngSeq_Out_T<T,T_var,T_elem> & -TAO_MngSeq_Out_T<T,T_var,T_elem>::operator= ( - const TAO_MngSeq_Out_T<T,T_var,T_elem> & p - ) -{ - this->ptr_ = p.ptr_; - return *this; -} - -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -TAO_MngSeq_Out_T<T,T_var,T_elem> & -TAO_MngSeq_Out_T<T,T_var,T_elem>::operator= (T * p) -{ - this->ptr_ = p; - return *this; -} - -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -TAO_MngSeq_Out_T<T,T_var,T_elem>::operator T *& () -{ - return this->ptr_; -} - -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -T *& -TAO_MngSeq_Out_T<T,T_var,T_elem>::ptr (void) -{ - return this->ptr_; -} - -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -T * -TAO_MngSeq_Out_T<T,T_var,T_elem>::operator-> (void) -{ - return this->ptr_; -} - -template<typename T, typename T_var, typename T_elem> -ACE_INLINE -T_elem -TAO_MngSeq_Out_T<T,T_var,T_elem>::operator[] (CORBA::ULong index) +typename TAO_Seq_Out_T<T>::T_elem +TAO_Seq_Out_T<T>::operator[] (CORBA::ULong index) { return this->ptr_->operator[] (index); } diff --git a/TAO/tao/Seq_Var_T.cpp b/TAO/tao/Seq_Var_T.cpp index e8e38e2eddb..a9929293475 100644 --- a/TAO/tao/Seq_Var_T.cpp +++ b/TAO/tao/Seq_Var_T.cpp @@ -13,23 +13,23 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -template<typename T, typename T_elem> -TAO_Seq_Var_Base_T<T,T_elem>::TAO_Seq_Var_Base_T ( - const TAO_Seq_Var_Base_T<T,T_elem> & p) +template<typename T> +TAO_Seq_Var_Base_T<T>::TAO_Seq_Var_Base_T ( + const TAO_Seq_Var_Base_T<T> & p) : ptr_ (p.ptr_ ? new T (*p.ptr_) : 0) { } // **************************************************************************** -template<typename T, typename T_elem> -TAO_FixedSeq_Var_T<T,T_elem> & -TAO_FixedSeq_Var_T<T,T_elem>::operator= ( - const TAO_FixedSeq_Var_T<T,T_elem> & p) +template<typename T> +TAO_FixedSeq_Var_T<T> & +TAO_FixedSeq_Var_T<T>::operator= ( + const TAO_FixedSeq_Var_T<T> & p) { // Strongly exception safe assignment using copy and non-throwing // swap technique. - TAO_FixedSeq_Var_T<T,T_elem> tmp (p); + TAO_FixedSeq_Var_T<T> tmp (p); T * old_ptr = this->ptr_; this->ptr_ = tmp.ptr_; @@ -39,13 +39,13 @@ TAO_FixedSeq_Var_T<T,T_elem>::operator= ( } // Fixed-size types only. -template<typename T, typename T_elem> -TAO_FixedSeq_Var_T<T,T_elem> & -TAO_FixedSeq_Var_T<T,T_elem>::operator= (const T & p) +template<typename T> +TAO_FixedSeq_Var_T<T> & +TAO_FixedSeq_Var_T<T>::operator= (const T & p) { // Strongly exception safe assignment using copy and non-throwing // swap technique. - TAO_FixedSeq_Var_T<T,T_elem> tmp (p); + TAO_FixedSeq_Var_T<T> tmp (p); T * old_ptr = this->ptr_; this->ptr_ = tmp.ptr_; @@ -56,32 +56,13 @@ TAO_FixedSeq_Var_T<T,T_elem>::operator= (const T & p) // **************************************************************************** -template<typename T, typename T_elem> -TAO_VarSeq_Var_T<T,T_elem> & -TAO_VarSeq_Var_T<T,T_elem>::operator= (const TAO_VarSeq_Var_T<T,T_elem> & p) +template<typename T> +TAO_VarSeq_Var_T<T> & +TAO_VarSeq_Var_T<T>::operator= (const TAO_VarSeq_Var_T<T> & p) { // Strongly exception safe assignment using copy and non-throwing // swap technique. - TAO_VarSeq_Var_T<T,T_elem> tmp (p); - - T * old_ptr = this->ptr_; - this->ptr_ = tmp.ptr_; - tmp.ptr_ = old_ptr; - - return *this; -} - -// **************************************************************************** - -template<typename T, typename T_elem> -TAO_MngSeq_Var_T<T,T_elem> & -TAO_MngSeq_Var_T<T,T_elem>::operator= ( - const TAO_MngSeq_Var_T<T,T_elem> & p - ) -{ - // Strongly exception safe assignment using copy and non-throwing - // swap technique. - TAO_MngSeq_Var_T<T,T_elem> tmp (p); + TAO_VarSeq_Var_T<T> tmp (p); T * old_ptr = this->ptr_; this->ptr_ = tmp.ptr_; diff --git a/TAO/tao/Seq_Var_T.h b/TAO/tao/Seq_Var_T.h index 9b3e4f38193..527c63e664f 100644 --- a/TAO/tao/Seq_Var_T.h +++ b/TAO/tao/Seq_Var_T.h @@ -29,13 +29,15 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * @brief Parametrized implementation of _var base class for sequences * */ -template <typename T, typename T_elem> +template <typename T> class TAO_Seq_Var_Base_T { public: + typedef typename T::subscript_type T_elem; + TAO_Seq_Var_Base_T (void); TAO_Seq_Var_Base_T (T *); - TAO_Seq_Var_Base_T (const TAO_Seq_Var_Base_T<T,T_elem> &); + TAO_Seq_Var_Base_T (const TAO_Seq_Var_Base_T<T> &); ~TAO_Seq_Var_Base_T (void); @@ -57,9 +59,8 @@ public: _out_type out (void); _retn_type _retn (void); - // TAO extension. - _retn_type ptr (void) const; - + /// TAO extension. + _retn_type ptr (void) const; protected: T * ptr_; }; @@ -69,26 +70,28 @@ protected: * * @brief Parametrized implementation of _var class for sequences * whose element is of fixed size.. - * */ -template <typename T, typename T_elem> -class TAO_FixedSeq_Var_T : public TAO_Seq_Var_Base_T<T,T_elem> +template <typename T> +class TAO_FixedSeq_Var_T : public TAO_Seq_Var_Base_T<T> { public: + typedef typename T::subscript_type T_elem; + typedef typename T::const_subscript_type T_const_elem; + TAO_FixedSeq_Var_T (void); TAO_FixedSeq_Var_T (T *); - TAO_FixedSeq_Var_T (const TAO_FixedSeq_Var_T<T,T_elem> &); + TAO_FixedSeq_Var_T (const TAO_FixedSeq_Var_T<T> &); // Fixed-size base types only. TAO_FixedSeq_Var_T (const T &); TAO_FixedSeq_Var_T & operator= (T *); - TAO_FixedSeq_Var_T & operator= (const TAO_FixedSeq_Var_T<T,T_elem> &); + TAO_FixedSeq_Var_T & operator= (const TAO_FixedSeq_Var_T<T> &); - T_elem & operator[] (CORBA::ULong index); - const T_elem & operator[] (CORBA::ULong index) const; + T_elem operator[] (CORBA::ULong index); + T_const_elem operator[] (CORBA::ULong index) const; - // Fixed-size base types only. + /// Fixed-size base types only. TAO_FixedSeq_Var_T & operator= (const T &); }; @@ -99,48 +102,25 @@ public: * whose element is of variable size.. * */ -template <typename T, typename T_elem> -class TAO_VarSeq_Var_T : public TAO_Seq_Var_Base_T<T,T_elem> +template <typename T> +class TAO_VarSeq_Var_T : public TAO_Seq_Var_Base_T<T> { public: + typedef typename T::subscript_type T_elem; + typedef typename T::const_subscript_type T_const_elem; + TAO_VarSeq_Var_T (void); TAO_VarSeq_Var_T (T *); - TAO_VarSeq_Var_T (const TAO_VarSeq_Var_T<T,T_elem> &); + TAO_VarSeq_Var_T (const TAO_VarSeq_Var_T<T> &); TAO_VarSeq_Var_T & operator= (T *); - TAO_VarSeq_Var_T & operator= (const TAO_VarSeq_Var_T<T,T_elem> &); - - T_elem & operator[] (CORBA::ULong index); - const T_elem & operator[] (CORBA::ULong index) const; - - // Variable-size base types only. - operator T *& (); -}; + TAO_VarSeq_Var_T & operator= (const TAO_VarSeq_Var_T<T> &); -/** - * @class TAO_MngSeq_Var_T - * - * @brief Parametrized implementation of _var class for sequences - * whose element is of a managed type - string, wstring, valuetype, - * interface, abstract interface and pseudo object. - * - */ -template <typename T, typename T_elem> -class TAO_MngSeq_Var_T : public TAO_Seq_Var_Base_T<T,T_elem> -{ -public: - TAO_MngSeq_Var_T (void); - TAO_MngSeq_Var_T (T *); - TAO_MngSeq_Var_T (const TAO_MngSeq_Var_T<T,T_elem> &); - - TAO_MngSeq_Var_T & operator= (T *); - TAO_MngSeq_Var_T & operator= (const TAO_MngSeq_Var_T<T,T_elem> &); + T_elem operator[] (CORBA::ULong index); + T_const_elem operator[] (CORBA::ULong index) const; - // Variable-size base types only. + /// Variable-size base types only. operator T *& (); - - // Managed base types only. - T_elem operator[] (CORBA::ULong index); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Seq_Var_T.inl b/TAO/tao/Seq_Var_T.inl index 1d5209183fb..ac3515783d4 100644 --- a/TAO/tao/Seq_Var_T.inl +++ b/TAO/tao/Seq_Var_T.inl @@ -4,188 +4,188 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Var_Base_T<T,T_elem>::TAO_Seq_Var_Base_T (void) +TAO_Seq_Var_Base_T<T>::TAO_Seq_Var_Base_T (void) : ptr_ (0) {} -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Var_Base_T<T,T_elem>::TAO_Seq_Var_Base_T (T * p) +TAO_Seq_Var_Base_T<T>::TAO_Seq_Var_Base_T (T * p) : ptr_ (p) {} -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Var_Base_T<T,T_elem>::~TAO_Seq_Var_Base_T (void) +TAO_Seq_Var_Base_T<T>::~TAO_Seq_Var_Base_T (void) { delete this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE const T * -TAO_Seq_Var_Base_T<T,T_elem>::operator-> (void) const +TAO_Seq_Var_Base_T<T>::operator-> (void) const { return this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE T * -TAO_Seq_Var_Base_T<T,T_elem>::operator-> (void) +TAO_Seq_Var_Base_T<T>::operator-> (void) { return this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Var_Base_T<T,T_elem>::operator const T & () const +TAO_Seq_Var_Base_T<T>::operator const T & () const { return *this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Var_Base_T<T,T_elem>::operator T & () +TAO_Seq_Var_Base_T<T>::operator T & () { return *this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_Seq_Var_Base_T<T,T_elem>::operator T & () const +TAO_Seq_Var_Base_T<T>::operator T & () const { return *this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE const T & -TAO_Seq_Var_Base_T<T,T_elem>::in (void) const +TAO_Seq_Var_Base_T<T>::in (void) const { return *this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE T & -TAO_Seq_Var_Base_T<T,T_elem>::inout (void) +TAO_Seq_Var_Base_T<T>::inout (void) { return *this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE T *& -TAO_Seq_Var_Base_T<T,T_elem>::out (void) +TAO_Seq_Var_Base_T<T>::out (void) { delete this->ptr_; this->ptr_ = 0; return this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE T * -TAO_Seq_Var_Base_T<T,T_elem>::_retn (void) +TAO_Seq_Var_Base_T<T>::_retn (void) { T * tmp = this->ptr_; this->ptr_ = 0; return tmp; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE T * -TAO_Seq_Var_Base_T<T,T_elem>::ptr (void) const +TAO_Seq_Var_Base_T<T>::ptr (void) const { return this->ptr_; } // *************************************************************** -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_FixedSeq_Var_T<T,T_elem>::TAO_FixedSeq_Var_T (void) +TAO_FixedSeq_Var_T<T>::TAO_FixedSeq_Var_T (void) {} -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_FixedSeq_Var_T<T,T_elem>::TAO_FixedSeq_Var_T (T * p) - : TAO_Seq_Var_Base_T<T,T_elem> (p) +TAO_FixedSeq_Var_T<T>::TAO_FixedSeq_Var_T (T * p) + : TAO_Seq_Var_Base_T<T> (p) {} -template<typename T, typename T_elem> -TAO_FixedSeq_Var_T<T,T_elem>::TAO_FixedSeq_Var_T ( - const TAO_FixedSeq_Var_T<T,T_elem> & p +template<typename T> +TAO_FixedSeq_Var_T<T>::TAO_FixedSeq_Var_T ( + const TAO_FixedSeq_Var_T<T> & p ) - : TAO_Seq_Var_Base_T<T,T_elem> (p) + : TAO_Seq_Var_Base_T<T> (p) { } // Fixed-size base types only. -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_FixedSeq_Var_T<T,T_elem>::TAO_FixedSeq_Var_T (const T & p) +TAO_FixedSeq_Var_T<T>::TAO_FixedSeq_Var_T (const T & p) { ACE_NEW (this->ptr_, T (p)); } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_FixedSeq_Var_T<T,T_elem> & -TAO_FixedSeq_Var_T<T,T_elem>::operator= (T * p) +TAO_FixedSeq_Var_T<T> & +TAO_FixedSeq_Var_T<T>::operator= (T * p) { delete this->ptr_; this->ptr_ = p; return *this; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -T_elem & -TAO_FixedSeq_Var_T<T,T_elem>::operator[] (CORBA::ULong index) +typename TAO_FixedSeq_Var_T<T>::T_elem +TAO_FixedSeq_Var_T<T>::operator[] (CORBA::ULong index) { return this->ptr_->operator[] (index); } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -const T_elem & -TAO_FixedSeq_Var_T<T,T_elem>::operator[] (CORBA::ULong index) const +typename TAO_FixedSeq_Var_T<T>::T_const_elem +TAO_FixedSeq_Var_T<T>::operator[] (CORBA::ULong index) const { return this->ptr_->operator[] (index); } // *************************************************************** -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_VarSeq_Var_T<T,T_elem>::TAO_VarSeq_Var_T (void) +TAO_VarSeq_Var_T<T>::TAO_VarSeq_Var_T (void) { } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_VarSeq_Var_T<T,T_elem>::TAO_VarSeq_Var_T (T * p) - : TAO_Seq_Var_Base_T<T,T_elem> (p) +TAO_VarSeq_Var_T<T>::TAO_VarSeq_Var_T (T * p) + : TAO_Seq_Var_Base_T<T> (p) { } -template<typename T, typename T_elem> -TAO_VarSeq_Var_T<T,T_elem>::TAO_VarSeq_Var_T ( - const TAO_VarSeq_Var_T<T,T_elem> & p) - : TAO_Seq_Var_Base_T<T,T_elem> (p) +template<typename T> +TAO_VarSeq_Var_T<T>::TAO_VarSeq_Var_T ( + const TAO_VarSeq_Var_T<T> & p) + : TAO_Seq_Var_Base_T<T> (p) { } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_VarSeq_Var_T<T,T_elem> & -TAO_VarSeq_Var_T<T,T_elem>::operator= (T * p) +TAO_VarSeq_Var_T<T> & +TAO_VarSeq_Var_T<T>::operator= (T * p) { delete this->ptr_; this->ptr_ = p; @@ -193,74 +193,28 @@ TAO_VarSeq_Var_T<T,T_elem>::operator= (T * p) } // Variable-size types only. -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -TAO_VarSeq_Var_T<T,T_elem>::operator T *& () +TAO_VarSeq_Var_T<T>::operator T *& () { return this->ptr_; } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -T_elem & -TAO_VarSeq_Var_T<T,T_elem>::operator[] (CORBA::ULong index) +typename TAO_VarSeq_Var_T<T>::T_elem +TAO_VarSeq_Var_T<T>::operator[] (CORBA::ULong index) { return this->ptr_->operator[] (index); } -template<typename T, typename T_elem> +template<typename T> ACE_INLINE -const T_elem & -TAO_VarSeq_Var_T<T,T_elem>::operator[] (CORBA::ULong index) const +typename TAO_VarSeq_Var_T<T>::T_const_elem +TAO_VarSeq_Var_T<T>::operator[] (CORBA::ULong index) const { return this->ptr_->operator[] (index); } -// *************************************************************** - -template<typename T, typename T_elem> -ACE_INLINE -TAO_MngSeq_Var_T<T,T_elem>::TAO_MngSeq_Var_T (void) -{} - -template<typename T, typename T_elem> -ACE_INLINE -TAO_MngSeq_Var_T<T,T_elem>::TAO_MngSeq_Var_T (T * p) - : TAO_Seq_Var_Base_T<T,T_elem> (p) -{ -} - -template<typename T, typename T_elem> -TAO_MngSeq_Var_T<T,T_elem>::TAO_MngSeq_Var_T ( - const TAO_MngSeq_Var_T<T,T_elem> & p) - : TAO_Seq_Var_Base_T<T,T_elem> (p) -{ -} - -template<typename T, typename T_elem> -ACE_INLINE -TAO_MngSeq_Var_T<T,T_elem> & -TAO_MngSeq_Var_T<T,T_elem>::operator= (T * p) -{ - delete this->ptr_; - this->ptr_ = p; - return *this; -} - -// Variable-size types only. -template<typename T, typename T_elem> -ACE_INLINE -TAO_MngSeq_Var_T<T,T_elem>::operator T *& () -{ - return this->ptr_; -} - -template<typename T, typename T_elem> -ACE_INLINE -T_elem -TAO_MngSeq_Var_T<T,T_elem>::operator[] (CORBA::ULong index) -{ - return this->ptr_->operator[] (index); -} TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Sequence.cpp b/TAO/tao/Sequence.cpp deleted file mode 100644 index 20c274d8a98..00000000000 --- a/TAO/tao/Sequence.cpp +++ /dev/null @@ -1,1116 +0,0 @@ -// $Id$ - -#include "tao/Sequence.h" - -#if !defined (__ACE_INLINE__) -#include "tao/Sequence.i" -#endif /* __ACE_INLINE__ */ - -#include "tao/SystemException.h" - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) -# include "ace/Message_Block.h" -#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 1) */ - -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_stdlib.h" -#include "ace/OS_Memory.h" - - -ACE_RCSID (tao, - Sequence, - "$Id$") - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// ************************************************************* -// Operations for class TAO_Base_Sequence -// ************************************************************* - -TAO_Base_Sequence::~TAO_Base_Sequence (void) -{ -} - -void TAO_Base_Sequence::_shrink_buffer (CORBA::ULong, CORBA::ULong) -{ - - // default is no op. -} - -void -TAO_Base_Sequence::_downcast (void *, - CORBA::Object * - ACE_ENV_ARG_DECL_NOT_USED) -{ - // default is no op. - // @@ TODO Maybe throw an exception? -} - -CORBA::Object * -TAO_Base_Sequence::_upcast (void *) const -{ - return 0; -} - -void -TAO_Base_Sequence::check_bounds (char const * filename, - unsigned long lineno, - CORBA::ULong tao_idx, - CORBA::ULong tao_max) const -{ - // TODO use hook - if (tao_idx >= tao_max) - { - ACE_ERROR ((LM_ERROR, - "Access error in TAO_Base_Sequence file=%s, line=%u, " - "idx=%u, max=%u\n", - ACE_TEXT_CHAR_TO_TCHAR (filename), - lineno, - tao_idx, - tao_max)); - - // @todo When we have a hook setup, we can totally ignore this or - // even remove this. -#if defined (ACE_HAS_EXCEPTIONS) - ACE_THROW (CORBA::BAD_PARAM ()); -#else - ACE_OS::abort (); -#endif /* ACE_HAS_EXCEPTIONS */ - } -} - -// ************************************************************* -// Operations for class TAO_Unbounded_Base_Sequence -// ************************************************************* - -TAO_Unbounded_Base_Sequence::~TAO_Unbounded_Base_Sequence (void) -{ -} - -// ************************************************************* -// Operations for class TAO_Bounded_Base_Sequence -// ************************************************************* - -TAO_Bounded_Base_Sequence::~TAO_Bounded_Base_Sequence (void) -{ -} - -// ************************************************************* - -// constructor for unbounded string seq -TAO_Unbounded_String_Sequence::TAO_Unbounded_String_Sequence ( - CORBA::ULong maximum - ) - : TAO_Unbounded_Base_Sequence ( - maximum, - TAO_Unbounded_String_Sequence::allocbuf (maximum) - ) -{ -} - -TAO_Unbounded_String_Sequence::TAO_Unbounded_String_Sequence ( - const TAO_Unbounded_String_Sequence & rhs - ) - : TAO_Unbounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - char* *tmp1 = - TAO_Unbounded_String_Sequence::allocbuf (this->maximum_); - - char ** const tmp2 = - reinterpret_cast<char ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = CORBA::string_dup (tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -TAO_Unbounded_String_Sequence::~TAO_Unbounded_String_Sequence (void) -{ - this->_deallocate_buffer (); -} - -TAO_Unbounded_String_Sequence & -TAO_Unbounded_String_Sequence::operator= ( - const TAO_Unbounded_String_Sequence & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - char ** tmp = reinterpret_cast<char **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::string_free (tmp[i]); - tmp[i] = 0; - } - - if (this->maximum_ < rhs.maximum_) - { - // Free the older buffer. - TAO_Unbounded_String_Sequence::freebuf (tmp); - this->buffer_ = - TAO_Unbounded_String_Sequence::allocbuf (rhs.maximum_); - } - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Unbounded_String_Sequence::allocbuf (rhs.maximum_); - } - } - - TAO_Unbounded_Base_Sequence::operator= (rhs); - - char ** tmp1 = reinterpret_cast <char **> (this->buffer_); - char ** const tmp2 = reinterpret_cast<char ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = CORBA::string_dup (tmp2[i]); - } - - return *this; -} - -TAO_SeqElem_String_Manager -TAO_Unbounded_String_Sequence::operator[] (CORBA::ULong slot) const -{ - TAO_SEQUENCE_ASSERT (slot, this->maximum_); - char ** const tmp = - reinterpret_cast<char ** ACE_CAST_CONST> (this->buffer_); - return TAO_SeqElem_String_Manager (tmp + slot, - this->release_); -} - -char ** -TAO_Unbounded_String_Sequence::allocbuf (CORBA::ULong nelems) -{ - char ** buf = 0; - ACE_NEW_RETURN (buf, - char * [nelems], - 0); - - for (CORBA::ULong i = 0; i < nelems; ++i) - { - buf[i] = 0; - } - - return buf; -} - -void -TAO_Unbounded_String_Sequence::freebuf (char ** buffer) -{ - if (buffer == 0) - { - return; - } - - // {orbos/97-05-15:16.11} - // The freebuf function ensures that the destructor for each element - // is called before the buffer is destroyed, except for string - // elements, which are freed using string_free(), and object - // reference elements, which are freed using release(). The freebuf - // function will ignore null pointers passed to it. - - // @@ How are we supposed to implement that! We don't know the - // length of the buffer here. - // Mark the length in the first four bytes? For the moment we let - // that be. - - delete [] buffer; -} - -void -TAO_Unbounded_String_Sequence::_tao_any_destructor ( - void * _tao_void_pointer - ) -{ - TAO_Unbounded_String_Sequence * tmp = - static_cast <TAO_Unbounded_String_Sequence *> (_tao_void_pointer); - delete tmp; -} - -char ** -TAO_Unbounded_String_Sequence::get_buffer (CORBA::Boolean orphan) -{ - char ** result = 0; - - if (orphan == 0) - { - // We retain ownership. - if (this->buffer_ == 0) - { - result = allocbuf (this->length_); - this->buffer_ = result; - this->release_ = 1; - } - else - { - result = reinterpret_cast <char **> (this->buffer_); - } - } - else // if (orphan == 1) - { - if (this->release_ != 0) - { - // We set the state back to default and relinquish - // ownership. - result = reinterpret_cast <char **> (this->buffer_); - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } - } - - return result; -} - -const char ** -TAO_Unbounded_String_Sequence::get_buffer (void) const -{ - return reinterpret_cast<const char ** ACE_CAST_CONST> (this->buffer_); -} - -void -TAO_Unbounded_String_Sequence::_allocate_buffer (CORBA::ULong length) -{ - char ** tmp = TAO_Unbounded_String_Sequence::allocbuf (length); - - if (this->buffer_ != 0) - { - char ** old = reinterpret_cast <char **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - // Only call duplicate when we did not own the previous - // buffer, since after this method we own it we must also - // own the objects. If we already own the objects there is - // no need to copy them, if we did we would also have to - // remove the old instances. - if (!this->release_) - { - tmp [i] = CORBA::string_dup (old[i]); - } - else - { - tmp [i] = old[i]; - } - } - - if (this->release_) - { - delete [] old; - } - } - - this->buffer_ = tmp; -} - -void -TAO_Unbounded_String_Sequence::_deallocate_buffer (void) -{ - if (this->buffer_ == 0 || this->release_ == 0) - { - return; - } - - char ** tmp = reinterpret_cast <char **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::string_free (tmp[i]); - tmp[i] = 0; - } - - TAO_Unbounded_String_Sequence::freebuf (tmp); - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; - this->maximum_ = 0; -} - -void -TAO_Unbounded_String_Sequence::_shrink_buffer (CORBA::ULong nl, - CORBA::ULong ol) -{ - char ** tmp = reinterpret_cast <char **> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) - { - CORBA::string_free (tmp[i]); - tmp[i] = 0; - } -} - -void -TAO_Unbounded_String_Sequence::replace (CORBA::ULong maximum, - CORBA::ULong length, - char ** data, - CORBA::Boolean release) -{ - if (this->release_ == 1) - { - char ** tmp = reinterpret_cast <char **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::string_free (tmp[i]); - tmp[i] = 0; - } - } - - this->maximum_ = maximum; - this->length_ = length; - - // If 'release' is 1, it is the caller's responsibility to allocate - // 'data' with CORBA::string_alloc. - this->buffer_ = data; - this->release_ = release; -} -// ************************************************************* - -// constructor for unbounded wide string seq -TAO_Unbounded_WString_Sequence::TAO_Unbounded_WString_Sequence ( - CORBA::ULong maximum - ) - : TAO_Unbounded_Base_Sequence ( - maximum, - TAO_Unbounded_WString_Sequence::allocbuf (maximum) - ) -{ -} - -TAO_Unbounded_WString_Sequence::TAO_Unbounded_WString_Sequence ( - const TAO_Unbounded_WString_Sequence & rhs - ) - : TAO_Unbounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - CORBA::WChar ** tmp1 = - TAO_Unbounded_WString_Sequence::allocbuf (this->maximum_); - - CORBA::WChar ** const tmp2 = - reinterpret_cast<CORBA::WChar ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = CORBA::wstring_dup (tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -TAO_Unbounded_WString_Sequence::~TAO_Unbounded_WString_Sequence (void) -{ - this->_deallocate_buffer (); -} - -TAO_Unbounded_WString_Sequence & -TAO_Unbounded_WString_Sequence::operator= ( - const TAO_Unbounded_WString_Sequence & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - CORBA::WChar ** tmp = reinterpret_cast <CORBA::WChar **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::wstring_free (tmp[i]); - tmp[i] = 0; - } - - if (this->maximum_ < rhs.maximum_) - { - // free the older buffer - TAO_Unbounded_WString_Sequence::freebuf (tmp); - this->buffer_ = - TAO_Unbounded_WString_Sequence::allocbuf (rhs.maximum_); - } - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Unbounded_WString_Sequence::allocbuf (rhs.maximum_); - } - } - - TAO_Unbounded_Base_Sequence::operator= (rhs); - - CORBA::WChar ** tmp1 = reinterpret_cast <CORBA::WChar **> (this->buffer_); - CORBA::WChar ** const tmp2 = - reinterpret_cast<CORBA::WChar ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i=0; i < rhs.length_; ++i) - { - tmp1[i] = CORBA::wstring_dup (tmp2[i]); - } - - return *this; -} - -TAO_SeqElem_WString_Manager -TAO_Unbounded_WString_Sequence::operator[] (CORBA::ULong slot) const -{ - TAO_SEQUENCE_ASSERT (slot, this->maximum_); - CORBA::WChar ** const tmp = - reinterpret_cast<CORBA::WChar ** ACE_CAST_CONST> (this->buffer_); - return TAO_SeqElem_WString_Manager (tmp + slot, - this->release_); -} - -CORBA::WChar ** -TAO_Unbounded_WString_Sequence::allocbuf (CORBA::ULong nelems) -{ - CORBA::WChar ** buf = 0; - ACE_NEW_RETURN (buf, - CORBA::WChar * [nelems], - 0); - - for (CORBA::ULong i = 0; i < nelems; ++i) - { - buf[i] = 0; - } - - return buf; -} - -void -TAO_Unbounded_WString_Sequence::freebuf (CORBA::WChar ** buffer) -{ - if (buffer == 0) - { - return; - } - - // {orbos/97-05-15:16.11} - // The freebuf function ensures that the destructor for each element - // is called before the buffer is destroyed, except for string - // elements, which are freed using wstring_free(), and object - // reference elements, which are freed using release(). The freebuf - // function will ignore null pointers passed to it. - - // @@ How are we supposed to implement that! We don't know the - // length of the buffer here. - // Mark the length in the first four bytes? For the moment we let - // that be. - - delete [] buffer; -} - -void -TAO_Unbounded_WString_Sequence::_tao_any_destructor ( - void * _tao_void_pointer - ) -{ - TAO_Unbounded_WString_Sequence * tmp = - static_cast<TAO_Unbounded_WString_Sequence *> (_tao_void_pointer); - delete tmp; -} - -CORBA::WChar ** -TAO_Unbounded_WString_Sequence::get_buffer (CORBA::Boolean orphan) -{ - CORBA::WChar ** result = 0; - - if (orphan == 0) - { - // We retain ownership. - if (this->buffer_ == 0) - { - result = allocbuf (this->length_); - this->buffer_ = result; - this->release_ = 1; - } - else - { - result = reinterpret_cast<CORBA::WChar **> (this->buffer_); - } - } - else // if (orphan == 1) - { - if (this->release_ != 0) - { - // We set the state back to default and relinquish - // ownership. - result = reinterpret_cast<CORBA::WChar **> (this->buffer_); - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } - } - - return result; -} - -const CORBA::WChar ** -TAO_Unbounded_WString_Sequence::get_buffer (void) const -{ - return reinterpret_cast<const CORBA::WChar ** ACE_CAST_CONST> (this->buffer_); -} - -void -TAO_Unbounded_WString_Sequence::_allocate_buffer (CORBA::ULong length) -{ - CORBA::WChar ** tmp = TAO_Unbounded_WString_Sequence::allocbuf (length); - - if (this->buffer_ != 0) - { - CORBA::WChar ** old = reinterpret_cast<CORBA::WChar **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - // Only call duplicate when we did not own the previous - // buffer, since after this method we own it we must also - // own the objects. If we already own the objects there is - // no need to copy them, if we did we would also have to - // remove the old instances. - if (!this->release_) - { - tmp [i] = CORBA::wstring_dup (old[i]); - } - else - { - tmp [i] = old[i]; - } - } - - if (this->release_) - { - delete [] old; - } - } - - this->buffer_ = tmp; -} - -void -TAO_Unbounded_WString_Sequence::_deallocate_buffer (void) -{ - if (this->buffer_ == 0 || this->release_ == 0) - { - return; - } - - CORBA::WChar **tmp = reinterpret_cast<CORBA::WChar **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::wstring_free (tmp[i]); - tmp[i] = 0; - } - - TAO_Unbounded_WString_Sequence::freebuf (tmp); - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; - this->maximum_ = 0; -} - -void -TAO_Unbounded_WString_Sequence::_shrink_buffer (CORBA::ULong nl, - CORBA::ULong ol) -{ - CORBA::WChar ** tmp = reinterpret_cast<CORBA::WChar **> (this->buffer_); - for (CORBA::ULong i = nl; i < ol; ++i) - { - CORBA::wstring_free (tmp[i]); - tmp[i] = 0; - } -} - -void -TAO_Unbounded_WString_Sequence::replace (CORBA::ULong maximum, - CORBA::ULong length, - CORBA::WChar* *data, - CORBA::Boolean release) -{ - if (this->release_ == 1) - { - CORBA::WChar **tmp = reinterpret_cast<CORBA::WChar **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::wstring_free (tmp[i]); - tmp[i] = 0; - } - } - - this->maximum_ = maximum; - this->length_ = length; - - // If 'release' is 1, it is the caller's responsibility to allocate - // 'data' with CORBA::wstring_alloc. - this->buffer_ = data; - this->release_ = release; -} - -// **************************************************************** - -TAO_Unbounded_Sequence<CORBA::Octet>::TAO_Unbounded_Sequence ( - const TAO_Unbounded_Sequence<CORBA::Octet> &rhs - ) - : TAO_Unbounded_Base_Sequence (rhs) -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - , mb_ (0) -#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ -{ - if (rhs.buffer_ != 0) - { - CORBA::Octet * tmp1 = - TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (this->maximum_); - - - CORBA::Octet * const tmp2 = - reinterpret_cast<CORBA::Octet * ACE_CAST_CONST> (rhs.buffer_); - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - if (rhs.mb_ == 0) - { - ACE_OS::memcpy (tmp1, - tmp2, - this->length_); - } - else - { - size_t offset = 0; - - for (const ACE_Message_Block *i = rhs.mb_; i != 0; i = i->cont ()) - { - ACE_OS::memcpy (tmp1 + offset, - i->rd_ptr (), - i->length ()); - - offset += i->length (); - } - } -#else /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ - ACE_OS::memcpy (tmp1, tmp2, this->length_); -#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 1) */ - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -TAO_Unbounded_Sequence<CORBA::Octet> & -TAO_Unbounded_Sequence<CORBA::Octet>::operator= ( - const TAO_Unbounded_Sequence<CORBA::Octet> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - if (this->mb_ != 0) - { - ACE_Message_Block::release (this->mb_); - this->mb_ = 0; - this->buffer_ = - TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (rhs.length_); - } - else -#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ - if (this->release_) - { - if (this->maximum_ < rhs.length_) - { - // free the old buffer - CORBA::Octet * tmp = reinterpret_cast<CORBA::Octet *> (this->buffer_); - TAO_Unbounded_Sequence<CORBA::Octet>::freebuf (tmp); - this->buffer_ = - TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (rhs.length_); - } - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (rhs.maximum_); - } - } - - TAO_Unbounded_Base_Sequence::operator= (rhs); - - CORBA::Octet * tmp1 = reinterpret_cast<CORBA::Octet *> (this->buffer_); - CORBA::Octet * const tmp2 = - reinterpret_cast<CORBA::Octet * ACE_CAST_CONST> (rhs.buffer_); - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - // for (CORBA::ULong i = 0; i < this->length_; ++i) - // tmp1[i] = tmp2[i]; - if (rhs.mb_ == 0) - { - ACE_OS::memcpy (tmp1, - tmp2, - this->length_); - } - else - { - size_t offset = 0; - - for (const ACE_Message_Block *i = rhs.mb_; i != 0; i = i->cont ()) - { - ACE_OS::memcpy (tmp1 + offset, - i->rd_ptr (), - i->length ()); - offset += i->length (); - } - } -#else /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ - ACE_OS::memcpy (tmp1, tmp2, this->length_); -#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ - - return *this; -} - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) -TAO_Unbounded_Sequence<CORBA::Octet>::TAO_Unbounded_Sequence ( - CORBA::ULong length, - const ACE_Message_Block * mb - ) - : TAO_Unbounded_Base_Sequence (length, - length, - mb->rd_ptr (), - 0), - mb_ (0) -{ - // Get the message block flags. - ACE_Message_Block::Message_Flags flg = mb->self_flags (); - - // If the DONT_DELETE flag is disabled just a duplicate would - // help. If the DONT_DELETE flag is enabled a deep copy is needed as - // the contents would be on stack. Just incrementing the ref count - // on the stack based data block would only crash the program when - // the stack unwinds - if (ACE_BIT_DISABLED (flg, - ACE_Message_Block::DONT_DELETE)) - { - this->mb_ = ACE_Message_Block::duplicate (mb); - } - else - { - // As we are in CORBA mode, all the data blocks would be aligned - // on an 8 byte boundary - ACE_Message_Block msgb (*mb, - ACE_CDR::MAX_ALIGNMENT); - - // Get the base pointer of the incoming message block - char *start = ACE_ptr_align_binary (mb->base (), - ACE_CDR::MAX_ALIGNMENT); - - // Get the read and write displacements in the incoming stream - size_t rd_pos = mb->rd_ptr () - start; - size_t wr_pos = mb->wr_ptr () - start; - - this->mb_ = ACE_Message_Block::duplicate (&msgb); - - this->mb_->rd_ptr (rd_pos); - this->mb_->wr_ptr (wr_pos); - } -} -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ - -TAO_Unbounded_Sequence<CORBA::Octet>::~TAO_Unbounded_Sequence (void) -{ - this->_deallocate_buffer (); -} - -// This function is a little too big to be inlined, but some compilers -// (Sun/CC 4.1?) die if it isn't :-( -CORBA::Octet * -TAO_Unbounded_Sequence<CORBA::Octet>::get_buffer (CORBA::Boolean orphan) -{ - CORBA::Octet * result = 0; - - if (orphan == 0) - { - // We retain ownership. - - if (this->buffer_ == 0) - { - // The buffer was not allocated, we must allocate it now. - result = - TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (this->length_); - this->buffer_ = result; - this->release_ = 1; - } - else - { - result = - reinterpret_cast<CORBA::Octet*> (this->buffer_); - } - } -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - else if (this->mb_ != 0) // (orphan == 1) - { - // We must create a copy anyway: - // the user is supposed to call freebuf() to release the - // buffer, but the buffer is inside a Message_Block... - // We thought about storing the pointer to the Message_Block - // somewhere at the beginning of the buffer (before the actual - // data), but that will not work in 64 bit machines when the - // buffer comes from a CDR stream. - // - result = TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (this->length_); - ACE_OS::memcpy (result, this->buffer_, this->length_); - } - else if (this->release_ != 0) - { - // We set the state back to default and relinquish - // ownership. - result = reinterpret_cast<CORBA::Octet *> (this->buffer_); - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } -#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - else - { - result = reinterpret_cast<CORBA::Octet*> (this->buffer_); - - if (this->release_ != 0) - { - // We set the state back to default and relinquish - // ownership. - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } - } -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - /* else - // Oops, it's not our buffer to relinquish... - return 0; - */ - return result; -} - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) -void -TAO_Unbounded_Sequence<CORBA::Octet>::replace (CORBA::ULong length, - const ACE_Message_Block * mb) -{ - this->_deallocate_buffer (); - - // Get the message block flags. - ACE_Message_Block::Message_Flags flg = mb->self_flags (); - - // If the DONT_DELETE flag is disabled just a duplicate would - // help. If the DONT_DELETE flag is enabled a deep copy is needed as - // the contents would be on stack. Just incrementing the ref count - // on the stack based data block would only crash the program when - // the stack unwinds - if (ACE_BIT_DISABLED (flg, - ACE_Message_Block::DONT_DELETE)) - { - this->mb_ = ACE_Message_Block::duplicate (mb); - } - else - { - // As we are in CORBA mode, all the data blocks would be aligned - // on an 8 byte boundary - ACE_Message_Block msgb (*mb, - ACE_CDR::MAX_ALIGNMENT); - - // Get the base pointer of the incoming message block - char * start = ACE_ptr_align_binary (mb->base (), - ACE_CDR::MAX_ALIGNMENT); - - // Get the read and write displacements in the incoming stream - size_t rd_pos = mb->rd_ptr () - start; - size_t wr_pos = mb->wr_ptr () - start; - - this->mb_ = ACE_Message_Block::duplicate (&msgb); - - this->mb_->rd_ptr (rd_pos); - this->mb_->wr_ptr (wr_pos); - } - - this->buffer_ = this->mb_->rd_ptr (); - this->maximum_ = length; - this->length_ = length; - this->release_ = 0; -} -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ - -void -TAO_Unbounded_Sequence<CORBA::Octet>::_tao_any_destructor (void * x) -{ - TAO_Unbounded_Sequence<CORBA::Octet> * tmp = - static_cast<TAO_Unbounded_Sequence<CORBA::Octet> *> (x); - delete tmp; -} - -void -TAO_Unbounded_Sequence<CORBA::Octet>::_allocate_buffer (CORBA::ULong length) -{ - CORBA::Octet *tmp = TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (length); - - if (this->buffer_ != 0) - { - CORBA::Octet * old = reinterpret_cast<CORBA::Octet *> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - tmp[i] = old[i]; - } - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - if (this->mb_ != 0) - { - ACE_Message_Block::release (this->mb_); - this->mb_ = 0; - } - else -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ - if (this->release_) - { - TAO_Unbounded_Sequence<CORBA::Octet>::freebuf (old); - } - } - - this->buffer_ = tmp; -} - -void TAO_Unbounded_Sequence<CORBA::Octet>::_deallocate_buffer (void) -{ - if (this->buffer_ != 0 -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - && this->mb_ == 0 -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ - && this->release_ != 0) - { - CORBA::Octet * tmp = reinterpret_cast<CORBA::Octet *> (this->buffer_); - TAO_Unbounded_Sequence<CORBA::Octet>::freebuf (tmp); - } -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - else - { - ACE_Message_Block::release (this->mb_); - this->mb_ = 0; - } -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ - - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; - this->maximum_ = 0; -} - - -void -TAO_Unbounded_Sequence<CORBA::Octet>::replace (CORBA::ULong max, - CORBA::ULong length, - CORBA::Octet * data, - CORBA::Boolean release) -{ - this->maximum_ = max; - this->length_ = length; - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - if (this->mb_ != 0) - { - ACE_Message_Block::release (this->mb_); - this->mb_ = 0; - } - else -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ - if (this->buffer_ && this->release_ == 1) - { - CORBA::Octet * tmp = - reinterpret_cast<CORBA::Octet *> (this->buffer_); - TAO_Unbounded_Sequence<CORBA::Octet>::freebuf (tmp); - } - - this->buffer_ = data; - this->release_ = release; -} - -// **************************************************************** - -bool -operator== (const TAO_Unbounded_Sequence<CORBA::Octet> & lhs, - const TAO_Unbounded_Sequence<CORBA::Octet> & rhs) -{ - const CORBA::ULong rlen = rhs.length (); - - if (rlen != lhs.length ()) - { - return false; - } - - for (CORBA::ULong i = 0; i < rlen; ++i) - { - if (rhs[i] != lhs[i]) - { - return false; - } - } - - return true; -} - -bool -operator!= (const TAO_Unbounded_Sequence<CORBA::Octet> & lhs, - const TAO_Unbounded_Sequence<CORBA::Octet> & rhs) -{ - return !(lhs == rhs); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Sequence.h b/TAO/tao/Sequence.h deleted file mode 100644 index 641a2c86f9d..00000000000 --- a/TAO/tao/Sequence.h +++ /dev/null @@ -1,681 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Sequence.h - * - * $Id$ - * - * @author Carlos O'Ryan - * @author Aniruddha Gokhale - */ -//============================================================================= - -#ifndef TAO_SEQUENCE_H -#define TAO_SEQUENCE_H - -#include /**/ "ace/pre.h" -#include "ace/CORBA_macros.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Managed_Types.h" -#include "tao/orbconf.h" -#include "tao/default_environment.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Message_Block; -ACE_END_VERSIONED_NAMESPACE_DECL - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace CORBA -{ - class Object; -} - -/** - * @class TAO_Base_Sequence - * - * @brief Base class for TAO sequences. - * - * This class provides a common interface for all IDL sequences, - * hence the interpreted marshal engine can manipulate them in a - * type safe manner. - */ -class TAO_Export TAO_Base_Sequence -{ -public: - /// We give access to TAO_Marshal_Sequence, this allows a safe yet - /// small footprint implementation of the marshal engine. - friend class TAO_Marshal_Sequence; - - /// Destructor. - virtual ~TAO_Base_Sequence (void); - - /// Return the maximum length of the sequence - CORBA::ULong maximum (void) const; - - /** - * Ensure that the buffer contains space for at least <length> - * elements. The constructor must be called for any new elements, - * the old ones (if any) must be copied into the buffer using - * operator= and then their destructors must be called. Finally the - * old buffer must be released. - */ - virtual void _allocate_buffer (CORBA::ULong length) = 0; - - /// Must deallocate the buffer and then set it to zero. - virtual void _deallocate_buffer (void) = 0; - - /** - * Some sequences (of objects and strings) require some cleanup if - * the sequence is shrunk. The spec requires the destructor to - * release the objects only from position <0> to <length-1>; so - * shrink and then delete could result in a memory leak. - */ - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); - - /// Used for sequences of objects to downcast a recently demarshalled - /// object reference into the right type. - virtual void _downcast (void *target, - CORBA::Object *src - ACE_ENV_ARG_DECL_WITH_DEFAULTS); - - /// Used for sequences of object to convert from the derived type - /// into the Object class. - virtual CORBA::Object *_upcast (void *src) const; - - // = orbos/98-01-11 proposed extensions. - /// Returns the state of the sequence release flag. - CORBA::Boolean release (void) const; - -protected: - /// Default constructor. - TAO_Base_Sequence (void); - - /// Constructor with control of ownership. - TAO_Base_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - void *buffer, - CORBA::Boolean release = 0); - - /// Assume ownership and set length to 0. - TAO_Base_Sequence (CORBA::ULong maximum, - void *buffer); - - void check_bounds( - char const * filename, unsigned long lineno, - CORBA::ULong tao_idx, CORBA::ULong tao_max) const; - -public: - - // = The following two functions should be protected but we made it - // public because it breaks some compilers. - - // Copy constructor and assignment operator are protected, the - // derived classes must provided the right semantics for the buffer - // copy, only the static fields are actually copy. - TAO_Base_Sequence (const TAO_Base_Sequence &rhs); - TAO_Base_Sequence &operator= (const TAO_Base_Sequence &rhs); - -protected: - - /// The maximum number of elements the buffer can contain. - CORBA::ULong maximum_; - - /// The current number of elements in the buffer. - CORBA::ULong length_; - - /// The buffer with all the elements, casting must be done in derived - /// classes. - void *buffer_; - - /// If true then the sequence should release the buffer when it is - /// destroyed. - CORBA::Boolean release_; -}; - -// **************************************************************** - -/** - * @class TAO_Unbounded_Base_Sequence - * - * @brief Base class for all bounded sequences. - * - * This class implements part of the funcionality common to all - * bounded sequences, using this intermediate class instead of - * virtual methods on TAO_Base_Sequence give us a slight - * improvement of performance, but also reduces the amount of - * generated code in the templates. - */ -class TAO_Export TAO_Unbounded_Base_Sequence : public TAO_Base_Sequence -{ -public: - /** - * = SPEC {16.11.2} - * For an unbounded sequence, setting the length to a larger value - * than the current length may reallocate the sequence - * data. Reallocation is conceptually equivalent to creating a new - * sequence of the desired new length, copying the old sequence - * elements zero through length into the new sequence, and then - * assigning the old sequence to be the same as the new sequence. - */ - void length (CORBA::ULong length); - - /** - * return the current length, it cannot go into the base class due - * to the C++ name lookup rules (if you don't know what I'm talking - * about, then try moving it there). - */ - CORBA::ULong length (void) const; - - /// destructor. - virtual ~TAO_Unbounded_Base_Sequence (void); - -protected: - /// Default constructor. - TAO_Unbounded_Base_Sequence (void); - - /// Constructor with control of ownership. - TAO_Unbounded_Base_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - void *buffer, - CORBA::Boolean release = 0); - - /// Assume ownership and set length to 0. - TAO_Unbounded_Base_Sequence (CORBA::ULong maximum, - void *buffer); -}; - -// **************************************************************** - -/** - * @class TAO_Bounded_Base_Sequence - * - * @brief Base class for all bounded sequences. - * - * This class implements part of the funcionality common to all - * bounded sequences, using this intermediate class instead of - * virtual methods on TAO_Base_Sequence give us a slight - * improvement of performance, but also reduces the amount of - * generated code in the templates. - */ -class TAO_Export TAO_Bounded_Base_Sequence : public TAO_Base_Sequence -{ -public: - /// Set the length, for this sequences this call is ignored if the - /// new length is greater that the maximum. - void length (CORBA::ULong length); - - /** - * Return the current length, it cannot go into the base class due - * to the C++ name lookup rules (if you don't know what I'm talking - * about, then try moving it there). - */ - CORBA::ULong length (void) const; - - /// Destructor. - virtual ~TAO_Bounded_Base_Sequence (void); - -protected: - /// Default constructor. - TAO_Bounded_Base_Sequence (void); - - /// Constructor with control of ownership. - TAO_Bounded_Base_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - void *buffer, - CORBA::Boolean release = 0); - - /// Assume ownership and set length to 0. - TAO_Bounded_Base_Sequence (CORBA::ULong maximum, - void *buffer); -}; - -// **************************************************************** - -/** - * @class TAO_Unbounded_String_Sequence - * - * @brief Unbounded sequence of strings. - * - * IDL sequences of strings must automatically duplicate and - * release their members based on some global <release> flag. - */ -class TAO_Export TAO_Unbounded_String_Sequence - : public TAO_Unbounded_Base_Sequence -{ - - // = SPEC - // 16.8 Mapping for Structured Types - // The mapping for struct, union, and sequence (but not array) is a - // C++ struct or class with a default constructor, a copy - // constructor, an assignment operator, and a destructor. - // -public: - // = Operations for the Unbounded_ObjectSequence - - /** - * {orbos/97-05-15:16.8} - * The default constructor initializes object reference members to - * appropriately typed nil object references and string members to - * NULL; all other members are initialized via their default - * constructors. - * - * {orbos/97-05-15:16.11} - * For both bounded and unbounded sequences, the default constructor - * (as shown in the example above) sets the sequence length equal to - * 0. - */ - TAO_Unbounded_String_Sequence (void); - - /** - * Unbounded sequences provide a constructor that allows only the - * initial value of the maximum length to be set (the ``maximum - * constructor'' shown in the example above). This allows - * applications to control how much buffer space is initially - * allocated by the sequence. This constructor also sets the length - * to 0 and the release flag to TRUE. - */ - TAO_Unbounded_String_Sequence (CORBA::ULong maximum); - - /** - * The ``T *data'' constructor (as shown in the example above) - * allows the length and contents of a bounded or unbounded sequence - * to be set. For unbounded sequences, it also allows the initial - * value of the maximum length to be set. For this constructor, - * ownership of the content's vector is determined by the release - * parameter---FALSE means the caller owns the storage, while TRUE - * means that the sequence assumes ownership of the storage. - * If release is TRUE, the content's vector must have been allocated - * using the sequence allocbuf function, and the sequence will pass - * it to freebuf when finished with it. - */ - TAO_Unbounded_String_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - char ** data, - CORBA::Boolean release = 0); - - /** - * The copy constructor performs a deep copy from the existing - * structure to create a new structure, including calling _duplicate - * on all object reference members and performing the necessary - * heap allocations for all string members. - * - * The copy constructor creates a new sequence with the same maximum - * and length as the given sequence, copies each of its current - * elements (items zero through length-1), and sets the release - * flag to TRUE. - */ - TAO_Unbounded_String_Sequence(const TAO_Unbounded_String_Sequence&); - - /// The destructor releases all object reference members and frees - /// all string members. - ~TAO_Unbounded_String_Sequence (void); - - /** - * The assignment operator first releases all object reference - * members and frees all string members, and then performs a - * deepcopy to create a new structure. - * - * The assignment operator deepcopies its parameter, releasing - * old storage if necessary. It behaves as if the original sequence - * is destroyed via its destructor and then the source sequence - * copied using the copy constructor. If release=TRUE, the - * destructor destroys each of the current elements (items zero - * through length--1). - * For an unbounded sequence, if a reallocation is necessary due to - * a change in the length and the sequence was created using the - * release=TRUE parameter in its constructor, the sequence will - * deallocate the old storage. If release is FALSE under these - * circumstances, old storage will not be freed before the - * reallocation is performed. After reallocation, the release flag - * is always set to TRUE. - */ - TAO_Unbounded_String_Sequence & operator= ( - const TAO_Unbounded_String_Sequence & - ); - - /// read-write accessor - TAO_SeqElem_String_Manager operator[] (CORBA::ULong slot) const; - - /** - * The allocbuf function allocates a vector of T elements that can - * be passed to the T *data constructor. The length of the vector is - * given by the nelems function argument. The allocbuf function - * initializes each element using its default constructor, except - * for strings, which are initialized to null pointers, and object - * references, which are initialized to suitably typed nil object - * references. A null pointer is returned if allocbuf for some - * reason cannot allocate the requested vector. Vectors allocated by - * allocbuf should be freed using the freebuf function. - */ - static char ** allocbuf (CORBA::ULong); - - /** - * The freebuf function ensures that the destructor for each element - * is called before the buffer is destroyed, except for string - * elements, which are freed using string_free(), and object - * reference elements, which are freed using release(). The freebuf - * function will ignore null pointers passed to it. - */ - static void freebuf (char **); - - static void _tao_any_destructor (void *); - - // = Fast buffer accessors. - char ** get_buffer (CORBA::Boolean orphan = 0); - const char ** get_buffer (void) const; - - // Functions to create, destroy, and adjust the underlying buffer. - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); - - // Parameters work the same as in constructor of the same signature. - void replace (CORBA::ULong maximum, - CORBA::ULong length, - char ** data, - CORBA::Boolean release = 0); -}; - -// **************************************************************** - -/** - * @class TAO_Unbounded_WString_Sequence - * - * @brief Unbounded sequence of wstrings. - * - * IDL sequences of wstrings must automatically duplicate and - * release their members based on some global <release> flag. - */ -class TAO_Export TAO_Unbounded_WString_Sequence - : public TAO_Unbounded_Base_Sequence -{ - - // = SPEC - // 16.8 Mapping for Structured Types - // The mapping for struct, union, and sequence (but not array) is a - // C++ struct or class with a default constructor, a copy - // constructor, an assignment operator, and a destructor. - // -public: - // = Operations for the Unbounded_ObjectSequence - - /** - * {orbos/97-05-15:16.8} - * The default constructor initializes object reference members to - * appropriately typed nil object references and wstring members to - * NULL; all other members are initialized via their default - * constructors. - * - * {orbos/97-05-15:16.11} - * For both bounded and unbounded sequences, the default constructor - * (as shown in the example above) sets the sequence length equal to - * 0. - */ - TAO_Unbounded_WString_Sequence (void); - - /** - * Unbounded sequences provide a constructor that allows only the - * initial value of the maximum length to be set (the ``maximum - * constructor'' shown in the example above). This allows - * applications to control how much buffer space is initially - * allocated by the sequence. This constructor also sets the length - * to 0 and the release flag to TRUE. - */ - TAO_Unbounded_WString_Sequence (CORBA::ULong maximum); - - /** - * The ``T *data'' constructor (as shown in the example above) - * allows the length and contents of a bounded or unbounded sequence - * to be set. For unbounded sequences, it also allows the initial - * value of the maximum length to be set. For this constructor, - * ownership of the contents vector is determined by the release - * parameter---FALSE means the caller owns the storage, while TRUE - * means that the sequence assumes ownership of the storage. - * If release is TRUE, the contents vector must have been allocated - * using the sequence allocbuf function, and the sequence will pass - * it to freebuf when finished with it. - */ - TAO_Unbounded_WString_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - CORBA::WChar ** data, - CORBA::Boolean release = 0); - - /** - * The copy constructor performs a deep copy from the existing - * structure to create a new structure, including calling _duplicate - * on all object reference members and performing the necessary - * heap allocations for all string members. - * - * The copy constructor creates a new sequence with the same maximum - * and length as the given sequence, copies each of its current - * elements (items zero through length-1), and sets the release - * flag to TRUE. - */ - TAO_Unbounded_WString_Sequence (const TAO_Unbounded_WString_Sequence &); - - /// The destructor releases all object reference members and frees - /// all string members. - ~TAO_Unbounded_WString_Sequence (void); - - /** - * The assignment operator first releases all object reference - * members and frees all wstring members, and then performs a - * deepcopy to create a new structure. - * - * The assignment operator deepcopies its parameter, releasing - * old storage if necessary. It behaves as if the original sequence - * is destroyed via its destructor and then the source sequence - * copied using the copy constructor. If release=TRUE, the - * destructor destroys each of the current elements (items zero - * through length--1). - * For an unbounded sequence, if a reallocation is necessary due to - * a change in the length and the sequence was created using the - * release=TRUE parameter in its constructor, the sequence will - * deallocate the old storage. If release is FALSE under these - * circumstances, old storage will not be freed before the - * reallocation is performed. After reallocation, the release flag - * is always set to TRUE. - */ - TAO_Unbounded_WString_Sequence & operator= ( - const TAO_Unbounded_WString_Sequence & - ); - - /// Read-write accessor - TAO_SeqElem_WString_Manager operator[] (CORBA::ULong slot) const; - - /** - * The allocbuf function allocates a vector of T elements that can - * be passed to the T *data constructor. The length of the vector is - * given by the nelems function argument. The allocbuf function - * initializes each element using its default constructor, except - * for strings, which are initialized to null pointers, and object - * references, which are initialized to suitably typed nil object - * references. A null pointer is returned if allocbuf for some - * reason cannot allocate the requested vector. Vectors allocated by - * allocbuf should be freed using the freebuf function. - */ - static CORBA::WChar ** allocbuf (CORBA::ULong); - - /** - * The freebuf function ensures that the destructor for each element - * is called before the buffer is destroyed, except for string - * elements, which are freed using wstring_free(), and object - * reference elements, which are freed using release(). The freebuf - * function will ignore null pointers passed to it. - */ - static void freebuf (CORBA::WChar **); - - static void _tao_any_destructor (void *); - - // = Fast buffer accessors. - CORBA::WChar ** get_buffer (CORBA::Boolean orphan = 0); - const CORBA::WChar ** get_buffer (void) const; - - // Functions to create, destroy, and adjust the underlying buffer. - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); - - // Parameters work the same as in constructor of the same signature. - void replace (CORBA::ULong maximum, - CORBA::ULong length, - CORBA::WChar ** data, - CORBA::Boolean release = 0); -}; - -// **************************************************************** - -// forward declaration, we are going to specialize that template -// here. -// The template itself requires this file so every user of the -// template should also see the specialization. -template<class T> class TAO_Unbounded_Sequence; - -/** - * @class TAO_Unbounded_Sequence<CORBA::Octet> - * - * @brief An unbounded sequence of Octets - * - * Marshalling and demarshalling octet sequences can be highly - * optimize, for instance at demarshalling we don't require a copy - * from the CDR buffer to the octet sequence buffer, we can simply - * hold a duplicate of the underlying ACE_Message_Block. - * Specializing the TAO_Unbounded_Sequence<T> parametric - * class, is an excellent way to achieve this optimizations. - */ -template<> -class TAO_Export TAO_Unbounded_Sequence<CORBA::Octet> - : public TAO_Unbounded_Base_Sequence -{ -public: - /// For efficient marshalling and demarshalling. - friend class TAO_Marshal_Sequence; - - /// see TAO_Unbounded_Sequence in "Sequence_T.h" - TAO_Unbounded_Sequence (void); - TAO_Unbounded_Sequence (CORBA::ULong max); - TAO_Unbounded_Sequence (CORBA::ULong max, - CORBA::ULong length, - CORBA::Octet *data, - CORBA::Boolean release = 0); - virtual ~TAO_Unbounded_Sequence (void); - - /// Use in the implementation of insertion and extraction operators - /// from CORBA::Any - static void _tao_any_destructor (void*); - - /** - * The copy constructor and assignment operators *do* copy the data, - * though we could simply duplicate the ref count in the - * ACE_Message_Block this will change the semantics for this - * operations. - */ - TAO_Unbounded_Sequence (const TAO_Unbounded_Sequence<CORBA::Octet> &); - TAO_Unbounded_Sequence<CORBA::Octet>& operator= ( - const TAO_Unbounded_Sequence<CORBA::Octet> & - ); - - /** - * See the general description in "Sequence_T.h" - * NOTE: This last two methods can be rendered useless in certain - * cases, see below. - */ - CORBA::Octet &operator[] (CORBA::ULong); - const CORBA::Octet &operator[] (CORBA::ULong) const; - - // = Static operations. - - /// Allocate storage for the sequence, please note that the storage - /// is always held in a ACE_Message_Block. - static CORBA::Octet *allocbuf (CORBA::ULong); - - /// Free the storage. - static void freebuf (CORBA::Octet *); - - /// Implement the methods for all the sequence, please see - /// TAO_Base_Sequence. - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - - // = Fast buffer accessors. - CORBA::Octet *get_buffer (CORBA::Boolean orphan = 0); - const CORBA::Octet *get_buffer (void) const; - - // NOTE: This last two methods can be rendered useless in certain - // cases, see below. - /// See the general description of this methods in "Sequence_T.h". - void replace (CORBA::ULong max, - CORBA::ULong length, - CORBA::Octet *data, - CORBA::Boolean release = 0); - - // = TAO extensions - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - - /// Returns the underlying message block, the caller must *not* - /// release the copy. - ACE_Message_Block* mb (void) const; - - /// Create a sequence of octets from a single message block (i.e. it - /// ignores any chaining in the meesage block). - TAO_Unbounded_Sequence (CORBA::ULong length, - const ACE_Message_Block* mb); - - /// Replaces the current buffer with <mb>, using only <length> bytes. - /// It takes a duplicate of <mb> so the user still owns it. - void replace (CORBA::ULong length, const ACE_Message_Block* mb); - - // - // NOTE: - // In the last two methods if the <mb> is the head of a chain then - // the following methods are not warranteed to work properly: - // operator[] - // get_buffer () - // the main purpose of this method is to support custom marshaling; - // so the complete chain is marshaled when the octet sequence is. - // - -private: - ACE_Message_Block* mb_; -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ -}; - -// **************************************************************** - -// Comparison of octet sequence. -TAO_Export bool operator== (const TAO_Unbounded_Sequence<CORBA::Octet> &l, - const TAO_Unbounded_Sequence<CORBA::Octet> &r); - -TAO_Export bool operator!= (const TAO_Unbounded_Sequence<CORBA::Octet> &l, - const TAO_Unbounded_Sequence<CORBA::Octet> &r); - -// **************************************************************** - -TAO_END_VERSIONED_NAMESPACE_DECL - -/** - * @brief Safe assertions without including Log_Msg.h - */ -#define TAO_SEQUENCE_ASSERT(TAO_IDX,TAO_MAX) \ - this->check_bounds(__FILE__, __LINE__, (TAO_IDX), (TAO_MAX)) - - -#if defined (__ACE_INLINE__) -#include "tao/Sequence.i" -#endif /* __ACE_INLINE__ */ - -#include "tao/Sequence_T.h" - -#include /**/ "ace/post.h" - -#endif /* TAO_SEQUENCE_H */ diff --git a/TAO/tao/Sequence.i b/TAO/tao/Sequence.i deleted file mode 100644 index 1293e10fe7b..00000000000 --- a/TAO/tao/Sequence.i +++ /dev/null @@ -1,303 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Operations on the unbounded sequence class. - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -TAO_Base_Sequence::TAO_Base_Sequence (void) - : maximum_ (0), - length_ (0), - buffer_ (0), - release_ (0) -{ -} - -ACE_INLINE -TAO_Base_Sequence::TAO_Base_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - void * buffer, - CORBA::Boolean release) - : maximum_ (maximum), - length_ (length), - buffer_ (buffer), - release_ (release) -{ -} - -ACE_INLINE -TAO_Base_Sequence::TAO_Base_Sequence (CORBA::ULong maximum, - void * data) - : maximum_ (maximum), - length_ (0), - buffer_ (data), - release_ (1) -{ -} - -ACE_INLINE -TAO_Base_Sequence::TAO_Base_Sequence (const TAO_Base_Sequence & rhs) - : maximum_ (rhs.maximum_), - length_ (rhs.length_), - buffer_ (0), - release_ (1) -{ -} - -ACE_INLINE -CORBA::Boolean -TAO_Base_Sequence::release (void) const -{ - return this->release_; -} - -ACE_INLINE -TAO_Base_Sequence & -TAO_Base_Sequence::operator= (const TAO_Base_Sequence & rhs) -{ - this->maximum_ = rhs.maximum_; - this->length_ = rhs.length_; - this->release_ = 1; - return *this; -} - -ACE_INLINE -CORBA::ULong -TAO_Base_Sequence::maximum (void) const -{ - return this->maximum_; -} - -// **************************************************************** - -ACE_INLINE -TAO_Unbounded_Base_Sequence::TAO_Unbounded_Base_Sequence (void) -{ -} - -ACE_INLINE -TAO_Unbounded_Base_Sequence::TAO_Unbounded_Base_Sequence ( - CORBA::ULong maximum, - CORBA::ULong length, - void * buffer, - CORBA::Boolean release - ) - : TAO_Base_Sequence (maximum, length, buffer, release) -{ -} - -ACE_INLINE -TAO_Unbounded_Base_Sequence::TAO_Unbounded_Base_Sequence ( - CORBA::ULong maximum, - void * buffer - ) - : TAO_Base_Sequence (maximum, buffer) -{ -} - -ACE_INLINE -CORBA::ULong -TAO_Unbounded_Base_Sequence::length (void) const -{ - return this->length_; -} - -ACE_INLINE -void -TAO_Unbounded_Base_Sequence::length (CORBA::ULong length) -{ - if (length > this->maximum_) - { - this->_allocate_buffer (length); - this->maximum_ = length; - this->release_ = 1; - } - else if (length < this->length_) - { - this->_shrink_buffer (length, this->length_); - } - - this->length_ = length; -} - -// **************************************************************** - -ACE_INLINE -TAO_Bounded_Base_Sequence::TAO_Bounded_Base_Sequence (void) -{ -} - -ACE_INLINE -TAO_Bounded_Base_Sequence::TAO_Bounded_Base_Sequence ( - CORBA::ULong maximum, - CORBA::ULong length, - void * buffer, - CORBA::Boolean release - ) - : TAO_Base_Sequence (maximum, length, buffer, release) -{ -} - -ACE_INLINE -TAO_Bounded_Base_Sequence::TAO_Bounded_Base_Sequence ( - CORBA::ULong maximum, - void * buffer - ) - : TAO_Base_Sequence (maximum, buffer) -{ -} - -ACE_INLINE -CORBA::ULong -TAO_Bounded_Base_Sequence::length (void) const -{ - return this->length_; -} - -ACE_INLINE -void -TAO_Bounded_Base_Sequence::length (CORBA::ULong length) -{ - if (this->buffer_ == 0) - { - this->_allocate_buffer (this->maximum_); - this->release_ = 1; - } - - if (length > this->maximum_) - { - return; - } - else if (length < this->length_) - { - this->_shrink_buffer (length, this->length_); - } - - this->length_ = length; -} - -// **************************************************************** - -ACE_INLINE -TAO_Unbounded_String_Sequence::TAO_Unbounded_String_Sequence (void) -{ -} - -ACE_INLINE -TAO_Unbounded_String_Sequence::TAO_Unbounded_String_Sequence ( - CORBA::ULong maximum, - CORBA::ULong length, - char ** value, - CORBA::Boolean release - ) - : TAO_Unbounded_Base_Sequence (maximum, length, value, release) -{ -} - -ACE_INLINE -TAO_Unbounded_WString_Sequence::TAO_Unbounded_WString_Sequence (void) -{ -} - -ACE_INLINE -TAO_Unbounded_WString_Sequence::TAO_Unbounded_WString_Sequence ( - CORBA::ULong maximum, - CORBA::ULong length, - CORBA::WChar ** value, - CORBA::Boolean release - ) - : TAO_Unbounded_Base_Sequence (maximum, length, value, release) -{ -} - -// **************************************************************** - -ACE_INLINE -CORBA::Octet * -TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (CORBA::ULong size) -{ - return new CORBA::Octet[size]; -} - -ACE_INLINE -void -TAO_Unbounded_Sequence<CORBA::Octet>::freebuf (CORBA::Octet * buffer) -{ - delete [] buffer; -} - -ACE_INLINE -TAO_Unbounded_Sequence<CORBA::Octet>::TAO_Unbounded_Sequence (void) -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - : mb_ (0) -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ -{ -} - -ACE_INLINE -TAO_Unbounded_Sequence<CORBA::Octet>::TAO_Unbounded_Sequence ( - CORBA::ULong maximum - ) - : TAO_Unbounded_Base_Sequence ( - maximum, - TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (maximum) - ) -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - , mb_ (0) -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ -{ -} - -ACE_INLINE -TAO_Unbounded_Sequence<CORBA::Octet>::TAO_Unbounded_Sequence ( - CORBA::ULong maximum, - CORBA::ULong length, - CORBA::Octet * data, - CORBA::Boolean release - ) - : TAO_Unbounded_Base_Sequence (maximum, length, data, release) -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - , mb_ (0) -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ -{ -} - -ACE_INLINE -const CORBA::Octet * -TAO_Unbounded_Sequence<CORBA::Octet>::get_buffer (void) const -{ - return reinterpret_cast<const CORBA::Octet * ACE_CAST_CONST> (this->buffer_); -} - -ACE_INLINE -CORBA::Octet & -TAO_Unbounded_Sequence<CORBA::Octet>::operator[] (CORBA::ULong i) -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - CORBA::Octet * tmp = reinterpret_cast<CORBA::Octet *> (this->buffer_); - return tmp[i]; -} - -ACE_INLINE -const CORBA::Octet & -TAO_Unbounded_Sequence<CORBA::Octet>::operator[] (CORBA::ULong i) const -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - CORBA::Octet * const tmp = - reinterpret_cast<CORBA::Octet * ACE_CAST_CONST> (this->buffer_); - return tmp[i]; -} - -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) -ACE_INLINE -ACE_Message_Block * -TAO_Unbounded_Sequence<CORBA::Octet>::mb (void) const -{ - return this->mb_; -} -#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Sequence_T.cpp b/TAO/tao/Sequence_T.cpp deleted file mode 100644 index 2d57569e8fd..00000000000 --- a/TAO/tao/Sequence_T.cpp +++ /dev/null @@ -1,2161 +0,0 @@ -// $Id$ - -#ifndef TAO_SEQUENCE_T_CPP -#define TAO_SEQUENCE_T_CPP - -#include "tao/Sequence_T.h" -#include "tao/Array_VarOut_T.h" - -#include "ace/OS_Memory.h" - - -#if !defined (__ACE_INLINE__) -#include "tao/Sequence_T.i" -#endif /* __ACE_INLINE__ */ - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template <typename T> -TAO_Unbounded_Sequence<T>::TAO_Unbounded_Sequence ( - const TAO_Unbounded_Sequence<T> & rhs - ) - : TAO_Unbounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - T * tmp1 = TAO_Unbounded_Sequence<T>::allocbuf (this->maximum_); - T * const tmp2 = - reinterpret_cast <T * ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - tmp1[i] = tmp2[i]; - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template <typename T> -TAO_Unbounded_Sequence<T> & -TAO_Unbounded_Sequence<T>::operator= (const TAO_Unbounded_Sequence<T> & rhs) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - if (this->maximum_ < rhs.maximum_) - { - // Free the old buffer. - T * tmp = reinterpret_cast <T *> (this->buffer_); - TAO_Unbounded_Sequence<T>::freebuf (tmp); - this->buffer_ = - TAO_Unbounded_Sequence<T>::allocbuf (rhs.maximum_); - } - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Unbounded_Sequence<T>::allocbuf (rhs.maximum_); - } - } - - TAO_Unbounded_Base_Sequence::operator= (rhs); - - T * tmp1 = reinterpret_cast <T *> (this->buffer_); - T * const tmp2 = reinterpret_cast <T * ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - tmp1[i] = tmp2[i]; - } - - return *this; -} - -template<typename T> -TAO_Unbounded_Sequence<T>::~TAO_Unbounded_Sequence (void) -{ - this->_deallocate_buffer (); -} - -template<typename T> -void -TAO_Unbounded_Sequence<T>::_allocate_buffer (CORBA::ULong length) -{ - T * tmp = TAO_Unbounded_Sequence<T>::allocbuf (length); - - if (this->buffer_ != 0) - { - T * old = reinterpret_cast <T *> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - tmp[i] = old[i]; - } - - if (this->release_) - { - TAO_Unbounded_Sequence<T>::freebuf (old); - } - } - - this->buffer_ = tmp; -} - -template<typename T> -void -TAO_Unbounded_Sequence<T>::_deallocate_buffer (void) -{ - if (this->release_ == 0) - { - return; - } - - T * tmp = reinterpret_cast <T *> (this->buffer_); - - TAO_Unbounded_Sequence<T>::freebuf (tmp); - this->buffer_ = 0; - this->maximum_ = 0; - this->length_ = 0; - this->release_ = 0; -} - -template<typename T> -void -TAO_Unbounded_Sequence<T>::_shrink_buffer (CORBA::ULong nl, - CORBA::ULong ol) -{ - T * tmp = reinterpret_cast <T *> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) { - tmp[i] = T(); - } -} - -template <typename T> -T * -TAO_Unbounded_Sequence<T>::get_buffer (CORBA::Boolean orphan) -{ - T * result = 0; - - if (orphan == 0) - { - // We retain ownership. - if (this->buffer_ == 0) - { - if (this->length_ > 0) - { - result = TAO_Unbounded_Sequence<T>::allocbuf (this->length_); - this->buffer_ = result; - this->release_ = 1; - } - } - else - { - result = reinterpret_cast <T *> (this->buffer_); - } - } - else - { - result = reinterpret_cast <T *> (this->buffer_); - - if (this->release_ != 0) - { - // We set the state back to default and relinquish ownership. - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } - } - - return result; -} - -// The following function is not inline, to avoid build (template -// instantiation) problems with Sun C++ 4.2 patch 104631-07/SunOS 5.6. -template <typename T> -T & -TAO_Unbounded_Sequence<T>::operator[] (CORBA::ULong i) -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - T * tmp = reinterpret_cast <T *> (this->buffer_); - return tmp[i]; -} - -// The following function is not inline, to avoid build (template -// instantiation) problems with Sun C++ 4.2 patch 104631-07/SunOS 5.6. -template <typename T> -const T & -TAO_Unbounded_Sequence<T>::operator[] (CORBA::ULong i) const -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - T * const tmp = reinterpret_cast <T * ACE_CAST_CONST> (this->buffer_); - return tmp[i]; -} - -template <typename T> -void -TAO_Unbounded_Sequence<T>::replace (CORBA::ULong max, - CORBA::ULong length, - T * data, - CORBA::Boolean release) -{ - this->maximum_ = max; - this->length_ = length; - - if (this->buffer_ && this->release_ == 1) - { - T * tmp = reinterpret_cast <T *> (this->buffer_); - TAO_Unbounded_Sequence<T>::freebuf (tmp); - } - - this->buffer_ = data; - this->release_ = release; -} - -// **************************************************************** -// Bounded_Sequence -// **************************************************************** - -template <typename T, size_t MAX> -TAO_Bounded_Sequence<T, MAX>::TAO_Bounded_Sequence ( - const TAO_Bounded_Sequence<T,MAX> &rhs - ) - : TAO_Bounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - T * tmp1 = TAO_Bounded_Sequence<T,MAX>::allocbuf (MAX); - - T * const tmp2 = reinterpret_cast <T * ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - tmp1[i] = tmp2[i]; - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template <typename T, size_t MAX> -TAO_Bounded_Sequence<T,MAX> & -TAO_Bounded_Sequence<T,MAX>::operator= ( - const TAO_Bounded_Sequence<T,MAX> &rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - // We never need to reallocate the buffer because they are - // always of size MAX. - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Bounded_Sequence<T, MAX>::allocbuf (rhs.maximum_); - } - } - - TAO_Bounded_Base_Sequence::operator= (rhs); - - T * tmp1 = reinterpret_cast <T *> (this->buffer_); - T * const tmp2 = reinterpret_cast <T * ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - tmp1[i] = tmp2[i]; - } - - return *this; -} - -template<typename T, size_t MAX> -TAO_Bounded_Sequence<T, MAX>::~TAO_Bounded_Sequence (void) -{ - this->_deallocate_buffer (); -} - -template<typename T, size_t MAX> -void -TAO_Bounded_Sequence<T, MAX>::_allocate_buffer (CORBA::ULong) -{ - // For this class memory is never reallocated so the implementation - // is *really* simple. - this->buffer_ = TAO_Bounded_Sequence<T, MAX>::allocbuf (MAX); -} - -template<typename T, size_t MAX> -void -TAO_Bounded_Sequence<T, MAX>::_deallocate_buffer (void) -{ - if (this->release_ == 0) - { - return; - } - - T * tmp = reinterpret_cast <T *> (this->buffer_); - TAO_Bounded_Sequence<T, MAX>::freebuf (tmp); - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; -} - -template<typename T, size_t MAX> -void -TAO_Bounded_Sequence<T, MAX>::_shrink_buffer (CORBA::ULong nl, - CORBA::ULong ol) -{ - T * tmp = reinterpret_cast <T *> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) { - tmp[i] = T(); - } -} - -template <typename T, size_t MAX> -T * -TAO_Bounded_Sequence<T, MAX>::get_buffer (CORBA::Boolean orphan) -{ - T * result = 0; - - if (orphan == 0) - { - // We retain ownership. - - if (this->buffer_ == 0) - { - result = TAO_Bounded_Sequence<T,MAX>::allocbuf (this->maximum_); - this->buffer_ = result; - this->release_ = 1; - } - else - { - result = reinterpret_cast <T*> (this->buffer_); - } - } - else // if (orphan == 1) - { - if (this->release_ != 0) - { - // We set the state back to default and relinquish - // ownership. - result = reinterpret_cast <T*> (this->buffer_); - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } - } - - return result; -} - -template <typename T, size_t MAX> -void -TAO_Bounded_Sequence<T,MAX>::replace (CORBA::ULong max, - CORBA::ULong length, - T * data, - CORBA::Boolean release) -{ - this->maximum_ = max; - this->length_ = length; - - if (this->buffer_ && this->release_ == 1) - { - T * tmp = reinterpret_cast <T *> (this->buffer_); - TAO_Bounded_Sequence<T,MAX>::freebuf (tmp); - } - - this->buffer_ = data; - this->release_ = release; -} - -// ************************************************************* -// class TAO_Object_Manager -// ************************************************************* - -template <typename T, typename T_var> -TAO_Object_Manager<T,T_var> & -TAO_Object_Manager<T,T_var>::operator= ( - const TAO_Object_Manager<T,T_var> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - TAO::Objref_Traits<T>::release (*this->ptr_); - *this->ptr_ = TAO::Objref_Traits<T>::duplicate (*rhs.ptr_); - } - else - { - *this->ptr_ = *rhs.ptr_; - } - - return *this; -} - -template <typename T, typename T_var> -TAO_Object_Manager<T,T_var> & -TAO_Object_Manager<T,T_var>::operator= (T * p) -{ - if (this->release_) - { - // The semantics of the elements of a sequence are the same as - // that of a var variable. Therefore we will not duplicate the - // user provided pointer before assigning it to the internal - // variable. - TAO::Objref_Traits<T>::release (*this->ptr_); - *this->ptr_ = p; - } - else - { - *this->ptr_ = p; - } - - return *this; -} - -template <typename T, typename T_var> -TAO_Object_Manager<T,T_var> & -TAO_Object_Manager<T,T_var>::operator= (const T_var & p) -{ - if (this->release_) - { - // The semantics of the elements of a sequence are the same as - // that of a var variable. Therefore we duplicate p's - // pointer before assigning it to the internal - // variable. - TAO::Objref_Traits<T>::release (*this->ptr_); - *this->ptr_ = TAO::Objref_Traits<T>::duplicate (p.in ()); - } - else - { - *this->ptr_ = p.in (); - } - - return *this; -} - -template <typename T, typename T_var> -T *& -TAO_Object_Manager<T,T_var>::out (void) -{ - TAO::Objref_Traits<T>::release (*this->ptr_); - *this->ptr_ = TAO::Objref_Traits<T>::nil (); - return *this->ptr_; -} - -template <typename T, typename T_var> -T * -TAO_Object_Manager<T,T_var>::_retn (void) -{ - T *temp = *this->ptr_; - *this->ptr_ = TAO::Objref_Traits<T>::nil (); - return temp; -} - -// ************************************************************* -// class TAO_Pseudo_Object_Manager -// ************************************************************* - -template <typename T> -TAO_Pseudo_Object_Manager<T> & -TAO_Pseudo_Object_Manager<T>::operator= ( - const TAO_Pseudo_Object_Manager<T> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - CORBA::release (*this->ptr_); - *this->ptr_ = T::_duplicate (*rhs.ptr_); - } - else - { - *this->ptr_ = *rhs.ptr_; - } - - return *this; -} - -template <typename T> -TAO_Pseudo_Object_Manager<T> & -TAO_Pseudo_Object_Manager<T>::operator= (T * p) -{ - if (this->release_) - { - // The semantics of the elements of a sequence are the same as - // that of a var variable. Therefore we will not duplicate the - // user provided pointer before assigning it to the internal - // variable. However, we will release it. - CORBA::release (*this->ptr_); - *this->ptr_ = p; - } - else - { - *this->ptr_ = p; - } - - return *this; -} - -template <typename T> -TAO_Pseudo_Object_Manager<T> & -TAO_Pseudo_Object_Manager<T>::operator= (const T_var_type & p) -{ - if (this->release_) - { - // The semantics of the elements of a sequence are the same as - // that of a var variable. Therefore we duplicate p's - // pointer before assigning it to the internal - // variable. - CORBA::release (*this->ptr_); - *this->ptr_ = T::_duplicate (p.in ()); - } - else - { - *this->ptr_ = p.in (); - } - - return *this; -} - -// ************************************************************* -// Operations for class TAO_Unbounded_Object_Sequence -// ************************************************************* - -// constructor for unbounded seq -template <typename T, typename T_var> -TAO_Unbounded_Object_Sequence<T,T_var>::TAO_Unbounded_Object_Sequence ( - CORBA::ULong maximum - ) - : TAO_Unbounded_Base_Sequence ( - maximum, - TAO_Unbounded_Object_Sequence<T,T_var>::allocbuf ( - maximum - ) - ) -{ -} - -template <typename T, typename T_var> -TAO_Unbounded_Object_Sequence<T,T_var>::TAO_Unbounded_Object_Sequence ( - const TAO_Unbounded_Object_Sequence<T,T_var> &rhs - ) - : TAO_Unbounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - T ** tmp1 = - TAO_Unbounded_Object_Sequence<T,T_var>::allocbuf ( - this->maximum_ - ); - T ** const tmp2 = reinterpret_cast <T ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = TAO::Objref_Traits<T>::duplicate (tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template<typename T, typename T_var> -TAO_Unbounded_Object_Sequence<T,T_var>::~TAO_Unbounded_Object_Sequence (void) -{ - this->_deallocate_buffer (); -} - -// Assignment operator. -template <typename T, typename T_var> -TAO_Unbounded_Object_Sequence<T,T_var> & -TAO_Unbounded_Object_Sequence<T,T_var>::operator= ( - const TAO_Unbounded_Object_Sequence<T,T_var> &rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - T ** tmp = reinterpret_cast <T **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - TAO::Objref_Traits<T>::release (tmp[i]); - tmp[i] = TAO::Objref_Traits<T>::nil (); - } - - if (this->maximum_ < rhs.maximum_) - { - TAO_Unbounded_Object_Sequence<T,T_var>::freebuf (tmp); - this->buffer_ = - TAO_Unbounded_Object_Sequence<T,T_var>::allocbuf ( - rhs.maximum_ - ); - } - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Unbounded_Object_Sequence<T,T_var>::allocbuf ( - rhs.maximum_ - ); - } - } - - TAO_Unbounded_Base_Sequence::operator= (rhs); - - T ** tmp1 = reinterpret_cast <T **> (this->buffer_); - T ** const tmp2 = reinterpret_cast <T ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = TAO::Objref_Traits<T>::duplicate (tmp2[i]); - } - - return *this; -} - -template <typename T, typename T_var> -T ** -TAO_Unbounded_Object_Sequence<T,T_var>::allocbuf ( - CORBA::ULong nelems - ) -{ - T ** buf = 0; - ACE_NEW_RETURN (buf, - T * [nelems], - 0); - - for (CORBA::ULong i = 0; i < nelems; ++i) - { - buf[i] = TAO::Objref_Traits<T>::nil (); - } - - return buf; -} - -template <typename T, typename T_var> -void -TAO_Unbounded_Object_Sequence<T,T_var>::freebuf (T ** buffer) -{ - if (buffer == 0) - { - return; - } - - // {orbos/97-05-15:16.11} The freebuf function ensures that the - // destructor for each element is called before the buffer is - // destroyed, except for string elements, which are freed using - // string_free(), and object reference elements, which are freed - // using release(). The freebuf function will ignore null pointers - // passed to it. - - // @@ How are we supposed to implement that! We don't know the - // length of the buffer here. - // Mark the length in the first four bytes? For the moment we let - // that be. - - delete [] buffer; -} - -template<typename T, typename T_var> -void -TAO_Unbounded_Object_Sequence<T,T_var>::_allocate_buffer ( - CORBA::ULong length - ) -{ - T ** tmp = - TAO_Unbounded_Object_Sequence<T,T_var>::allocbuf (length); - - if (this->buffer_ != 0) - { - T ** old = reinterpret_cast <T **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - // Only call duplicate when we did not own the previous - // buffer, since after this method we own it we must also own - // the objects. If we already own the objects there is no - // need to copy them, if we did we would also have to remove - // the old instances. - if (!this->release_) - { - tmp[i] = TAO::Objref_Traits<T>::duplicate (old[i]); - } - else - { - tmp[i] = old[i]; - } - - if (this->release_) - { - delete [] old; - } - } - - this->buffer_ = tmp; -} - -template<typename T, typename T_var> -void -TAO_Unbounded_Object_Sequence<T,T_var>::_deallocate_buffer ( - void - ) -{ - if (this->buffer_ == 0 || this->release_ == 0) - { - return; - } - - T ** tmp = reinterpret_cast <T **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - TAO::Objref_Traits<T>::release (tmp[i]); - tmp[i] = TAO::Objref_Traits<T>::nil (); - } - - TAO_Unbounded_Object_Sequence<T,T_var>::freebuf (tmp); - this->buffer_ = 0; - this->maximum_ = 0; - this->length_ = 0; - this->release_ = 0; -} - -template<typename T, typename T_var> -void -TAO_Unbounded_Object_Sequence<T,T_var>::_shrink_buffer ( - CORBA::ULong nl, - CORBA::ULong ol - ) -{ - T ** tmp = static_cast <T **> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) - { - TAO::Objref_Traits<T>::release (tmp[i]); - tmp[i] = TAO::Objref_Traits<T>::nil (); - } -} - -// ************************************************************* -// Operations for class TAO_Bounded_Object_Sequence -// ************************************************************* - -template <typename T, typename T_var, size_t MAX> -TAO_Bounded_Object_Sequence<T,T_var,MAX>::TAO_Bounded_Object_Sequence (void) - : TAO_Bounded_Base_Sequence ( - MAX, - TAO_Bounded_Object_Sequence<T,T_var,MAX>::allocbuf (MAX) - ) -{ -} - -template <typename T, typename T_var, size_t MAX> -TAO_Bounded_Object_Sequence<T,T_var,MAX>::TAO_Bounded_Object_Sequence ( - const TAO_Bounded_Object_Sequence<T,T_var,MAX> & rhs - ) - : TAO_Bounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - T ** tmp1 = - TAO_Bounded_Object_Sequence<T,T_var,MAX>::allocbuf (MAX); - - T ** const tmp2 = reinterpret_cast <T** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = TAO::Objref_Traits<T>::duplicate (tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template <typename T, typename T_var, size_t MAX> -TAO_Bounded_Object_Sequence<T, T_var,MAX> & -TAO_Bounded_Object_Sequence<T,T_var,MAX>::operator= ( - const TAO_Bounded_Object_Sequence<T,T_var,MAX> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - T ** tmp = reinterpret_cast<T **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - TAO::Objref_Traits<T>::release (tmp[i]); - tmp[i] = TAO::Objref_Traits<T>::nil (); - } - // No need to reallocate the buffer since it is always of size - // MAX - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Bounded_Object_Sequence<T,T_var,MAX>::allocbuf ( - rhs.maximum_ - ); - } - } - - TAO_Bounded_Base_Sequence::operator= (rhs); - - T ** tmp1 = reinterpret_cast<T **> (this->buffer_); - T ** const tmp2 = reinterpret_cast<T ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i=0; i < rhs.length_; ++i) - { - tmp1[i] = TAO::Objref_Traits<T>::duplicate (tmp2[i]); - } - - return *this; -} - -template <typename T, typename T_var, size_t MAX> -T ** -TAO_Bounded_Object_Sequence<T,T_var,MAX>::allocbuf ( - CORBA::ULong - ) -{ - T ** buf = 0; - ACE_NEW_RETURN (buf, - T * [MAX], - 0); - - for (CORBA::ULong i = 0; i < MAX; ++i) - { - buf[i] = TAO::Objref_Traits<T>::nil (); - } - - return buf; -} - -template <typename T, typename T_var, size_t MAX> -void -TAO_Bounded_Object_Sequence<T,T_var,MAX>::freebuf (T ** buffer) -{ - // How much do we deallocate? Easy! allocbuf() always creates MAX - // elements and initialize them to T::_nil(). So we can be - // complaint and call CORBA::release() on each one. - for (CORBA::ULong i = 0; i < MAX; ++i) - { - if (buffer[i] != TAO::Objref_Traits<T>::nil ()) - { - TAO::Objref_Traits<T>::release (buffer[i]); - buffer[i] = TAO::Objref_Traits<T>::nil (); - } - } - - delete [] buffer; -} - -template<typename T, typename T_var, size_t MAX> -void -TAO_Bounded_Object_Sequence<T,T_var,MAX>::_allocate_buffer ( - CORBA::ULong length - ) -{ - // For this class memory is never reallocated so the implementation - // is *really* simple. - this->buffer_ = - TAO_Bounded_Object_Sequence<T,T_var,MAX>::allocbuf (length); -} - -template<typename T, typename T_var, size_t MAX> -void -TAO_Bounded_Object_Sequence<T,T_var,MAX>::_deallocate_buffer ( - void - ) -{ - if (this->release_ == 0) - { - return; - } - - T ** tmp = reinterpret_cast<T **> (this->buffer_); - TAO_Bounded_Object_Sequence<T,T_var,MAX>::freebuf (tmp); - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; -} - -template<typename T, typename T_var, size_t MAX> -void -TAO_Bounded_Object_Sequence<T,T_var,MAX>::_shrink_buffer ( - CORBA::ULong nl, - CORBA::ULong ol - ) -{ - T ** tmp = reinterpret_cast<T **> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) - { - TAO::Objref_Traits<T>::release (tmp[i]); - tmp[i] = TAO::Objref_Traits<T>::nil (); - } -} - -// ************************************************************* -// Operations for class TAO_Unbounded_Pseudo_Sequence -// ************************************************************* - -template <typename T> -TAO_Unbounded_Pseudo_Sequence<T>::TAO_Unbounded_Pseudo_Sequence ( - CORBA::ULong maximum - ) - : TAO_Unbounded_Base_Sequence ( - maximum, - TAO_Unbounded_Pseudo_Sequence<T>::allocbuf (maximum) - ) -{ -} - -template <typename T> -TAO_Unbounded_Pseudo_Sequence<T>::TAO_Unbounded_Pseudo_Sequence ( - const TAO_Unbounded_Pseudo_Sequence<T> & rhs - ) - : TAO_Unbounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - T **tmp1 = - TAO_Unbounded_Pseudo_Sequence<T>::allocbuf (this->maximum_); - - T ** const tmp2 = - reinterpret_cast<T ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = T::_duplicate (tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template <typename T> -TAO_Unbounded_Pseudo_Sequence<T>::~TAO_Unbounded_Pseudo_Sequence (void) -{ - this->_deallocate_buffer (); -} - -template <typename T> -TAO_Unbounded_Pseudo_Sequence<T> & -TAO_Unbounded_Pseudo_Sequence<T>::operator= ( - const TAO_Unbounded_Pseudo_Sequence<T> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - T ** tmp = reinterpret_cast<T **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::release (tmp[i]); - tmp[i] = T::_nil (); - } - - if (this->maximum_ < rhs.maximum_) - { - TAO_Unbounded_Pseudo_Sequence<T>::freebuf (tmp); - this->buffer_ = - TAO_Unbounded_Pseudo_Sequence<T>::allocbuf (rhs.maximum_); - } - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Unbounded_Pseudo_Sequence<T>::allocbuf (rhs.maximum_); - } - } - - TAO_Unbounded_Base_Sequence::operator= (rhs); - - T ** tmp1 = reinterpret_cast<T **> (this->buffer_); - T ** const tmp2 = reinterpret_cast<T ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = T::_duplicate (tmp2[i]); - } - - return *this; -} - -template <typename T> -T ** -TAO_Unbounded_Pseudo_Sequence<T>::allocbuf (CORBA::ULong nelems) -{ - T ** buf = 0; - ACE_NEW_RETURN (buf, - T * [nelems], - 0); - - for (CORBA::ULong i = 0; i < nelems; ++i) - { - buf[i] = T::_nil (); - } - - return buf; -} - -template <typename T> -void -TAO_Unbounded_Pseudo_Sequence<T>::freebuf (T ** buffer) -{ - if (buffer == 0) - { - return; - } - - // {orbos/97-05-15:16.11} The freebuf function ensures that the - // destructor for each element is called before the buffer is - // destroyed, except for string elements, which are freed using - // string_free(), and object reference elements, which are freed - // using release(). The freebuf function will ignore null pointers - // passed to it. - - // @@ How are we supposed to implement that! We don't know the - // length of the buffer here. - // Mark the length in the first four bytes? For the moment we let - // that be. - - delete [] buffer; -} - -template <typename T> -void -TAO_Unbounded_Pseudo_Sequence<T>::_allocate_buffer (CORBA::ULong length) -{ - T ** tmp = TAO_Unbounded_Pseudo_Sequence<T>::allocbuf (length); - - if (this->buffer_ != 0) - { - T ** old = reinterpret_cast<T **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - // Only call duplicate when we did not own the previous - // buffer, since after this method we own it we must also own - // the objects. If we already own the objects there is no - // need to copy them, if we did we would also have to remove - // the old instances. - if (!this->release_) - { - tmp[i] = T::_duplicate (old[i]); - } - else - { - tmp[i] = old[i]; - } - - if (this->release_) - { - delete [] old; - } - } - - this->buffer_ = tmp; -} - -template <typename T> -void -TAO_Unbounded_Pseudo_Sequence<T>::_deallocate_buffer (void) -{ - if (this->buffer_ == 0 || this->release_ == 0) - { - return; - } - - T ** tmp = reinterpret_cast<T **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::release (tmp[i]); - tmp[i] = T::_nil (); - } - - TAO_Unbounded_Pseudo_Sequence<T>::freebuf (tmp); - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; - this->maximum_ = 0; -} - -template <typename T> -void -TAO_Unbounded_Pseudo_Sequence<T>::_shrink_buffer (CORBA::ULong nl, - CORBA::ULong ol) -{ - T ** tmp = static_cast<T **> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) - { - CORBA::release (tmp[i]); - tmp[i] = T::_nil (); - } -} - -// ************************************************************* -// Operations for class TAO_Bounded_Pseudo_Sequence -// ************************************************************* - -template <typename T, size_t MAX> -TAO_Bounded_Pseudo_Sequence<T,MAX>::TAO_Bounded_Pseudo_Sequence (void) - : TAO_Bounded_Base_Sequence ( - MAX, - TAO_Bounded_Pseudo_Sequence<T,MAX>::allocbuf (MAX) - ) -{ -} - -template <typename T, size_t MAX> -TAO_Bounded_Pseudo_Sequence<T,MAX>::TAO_Bounded_Pseudo_Sequence ( - const TAO_Bounded_Pseudo_Sequence<T,MAX> & rhs - ) - : TAO_Bounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - T ** tmp1 = - TAO_Bounded_Pseudo_Sequence<T,MAX>::allocbuf (MAX); - - T ** const tmp2 = - reinterpret_cast<T ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = T::_duplicate (tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template <typename T, size_t MAX> -TAO_Bounded_Pseudo_Sequence<T,MAX> & -TAO_Bounded_Pseudo_Sequence<T,MAX>::operator= ( - const TAO_Bounded_Pseudo_Sequence<T,MAX> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - T ** tmp = reinterpret_cast<T **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::release (tmp[i]); - tmp[i] = T::_nil (); - } - // No need to reallocate the buffer since it is always of size - // MAX - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Bounded_Pseudo_Sequence<T,MAX>::allocbuf (rhs.maximum_); - } - } - - TAO_Bounded_Base_Sequence::operator= (rhs); - - T ** tmp1 = reinterpret_cast<T **> (this->buffer_); - T ** const tmp2 = reinterpret_cast<T ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i=0; i < rhs.length_; ++i) - { - tmp1[i] = T::_duplicate (tmp2[i]); - } - - return *this; -} - -template <typename T, size_t MAX> -T ** -TAO_Bounded_Pseudo_Sequence<T,MAX>::allocbuf (CORBA::ULong) -{ - T ** buf = 0; - ACE_NEW_RETURN (buf, - T * [MAX], - 0); - - for (CORBA::ULong i = 0; i < MAX; ++i) - { - buf[i] = T::_nil (); - } - - return buf; -} - -template <typename T, size_t MAX> -void -TAO_Bounded_Pseudo_Sequence<T,MAX>::freebuf (T ** buffer) -{ - // How much do we deallocate? Easy! allocbuf() always creates MAX - // elements and initialize them to T::_nil(). So we can be - // complaint and call CORBA::release() on each one. - for (CORBA::ULong i = 0; i < MAX; ++i) - { - if (buffer[i] != T::_nil ()) - { - CORBA::release (buffer[i]); - buffer[i] = T::_nil (); - } - } - - delete [] buffer; -} - -template <typename T, size_t MAX> -void -TAO_Bounded_Pseudo_Sequence<T,MAX>::_allocate_buffer ( - CORBA::ULong length - ) -{ - // For this class memory is never reallocated so the implementation - // is *really* simple. - this->buffer_ = - TAO_Bounded_Pseudo_Sequence<T,MAX>::allocbuf (length); -} - -template <typename T, size_t MAX> -void -TAO_Bounded_Pseudo_Sequence<T,MAX>::_deallocate_buffer (void) -{ - if (this->release_ == 0) - { - return; - } - - T ** tmp = reinterpret_cast<T **> (this->buffer_); - TAO_Bounded_Pseudo_Sequence<T,MAX>::freebuf (tmp); - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; -} - -template <typename T, size_t MAX> -void -TAO_Bounded_Pseudo_Sequence<T,MAX>::_shrink_buffer (CORBA::ULong nl, - CORBA::ULong ol) -{ - T ** tmp = reinterpret_cast<T **> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) - { - CORBA::release (tmp[i]); - tmp[i] = T::_nil (); - } -} - -// ************************************************************* -// Operations for class TAO_Unbounded_Array_Sequence -// ************************************************************* - -template <typename T, typename T_slice, typename TAG> -T * -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::allocbuf (CORBA::ULong nelems) -{ - T * buf = 0; - ACE_NEW_RETURN (buf, - T [nelems], - 0); - - return buf; -} - -template <typename T, typename T_slice, typename TAG> -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::TAO_Unbounded_Array_Sequence ( - const TAO_Unbounded_Array_Sequence<T,T_slice,TAG> & rhs - ) - : TAO_Unbounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - typedef TAO_Unbounded_Array_Sequence<T,T_slice,TAG> SEQ_TYPE; - T * tmp1 = - reinterpret_cast<T *> (SEQ_TYPE::allocbuf (this->maximum_) - ); - - const T * tmp2 = reinterpret_cast<const T *> (rhs.buffer_); - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - TAO::Array_Traits<T,T_slice,TAG>::copy (tmp1[i], tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template <typename T, typename T_slice, typename TAG> -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::~TAO_Unbounded_Array_Sequence ( - void - ) -{ - this->_deallocate_buffer (); -} - -template <typename T, typename T_slice, typename TAG> -TAO_Unbounded_Array_Sequence<T,T_slice,TAG> & -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::operator= ( - const TAO_Unbounded_Array_Sequence<T,T_slice,TAG> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - if (this->maximum_ < rhs.maximum_) - { - // free the old buffer - T * tmp = reinterpret_cast<T *> (this->buffer_); - TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::freebuf (tmp); - - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::allocbuf ( - rhs.maximum_ - ); - } - } - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::allocbuf ( - rhs.maximum_ - ); - } - } - - TAO_Unbounded_Base_Sequence::operator= (rhs); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - TAO::Array_Traits<T,T_slice,TAG>::copy ( - reinterpret_cast<T *> (this->buffer_)[i], - reinterpret_cast<const T *> (rhs.buffer_)[i] - ); - } - - return *this; -} - -template <typename T, typename T_slice, typename TAG> -T * -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::get_buffer ( - CORBA::Boolean orphan - ) -{ - T * result = 0; - - if (orphan == 0) - { - // We retain ownership. - - if (this->buffer_ == 0) - { - if (this->length_ > 0) - { - result = - TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::allocbuf ( - this->length_ - ); - this->buffer_ = result; - this->release_ = 1; - } - } - else - { - result = - reinterpret_cast<T *> (this->buffer_); - } - } - else - { - if (this->release_ != 0) - { - // We set the state back to default and relinquish - // ownership. - result = reinterpret_cast<T *> (this->buffer_); - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } - } - - return result; -} - -template <typename T, typename T_slice, typename TAG> -void -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::_allocate_buffer ( - CORBA::ULong length - ) -{ - typedef TAO_Unbounded_Array_Sequence<T,T_slice,TAG> SEQ_TYPE; - T * tmp = - reinterpret_cast<T *> (SEQ_TYPE::allocbuf (length) - ); - - if (this->buffer_ != 0) - { - T* old = (T *) this->buffer_; - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - TAO::Array_Traits<T,T_slice,TAG>::copy (tmp[i], old[i]); - } - - if (this->release_) - { - delete [] old; - } - } - - this->buffer_ = tmp; -} - -template <typename T, typename T_slice, typename TAG> -void -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::_deallocate_buffer (void) -{ - if (this->buffer_ == 0 || this->release_ == 0) - { - return; - } - - T * tmp = reinterpret_cast<T *> (this->buffer_); - TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::freebuf (tmp); - - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; - this->maximum_ = 0; -} - -template <typename T, typename T_slice, typename TAG> -void -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::replace (CORBA::ULong max, - CORBA::ULong length, - T * data, - CORBA::Boolean release) -{ - this->maximum_ = max; - this->length_ = length; - - if (this->buffer_ && this->release_ == 1) - { - T * tmp = reinterpret_cast<T *> (this->buffer_); - TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::freebuf (tmp); - } - - this->buffer_ = data; - this->release_ = release; -} - -// ************************************************************* -// Operations for class TAO_Bounded_Array_Sequence -// ************************************************************* - -template <typename T, typename T_slice, typename TAG, size_t MAX> -T * -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::allocbuf (CORBA::ULong) -{ - T * buf = 0; - ACE_NEW_RETURN (buf, - T [MAX], - 0); - - return buf; -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::TAO_Bounded_Array_Sequence ( - const TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX> &rhs - ) - : TAO_Bounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - typedef TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX> SEQ_TYPE; - T * tmp1 = - reinterpret_cast<T *> (SEQ_TYPE::allocbuf (MAX) - ); - - const T* tmp2 = (const T *) rhs.buffer_; - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - TAO::Array_Traits<T,T_slice,TAG>::copy (tmp1[i], tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::~TAO_Bounded_Array_Sequence (void) -{ - this->_deallocate_buffer (); -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX> & -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::operator= ( - const TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - // We never need to reallocate the buffer because they are - // always of size MAX. - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::allocbuf ( - rhs.maximum_ - ); - } - } - - TAO_Bounded_Base_Sequence::operator= (rhs); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - TAO::Array_Traits<T,T_slice,TAG>::copy ( - ((T *) this->buffer_)[i], - ((const T *) rhs.buffer_)[i] - ); - } - - return *this; -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -T * -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::get_buffer (CORBA::Boolean orphan) -{ - T * result = 0; - - if (orphan == 0) - { - // We retain ownership. - - if (this->buffer_ == 0) - { - result = - TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::allocbuf ( - this->maximum_ - ); - this->buffer_ = result; - this->release_ = 1; - } - else - { - result = - reinterpret_cast<T *> (this->buffer_); - } - } - else - { - if (this->release_ != 0) - { - // We set the state back to default and relinquish ownership. - result = reinterpret_cast<T *> (this->buffer_); - this->maximum_ = 0; - this->length_ = 0; - this->buffer_ = 0; - this->release_ = 0; - } - } - - return result; -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -void -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::freebuf (T * buffer) -{ - if (buffer == 0) - { - return; - } - - delete [] buffer; -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -void -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::_allocate_buffer ( - CORBA::ULong length - ) -{ - // For this class memory is never reallocated so the implementation - // is *really* simple. - this->buffer_ = - TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::allocbuf (length); -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -void -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::_deallocate_buffer (void) -{ - if (this->buffer_ == 0 || this->release_ == 0) - { - return; - } - - T * tmp = reinterpret_cast<T *> (this->buffer_); - - TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::freebuf (tmp); - - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -void -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::replace (CORBA::ULong max, - CORBA::ULong length, - T * data, - CORBA::Boolean release) -{ - this->maximum_ = max; - this->length_ = length; - - if (this->buffer_ && this->release_ == 1) - { - T * tmp = reinterpret_cast<T *> (this->buffer_); - TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::freebuf (tmp); - } - - this->buffer_ = data; - this->release_ = release; -} - -// ************************************************************* -// Operations for class TAO_Bounded_String_Sequence -// ************************************************************* - -template<size_t MAX> -TAO_Bounded_String_Sequence<MAX>::TAO_Bounded_String_Sequence (void) - : TAO_Bounded_Base_Sequence ( - MAX, - TAO_Bounded_String_Sequence<MAX>::allocbuf(MAX) - ) -{ -} - -template<size_t MAX> -TAO_Bounded_String_Sequence<MAX>::TAO_Bounded_String_Sequence ( - const TAO_Bounded_String_Sequence<MAX> & rhs - ) - : TAO_Bounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - char ** tmp1 = - TAO_Bounded_String_Sequence<MAX>::allocbuf (this->maximum_); - - char ** const tmp2 = - reinterpret_cast<char ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = CORBA::string_dup (tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template<size_t MAX> -TAO_Bounded_String_Sequence<MAX> & -TAO_Bounded_String_Sequence<MAX>::operator= ( - const TAO_Bounded_String_Sequence<MAX> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - char ** tmp = reinterpret_cast<char **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::string_free (tmp[i]); - tmp[i] = 0; - } - // No need to reallocate because the buffer is supposed to be of - // <MAX> size. - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Bounded_String_Sequence<MAX>::allocbuf (rhs.maximum_); - } - } - - TAO_Bounded_Base_Sequence::operator= (rhs); - - char ** tmp1 = reinterpret_cast<char **> (this->buffer_); - char ** const tmp2 = reinterpret_cast<char ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = CORBA::string_dup (tmp2[i]); - } - - return *this; -} - -template<size_t MAX> -TAO_SeqElem_String_Manager -TAO_Bounded_String_Sequence<MAX>::operator[] (CORBA::ULong slot) const -{ - TAO_SEQUENCE_ASSERT (slot, this->maximum_); - char ** const tmp = reinterpret_cast<char ** ACE_CAST_CONST> (this->buffer_); - return TAO_SeqElem_String_Manager (tmp + slot, - this->release_); -} - -template<size_t MAX> -char ** -TAO_Bounded_String_Sequence<MAX>::allocbuf (CORBA::ULong) -{ - char **buf = 0; - ACE_NEW_RETURN (buf, - char * [MAX], - 0); - - for (CORBA::ULong i = 0; i < MAX; ++i) - { - buf[i] = 0; - } - - return buf; -} - -template<size_t MAX> -void -TAO_Bounded_String_Sequence<MAX>::freebuf (char ** buffer) -{ - // How much do we deallocate? Easy! <allocbuf> always creates MAX - // elements and initialize them to 0 (they say NULL, yuck!). So we - // can be complaint and call CORBA::string_free() on each one. - - for (CORBA::ULong i = 0; i < MAX; ++i) - { - if (buffer[i] != 0) - { - CORBA::string_free (buffer[i]); - buffer[i] = 0; - } - } - - delete [] buffer; -} - -template<size_t MAX> -void -TAO_Bounded_String_Sequence<MAX>::_allocate_buffer (CORBA::ULong /* length */) -{ - // For this class memory is never reallocated so the implementation - // is *really* simple. - this->buffer_ = - TAO_Bounded_String_Sequence<MAX>::allocbuf (MAX); -} - -template<size_t MAX> -void -TAO_Bounded_String_Sequence<MAX>::_deallocate_buffer (void) -{ - if (this->release_ == 0) - { - return; - } - - char ** tmp = reinterpret_cast<char **> (this->buffer_); - TAO_Bounded_String_Sequence<MAX>::freebuf (tmp); - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; -} - -template<size_t MAX> -void -TAO_Bounded_String_Sequence<MAX>::_shrink_buffer (CORBA::ULong nl, - CORBA::ULong ol) -{ - char ** tmp = reinterpret_cast<char **> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) - { - CORBA::string_free (tmp[i]); - tmp[i] = 0; - } -} - -template<size_t MAX> -void -TAO_Bounded_String_Sequence<MAX>::replace (CORBA::ULong length, - char ** data, - CORBA::Boolean release) -{ - TAO_SEQUENCE_ASSERT (length, this->maximum_); - this->_deallocate_buffer (); - this->length_ = length; - - // If 'release' is 1, caller is responsible for allocating new buffer - // with CORBA::string_alloc. - this->buffer_ = data; - this->release_ = release; -} -// ************************************************************* -// Operations for class TAO_Bounded_WString_Sequence -// ************************************************************* - -template<size_t MAX> -TAO_Bounded_WString_Sequence<MAX>::TAO_Bounded_WString_Sequence (void) - : TAO_Bounded_Base_Sequence ( - MAX, - TAO_Bounded_WString_Sequence<MAX>::allocbuf(MAX) - ) -{ -} - -template<size_t MAX> -TAO_Bounded_WString_Sequence<MAX>::TAO_Bounded_WString_Sequence ( - const TAO_Bounded_WString_Sequence<MAX> & rhs - ) - : TAO_Bounded_Base_Sequence (rhs) -{ - if (rhs.buffer_ != 0) - { - CORBA::WChar ** tmp1 = - TAO_Bounded_WString_Sequence<MAX>::allocbuf (this->maximum_); - - CORBA::WChar ** const tmp2 = - reinterpret_cast<CORBA::WChar ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = CORBA::wstring_dup (tmp2[i]); - } - - this->buffer_ = tmp1; - } - else - { - this->buffer_ = 0; - } -} - -template<size_t MAX> -TAO_Bounded_WString_Sequence<MAX> & -TAO_Bounded_WString_Sequence<MAX>::operator= ( - const TAO_Bounded_WString_Sequence<MAX> & rhs - ) -{ - if (this == &rhs) - { - return *this; - } - - if (this->release_) - { - CORBA::WChar ** tmp = reinterpret_cast<CORBA::WChar **> (this->buffer_); - - for (CORBA::ULong i = 0; i < this->length_; ++i) - { - CORBA::wstring_free (tmp[i]); - tmp[i] = 0; - } - // No need to reallocate because the buffer is supposed to be of - // <MAX> size. - } - else - { - if (rhs.maximum_ == 0) - { - this->buffer_ = 0; - } - else - { - this->buffer_ = - TAO_Bounded_WString_Sequence<MAX>::allocbuf (rhs.maximum_); - } - } - - TAO_Bounded_Base_Sequence::operator= (rhs); - - CORBA::WChar ** tmp1 = reinterpret_cast<CORBA::WChar **> (this->buffer_); - CORBA::WChar ** const tmp2 = - reinterpret_cast<CORBA::WChar ** ACE_CAST_CONST> (rhs.buffer_); - - for (CORBA::ULong i = 0; i < rhs.length_; ++i) - { - tmp1[i] = CORBA::wstring_dup (tmp2[i]); - } - - return *this; -} - -template<size_t MAX> -TAO_SeqElem_WString_Manager -TAO_Bounded_WString_Sequence<MAX>::operator[] (CORBA::ULong slot) const -{ - TAO_SEQUENCE_ASSERT (slot, this->maximum_); - CORBA::WChar ** const tmp = - reinterpret_cast<CORBA::WChar ** ACE_CAST_CONST> (this->buffer_); - return TAO_SeqElem_WString_Manager (tmp + slot, - this->release_); -} - -template<size_t MAX> -CORBA::WChar ** -TAO_Bounded_WString_Sequence<MAX>::allocbuf (CORBA::ULong) -{ - CORBA::WChar ** buf = 0; - ACE_NEW_RETURN (buf, - CORBA::WChar * [MAX], - 0); - - for (CORBA::ULong i = 0; i < MAX; ++i) - { - buf[i] = 0; - } - - return buf; -} - -template<size_t MAX> -void -TAO_Bounded_WString_Sequence<MAX>::freebuf (CORBA::WChar* *buffer) -{ - // How much do we deallocate? Easy! <allocbuf> always creates MAX - // elements and initialize them to 0 (they say NULL, yuck!). So we - // can be complaint and call CORBA::wstring_free() on each one. - - for (CORBA::ULong i = 0; i < MAX; ++i) - { - if (buffer[i] != 0) - { - CORBA::wstring_free (buffer[i]); - buffer[i] = 0; - } - } - - delete [] buffer; -} - -template<size_t MAX> -void -TAO_Bounded_WString_Sequence<MAX>::_allocate_buffer ( - CORBA::ULong /* length */ - ) -{ - // For this class memory is never reallocated so the implementation - // is *really* simple. - this->buffer_ = - TAO_Bounded_WString_Sequence<MAX>::allocbuf (MAX); -} - -template<size_t MAX> -void -TAO_Bounded_WString_Sequence<MAX>::_deallocate_buffer (void) -{ - if (this->release_ == 0) - { - return; - } - - CORBA::WChar ** tmp = reinterpret_cast<CORBA::WChar **> (this->buffer_); - TAO_Bounded_WString_Sequence<MAX>::freebuf (tmp); - this->buffer_ = 0; - this->length_ = 0; - this->release_ = 0; -} - -template<size_t MAX> -void -TAO_Bounded_WString_Sequence<MAX>::_shrink_buffer (CORBA::ULong nl, - CORBA::ULong ol) -{ - CORBA::WChar ** tmp = reinterpret_cast<CORBA::WChar **> (this->buffer_); - - for (CORBA::ULong i = nl; i < ol; ++i) - { - CORBA::wstring_free (tmp[i]); - tmp[i] = 0; - } -} - -template<size_t MAX> -void -TAO_Bounded_WString_Sequence<MAX>::replace (CORBA::ULong length, - CORBA::WChar ** data, - CORBA::Boolean release) -{ - TAO_SEQUENCE_ASSERT (length, this->maximum_); - - this->_deallocate_buffer (); - this->length_ = length; - - // If 'release' is 1, caller is responsible for allocating new buffer - // with CORBA::wstring_alloc. - this->buffer_ = data; - this->release_ = release; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif /* tao/TAO_SEQUENCE_T_CPP */ diff --git a/TAO/tao/Sequence_T.h b/TAO/tao/Sequence_T.h index 2f7964a06d0..2ee1b14407d 100644 --- a/TAO/tao/Sequence_T.h +++ b/TAO/tao/Sequence_T.h @@ -1,1231 +1,15 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Sequence_T.h - * - * $Id$ - * - * @author Carlos O'Ryan and Aniruddha Gokhale - */ -//============================================================================= - -#ifndef TAO_SEQUENCE_T_H -#define TAO_SEQUENCE_T_H - -#include /**/ "ace/pre.h" - -#include "tao/Sequence.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Objref_VarOut_T.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_Unbounded_Sequence - * - * @brief Parametrized implementation of IDL unbounded sequences. - * - * This class completes the implementation for TAO_Base_Sequence - * for the unbounded case. - */ -template <typename T> -class TAO_Unbounded_Sequence : public TAO_Unbounded_Base_Sequence -{ -public: - // = Initialization and termination methods. - - /// Default constructor. - TAO_Unbounded_Sequence (void); - - /// Constructor using a maximum length value. - TAO_Unbounded_Sequence (CORBA::ULong max); - - /** - * Constructor using the data and memory management flag. Memory - * *must* be allocated using the ::allocbuf static method, since in - * the future this classes may use a global ACE_Allocator. - */ - TAO_Unbounded_Sequence (CORBA::ULong max, - CORBA::ULong length, - T * data, - CORBA::Boolean release = 0); - - /// Copy constructor. - TAO_Unbounded_Sequence (const TAO_Unbounded_Sequence<T> &); - - /// Assignment operator. - TAO_Unbounded_Sequence<T> & operator= (const TAO_Unbounded_Sequence<T> &); - - /// Dtor. - ~TAO_Unbounded_Sequence (void); - - // = Accessors. - - /// operator [] - T & operator[] (CORBA::ULong); - - /// operator [] - const T & operator[] (CORBA::ULong) const; - - // = Static operations. - - /// Allocate storage for the sequence. - static T * allocbuf (CORBA::ULong); - - /// Free the sequence. - static void freebuf (T *); - - - /// Implement the TAO_Base_Sequence methods (see Sequence.h) - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); - - // = orbos/98-01-11 proposed extensions. - /** - * Allows read-write access to the underlying buffer. If <orphan> - * is FALSE the sequence returns a pointer to its buffer, allocating - * one if it has not yet done so. The number of elements in the - * buffer can be determined from the sequence <length> accessor. - * - * If the <orphan> argument to <get_buffer> is FALSE, the sequence - * maintains ownership of the underlying buffer. Elements in the - * returned buffer may be directly replaced by the caller. For - * sequences of strings, wide strings, and object references, the - * caller must use the sequence <release> accessor to determine - * whether elements should be freed (using <string_free>, - * <wstring_free>, or <CORBA::release> for strings, wide straings, - * and object references, respective) before being directly assigned - * to. - * - * If the <orphan> argument to <get_buffer> is TRUE, the sequence - * yields ownership of the buffer to the caller. If <orphan> is - * TRUE and the sequence does not own its buffer (i.e., its - * <release> flag is FALSE), the return value is a null pointer. If - * the buffer is taken from the sequence using this form of - * <get_buffer>, the sequence reverts to the same state it would - * have if constructed using its default constructor. The caller - * becomes responsible for eventually freeing each element of the - * returned buffer (for strings, wide string, and object - * references), and then freeing the returned buffer itself using - * <freebuf>. - */ - T * get_buffer (CORBA::Boolean orphan = 0); - - /** - * This function allows read-only access to the sequence buffer. - * The sequence returns its buffer, allocating one of one has not - * yet been allocated. No direct modification of the returned - * buffer by the caller is permitted. - */ - const T * get_buffer (void) const; - - /** - * Allows the buffer underlying a sequence to be replaced. The - * parameters to <replace> are identical in type, order, and purpose - * to those for the <T *data> constructor for the sequence. - */ - void replace (CORBA::ULong max, - CORBA::ULong length, - T * data, - CORBA::Boolean release = 0); -}; - -// ************************************************************* - -/** - * @class TAO_Bounded_Sequence - * - * @brief Parametric bounded sequence. - * - * This class completes the implementation for TAO_Base_Sequence - * for the bounded case. - */ -template <typename T, size_t MAX> -class TAO_Bounded_Sequence : public TAO_Bounded_Base_Sequence -{ -public: - // = Initialization and termination methods. - /// Default constructor. - TAO_Bounded_Sequence (void); - - /// Constructor using the data and memory management flag. - TAO_Bounded_Sequence (CORBA::ULong length, - T *data, - CORBA::Boolean release=0); - - /// Copy constructor. - TAO_Bounded_Sequence (const TAO_Bounded_Sequence<T,MAX> &); - - /// Assignment operator. - TAO_Bounded_Sequence<T,MAX> & operator= ( - const TAO_Bounded_Sequence<T,MAX> & - ); - - /// Dtor. - ~TAO_Bounded_Sequence (void); - - // = Accessors. - /// operator [] - T & operator[] (CORBA::ULong); - - /// operator [] - const T & operator[] (CORBA::ULong) const; - - // = Static operations. - - /// Allocate storage for the sequence. - static T * allocbuf (CORBA::ULong); - - /// Free the sequence. - static void freebuf (T *); - - /// allocate a buffer of the requested length. The buffer is allocated for - /// the right type - virtual void _allocate_buffer (CORBA::ULong length); - - /// deallocate the buffer - virtual void _deallocate_buffer (void); - - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); - - // = orbos/98-01-11 proposed extensions. - /** - * Allows read-write access to the underlying buffer. If <orphan> - * is FALSE the sequence returns a pointer to its buffer, allocating - * one if it has not yet done so. The size of the returned buffer - * is equal to the sequence bound, which can be determined with the - * <maximum> accessor. The number of elements in the buffer can be - * determined from the sequence <length> accessor. - * - * If the <orphan> argument to <get_buffer> is FALSE, the sequence - * maintains ownership of the underlying buffer. Elements in the - * returned buffer may be directly replaced by the caller. For - * sequences of strings, wide strings, and object references, the - * caller must use the sequence <release> accessor to determine - * whether elements should be freed (using <string_free>, - * <wstring_free>, or <CORBA::release> for strings, wide straings, - * and object references, respective) before being directly assigned - * to. - * - * If the <orphan> argument to <get_buffer> is TRUE, the sequence - * yields ownership of the buffer to the caller. If <orphan> is - * TRUE and the sequence does not own its buffer (i.e., its - * <release> flag is FALSE), the return value is a null pointer. If - * the buffer is taken from the sequence using this form of - * <get_buffer>, the sequence reverts to the same state it would - * have if constructed using its default constructor. The caller - * becomes responsible for eventually freeing each element of the - * returned buffer (for strings, wide string, and object - * references), and then freeing the returned buffer itself using - * <freebuf>. - */ - T * get_buffer (CORBA::Boolean orphan = 0); - - /** - * This function allows read-only access to the sequence buffer. - * The sequence returns its buffer, allocating one of one has not - * yet been allocated. No direct modification of the returned - * buffer by the caller is permitted. - */ - const T * get_buffer (void) const; - - /** - * Allows the buffer underlying a sequence to be replaced. The - * parameters to <replace> are identical in type, order, and purpose - * to those for the <T *data> constructor for the sequence. - */ - void replace (CORBA::ULong max, - CORBA::ULong length, - T * data, - CORBA::Boolean release = 0); -}; - -// ************************************************************* - -template<typename T, typename T_var> - class TAO_Unbounded_Object_Sequence; -template<class T> class TAO_Unbounded_Pseudo_Sequence; -template<typename T, typename T_var, size_t MAX> - class TAO_Bounded_Object_Sequence; -template<size_t MAX> class TAO_Bounded_String_Sequence; - - /** - * @class TAO_Object_Manager - * - * @brief Manager for Objects. - * - * The mapping for sequences of objects (and other pseudo objects) - * requires an auxiliar class or <Manager> to handle the reference - * count on the object, (a kind of smart pointer). - * The main difference with respect to T_var classes is that - * automatic release is not controlled on a per-item basis, but - * for the sequence as a whole. - * Further the class must implement "transparent" assignment into - * the sequence, for instance, operator[] returns a managed - * object, but: - * object_sequence[i] = foo; - * must change the state of the sequence. - * This class implements the generic object manager and is used to - * instantiate the proper sequence types. - * = NOTES - * It has been proposed that the class should be parametric on - * both T and T_ptr, IMHO this is no necesary: though the IDL spec - * says that T_ptr *could* map to a type different to T* in the - * particular case of TAO it does map to <T*>. - */ -template<typename T, typename T_var> -class TAO_Object_Manager -{ -public: - // @@ Use partial template specialization here to give access only - // to the right kind of sequence. - // friend template<CORBA::ULong MAX> - // class TAO_Bounded_Object_Sequence<T,MAX>; - - // = Initialization and termination methods. - /** - * Copy constructor, the semantics are non-trivial: - * + The referenced element is duplicated or not according to the - * release value on the <rhs>. - * + In any case a new reference to the same object is created. - */ - TAO_Object_Manager (const TAO_Object_Manager<T,T_var> & rhs); - - /** - * Constructor from address of an element, it should be private and - * only TAO_*_Object_Sequence would use it, but we have some - * problems with friendship and templates. - */ - TAO_Object_Manager (T **, CORBA::Boolean release); - - /// Destructor, only releases the object if <release_> is true. - ~TAO_Object_Manager (void); - - /** - * Assignment from another managed type, only release if - * <this->release_> is true. - * @@ TODO what happens if rhs.release_ is true an this->relase_ is - * false? - */ - TAO_Object_Manager<T,T_var> & operator= ( - const TAO_Object_Manager<T,T_var> & rhs - ); - - /// Assignment from T *. - TAO_Object_Manager<T,T_var> & operator= (T *); - - /// Assignment from T_life. - TAO_Object_Manager<T,T_var> & operator= (const T_var &); - - /// Return pointer. - T * operator-> (void) const; - - /// Cast (read-only). - operator const T * () const; - - /// Cast. - operator T *& (); - - /// Cast (read-only) so that assignment from a structured - /// type to a T_var will make a copy. - operator const T_var () const; - - /// for in parameter. - T * in (void) const; - - /// for inout parameter. - T *& inout (void); - - /// for out parameter. - T *& out (void); - - /// for return type - T * _retn (void); - -private: - /// data member, notice that it is a pointer, to implement the - /// reference behavior for assignment. - T ** ptr_; - - /// release flag based on parent's flag - CORBA::Boolean release_; -}; - -// ************************************************************* - - /** - * @class TAO_Pseudo_Object_Manager - * - * @brief Manager for Pseudo Objects. - * - */ -template<typename T> -class TAO_Pseudo_Object_Manager -{ - friend class TAO_Unbounded_Pseudo_Sequence<T>; -public: - // @@ Use partial template specialization here to give access only - // to the right kind of sequence. - // friend template<CORBA::ULong MAX> - // class TAO_Bounded_Object_Sequence<T,MAX>; - - // = Initialization and termination methods. - /** - * Copy constructor, the semantics are non-trivial: - * + The referenced element is duplicated or not according to the - * release value on the <rhs>. - * + In any case a new reference to the same object is created. - */ - TAO_Pseudo_Object_Manager (const TAO_Pseudo_Object_Manager<T> & rhs); - - /** - * Constructor from address of an element, it should be private and - * only TAO_*_Object_Sequence would use it, but we have some - * problems with friendship and templates. - */ - TAO_Pseudo_Object_Manager (T **, CORBA::Boolean release); - - /// Destructor, only releases the object if <release_> is true. - ~TAO_Pseudo_Object_Manager (void); - - /** - * Assignment from another managed type, only release if - * <this->release_> is true. - * @@ TODO what happens if rhs.release_ is true an this->relase_ is - * false? - */ - TAO_Pseudo_Object_Manager<T> & operator= ( - const TAO_Pseudo_Object_Manager<T> & rhs - ); - - /// Assignment from T *. - TAO_Pseudo_Object_Manager<T> & operator= (T *); - - /// Workaround for MSVC 6. - typedef typename T::_var_type T_var_type; - - /// Assignment from T_var. - TAO_Pseudo_Object_Manager<T> & operator= (const T_var_type &); - - /// Return pointer. - T * operator-> (void) const; - - /// Cast (read-only). - operator const T * () const; - - /// Cast. - operator T *& (); - - /// for in parameter. - T * in (void) const; - - /// for inout parameter. - T *& inout (void); - - /// for out parameter. - T *& out (void); - - /// for return type - T * _retn (void); - -private: - /// data member, notice that it is a pointer, to implement the - /// reference behavior for assignment. - T ** ptr_; - - /// release flag based on parent's flag - CORBA::Boolean release_; -}; - -// ************************************************************* - -/** - * @class TAO_Unbounded_Object_Sequence - * - * @brief Parametric sequence for types that require managers. - * - * Some IDL types require that sequences on them have a "manager" - * class, in charge of handling the object lifetime, examples are - * pseudo objects, object references, valuetypes, and strings. - */ -template<typename T, typename T_var> -class TAO_Unbounded_Object_Sequence : public TAO_Unbounded_Base_Sequence -{ - - // = SPEC - // 16.8 Mapping for Structured Types - // The mapping for struct, union, and sequence (but not array) is a - // C++ struct or class with a default constructor, a copy - // constructor, an assignment operator, and a destructor. - // -public: - // = Initialization and termination methods. - - /** - * {orbos/97-05-15:16.8} - * The default constructor initializes object reference members to - * appropriately typed nil object references and string members to - * NULL; all other members are initialized via their default - * constructors. - * - * {orbos/97-05-15:16.11} - * For both bounded and unbounded sequences, the default constructor - * (as shown in the example above) sets the sequence length equal to - * 0. - */ - TAO_Unbounded_Object_Sequence (void); - - /** - * Unbounded sequences provide a constructor that allows only the - * initial value of the maximum length to be set (the ``maximum - * constructor'' shown in the example above). This allows - * applications to control how much buffer space is initially - * allocated by the sequence. This constructor also sets the length - * to 0 and the release flag to TRUE. - */ - TAO_Unbounded_Object_Sequence (CORBA::ULong max); - - /** - * The ``T *data'' constructor (as shown in the example above) - * allows the length and contents of a bounded or unbounded sequence - * to be set. For unbounded sequences, it also allows the initial - * value of the maximum length to be set. For this constructor, - * ownership of the contents vector is determined by the release - * parameter---FALSE means the caller owns the storage, while TRUE - * means that the sequence assumes ownership of the storage. - * If release is TRUE, the contents vector must have been allocated - * using the sequence allocbuf function, and the sequence will pass - * it to freebuf when finished with it. - */ - TAO_Unbounded_Object_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - T ** data, - CORBA::Boolean release = 0); - - /** - * The copy constructor performs a deep copy from the existing - * structure to create a new structure, including calling _duplicate - * on all object reference members and performing the necessary - * heap allocations for all string members. - * - * The copy constructor creates a new sequence with the same maximum - * and length as the given sequence, copies each of its current - * elements (items zero through length-1), and sets the release - * flag to TRUE. - */ - TAO_Unbounded_Object_Sequence ( - const TAO_Unbounded_Object_Sequence<T,T_var> & - ); - - /// The destructor releases all object reference memebrs and frees - /// all string members. - ~TAO_Unbounded_Object_Sequence (void); - - /** - * The assignment operator first releases all object reference - * members and frees all string members, and then performs a - * deepcopy to create a new structure. - * - * The assignment operator deepcopies its parameter, releasing old - * storage if necessary. It behaves as if the original sequence is - * destroyed via its destructor and then the source sequence copied - * using the copy constructor. If release=TRUE, the destructor - * destroys each of the current elements (items zero through - * length--1). For an unbounded sequence, if a reallocation is - * necessary due to a change in the length and the sequence was - * created using the release=TRUE parameter in its constructor, the - * sequence will deallocate the old storage. If release is FALSE - * under these circumstances, old storage will not be freed before - * the reallocation is performed. After reallocation, the release - * flag is always set to TRUE. - */ - TAO_Unbounded_Object_Sequence<T,T_var> &operator= ( - const TAO_Unbounded_Object_Sequence <T,T_var> & - ); - - /// read-write accessor - TAO_Object_Manager<T,T_var> operator[] ( - CORBA::ULong slot - ) const; - - /** - * The allocbuf function allocates a vector of T elements that can - * be passed to the T *data constructor. The length of the vector is - * given by the nelems function argument. The allocbuf function - * initializes each element using its default constructor, except - * for strings, which are initialized to null pointers, and object - * references, which are initialized to suitably typed nil object - * references. A null pointer is returned if allocbuf for some - * reason cannot allocate the requested vector. Vectors allocated by - * allocbuf should be freed using the freebuf function. - */ - static T ** allocbuf (CORBA::ULong); - - /** - * The freebuf function ensures that the destructor for each element - * is called before the buffer is destroyed, except for string - * elements, which are freed using string_free(), and object - * reference elements, which are freed using release(). The freebuf - * function will ignore null pointers passed to it. - */ - static void freebuf (T **); - - // The Base_Sequence functions, please see "tao/Sequence.h" - /// No default to workaround egcs problem with templates and - /// namespaces - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); -}; - -// ************************************************************* - -/** - * @class TAO_Bounded_Object_Sequence - * - * @brief Parametric sequence for types that require managers. - * - * Please see the documentation for the unbounded case. - */ -template<typename T, typename T_var, size_t MAX> -class TAO_Bounded_Object_Sequence : public TAO_Bounded_Base_Sequence -{ -public: - // = Initialization and termination methods. - - /** - * For bounded sequences, the maximum length is part of the type and - * cannot be set or modified, while for unbounded sequences, the - * default constructor also sets the maximum length to 0. The - * default constructor for a bounded sequence always allocates a - * contents vector, so it always sets the release flag to TRUE. - */ - TAO_Bounded_Object_Sequence (void); - - /// Constructor from data. - TAO_Bounded_Object_Sequence (CORBA::ULong length, - T ** value, - CORBA::Boolean release = 0); - - /// Copy constructor. - TAO_Bounded_Object_Sequence ( - const TAO_Bounded_Object_Sequence<T,T_var,MAX> & - ); - - /// destructor - ~TAO_Bounded_Object_Sequence (void); - - /// Assignment from another Bounded sequence. - TAO_Bounded_Object_Sequence<T,T_var,MAX> &operator= ( - const TAO_Bounded_Object_Sequence<T,T_var,MAX> & - ); - - /// Read-write accessor. - TAO_Object_Manager<T,T_var> operator[] ( - CORBA::ULong slot - ) const; - - /// Allocate storage for a sequence.. - static T ** allocbuf (CORBA::ULong length); - - /// Free a buffer allocated by allocbuf() and release each element on - /// it. - static void freebuf (T ** buffer); - - // The Base_Sequence functions, please see "tao/sequence.h" - /// No default to workaround egcs problem with templates and - /// namespaces - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); -}; - -// ************************************************************* - -/** - * @class TAO_Unbounded_Pseudo_Sequence - * - * @brief Parametric sequence for pseudo objects. - * - * Some IDL types (including pseudo objects) require that - * sequences on them have a "manager" class, in charge of handling - * the object lifetime. - * This parametric class implements those sequences. In general - * the sequence is similar to Object_Sequente, except for some - * TAO internal details. The complete documentation of each method - * is provided in TAO_Unbounded_Object_Sequece - */ -template<typename T> -class TAO_Unbounded_Pseudo_Sequence : public TAO_Unbounded_Base_Sequence -{ -public: - // = Initialization and termination methods. - - /// default ctor - TAO_Unbounded_Pseudo_Sequence (void); - - /// Constructor with a "hint" for the maximum capacity. - TAO_Unbounded_Pseudo_Sequence (CORBA::ULong max); - - /// Constructor with a given buffer. - TAO_Unbounded_Pseudo_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - T ** data, - CORBA::Boolean release = 0); - - /// Copy ctor, deep copies. - TAO_Unbounded_Pseudo_Sequence ( - const TAO_Unbounded_Pseudo_Sequence<T> & - ); - - /// dtor releases all the contained elements. - ~TAO_Unbounded_Pseudo_Sequence (void); - - /** - * The assignment operator first releases all object reference - * members and frees all string members, and then performs a - * deepcopy to create a new structure. - */ - TAO_Unbounded_Pseudo_Sequence<T> & operator= ( - const TAO_Unbounded_Pseudo_Sequence <T> & - ); - - /// read-write accessor - TAO_Pseudo_Object_Manager<T> operator[] (CORBA::ULong slot) const; - - /// The allocbuf function allocates a vector of T elements that can - /// be passed to the T *data constructor. - static T ** allocbuf (CORBA::ULong); - - /// Release all the elements. - static void freebuf (T **); - - // The Base_Sequence functions, please see "tao/Sequence.h" - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); -}; - -// ************************************************************* - -/** - * @class TAO_Bounded_Pseudo_Sequence - * - * @brief Bounded version of TAO_Unbounded_Pseudo_Sequence. - * - * Please see the documentation for the unbounded case. - */ -template<typename T, size_t MAX> -class TAO_Bounded_Pseudo_Sequence : public TAO_Bounded_Base_Sequence -{ -public: - // = Initialization and termination methods. - - /// default ctor. - TAO_Bounded_Pseudo_Sequence (void); - - /// Constructor from data. - TAO_Bounded_Pseudo_Sequence (CORBA::ULong length, - T ** value, - CORBA::Boolean release = 0); - - /// Copy constructor. - TAO_Bounded_Pseudo_Sequence ( - const TAO_Bounded_Pseudo_Sequence<T,MAX> & - ); - - /// destructor - ~TAO_Bounded_Pseudo_Sequence (void); - - /// Assignment from another Bounded sequence. - TAO_Bounded_Pseudo_Sequence & operator= ( - const TAO_Bounded_Pseudo_Sequence<T,MAX> & - ); - - /// Read-write accessor. - TAO_Pseudo_Object_Manager<T> operator[] (CORBA::ULong slot) const; - - /// Allocate storage for a sequence.. - static T ** allocbuf (CORBA::ULong length); - - /// Free a buffer allocated by allocbuf() and release each element on - /// it. - static void freebuf (T ** buffer); - - // The Base_Sequence functions, please see "tao/sequence.h" - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); -}; - -// ************************************************************* - -/** - * @class TAO_Unbounded_Array_Sequence - * - * @brief Parametric sequence for arrays. - * - * The IDL mapping for arrays includes some unique allocation, - * deallocation, and copying functions, and precludes - * direct assignment of one array to another. Also, the - * Any and CDR operators use a special class derived from - * the array. For these reasons, we use a special class for - * sequences of arrays. - */ -template <typename T, typename T_slice, typename TAG> -class TAO_Unbounded_Array_Sequence : public TAO_Unbounded_Base_Sequence -{ -public: - // = Initialization and termination methods. - - /// default ctor - TAO_Unbounded_Array_Sequence (void); - - /// Constructor with a "hint" for the maximum capacity. - TAO_Unbounded_Array_Sequence (CORBA::ULong max); - - /// Constructor with a given buffer. - TAO_Unbounded_Array_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - T * data, - CORBA::Boolean release = 0); - - /// Copy ctor, deep copies. - TAO_Unbounded_Array_Sequence ( - const TAO_Unbounded_Array_Sequence<T,T_slice,TAG> & - ); - - /// dtor releases all the contained elements. - ~TAO_Unbounded_Array_Sequence (void); - - /** - * The assignment operator first releases all object reference - * members and frees all string members, and then performs a - * deepcopy to create a new structure. - */ - TAO_Unbounded_Array_Sequence<T,T_slice,TAG> & operator= ( - const TAO_Unbounded_Array_Sequence <T,T_slice,TAG> & - ); - - // = Accessors. - /// operator [] - T & operator[] (CORBA::ULong); - - /// operator [] - const T & operator[] (CORBA::ULong) const; - - /// The allocbuf function allocates a vector of T elements that can - /// be passed to the T *data constructor. - static T * allocbuf (CORBA::ULong); - - /// Release all the elements. - static void freebuf (T *); - - /// allocate a buffer of the requested length. The buffer is allocated for the - /// right type - virtual void _allocate_buffer (CORBA::ULong length); - - /// deallocate the buffer - virtual void _deallocate_buffer (void); - - // = orbos/98-01-11 proposed extensions. - /** - * Allows read-write access to the underlying buffer. If <orphan> - * is FALSE the sequence returns a pointer to its buffer, allocating - * one if it has not yet done so. The number of elements in the - * buffer can be determined from the sequence <length> accessor. - * - * If the <orphan> argument to <get_buffer> is FALSE, the sequence - * maintains ownership of the underlying buffer. Elements in the - * returned buffer may be directly replaced by the caller. - * - * If the <orphan> argument to <get_buffer> is TRUE, the sequence - * yields ownership of the buffer to the caller. If <orphan> is - * TRUE and the sequence does not own its buffer (i.e., its - * <release> flag is FALSE), the return value is a null pointer. If - * the buffer is taken from the sequence using this form of - * <get_buffer>, the sequence reverts to the same state it would - * have if constructed using its default constructor. The caller - * becomes responsible for eventually freeing each element of the - * returned buffer (for strings, wide string, and object - * references), and then freeing the returned buffer itself using - * <freebuf>. - */ - T * get_buffer (CORBA::Boolean orphan = 0); - - /** - * This function allows read-only access to the sequence buffer. - * The sequence returns its buffer, allocating one of one has not - * yet been allocated. No direct modification of the returned - * buffer by the caller is permitted. - */ - const T * get_buffer (void) const; - - /** - * Allows the buffer underlying a sequence to be replaced. The - * parameters to <replace> are identical in type, order, and purpose - * to those for the <T *data> constructor for the sequence. - */ - void replace (CORBA::ULong max, - CORBA::ULong length, - T * data, - CORBA::Boolean release = 0); -}; - -// ************************************************************* - -/** - * @class TAO_Bounded_Array_Sequence - * - * @brief Bounded version of TAO_Unbounded_Array_Sequence. - * - * Please see the documentation for the unbounded case. - */ -template <typename T, typename T_slice, typename TAG, size_t MAX> -class TAO_Bounded_Array_Sequence : public TAO_Bounded_Base_Sequence -{ -public: - // = Initialization and termination methods. - - /// default ctor. - TAO_Bounded_Array_Sequence (void); - - /// Constructor from data. - TAO_Bounded_Array_Sequence (CORBA::ULong length, - T *value, - CORBA::Boolean release = 0); - - /// Copy constructor. - TAO_Bounded_Array_Sequence ( - const TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX> & - ); - - /// destructor - ~TAO_Bounded_Array_Sequence (void); - - /// Assignment from another Bounded sequence. - TAO_Bounded_Array_Sequence &operator= ( - const TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX> & - ); - - // = Accessors. - /// operator [] - T &operator[] (CORBA::ULong); - - /// operator [] - const T &operator[] (CORBA::ULong) const; - - /// Allocate storage for a sequence.. - static T * allocbuf (CORBA::ULong length); - - /// Free a buffer allocated by allocbuf() and release each element on - /// it. - static void freebuf (T * buffer); - - /// allocate a buffer of the requested length. The buffer is allocated for the - /// right type - virtual void _allocate_buffer (CORBA::ULong length); - - /// deallocate the buffer - virtual void _deallocate_buffer (void); - - // = orbos/98-01-11 proposed extensions. - /** - * Allows read-write access to the underlying buffer. If <orphan> - * is FALSE the sequence returns a pointer to its buffer, allocating - * one if it has not yet done so. The number of elements in the - * buffer can be determined from the sequence <length> accessor. - * - * If the <orphan> argument to <get_buffer> is FALSE, the sequence - * maintains ownership of the underlying buffer. Elements in the - * returned buffer may be directly replaced by the caller. - * - * If the <orphan> argument to <get_buffer> is TRUE, the sequence - * yields ownership of the buffer to the caller. If <orphan> is - * TRUE and the sequence does not own its buffer (i.e., its - * <release> flag is FALSE), the return value is a null pointer. If - * the buffer is taken from the sequence using this form of - * <get_buffer>, the sequence reverts to the same state it would - * have if constructed using its default constructor. The caller - * becomes responsible for eventually freeing each element of the - * returned buffer (for strings, wide string, and object - * references), and then freeing the returned buffer itself using - * <freebuf>. - */ - T * get_buffer (CORBA::Boolean orphan = 0); - - /** - * This function allows read-only access to the sequence buffer. - * The sequence returns its buffer, allocating one of one has not - * yet been allocated. No direct modification of the returned - * buffer by the caller is permitted. - */ - const T * get_buffer (void) const; - - /** - * Allows the buffer underlying a sequence to be replaced. The - * parameters to <replace> are identical in type, order, and purpose - * to those for the <T *data> constructor for the sequence. - */ - void replace (CORBA::ULong max, - CORBA::ULong length, - T *data, - CORBA::Boolean release = 0); -}; - -// ************************************************************* - -/** - * @class TAO_Bounded_String_Sequence - * - * @brief Bounded sequence of strings. - * - * As its unbounded counterpart it duplicates and releases strings - * (via CORBA::string_dup and CORBA::string_free) under the - * control of a per sequence flag, but the capacity of the - * sequence is bound on the type. - */ -template<size_t MAX> -class TAO_Bounded_String_Sequence : public TAO_Bounded_Base_Sequence -{ -public: - /** - * {SPEC} - * For bounded sequences, the maximum length is part of the type and - * cannot be set or modified, while for unbounded sequences, the - * default constructor also sets the maximum length to 0. The - * default constructor for a bounded sequence always allocates a - * contents vector, so it always sets the release flag to TRUE. - */ - TAO_Bounded_String_Sequence (void); - - /** - * {SPEC} - * The ``T *data'' constructor (as shown in the example above) - * allows the length and contents of a bounded or unbounded sequence - * to be set. For unbounded sequences, it also allows the initial - * value of the maximum length to be set. For this constructor, - * ownership of the contents vector is determined by the release - * parameter---FALSE means the caller owns the storage, while TRUE - * means that the sequence assumes ownership of the storage. - * - * If release is TRUE, the contents vector must have been allocated - * using the sequence allocbuf function, and the sequence will pass - * it to freebuf when finished with it. - */ - TAO_Bounded_String_Sequence (CORBA::ULong length, - char ** value, - CORBA::Boolean release = 0); - - /** - * {SPEC} - * Management Functions'' on page 16. The copy constructor creates a - * new sequence with the same maximum and length as the given - * sequence, copies each of its current elements (items zero through - * length--1), and sets the release flag to TRUE. - */ - TAO_Bounded_String_Sequence (const TAO_Bounded_String_Sequence<MAX> &); - - /** - * {SPEC} - * The assignment operator deep copies its parameter, releasing - * old storage if necessary. It behaves as if the original sequence - * is destroyed via its destructor and then the source sequence - * copied using the copy constructor. - */ - TAO_Bounded_String_Sequence & operator= ( - const TAO_Bounded_String_Sequence<MAX> & - ); - - /** - * {SPEC} - * If release=TRUE, the destructor destroys each of the current - * elements (items zero through length-1). - */ - ~TAO_Bounded_String_Sequence (void); - - /// read-write accessor - TAO_SeqElem_String_Manager operator[] (CORBA::ULong slot) const; - - /** - * {SPEC} - * The allocbuf function allocates a vector of T elements that can - * be passed to the T *data constructor. The length of the vector is - * given by the nelems function argument. The allocbuf function - * initializes each element using its default constructor, except - * for strings, which are initialized to null pointers, and object - * references, which are initialized to suitably typed nil object - * references. A null pointer is returned if allocbuf for some - * reason cannot allocate the requested vector. Vectors allocated by - * allocbuf should be freed using the freebuf function. - */ - static char ** allocbuf (CORBA::ULong length); - - /** - * {SPEC} - * The freebuf function ensures that the destructor for each element - * is called before the buffer is destroyed, except for string - * elements, which are freed using string_free(), and object - * reference elements, which are freed using release(). The freebuf - * function will ignore null pointers passed to it. - */ - static void freebuf (char ** buffer); - - // Functions to create, destroy, and adjust the underlying buffer. - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); - - // Parameters work the same as in constructor of the same signature. - void replace (CORBA::ULong length, - char ** value, - CORBA::Boolean release = 0); -}; - -// ************************************************************* - -/** - * @class TAO_Bounded_WString_Sequence - * - * @brief Bounded sequence of wstrings. - * - * As its unbounded counterpart it duplicates and releases strings - * (via CORBA::wstring_dup and CORBA::wstring_free) under the - * control of a per sequence flag, but the capacity of the - * sequence is bound on the type. - */ -template<size_t MAX> -class TAO_Bounded_WString_Sequence : public TAO_Bounded_Base_Sequence -{ -public: - /** - * {SPEC} - * For bounded sequences, the maximum length is part of the type and - * cannot be set or modified, while for unbounded sequences, the - * default constructor also sets the maximum length to 0. The - * default constructor for a bounded sequence always allocates a - * contents vector, so it always sets the release flag to TRUE. - */ - TAO_Bounded_WString_Sequence (void); - - /** - * {SPEC} - * The ``T *data'' constructor (as shown in the example above) - * allows the length and contents of a bounded or unbounded sequence - * to be set. For unbounded sequences, it also allows the initial - * value of the maximum length to be set. For this constructor, - * ownership of the contents vector is determined by the release - * parameter---FALSE means the caller owns the storage, while TRUE - * means that the sequence assumes ownership of the storage. - * - * If release is TRUE, the contents vector must have been allocated - * using the sequence allocbuf function, and the sequence will pass - * it to freebuf when finished with it. - */ - TAO_Bounded_WString_Sequence (CORBA::ULong length, - CORBA::WChar ** value, - CORBA::Boolean release = 0); - - /** - * {SPEC} - * Management Functions'' on page 16. The copy constructor creates a - * new sequence with the same maximum and length as the given - * sequence, copies each of its current elements (items zero through - * length--1), and sets the release flag to TRUE. - */ - TAO_Bounded_WString_Sequence (const TAO_Bounded_WString_Sequence<MAX> &); - - /** - * {SPEC} - * The assignment operator deep copies its parameter, releasing - * old storage if necessary. It behaves as if the original sequence - * is destroyed via its destructor and then the source sequence - * copied using the copy constructor. - */ - TAO_Bounded_WString_Sequence &operator= ( - const TAO_Bounded_WString_Sequence<MAX> & - ); - - /** - * {SPEC} - * If release=TRUE, the destructor destroys each of the current - * elements (items zero through length-1). - */ - ~TAO_Bounded_WString_Sequence (void); - - /// read-write accessor - TAO_SeqElem_WString_Manager operator[] (CORBA::ULong slot) const; - - /** - * {SPEC} - * The allocbuf function allocates a vector of T elements that can - * be passed to the T *data constructor. The length of the vector is - * given by the nelems function argument. The allocbuf function - * initializes each element using its default constructor, except - * for (w)strings, which are initialized to null pointers, and object - * references, which are initialized to suitably typed nil object - * references. A null pointer is returned if allocbuf for some - * reason cannot allocate the requested vector. Vectors allocated by - * allocbuf should be freed using the freebuf function. - */ - static CORBA::WChar ** allocbuf (CORBA::ULong length); - - /** - * {SPEC} - * The freebuf function ensures that the destructor for each element - * is called before the buffer is destroyed, except for string - * elements, which are freed using wstring_free(), and object - * reference elements, which are freed using release(). The freebuf - * function will ignore null pointers passed to it. - */ - static void freebuf (CORBA::WChar ** buffer); - - // Functions to create, destroy, and adjust the underlying buffer. - virtual void _allocate_buffer (CORBA::ULong length); - virtual void _deallocate_buffer (void); - virtual void _shrink_buffer (CORBA::ULong new_length, - CORBA::ULong old_length); - - // Parameters work the same as in constructor of the same signature. - void replace (CORBA::ULong length, - CORBA::WChar ** value, - CORBA::Boolean release = 0); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -// ************************************************************* - -#if defined (__ACE_INLINE__) -#include "tao/Sequence_T.i" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Sequence_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Sequence_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* TAO_SEQUENCE_T_H */ +// $Id$ + +#include "tao/Unbounded_Octet_Sequence_T.h" +#include "tao/Unbounded_Value_Sequence_T.h" +#include "tao/Unbounded_Wstring_Sequence_T.h" +#include "tao/Unbounded_String_Sequence_T.h" +#include "tao/Unbounded_Object_Reference_Sequence_T.h" +#include "tao/Unbounded_Sequence_CDR_T.h" +#include "tao/Unbounded_Array_Sequence_T.h" +#include "tao/Bounded_Value_Sequence_T.h" +#include "tao/Bounded_Wstring_Sequence_T.h" +#include "tao/Bounded_String_Sequence_T.h" +#include "tao/Bounded_Object_Reference_Sequence_T.h" +#include "tao/Bounded_Sequence_CDR_T.h" +#include "tao/Bounded_Array_Sequence_T.h" diff --git a/TAO/tao/Sequence_T.i b/TAO/tao/Sequence_T.i deleted file mode 100644 index 960c9ae687a..00000000000 --- a/TAO/tao/Sequence_T.i +++ /dev/null @@ -1,607 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// *************************************************** -// Operations on the generic unbounded sequence class. -// *************************************************** - -template <typename T> -ACE_INLINE -T * -TAO_Unbounded_Sequence<T>::allocbuf (CORBA::ULong size) -{ - return new T[size]; -} - -template <typename T> -ACE_INLINE -void -TAO_Unbounded_Sequence<T>::freebuf (T *buffer) -{ - delete [] buffer; -} - -template <typename T> -ACE_INLINE -TAO_Unbounded_Sequence<T>::TAO_Unbounded_Sequence (void) -{ -} - -template <typename T> -ACE_INLINE -TAO_Unbounded_Sequence<T>::TAO_Unbounded_Sequence (CORBA::ULong maximum) - : TAO_Unbounded_Base_Sequence (maximum, - TAO_Unbounded_Sequence<T>::allocbuf (maximum)) -{ -} - -template <typename T> -ACE_INLINE -TAO_Unbounded_Sequence<T>::TAO_Unbounded_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - T * data, - CORBA::Boolean release) - : TAO_Unbounded_Base_Sequence (maximum, length, data, release) -{ -} - -template <typename T> -ACE_INLINE -const T * -TAO_Unbounded_Sequence<T>::get_buffer (void) const -{ - return reinterpret_cast<const T * ACE_CAST_CONST> (this->buffer_); -} - -// *************************************************** -// operations on the generic Bounded sequence class -// *************************************************** - -template <typename T, size_t MAX> -ACE_INLINE -T * -TAO_Bounded_Sequence<T, MAX>::allocbuf (CORBA::ULong) -{ - return new T[MAX]; -} - -template <typename T, size_t MAX> -ACE_INLINE -void -TAO_Bounded_Sequence<T, MAX>::freebuf (T * buffer) -{ - delete [] buffer; -} - -template <typename T, size_t MAX> -ACE_INLINE -TAO_Bounded_Sequence<T, MAX>::TAO_Bounded_Sequence (void) -{ - this->maximum_ = MAX; -} - -template <typename T, size_t MAX> -ACE_INLINE -TAO_Bounded_Sequence<T, MAX>::TAO_Bounded_Sequence (CORBA::ULong length, - T * data, - CORBA::Boolean release) - : TAO_Bounded_Base_Sequence (MAX, length, data, release) -{ -} - -template <typename T, size_t MAX> -ACE_INLINE -const T * -TAO_Bounded_Sequence<T, MAX>::get_buffer (void) const -{ - return reinterpret_cast<const T * ACE_CAST_CONST> (this->buffer_); -} - -template <class T, size_t MAX> -ACE_INLINE -T & -TAO_Bounded_Sequence<T, MAX>::operator[] (CORBA::ULong i) -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - T * tmp = reinterpret_cast<T *> (this->buffer_); - return tmp[i]; -} - -template <class T, size_t MAX> -ACE_INLINE -const T & -TAO_Bounded_Sequence<T, MAX>::operator[] (CORBA::ULong i) const -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - const T * tmp = reinterpret_cast<const T * ACE_CAST_CONST> (this->buffer_); - return tmp[i]; -} - -// ************************************************************* -// Inline operations for class TAO_Object_Manager<T> -// ************************************************************* - -template <typename T, typename T_var> -ACE_INLINE -TAO_Object_Manager<T,T_var>::~TAO_Object_Manager (void) -{ -} - -template <typename T, typename T_var> -ACE_INLINE -TAO_Object_Manager<T,T_var>::TAO_Object_Manager ( - const TAO_Object_Manager<T,T_var> & rhs - ) - : ptr_ (rhs.ptr_), - release_ (rhs.release_) -{ -} - -template <typename T, typename T_var> -ACE_INLINE -TAO_Object_Manager<T,T_var>::TAO_Object_Manager ( - T ** buffer, - CORBA::Boolean release - ) - : ptr_ (buffer), - release_ (release) -{ -} - -template <typename T, typename T_var> -ACE_INLINE T * -TAO_Object_Manager<T,T_var>::operator-> (void) const -{ - return *this->ptr_; -} - -template <typename T, typename T_var> -ACE_INLINE -TAO_Object_Manager<T,T_var>::operator const T_var () const -{ - return TAO::Objref_Traits<T>::duplicate (*this->ptr_); -} - -template <typename T, typename T_var> -ACE_INLINE -TAO_Object_Manager<T,T_var>::operator const T *() const -{ - return *this->ptr_; -} - -template <typename T, typename T_var> -ACE_INLINE -TAO_Object_Manager<T,T_var>::operator T *&() -{ - return *this->ptr_; -} - -template <typename T, typename T_var> -ACE_INLINE -T * -TAO_Object_Manager<T,T_var>::in (void) const -{ - return *this->ptr_; -} - -template <typename T, typename T_var> -ACE_INLINE -T *& -TAO_Object_Manager<T,T_var>::inout (void) -{ - return *this->ptr_; -} - -// ************************************************************* -// Inline operations for class TAO_Pseudo_Object_Manager<T> -// ************************************************************* - -template <typename T> -ACE_INLINE -TAO_Pseudo_Object_Manager<T>::~TAO_Pseudo_Object_Manager (void) -{ -} - -template <typename T> -ACE_INLINE -TAO_Pseudo_Object_Manager<T>::TAO_Pseudo_Object_Manager ( - const TAO_Pseudo_Object_Manager<T> & rhs - ) - : ptr_ (rhs.ptr_), - release_ (rhs.release_) -{ -} - -template <typename T> -ACE_INLINE -TAO_Pseudo_Object_Manager<T>::TAO_Pseudo_Object_Manager( - T ** buffer, - CORBA::Boolean release - ) - : ptr_ (buffer), - release_ (release) -{ -} - -template <typename T> -ACE_INLINE -T * -TAO_Pseudo_Object_Manager<T>::operator-> (void) const -{ - return *this->ptr_; -} - -template <typename T> -ACE_INLINE -TAO_Pseudo_Object_Manager<T>::operator const T * () const -{ - return *this->ptr_; -} - -template <typename T> -ACE_INLINE -TAO_Pseudo_Object_Manager<T>::operator T *& () -{ - return *this->ptr_; -} - -template <typename T> -ACE_INLINE -T * -TAO_Pseudo_Object_Manager<T>::in (void) const -{ - return *this->ptr_; -} - -template <typename T> -ACE_INLINE -T *& -TAO_Pseudo_Object_Manager<T>::inout (void) -{ - return *this->ptr_; -} - -template <typename T> -ACE_INLINE -T *& -TAO_Pseudo_Object_Manager<T>::out (void) -{ - CORBA::release (*this->ptr_); - *this->ptr_ = T::_nil (); - return *this->ptr_; -} - -template <typename T> -ACE_INLINE -T * -TAO_Pseudo_Object_Manager<T>::_retn (void) -{ - T * temp = *this->ptr_; - *this->ptr_ = T::_nil (); - return temp; -} - -// ************************************************************* -// class TAO_Unbounded_Object_Sequence -// ************************************************************* - -template <typename T, typename T_var> -ACE_INLINE -TAO_Unbounded_Object_Sequence<T,T_var>::TAO_Unbounded_Object_Sequence (void) -{ -} - -template <typename T, typename T_var> -ACE_INLINE -TAO_Unbounded_Object_Sequence<T,T_var>::TAO_Unbounded_Object_Sequence ( - CORBA::ULong maximum, - CORBA::ULong length, - T* *value, - CORBA::Boolean release - ) - : TAO_Unbounded_Base_Sequence (maximum, length, value, release) -{ -} - -template <typename T, typename T_var> -ACE_INLINE -TAO_Object_Manager<T,T_var> -TAO_Unbounded_Object_Sequence<T,T_var>::operator[] ( - CORBA::ULong slot - ) const -{ - TAO_SEQUENCE_ASSERT (slot, this->maximum_); - T ** const tmp = reinterpret_cast<T ** ACE_CAST_CONST> (this->buffer_); - return - TAO_Object_Manager<T,T_var> (tmp + slot, this->release_); -} - -// ************************************************************* -// class TAO_Bounded_Object_Sequence -// ************************************************************* - -template <typename T, typename T_var, size_t MAX> -ACE_INLINE -TAO_Bounded_Object_Sequence<T,T_var,MAX>::~TAO_Bounded_Object_Sequence (void) -{ - this->_deallocate_buffer (); -} - -template <typename T, typename T_var, size_t MAX> -ACE_INLINE -TAO_Bounded_Object_Sequence<T,T_var,MAX>::TAO_Bounded_Object_Sequence ( - CORBA::ULong length, - T ** value, - CORBA::Boolean release - ) - : TAO_Bounded_Base_Sequence (MAX, length, value, release) -{ -} - -template <typename T, typename T_var, size_t MAX> -ACE_INLINE -TAO_Object_Manager<T,T_var> -TAO_Bounded_Object_Sequence<T, T_var,MAX>::operator[] ( - CORBA::ULong slot - ) const -{ - TAO_SEQUENCE_ASSERT (slot, this->maximum_); - T ** const tmp = reinterpret_cast<T ** ACE_CAST_CONST> (this->buffer_); - return - TAO_Object_Manager<T,T_var> (tmp + slot, this->release_ ); -} - -// ************************************************************* -// class TAO_Unbounded_Pseudo_Sequence -// ************************************************************* - -template <typename T> -ACE_INLINE -TAO_Unbounded_Pseudo_Sequence<T>::TAO_Unbounded_Pseudo_Sequence (void) -{ -} - -template <typename T> -ACE_INLINE -TAO_Unbounded_Pseudo_Sequence<T>::TAO_Unbounded_Pseudo_Sequence ( - CORBA::ULong maximum, - CORBA::ULong length, - T ** value, - CORBA::Boolean release - ) - : TAO_Unbounded_Base_Sequence (maximum, length, value, release) -{ -} - -template <typename T> -ACE_INLINE -TAO_Pseudo_Object_Manager<T> -TAO_Unbounded_Pseudo_Sequence<T>::operator[] (CORBA::ULong slot) const -{ - TAO_SEQUENCE_ASSERT (slot, this->maximum_); - T ** const tmp = reinterpret_cast<T ** ACE_CAST_CONST> (this->buffer_); - return TAO_Pseudo_Object_Manager<T> (tmp + slot, this->release_); -} - -// ************************************************************* -// class TAO_Bounded_Pseudo_Sequence -// ************************************************************* - -template <typename T, size_t MAX> -ACE_INLINE -TAO_Bounded_Pseudo_Sequence<T,MAX>::~TAO_Bounded_Pseudo_Sequence (void) -{ - this->_deallocate_buffer (); -} - -template <typename T, size_t MAX> -ACE_INLINE -TAO_Bounded_Pseudo_Sequence<T,MAX>::TAO_Bounded_Pseudo_Sequence ( - CORBA::ULong length, - T ** value, - CORBA::Boolean release - ) - : TAO_Bounded_Base_Sequence (MAX, length, value, release) -{ -} - -template <typename T, size_t MAX> -ACE_INLINE -TAO_Pseudo_Object_Manager<T> -TAO_Bounded_Pseudo_Sequence<T,MAX>::operator[] (CORBA::ULong slot) const -{ - TAO_SEQUENCE_ASSERT (slot, this->maximum_); - T ** const tmp = reinterpret_cast<T ** ACE_CAST_CONST> (this->buffer_); - return TAO_Pseudo_Object_Manager<T> (tmp + slot, - this->release_); -} - -// ************************************************************* -// class TAO_Unbounded_Array_Sequence -// ************************************************************* - -template <typename T, typename T_slice, typename TAG> -ACE_INLINE -void -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::freebuf (T * buffer) -{ - if (buffer == 0) - { - return; - } - - delete [] buffer; -} - -template <typename T, typename T_slice, typename TAG> -ACE_INLINE -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::TAO_Unbounded_Array_Sequence ( - void - ) -{ -} - -template <typename T, typename T_slice, typename TAG> -ACE_INLINE -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>:: -TAO_Unbounded_Array_Sequence (CORBA::ULong maximum) - : TAO_Unbounded_Base_Sequence ( - maximum, - TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::allocbuf (maximum) - ) -{ -} - -template <typename T, typename T_slice, typename TAG> -ACE_INLINE -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>:: -TAO_Unbounded_Array_Sequence (CORBA::ULong maximum, - CORBA::ULong length, - T * value, - CORBA::Boolean release) - : TAO_Unbounded_Base_Sequence (maximum, length, value, release) -{ -} - -template <typename T, typename T_slice, typename TAG> -ACE_INLINE -T & -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::operator[] (CORBA::ULong i) -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - -#if defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) - return ((T *) this->buffer_)[i]; -#else /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */ - return (reinterpret_cast<T *> (this->buffer_))[i]; -#endif /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */ -} - -template <typename T, typename T_slice, typename TAG> -ACE_INLINE -const T & -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::operator[] (CORBA::ULong i) const -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - -#if defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) - return ((const T * ACE_CAST_CONST) this->buffer_)[i]; -#else /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */ - return (reinterpret_cast<const T * ACE_CAST_CONST> (this->buffer_))[i]; -#endif /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */ -} - -template <typename T, typename T_slice, typename TAG> -ACE_INLINE -const T * -TAO_Unbounded_Array_Sequence<T,T_slice,TAG>::get_buffer (void) const -{ - return reinterpret_cast<const T * ACE_CAST_CONST> (this->buffer_); -} - -// ************************************************************* -// class TAO_Bounded_Array_Sequence -// ************************************************************* - -template <typename T, typename T_slice, typename TAG, size_t MAX> -ACE_INLINE -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>:: -TAO_Bounded_Array_Sequence (void) - : TAO_Bounded_Base_Sequence (MAX, 0, allocbuf (MAX), 1) -{ -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -ACE_INLINE -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>:: -TAO_Bounded_Array_Sequence (CORBA::ULong length, - T * data, - CORBA::Boolean release) - : TAO_Bounded_Base_Sequence (MAX, length, data, release) -{ -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -ACE_INLINE -T & -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::operator[] (CORBA::ULong i) -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - -#if defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) - return ((T *) this->buffer_)[i]; -#else /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */ - return (reinterpret_cast<T *> (this->buffer_))[i]; -#endif /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */ -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -ACE_INLINE -const T & -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::operator[] ( - CORBA::ULong i - ) const -{ - TAO_SEQUENCE_ASSERT (i, this->maximum_); - -#if defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) - return ((const T * ACE_CAST_CONST) this->buffer_)[i]; -#else /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */ - return (reinterpret_cast<const T * ACE_CAST_CONST> (this->buffer_))[i]; -#endif /* (__SUNPRO_CC) && (__SUNPRO_CC < 0x500) */ -} - -template <typename T, typename T_slice, typename TAG, size_t MAX> -ACE_INLINE -const T * -TAO_Bounded_Array_Sequence<T,T_slice,TAG,MAX>::get_buffer (void) const -{ - return reinterpret_cast<const T * ACE_CAST_CONST> (this->buffer_); -} - -// ************************************************************* -// class TAO_Bounded_String_Sequence -// ************************************************************* - -template<size_t MAX> -ACE_INLINE -TAO_Bounded_String_Sequence<MAX>::~TAO_Bounded_String_Sequence (void) -{ - this->_deallocate_buffer (); -} - -template<size_t MAX> -ACE_INLINE -TAO_Bounded_String_Sequence<MAX>:: -TAO_Bounded_String_Sequence (CORBA::ULong length, - char ** value, - CORBA::Boolean release) - : TAO_Bounded_Base_Sequence (MAX, length, value, release) -{ -} - -// ************************************************************* -// class TAO_Bounded_WString_Sequence -// ************************************************************* - -template<size_t MAX> -ACE_INLINE -TAO_Bounded_WString_Sequence<MAX>::~TAO_Bounded_WString_Sequence (void) -{ - this->_deallocate_buffer (); -} - -template<size_t MAX> -ACE_INLINE -TAO_Bounded_WString_Sequence<MAX>:: -TAO_Bounded_WString_Sequence (CORBA::ULong length, - CORBA::WChar ** value, - CORBA::Boolean release) - : TAO_Bounded_Base_Sequence (MAX, length, value, release) -{ -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Service_Callbacks.cpp b/TAO/tao/Service_Callbacks.cpp index 97653579a7f..0e9b89c9ff1 100644 --- a/TAO/tao/Service_Callbacks.cpp +++ b/TAO/tao/Service_Callbacks.cpp @@ -19,14 +19,14 @@ CORBA::Boolean TAO_Service_Callbacks::select_profile (TAO_MProfile * /*mprofile*/, TAO_Profile *& /*pfile*/) { - return 0; + return false; } CORBA::Boolean TAO_Service_Callbacks::reselect_profile (TAO_Stub * /*stub*/, TAO_Profile *& /*pfile*/) { - return 0; + return false; } @@ -35,7 +35,7 @@ TAO_Service_Callbacks::object_is_nil (CORBA::Object_ptr /* obj */) { // We shouldn't be here at all. But in case if we are here, // something is wrong. So, we send a true for a is_nil () call - return 1; + return true; } void diff --git a/TAO/tao/Service_Context.cpp b/TAO/tao/Service_Context.cpp index 9d0a4c1c5e6..78cc30595b6 100644 --- a/TAO/tao/Service_Context.cpp +++ b/TAO/tao/Service_Context.cpp @@ -24,7 +24,7 @@ TAO_Service_Context::set_context_i (IOP::ServiceId id, context.context_id = id; // Make a *copy* of the CDR stream... - size_t length = cdr.total_length (); + size_t const length = cdr.total_length (); context.context_data.length (static_cast<CORBA::ULong> (length)); CORBA::Octet *buf = context.context_data.get_buffer (); @@ -44,7 +44,7 @@ TAO_Service_Context::set_context_i (IOP::ServiceContext &context, TAO_OutputCDR &cdr) { // Make a *copy* of the CDR stream... - size_t length = cdr.total_length (); + size_t const length = cdr.total_length (); context.context_data.length (static_cast<CORBA::ULong> (length)); CORBA::Octet *buf = context.context_data.get_buffer (); @@ -117,9 +117,9 @@ TAO_Service_Context::set_context_i (IOP::ServiceContext& context) { if (context.context_id == this->service_context_[i].context_id) { - CORBA::ULong max = context.context_data.maximum (); - CORBA::ULong len = context.context_data.length (); - CORBA::Octet* buf = context.context_data.get_buffer (1); + CORBA::ULong const max = context.context_data.maximum (); + CORBA::ULong const len = context.context_data.length (); + CORBA::Octet * const buf = context.context_data.get_buffer (1); this->service_context_[i].context_data.replace (max, len, buf, 1); return; } @@ -133,12 +133,12 @@ TAO_Service_Context::add_context_i (IOP::ServiceContext& context) { // @@ TODO Some contexts can show up multiple times, others // can't find out and take appropiate action. - CORBA::ULong l = this->service_context_.length (); + CORBA::ULong const l = this->service_context_.length (); this->service_context_.length (l + 1); this->service_context_[l].context_id = context.context_id; - CORBA::ULong max = context.context_data.maximum (); - CORBA::ULong len = context.context_data.length (); - CORBA::Octet* buf = context.context_data.get_buffer (1); + CORBA::ULong const max = context.context_data.maximum (); + CORBA::ULong const len = context.context_data.length (); + CORBA::Octet* const buf = context.context_data.get_buffer (1); this->service_context_[l].context_data.replace (max, len, buf, 1); } @@ -147,7 +147,7 @@ TAO_Service_Context::add_context_i (const IOP::ServiceContext& context) { // @@ TODO Some contexts can show up multiple times, others // can't find out and take appropiate action. - CORBA::ULong l = this->service_context_.length (); + CORBA::ULong const l = this->service_context_.length (); this->service_context_.length (l + 1); this->service_context_[l] = context; } @@ -187,7 +187,7 @@ int TAO_Service_Context::get_context (IOP::ServiceId id, IOP::ServiceContext_out context) { - CORBA::ULong len = this->service_context_.length (); + CORBA::ULong const len = this->service_context_.length (); for (CORBA::ULong i = 0; i < len; ++i) { diff --git a/TAO/tao/ServicesC.cpp b/TAO/tao/ServicesC.cpp index 853fbfd293f..4fad6bd654b 100644 --- a/TAO/tao/ServicesC.cpp +++ b/TAO/tao/ServicesC.cpp @@ -44,7 +44,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_SERVICEOPTIONSEQ_CS_) @@ -56,7 +56,7 @@ CORBA::ServiceOptionSeq::ServiceOptionSeq (void) CORBA::ServiceOptionSeq::ServiceOptionSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceOption > (max) @@ -68,7 +68,7 @@ CORBA::ServiceOptionSeq::ServiceOptionSeq ( CORBA::ULong * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceOption > (max, length, buffer, release) @@ -77,7 +77,7 @@ CORBA::ServiceOptionSeq::ServiceOptionSeq ( CORBA::ServiceOptionSeq::ServiceOptionSeq ( const ServiceOptionSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceOption > (seq) @@ -97,10 +97,10 @@ void CORBA::ServiceOptionSeq::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void CORBA::ServiceDetail::_tao_any_destructor ( void *_tao_void_pointer ) @@ -110,7 +110,7 @@ CORBA::ServiceDetail::_tao_any_destructor ( delete _tao_tmp_pointer; } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_SERVICEDETAILSEQ_CS_) @@ -122,7 +122,7 @@ CORBA::ServiceDetailSeq::ServiceDetailSeq (void) CORBA::ServiceDetailSeq::ServiceDetailSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceDetail > (max) @@ -134,7 +134,7 @@ CORBA::ServiceDetailSeq::ServiceDetailSeq ( CORBA::ServiceDetail * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceDetail > (max, length, buffer, release) @@ -143,7 +143,7 @@ CORBA::ServiceDetailSeq::ServiceDetailSeq ( CORBA::ServiceDetailSeq::ServiceDetailSeq ( const ServiceDetailSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< ServiceDetail > (seq) @@ -163,10 +163,10 @@ void CORBA::ServiceDetailSeq::_tao_any_destructor ( #endif /* end #if !defined */ -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void CORBA::ServiceInformation::_tao_any_destructor ( void *_tao_void_pointer ) @@ -187,15 +187,7 @@ CORBA::Boolean operator<< ( const CORBA::ServiceOptionSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -203,33 +195,7 @@ CORBA::Boolean operator>> ( CORBA::ServiceOptionSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_ServiceOptionSeq_CPP_ */ @@ -268,22 +234,7 @@ CORBA::Boolean operator<< ( const CORBA::ServiceDetailSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i]); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -291,40 +242,7 @@ CORBA::Boolean operator>> ( CORBA::ServiceDetailSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i]); - } - - return _tao_marshal_flag; - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_ServiceDetailSeq_CPP_ */ diff --git a/TAO/tao/ServicesC.h b/TAO/tao/ServicesC.h index 524b9bef015..d137d8282ab 100644 --- a/TAO/tao/ServicesC.h +++ b/TAO/tao/ServicesC.h @@ -67,58 +67,55 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::UShort ServiceType; typedef CORBA::UShort_out ServiceType_out; - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::ULong ServiceOption; typedef CORBA::ULong_out ServiceOption_out; - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::ULong ServiceDetailType; typedef CORBA::ULong_out ServiceDetailType_out; - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:472 - + typedef OctetSeq ServiceDetailData; typedef OctetSeq_var ServiceDetailData_var; typedef OctetSeq_out ServiceDetailData_out; - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_SERVICEOPTIONSEQ_CH_) #define _CORBA_SERVICEOPTIONSEQ_CH_ - + class ServiceOptionSeq; - + typedef TAO_FixedSeq_Var_T< - ServiceOptionSeq, - ServiceOption + ServiceOptionSeq > ServiceOptionSeq_var; - + typedef TAO_Seq_Out_T< - ServiceOptionSeq, - ServiceOptionSeq_var, - ServiceOption + ServiceOptionSeq > ServiceOptionSeq_out; - + class TAO_Export ServiceOptionSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< ServiceOption > { @@ -128,80 +125,77 @@ namespace CORBA ServiceOptionSeq ( CORBA::ULong max, CORBA::ULong length, - CORBA::ULong* buffer, - CORBA::Boolean release = 0 + CORBA::ULong* buffer, + CORBA::Boolean release = false ); ServiceOptionSeq (const ServiceOptionSeq &); ~ServiceOptionSeq (void); - + static void _tao_any_destructor (void *); - + typedef ServiceOptionSeq_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const CORBA::ServiceType Security = 1U; - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct ServiceDetail; - + typedef TAO_Var_Var_T< ServiceDetail > ServiceDetail_var; - + typedef TAO_Out_T< ServiceDetail, ServiceDetail_var > ServiceDetail_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export ServiceDetail { typedef ServiceDetail_var _var_type; - + static void _tao_any_destructor (void *); CORBA::ServiceDetailType service_detail_type; CORBA::ServiceDetailData service_detail; }; - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_SERVICEDETAILSEQ_CH_) #define _CORBA_SERVICEDETAILSEQ_CH_ - + class ServiceDetailSeq; - + typedef TAO_VarSeq_Var_T< - ServiceDetailSeq, - ServiceDetail + ServiceDetailSeq > ServiceDetailSeq_var; - + typedef TAO_Seq_Out_T< - ServiceDetailSeq, - ServiceDetailSeq_var, - ServiceDetail + ServiceDetailSeq > ServiceDetailSeq_out; - + class TAO_Export ServiceDetailSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< ServiceDetail > { @@ -211,44 +205,44 @@ namespace CORBA ServiceDetailSeq ( CORBA::ULong max, CORBA::ULong length, - ServiceDetail* buffer, - CORBA::Boolean release = 0 + ServiceDetail* buffer, + CORBA::Boolean release = false ); ServiceDetailSeq (const ServiceDetailSeq &); ~ServiceDetailSeq (void); - + static void _tao_any_destructor (void *); - + typedef ServiceDetailSeq_var _var_type; }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct ServiceInformation; - + typedef TAO_Var_Var_T< ServiceInformation > ServiceInformation_var; - + typedef TAO_Out_T< ServiceInformation, ServiceInformation_var > ServiceInformation_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export ServiceInformation { typedef ServiceInformation_var _var_type; - + static void _tao_any_destructor (void *); CORBA::ServiceOptionSeq service_options; CORBA::ServiceDetailSeq service_details; diff --git a/TAO/tao/ShortSeqC.cpp b/TAO/tao/ShortSeqC.cpp index 4ebe8407bcb..61dd1f3fb77 100644 --- a/TAO/tao/ShortSeqC.cpp +++ b/TAO/tao/ShortSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_SHORTSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::ShortSeq::ShortSeq (void) CORBA::ShortSeq::ShortSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Short > (max) @@ -67,7 +67,7 @@ CORBA::ShortSeq::ShortSeq ( CORBA::Short * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Short > (max, length, buffer, release) @@ -76,7 +76,7 @@ CORBA::ShortSeq::ShortSeq ( CORBA::ShortSeq::ShortSeq ( const ShortSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::Short > (seq) @@ -107,15 +107,7 @@ CORBA::Boolean operator<< ( const CORBA::ShortSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_short_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -123,33 +115,7 @@ CORBA::Boolean operator>> ( CORBA::ShortSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_short_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_ShortSeq_CPP_ */ diff --git a/TAO/tao/ShortSeqC.h b/TAO/tao/ShortSeqC.h index 710cff4afb9..1df136c852c 100644 --- a/TAO/tao/ShortSeqC.h +++ b/TAO/tao/ShortSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_SHORTSEQ_CH_) #define _CORBA_SHORTSEQ_CH_ - + class ShortSeq; - + typedef TAO_FixedSeq_Var_T< - ShortSeq, - CORBA::Short + ShortSeq > ShortSeq_var; - + typedef TAO_Seq_Out_T< - ShortSeq, - ShortSeq_var, - CORBA::Short + ShortSeq > ShortSeq_out; - + class TAO_Export ShortSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::Short > { @@ -95,14 +92,14 @@ namespace CORBA ShortSeq ( CORBA::ULong max, CORBA::ULong length, - CORBA::Short* buffer, - CORBA::Boolean release = 0 + CORBA::Short* buffer, + CORBA::Boolean release = false ); ShortSeq (const ShortSeq &); ~ShortSeq (void); - + static void _tao_any_destructor (void *); - + typedef ShortSeq_var _var_type; }; diff --git a/TAO/tao/StringSeqC.cpp b/TAO/tao/StringSeqC.cpp index 426787893e4..a031820d1a8 100644 --- a/TAO/tao/StringSeqC.cpp +++ b/TAO/tao/StringSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_STRINGSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::StringSeq::StringSeq (void) CORBA::StringSeq::StringSeq ( CORBA::ULong max ) - : TAO_Unbounded_String_Sequence + : TAO::unbounded_string_sequence (max) {} @@ -65,14 +65,14 @@ CORBA::StringSeq::StringSeq ( char * * buffer, CORBA::Boolean release ) - : TAO_Unbounded_String_Sequence + : TAO::unbounded_string_sequence (max, length, buffer, release) {} CORBA::StringSeq::StringSeq ( const StringSeq &seq ) - : TAO_Unbounded_String_Sequence + : TAO::unbounded_string_sequence (seq) {} @@ -101,22 +101,7 @@ CORBA::Boolean operator<< ( const CORBA::StringSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i].in ()); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -124,41 +109,7 @@ CORBA::Boolean operator>> ( CORBA::StringSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - CORBA::Boolean _tao_marshal_flag = true; - - for (CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); - - } - - return _tao_marshal_flag; - - } - -return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_StringSeq_CPP_ */ diff --git a/TAO/tao/StringSeqC.h b/TAO/tao/StringSeqC.h index 85a6e6bb5ac..0142991161a 100644 --- a/TAO/tao/StringSeqC.h +++ b/TAO/tao/StringSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_STRINGSEQ_CH_) #define _CORBA_STRINGSEQ_CH_ - + class StringSeq; - + typedef - TAO_MngSeq_Var_T< - StringSeq, - TAO_SeqElem_String_Manager + TAO_VarSeq_Var_T< + StringSeq > StringSeq_var; - + typedef - TAO_MngSeq_Out_T< - StringSeq, - StringSeq_var, - TAO_SeqElem_String_Manager + TAO_Seq_Out_T< + StringSeq > StringSeq_out; - + class TAO_Export StringSeq : public - TAO_Unbounded_String_Sequence + TAO::unbounded_string_sequence { public: StringSeq (void); @@ -93,14 +90,14 @@ namespace CORBA StringSeq ( CORBA::ULong max, CORBA::ULong length, - char ** buffer, - CORBA::Boolean release = 0 + char ** buffer, + CORBA::Boolean release = false ); StringSeq (const StringSeq &); ~StringSeq (void); - + static void _tao_any_destructor (void *); - + typedef StringSeq_var _var_type; }; diff --git a/TAO/tao/String_Alloc.cpp b/TAO/tao/String_Alloc.cpp new file mode 100644 index 00000000000..5844fb9503f --- /dev/null +++ b/TAO/tao/String_Alloc.cpp @@ -0,0 +1,104 @@ +#include "String_Alloc.h" + +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_wchar.h" +#include "ace/OS_Memory.h" + +// FUZZ: disable check_for_streams_include +#include "ace/streams.h" + +ACE_RCSID (tao, + String_Alloc, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +char * +CORBA::string_dup (const char *str) +{ + if (!str) + { + errno = EINVAL; + return 0; + } + + const size_t len = ACE_OS::strlen (str); + + // This allocates an extra byte for the '\0'; + char * copy = CORBA::string_alloc (static_cast<CORBA::ULong> (len)); + + // The memcpy() below assumes that the destination is a valid buffer. + if (copy == 0) + { + return 0; + } + + ACE_OS::memcpy (copy, + str, + len + 1); + return copy; +} + +char * +CORBA::string_alloc (CORBA::ULong len) +{ + // Allocate 1 + strlen to accomodate the null terminating character. + + char *s = 0; + ACE_NEW_RETURN (s, + char[size_t (len + 1)], + 0); + + s[0]= '\0'; + + return s; +} + +void +CORBA::string_free (char *str) +{ + delete [] str; +} + +// **************************************************************** + +CORBA::WChar* +CORBA::wstring_dup (const WChar *const str) +{ + if (!str) + { + errno = EINVAL; + return 0; + } + + CORBA::WChar* retval = + CORBA::wstring_alloc (static_cast <CORBA::ULong> (ACE_OS::strlen (str))); + + // The wscpy() below assumes that the destination is a valid buffer. + if (retval == 0) + { + return 0; + } + + return ACE_OS::wscpy (retval, + str); +} + +CORBA::WChar* +CORBA::wstring_alloc (CORBA::ULong len) +{ + CORBA::WChar *s = 0; + ACE_NEW_RETURN (s, + CORBA::WChar [(size_t) (len + 1)], + 0); + + return s; +} + +void +CORBA::wstring_free (CORBA::WChar *const str) +{ + delete [] str; +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/String_Alloc.h b/TAO/tao/String_Alloc.h new file mode 100644 index 00000000000..6537f97b44b --- /dev/null +++ b/TAO/tao/String_Alloc.h @@ -0,0 +1,57 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file String_Alloc.h + * + * $Id$ + * + * Header file for the CORBA string types. + * + * @author DOC Group at Wash U, UCI, and Vanderbilt U. + */ +//============================================================================= + +#ifndef TAO_STRING_ALLOC_H +#define TAO_STRING_ALLOC_H + +#include /**/ "ace/pre.h" + +#include "tao/TAO_Export.h" +#include "tao/Basic_Types.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace CORBA +{ + /** + * @name CORBA String Memory Management + * + * CORBA string memory management functions. + */ + //@{ + TAO_Export char * string_alloc (ULong len); + TAO_Export char * string_dup (const char *); + TAO_Export void string_free (char *); + //@} + + /** + * @name CORBA Wide String Memory Management + * + * CORBA wide string memory management functions. + */ + //@{ + TAO_Export WChar * wstring_alloc (ULong len); + TAO_Export WChar * wstring_dup (const WChar * const); + TAO_Export void wstring_free (WChar * const); + //@} +} // End CORBA namespace. + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_STRING_ALLOC_H */ diff --git a/TAO/tao/String_Manager_T.h b/TAO/tao/String_Manager_T.h new file mode 100644 index 00000000000..66561317f5b --- /dev/null +++ b/TAO/tao/String_Manager_T.h @@ -0,0 +1,138 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file String_Manager_T.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + +#ifndef TAO_STRING_MANAGER_T +#define TAO_STRING_MANAGER_T + +#include /**/ "ace/pre.h" + +#include "tao/TAO_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Basic_Types.h" +#include "tao/String_Traits_Base_T.h" + +#include <algorithm> + +/****************************************************************/ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +template <typename charT> +class String_Manager_T +{ +public: + typedef charT character_type; + typedef TAO::details::string_traits_base <charT> s_traits; + + /// Default CTOR will initialize the underlying ptr_ to empty string. + inline String_Manager_T (void) : ptr_ (s_traits::default_initializer()) + { + } + + /// Copy constructor + inline String_Manager_T (const String_Manager_T<charT> &rhs) : ptr_ (s_traits::duplicate (rhs.ptr_)) + { + } + + /// Constructor from const char* makes a copy. + inline String_Manager_T (const character_type *s) : ptr_ (s_traits::duplicate (s)) + { + } + + /// Destructor + inline ~String_Manager_T (void) { + s_traits::release (this->ptr_); + } + + /// Assignment from another managed type + inline String_Manager_T &operator= (const String_Manager_T<charT> &rhs) { + // Strongly exception safe by means of copy and non-throwing swap + // technique. + String_Manager_T <character_type> tmp (rhs); + std::swap (this->ptr_, tmp.ptr_); + return *this; + } + + /// Assignment from var type will make a copy + inline String_Manager_T &operator= (const typename s_traits::string_var& value) { + // Strongly exception safe by means of copy and non-throwing swap + // technique. + String_Manager_T <character_type> tmp (value.in ()); + std::swap (this->ptr_, tmp.ptr_); + return *this; + } + + /// Assignment from a constant * will make a copy + inline String_Manager_T &operator= (const character_type *p) { + // Strongly exception safe by means of copy and non-throwing swap + // technique. + String_Manager_T <character_type> tmp (p); + std::swap (this->ptr_, tmp.ptr_); + return *this; + } + + /// Assignment from char* will not make a copy. The String_Manager_T will now + /// own the string. + inline String_Manager_T &operator= (character_type *p) { + s_traits::release (this->ptr_); + this->ptr_ = p; + return *this; + } + + /// Cast (read-only) + inline operator const character_type*() const { + return this->ptr_; + } + + /// For in parameter. + inline const character_type *in (void) const { + return this->ptr_; + } + + /// For inout parameter. + inline character_type *&inout (void) { + return this->ptr_; + } + + /// for out parameter. + inline character_type *&out (void) { + s_traits::release (this->ptr_); + this->ptr_ = s_traits::default_initializer(); + return this->ptr_; + } + + /// For string of return type. + inline character_type *_retn (void) { + character_type *temp = this->ptr_; + this->ptr_ = s_traits::default_initializer(); + return temp; + } + +private: + /// The underlying string + character_type *ptr_; +}; + + typedef TAO::String_Manager_T<CORBA::Char> String_Manager; + typedef TAO::String_Manager_T<CORBA::WChar> WString_Manager; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* TAO_STRING_MANAGER_T */ diff --git a/TAO/tao/String_Sequence_Element_T.h b/TAO/tao/String_Sequence_Element_T.h new file mode 100644 index 00000000000..245b652b92f --- /dev/null +++ b/TAO/tao/String_Sequence_Element_T.h @@ -0,0 +1,124 @@ +#ifndef guard_string_sequence_element_hpp +#define guard_string_sequence_element_hpp +/** + * @file + * + * @brief Implement the type returned by operator[] in string + * sequences. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename traits> +class string_sequence_element +{ +public: + typedef typename traits::char_type character_type; + typedef character_type * value_type; + typedef character_type const * const_value_type; + typedef typename traits::string_var string_var; + typedef typename traits::string_mgr string_mgr; + +private: + inline string_sequence_element<traits> & pseudo_copy_swap( + string_var & rhs) + { + if (release()) + { + traits::release(*element_); + } + *element_ = rhs._retn(); + return *this; + } + +public: + string_sequence_element( + value_type & e, CORBA::Boolean release) + : element_(&e) + , release_(release) + { + } + + string_sequence_element( + string_sequence_element const & rhs) + : element_(rhs.element_) + , release_(rhs.release_) + { + } + + ~string_sequence_element() + { + } + + string_sequence_element & operator=(const_value_type rhs) + { + string_var tmp(rhs); + return pseudo_copy_swap(tmp); + } + + string_sequence_element & operator=(value_type rhs) + { + string_var tmp(rhs); + return pseudo_copy_swap(tmp); + } + + string_sequence_element & operator=(string_sequence_element const & rhs) + { + string_var tmp(static_cast<const_value_type>(rhs)); + return pseudo_copy_swap(tmp); + } + + string_sequence_element & operator=(string_var const & rhs) + { + string_var tmp(rhs); + return pseudo_copy_swap(tmp); + } + + string_sequence_element & operator=(string_mgr const & rhs) + { + string_var tmp(rhs.in()); + return pseudo_copy_swap(tmp); + } + + inline operator const_value_type() const + { + return *element_; + } + + void swap(string_sequence_element & rhs) + { + std::swap(element_, rhs.element_); + std::swap(release_, rhs.release_); + } + + CORBA::Boolean release() const + { + return release_; + } + +private: + // This function is not implemented + string_sequence_element(); + +private: + value_type * element_; + CORBA::Boolean release_; +}; + +} // namespace details +} // namespace CORBA + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_string_sequence_element_hpp diff --git a/TAO/tao/String_Traits_Base_T.h b/TAO/tao/String_Traits_Base_T.h new file mode 100644 index 00000000000..6b2ae6eb051 --- /dev/null +++ b/TAO/tao/String_Traits_Base_T.h @@ -0,0 +1,106 @@ +#ifndef guard_string_traits_base_hpp +#define guard_string_traits_base_hpp +/** + * @file + * + * @brief Isolate the string_traits from the accidental differences + * between wstring and string. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/String_Alloc.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +template<typename charT> +class String_Manager_T; + +template<typename charT> +class String_var; + +template<typename charT> +class String_out; + +namespace details +{ + +template<typename charT> +struct string_traits_base +{ +}; + +template<> +struct string_traits_base<char> +{ + typedef char char_type; + typedef TAO::String_var <char_type> string_var; + typedef TAO::String_out <char_type> string_out; + typedef TAO::String_Manager_T <char_type> string_mgr; + + inline static char_type * default_initializer() + { + return CORBA::string_dup(""); + } + + inline static char_type * duplicate(char_type const * s) + { + return CORBA::string_dup(s); + } + + inline static void release(char_type * s) + { + CORBA::string_free(s); + } + + inline static char_type * allocate (CORBA::ULong len) + { + return CORBA::string_alloc (len); + } +}; + +template<> +struct string_traits_base<CORBA::WChar> +{ + typedef CORBA::WChar char_type; + typedef TAO::String_var <char_type> string_var; + typedef TAO::String_out <char_type> string_out; + typedef TAO::String_Manager_T <char_type> string_mgr; + + inline static char_type * default_initializer() + { +#if defined(ACE_HAS_WCHAR) || defined(ACE_HAS_XPG4_MULTIBYTE_CHAR) + return CORBA::wstring_dup(L""); +#else +#warning "platform not configured with native wchar_t support" + static CORBA::WChar empty[] = { 0 }; + return CORBA::wstring_dup(empty); +#endif /* 0 */ + } + + inline static char_type * duplicate(char_type const * s) + { + return CORBA::wstring_dup(s); + } + + inline static void release(char_type * s) + { + CORBA::wstring_free(s); + } + + inline static char_type * allocate (CORBA::ULong len) + { + return CORBA::wstring_alloc (len); + } +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_string_traits_base_hpp diff --git a/TAO/tao/String_Traits_T.h b/TAO/tao/String_Traits_T.h new file mode 100644 index 00000000000..3b55b49a011 --- /dev/null +++ b/TAO/tao/String_Traits_T.h @@ -0,0 +1,77 @@ +#ifndef guard_string_traits_hpp +#define guard_string_traits_hpp +/** + * @file + * + * @brief Implement the element manipulation traits for string types. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "String_Traits_Base_T.h" + +#include <algorithm> +#include <functional> + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename char_type, class derived> +struct string_traits_decorator +{ + typedef char_type * value_type; + typedef char_type const * const_value_type; + + inline static void zero_range( + char_type ** begin, char_type ** end) + { + std::fill(begin, end, static_cast<char_type*>(0)); + } + + inline static void initialize_range( + char_type ** begin, char_type ** end) + { + std::generate(begin, end, &derived::default_initializer); + } + + inline static void copy_range( + char_type ** begin, char_type ** end, char_type ** dst) + { + std::transform(begin, end, dst, &derived::duplicate); + } + + inline static void release_range( + char_type ** begin, char_type ** end) + { + std::for_each(begin, end, &derived::release); + } + + inline static char_type const * initialize_if_zero(char_type * & element) + { + if (element == 0) + { + element = derived::default_initializer(); + } + return element; + } +}; + +template<class charT, bool dummy> +struct string_traits + : public string_traits_base<charT> + , public string_traits_decorator<charT,string_traits<charT,dummy> > +{ +}; + +} // namespace details +} // namespace CORBA + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_string_traits_hpp diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp index 67807d51226..cdfed84c382 100644 --- a/TAO/tao/Stub.cpp +++ b/TAO/tao/Stub.cpp @@ -332,8 +332,8 @@ TAO_Stub::is_equivalent (CORBA::Object_ptr other_obj) if (CORBA::is_nil (other_obj)) return false; - TAO_Profile *other_profile = other_obj->_stubobj ()->profile_in_use_; - TAO_Profile *this_profile = this->profile_in_use_; + TAO_Profile * const other_profile = other_obj->_stubobj ()->profile_in_use_; + TAO_Profile * const this_profile = this->profile_in_use_; if (other_profile == 0 || this_profile == 0) return false; @@ -362,7 +362,7 @@ TAO_Stub::_decr_refcnt (void) TAO_Profile * TAO_Stub::set_profile_in_use_i (TAO_Profile *pfile) { - TAO_Profile *old = this->profile_in_use_; + TAO_Profile *const old = this->profile_in_use_; // Since we are actively using this profile we dont want // it to disappear, so increase the reference count by one!! diff --git a/TAO/tao/Synch_Invocation.cpp b/TAO/tao/Synch_Invocation.cpp index a3f4e5d61b2..5f18d58eba1 100644 --- a/TAO/tao/Synch_Invocation.cpp +++ b/TAO/tao/Synch_Invocation.cpp @@ -650,7 +650,7 @@ namespace TAO } CORBA::SystemException *ex = - TAO_Exceptions::create_system_exception (type_id.in ()); + TAO::create_system_exception (type_id.in ()); if (ex == 0) { diff --git a/TAO/tao/Synch_Queued_Message.cpp b/TAO/tao/Synch_Queued_Message.cpp index bcafd9afefc..f72ae27e1b4 100644 --- a/TAO/tao/Synch_Queued_Message.cpp +++ b/TAO/tao/Synch_Queued_Message.cpp @@ -63,7 +63,7 @@ TAO_Synch_Queued_Message::fill_iov (int iovcnt_max, message_block != 0 && iovcnt < iovcnt_max; message_block = message_block->cont ()) { - size_t message_block_length = message_block->length (); + size_t const message_block_length = message_block->length (); // Check if this block has any data to be sent. if (message_block_length > 0) @@ -151,7 +151,7 @@ TAO_Synch_Queued_Message::clone (ACE_Allocator *alloc) // Set the flag to indicate that <qm> is created on the heap. if (qm) { - qm->is_heap_created_ = 1; + qm->is_heap_created_ = true; } return qm; diff --git a/TAO/tao/Synch_Reply_Dispatcher.cpp b/TAO/tao/Synch_Reply_Dispatcher.cpp index d8f7fd8df1e..9dbdcb0eabd 100644 --- a/TAO/tao/Synch_Reply_Dispatcher.cpp +++ b/TAO/tao/Synch_Reply_Dispatcher.cpp @@ -59,8 +59,8 @@ TAO_Synch_Reply_Dispatcher::dispatch_reply ( // Steal the buffer, that way we don't do any unnecesary copies of // this data. - CORBA::ULong max = params.svc_ctx_.maximum (); - CORBA::ULong len = params.svc_ctx_.length (); + CORBA::ULong const max = params.svc_ctx_.maximum (); + CORBA::ULong const len = params.svc_ctx_.length (); IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (1); this->reply_service_info_.replace (max, len, context_list, 1); diff --git a/TAO/tao/SystemException.cpp b/TAO/tao/SystemException.cpp index 35a47758128..a55e9cc3b6a 100644 --- a/TAO/tao/SystemException.cpp +++ b/TAO/tao/SystemException.cpp @@ -936,7 +936,7 @@ STANDARD_EXCEPTION_LIST #undef TAO_SYSTEM_EXCEPTION CORBA::SystemException * -TAO_Exceptions::create_system_exception (const char *id) +TAO::create_system_exception (const char *id) { for (CORBA::ULong i = 0; i < array_sz; ++i) { diff --git a/TAO/tao/TAOC.cpp b/TAO/tao/TAOC.cpp index 11c30f3c6be..4e6e3e361c9 100644 --- a/TAO/tao/TAOC.cpp +++ b/TAO/tao/TAOC.cpp @@ -44,10 +44,10 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_structure/structure_cs.cpp:66 -void +void TAO::BufferingConstraint::_tao_any_destructor ( void *_tao_void_pointer ) @@ -75,7 +75,7 @@ TAO::Objref_Traits<TAO::BufferingConstraintPolicy>::release ( TAO::BufferingConstraintPolicy_ptr p ) { - CORBA::release (p); + ::CORBA::release (p); } TAO::BufferingConstraintPolicy_ptr @@ -86,7 +86,7 @@ TAO::Objref_Traits<TAO::BufferingConstraintPolicy>::nil (void) CORBA::Boolean TAO::Objref_Traits<TAO::BufferingConstraintPolicy>::marshal ( - TAO::BufferingConstraintPolicy_ptr p, + const TAO::BufferingConstraintPolicy_ptr p, TAO_OutputCDR & cdr ) { @@ -124,18 +124,18 @@ TAO::BufferingConstraintPolicy::_unchecked_narrow ( TAO::BufferingConstraintPolicy_ptr TAO::BufferingConstraintPolicy::_duplicate (BufferingConstraintPolicy_ptr obj) { - if (! CORBA::is_nil (obj)) + if (! ::CORBA::is_nil (obj)) { obj->_add_ref (); } - + return obj; } void TAO::BufferingConstraintPolicy::_tao_release (BufferingConstraintPolicy_ptr obj) { - CORBA::release (obj); + ::CORBA::release (obj); } CORBA::Boolean diff --git a/TAO/tao/TAOC.h b/TAO/tao/TAOC.h index b417694122b..09119762180 100644 --- a/TAO/tao/TAOC.h +++ b/TAO/tao/TAOC.h @@ -64,82 +64,82 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - + // TAO_IDL - Generated from // be\be_visitor_typedef/typedef_ch.cpp:379 - + typedef CORBA::UShort BufferingConstraintMode; typedef CORBA::UShort_out BufferingConstraintMode_out; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const TAO::BufferingConstraintMode BUFFER_FLUSH = 0U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const TAO::BufferingConstraintMode BUFFER_TIMEOUT = 1U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const TAO::BufferingConstraintMode BUFFER_MESSAGE_COUNT = 2U; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const TAO::BufferingConstraintMode BUFFER_MESSAGE_BYTES = 4U; - + // TAO_IDL - Generated from // be\be_type.cpp:258 - + struct BufferingConstraint; - + typedef TAO_Fixed_Var_T< BufferingConstraint > BufferingConstraint_var; - + typedef BufferingConstraint & BufferingConstraint_out; - + // TAO_IDL - Generated from // be\be_visitor_structure/structure_ch.cpp:57 - + struct TAO_Export BufferingConstraint { typedef BufferingConstraint_var _var_type; - + static void _tao_any_destructor (void *); TAO::BufferingConstraintMode mode; TimeBase::TimeT timeout; CORBA::ULong message_count; CORBA::ULong message_bytes; }; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const CORBA::PolicyType BUFFERING_CONSTRAINT_POLICY_TYPE = 1413545985U; - + // TAO_IDL - Generated from // be\be_interface.cpp:598 #if !defined (_TAO_BUFFERINGCONSTRAINTPOLICY__VAR_OUT_CH_) #define _TAO_BUFFERINGCONSTRAINTPOLICY__VAR_OUT_CH_ - + class BufferingConstraintPolicy; typedef BufferingConstraintPolicy *BufferingConstraintPolicy_ptr; - + typedef TAO_Objref_Var_T< BufferingConstraintPolicy > BufferingConstraintPolicy_var; - + typedef TAO_Objref_Out_T< BufferingConstraintPolicy @@ -147,106 +147,106 @@ namespace TAO BufferingConstraintPolicy_out; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_interface/interface_ch.cpp:54 #if !defined (_TAO_BUFFERINGCONSTRAINTPOLICY_CH_) #define _TAO_BUFFERINGCONSTRAINTPOLICY_CH_ - + class TAO_Export BufferingConstraintPolicy : public virtual ::CORBA::Policy { public: typedef BufferingConstraintPolicy_ptr _ptr_type; typedef BufferingConstraintPolicy_var _var_type; - + // The static operations. static BufferingConstraintPolicy_ptr _duplicate (BufferingConstraintPolicy_ptr obj); - + static void _tao_release (BufferingConstraintPolicy_ptr obj); - + static BufferingConstraintPolicy_ptr _narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + static BufferingConstraintPolicy_ptr _unchecked_narrow ( CORBA::Object_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + static BufferingConstraintPolicy_ptr _nil (void) { return static_cast<BufferingConstraintPolicy_ptr> (0); } - - - + + + // TAO_IDL - Generated from // be\be_visitor_operation/operation_ch.cpp:46 - + virtual ::TAO::BufferingConstraint buffering_constraint ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( CORBA::SystemException )) = 0; - + // TAO_IDL - Generated from // be\be_visitor_operation/operation_ch.cpp:46 - + virtual ::CORBA::Policy_ptr copy ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( CORBA::SystemException )) = 0; - + // TAO_IDL - Generated from // be\be_visitor_operation/operation_ch.cpp:46 - + virtual void destroy ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS ) ACE_THROW_SPEC (( CORBA::SystemException )) = 0; - + // TAO_IDL - Generated from // be\be_visitor_interface/interface_ch.cpp:210 - + virtual CORBA::Boolean _is_a ( const char *type_id ACE_ENV_ARG_DECL_WITH_DEFAULTS ); - + virtual const char* _interface_repository_id (void) const; virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); - + protected: // Abstract or local interface only. BufferingConstraintPolicy (void); - + virtual ~BufferingConstraintPolicy (void); - + private: // Private and unimplemented for concrete interfaces. BufferingConstraintPolicy (const BufferingConstraintPolicy &); - + void operator= (const BufferingConstraintPolicy &); }; #endif /* end #if !defined */ - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const Messaging::SyncScope SYNC_EAGER_BUFFERING = 0; - + // TAO_IDL - Generated from // be\be_visitor_constant/constant_ch.cpp:52 - + const Messaging::SyncScope SYNC_DELAYED_BUFFERING = -2; // TAO_IDL - Generated from @@ -263,7 +263,7 @@ namespace TAO #if !defined (_TAO_BUFFERINGCONSTRAINTPOLICY__TRAITS_) #define _TAO_BUFFERINGCONSTRAINTPOLICY__TRAITS_ - + template<> struct TAO_Export Objref_Traits< ::TAO::BufferingConstraintPolicy> { @@ -275,7 +275,7 @@ namespace TAO ); static ::TAO::BufferingConstraintPolicy_ptr nil (void); static CORBA::Boolean marshal ( - ::TAO::BufferingConstraintPolicy_ptr p, + const ::TAO::BufferingConstraintPolicy_ptr p, TAO_OutputCDR & cdr ); }; diff --git a/TAO/tao/TAO_Server_Request.cpp b/TAO/tao/TAO_Server_Request.cpp index d49d18f228b..c4b7f69adb1 100644 --- a/TAO/tao/TAO_Server_Request.cpp +++ b/TAO/tao/TAO_Server_Request.cpp @@ -162,7 +162,8 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_ORB_Core * orb_core, #endif /* TAO_HAS_INTERCEPTORS == 1 */ { // Have to use a const_cast<>. *sigh* - this->profile_.object_key (const_cast<TAO::ObjectKey &> (target->_stubobj ()->object_key ())); + this->profile_.object_key ( + const_cast<TAO::ObjectKey &> (target->_stubobj ()->object_key ())); // Shallow copy the request service context list. This way the operation // details and server request share the request context. @@ -226,7 +227,8 @@ TAO_ServerRequest::reply_service_context (void) } else { - return const_cast <TAO_Operation_Details*> (this->operation_details_)->reply_service_context (); + return const_cast <TAO_Operation_Details*> ( + this->operation_details_)->reply_service_context (); } } @@ -261,11 +263,11 @@ TAO_ServerRequest::init_reply (void) // Forward exception only. if (!CORBA::is_nil (this->forward_location_.in ())) { - const CORBA::Boolean permanent_forward_condition = - this->orb_core_->is_permanent_forward_condition (this->forward_location_.in (), + CORBA::Boolean const permanent_forward_condition = + this->orb_core_->is_permanent_forward_condition (this->forward_location_.in (), this->request_service_context ()); - - reply_params.reply_status_ + + reply_params.reply_status_ = permanent_forward_condition ? TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM : TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD; @@ -372,7 +374,6 @@ TAO_ServerRequest::tao_send_reply (void) void TAO_ServerRequest::tao_send_reply_exception (CORBA::Exception &ex) { - // int result = 0; if (this->response_expected_ && !this->collocated ()) { // A copy of the reply parameters diff --git a/TAO/tao/TAO_Singleton_Manager.cpp b/TAO/tao/TAO_Singleton_Manager.cpp index 829f808c51f..8858df813b1 100644 --- a/TAO/tao/TAO_Singleton_Manager.cpp +++ b/TAO/tao/TAO_Singleton_Manager.cpp @@ -35,18 +35,8 @@ namespace TAO_Singleton_Manager * the_instance = 0; } -#if (defined (ACE_HAS_VERSIONED_NAMESPACE) \ - && ACE_HAS_VERSIONED_NAMESPACE == 1) \ - && !(defined (_MSC_VER) && _MSC_VER <= 1200) -// MSVC++ 6's preprocessor can't handle macro expansions required by -// the versioned namespace support. *sigh* - +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) # define TAO_SINGLETON_MANAGER_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(TAO_VERSIONED_NAMESPACE_NAME, _TAO_Singleton_Manager_cleanup_destroyer) - -#else - -# define TAO_SINGLETON_MANAGER_CLEANUP_DESTROYER_NAME TAO_Singleton_Manager_cleanup_destroyer - #endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ // Adapter for cleanup, used to register cleanup function with the diff --git a/TAO/tao/Tagged_Profile.h b/TAO/tao/Tagged_Profile.h index 58b0ff93167..541cb4362a4 100644 --- a/TAO/tao/Tagged_Profile.h +++ b/TAO/tao/Tagged_Profile.h @@ -47,7 +47,7 @@ class TAO_Export TAO_Tagged_Profile public: /// Declare FW_Server_Request_Wrapper a friend - /// This friendship makes the FW_Server_Request_Wrapper be able to + /// This friendship makes the FW_Server_Request_Wrapper be able to /// clone the TAO_Tagged_Profile data member in TAO_ServerRequest. friend class TAO::CSD::FW_Server_Request_Wrapper; @@ -127,7 +127,7 @@ private: * string type_id; * sequence<TaggedProfile> profiles; * }; - * The mapping for the type_id of type string is TAO_String_Manager + * The mapping for the type_id of type string is TAO::String_Manager * which does lot of bad things like allocation on construction and * a deallocation on destruction. This is bad along the critical * path. So we will store this nested structure ripped open with the diff --git a/TAO/tao/Thread_Lane_Resources_Manager.h b/TAO/tao/Thread_Lane_Resources_Manager.h index 47915050b97..e0637fbd23f 100644 --- a/TAO/tao/Thread_Lane_Resources_Manager.h +++ b/TAO/tao/Thread_Lane_Resources_Manager.h @@ -84,7 +84,7 @@ public: protected: /// The ORB Core. - TAO_ORB_Core *orb_core_; + TAO_ORB_Core * const orb_core_; /// The leader follower strategy TAO_LF_Strategy *lf_strategy_; diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index 2a1f66c5a78..e4817c918de 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -294,7 +294,7 @@ TAO_Transport::register_handler (void) this->id ())); } - ACE_Reactor *r = this->orb_core_->reactor (); + ACE_Reactor * const r = this->orb_core_->reactor (); // @@note: This should be okay since the register handler call will // not make a nested call into the transport. @@ -353,7 +353,7 @@ TAO_Transport::generate_request_header ( // on a particular connection. if (this->first_request_) { - TAO_Codeset_Manager *csm = this->orb_core ()->codeset_manager (); + TAO_Codeset_Manager * const csm = this->orb_core ()->codeset_manager (); if (csm) csm->generate_service_context (opdetails,*this); } @@ -482,7 +482,7 @@ TAO_Transport::send_message_block_chain_i (const ACE_Message_Block *mb, synch_message.push_back (this->head_, this->tail_); - int n = this->drain_queue_i (); + int const n = this->drain_queue_i (); if (n == -1) { @@ -696,7 +696,7 @@ TAO_Transport::schedule_output_i (void) // Check to see if our event handler is still registered with the // reactor. It's possible for another thread to have run close_connection() // since we last used the event handler. - ACE_Event_Handler *found = reactor->find_handler (eh->get_handle ()); + ACE_Event_Handler * const found = reactor->find_handler (eh->get_handle ()); if (found != eh) { if(TAO_debug_level > 3) @@ -727,8 +727,8 @@ TAO_Transport::schedule_output_i (void) int TAO_Transport::cancel_output_i (void) { - ACE_Event_Handler *eh = this->event_handler_i (); - ACE_Reactor *reactor = eh->reactor (); + ACE_Event_Handler * const eh = this->event_handler_i (); + ACE_Reactor *const reactor = eh->reactor (); if (TAO_debug_level > 3) { diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h index f1a9ba45ac0..075d6565296 100644 --- a/TAO/tao/Transport.h +++ b/TAO/tao/Transport.h @@ -196,7 +196,7 @@ namespace TAO * to do the above, the reactor will call us back when the handle * becomes read ready. The read-operation will copy data directly * into the enqueued buffer. If the message has bee read completely - * the message is sent to the higher layers of the ORB for processing. + * the message is sent to the higher layers of the ORB for processing. * * (c) If we get multiple messages (possible if the client connected * to the server sends oneways or AMI requests), we parse and @@ -900,10 +900,10 @@ private: protected: /// IOP protocol tag. - CORBA::ULong tag_; + CORBA::ULong const tag_; /// Global orbcore resource. - TAO_ORB_Core *orb_core_; + TAO_ORB_Core * const orb_core_; /// Our entry in the cache. We don't own this. It is here for our /// convenience. We cannot just change things around. diff --git a/TAO/tao/ULongLongSeqC.cpp b/TAO/tao/ULongLongSeqC.cpp index 08f97a96aed..108d4780a22 100644 --- a/TAO/tao/ULongLongSeqC.cpp +++ b/TAO/tao/ULongLongSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_ULONGLONGSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::ULongLongSeq::ULongLongSeq (void) CORBA::ULongLongSeq::ULongLongSeq ( ::CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::ULongLong > (max) @@ -67,7 +67,7 @@ CORBA::ULongLongSeq::ULongLongSeq ( ::CORBA::ULongLong * buffer, ::CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::ULongLong > (max, length, buffer, release) @@ -76,7 +76,7 @@ CORBA::ULongLongSeq::ULongLongSeq ( CORBA::ULongLongSeq::ULongLongSeq ( const ULongLongSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::ULongLong > (seq) @@ -107,15 +107,7 @@ void CORBA::ULongLongSeq::_tao_any_destructor ( const CORBA::ULongLongSeq &_tao_sequence ) { - const ::CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_ulonglong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } ::CORBA::Boolean operator>> ( @@ -123,33 +115,7 @@ void CORBA::ULongLongSeq::_tao_any_destructor ( CORBA::ULongLongSeq &_tao_sequence ) { - ::CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_ulonglong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_ULongLongSeq_CPP_ */ diff --git a/TAO/tao/ULongLongSeqC.h b/TAO/tao/ULongLongSeqC.h index b77ce3b7af6..94af13b4328 100644 --- a/TAO/tao/ULongLongSeqC.h +++ b/TAO/tao/ULongLongSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_ULONGLONGSEQ_CH_) #define _CORBA_ULONGLONGSEQ_CH_ - + class ULongLongSeq; - + typedef TAO_FixedSeq_Var_T< - ULongLongSeq, - CORBA::ULongLong + ULongLongSeq > ULongLongSeq_var; - + typedef TAO_Seq_Out_T< - ULongLongSeq, - ULongLongSeq_var, - CORBA::ULongLong + ULongLongSeq > ULongLongSeq_out; - + class TAO_Export ULongLongSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::ULongLong > { @@ -95,14 +92,14 @@ namespace CORBA ULongLongSeq ( ::CORBA::ULong max, ::CORBA::ULong length, - ::CORBA::ULongLong* buffer, - ::CORBA::Boolean release = 0 + ::CORBA::ULongLong* buffer, + ::CORBA::Boolean release = false ); ULongLongSeq (const ULongLongSeq &); ~ULongLongSeq (void); - + static void _tao_any_destructor (void *); - + typedef ULongLongSeq_var _var_type; }; diff --git a/TAO/tao/ULongSeqC.cpp b/TAO/tao/ULongSeqC.cpp index a474b95567f..33def028c72 100644 --- a/TAO/tao/ULongSeqC.cpp +++ b/TAO/tao/ULongSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_ULONGSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::ULongSeq::ULongSeq (void) CORBA::ULongSeq::ULongSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::ULong > (max) @@ -67,7 +67,7 @@ CORBA::ULongSeq::ULongSeq ( CORBA::ULong * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::ULong > (max, length, buffer, release) @@ -76,7 +76,7 @@ CORBA::ULongSeq::ULongSeq ( CORBA::ULongSeq::ULongSeq ( const ULongSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::ULong > (seq) @@ -107,15 +107,7 @@ CORBA::Boolean operator<< ( const CORBA::ULongSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -123,33 +115,7 @@ CORBA::Boolean operator>> ( CORBA::ULongSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_ULongSeq_CPP_ */ diff --git a/TAO/tao/ULongSeqC.h b/TAO/tao/ULongSeqC.h index f0b8beb805d..877065e7585 100644 --- a/TAO/tao/ULongSeqC.h +++ b/TAO/tao/ULongSeqC.h @@ -64,33 +64,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_ULONGSEQ_CH_) #define _CORBA_ULONGSEQ_CH_ - + class ULongSeq; - + typedef TAO_FixedSeq_Var_T< - ULongSeq, - CORBA::ULong + ULongSeq > ULongSeq_var; - + typedef TAO_Seq_Out_T< - ULongSeq, - ULongSeq_var, - CORBA::ULong + ULongSeq > ULongSeq_out; - + class TAO_Export ULongSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::ULong > { @@ -100,14 +97,14 @@ namespace CORBA ULongSeq ( CORBA::ULong max, CORBA::ULong length, - CORBA::ULong* buffer, - CORBA::Boolean release = 0 + CORBA::ULong* buffer, + CORBA::Boolean release = false ); ULongSeq (const ULongSeq &); ~ULongSeq (void); - + static void _tao_any_destructor (void *); - + typedef ULongSeq_var _var_type; }; diff --git a/TAO/tao/UShortSeqC.cpp b/TAO/tao/UShortSeqC.cpp index aecdf19d4a5..53db618d251 100644 --- a/TAO/tao/UShortSeqC.cpp +++ b/TAO/tao/UShortSeqC.cpp @@ -47,7 +47,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_USHORTSEQ_CS_) @@ -59,7 +59,7 @@ CORBA::UShortSeq::UShortSeq (void) CORBA::UShortSeq::UShortSeq ( CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::UShort > (max) @@ -71,7 +71,7 @@ CORBA::UShortSeq::UShortSeq ( CORBA::UShort * buffer, CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::UShort > (max, length, buffer, release) @@ -80,7 +80,7 @@ CORBA::UShortSeq::UShortSeq ( CORBA::UShortSeq::UShortSeq ( const UShortSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::UShort > (seq) @@ -111,15 +111,7 @@ CORBA::Boolean operator<< ( const CORBA::UShortSeq &_tao_sequence ) { - const CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_ushort_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } CORBA::Boolean operator>> ( @@ -127,33 +119,7 @@ CORBA::Boolean operator>> ( CORBA::UShortSeq &_tao_sequence ) { - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_ushort_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_UShortSeq_CPP_ */ diff --git a/TAO/tao/UShortSeqC.h b/TAO/tao/UShortSeqC.h index 883ac0591c2..1d84ccb1f07 100644 --- a/TAO/tao/UShortSeqC.h +++ b/TAO/tao/UShortSeqC.h @@ -79,22 +79,19 @@ namespace CORBA typedef TAO_FixedSeq_Var_T< - UShortSeq, - CORBA::UShort + UShortSeq > UShortSeq_var; typedef TAO_Seq_Out_T< - UShortSeq, - UShortSeq_var, - CORBA::UShort + UShortSeq > UShortSeq_out; class TAO_Export UShortSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::UShort > { @@ -105,7 +102,7 @@ namespace CORBA CORBA::ULong max, CORBA::ULong length, CORBA::UShort* buffer, - CORBA::Boolean release = 0 + CORBA::Boolean release = false ); UShortSeq (const UShortSeq &); ~UShortSeq (void); @@ -139,7 +136,7 @@ namespace TAO // but we put the instantiation here because the application will // need to see it in *C.h to avoid the error. #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT - template class TAO_Export TAO_Unbounded_Sequence<CORBA::UShortSeq>; +// template class TAO_Export TAO_Unbounded_Sequence<CORBA::UShortSeq>; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ // TAO_IDL - Generated from diff --git a/TAO/tao/Unbounded_Array_Allocation_Traits_T.h b/TAO/tao/Unbounded_Array_Allocation_Traits_T.h new file mode 100644 index 00000000000..283094749ba --- /dev/null +++ b/TAO/tao/Unbounded_Array_Allocation_Traits_T.h @@ -0,0 +1,54 @@ +#ifndef guard_unbounded_array_allocation_traits_hpp +#define guard_unbounded_array_allocation_traits_hpp +/** + * @file + * + * @brief Details can be found in the documentation for + * TAO::details::generic_sequence + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, bool dummy> +struct unbounded_array_allocation_traits +{ + typedef T value_type; + + inline static CORBA::ULong default_maximum() + { + return 0; + } + + inline static value_type * default_buffer_allocation() + { + return 0; + } + + inline static value_type * allocbuf(CORBA::ULong maximum) + { + return new value_type[maximum]; + } + + inline static void freebuf(value_type * buffer) + { + delete[] buffer; + } +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_array_allocation_traits_hpp diff --git a/TAO/tao/Unbounded_Array_Sequence_T.h b/TAO/tao/Unbounded_Array_Sequence_T.h new file mode 100644 index 00000000000..d91a6baf8be --- /dev/null +++ b/TAO/tao/Unbounded_Array_Sequence_T.h @@ -0,0 +1,150 @@ +#ifndef guard_unbounded_array_sequence_hpp +#define guard_unbounded_array_sequence_hpp +/** + * @file + * + * @brief Implement unbounded sequences for arrays. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "Unbounded_Array_Allocation_Traits_T.h" +#include "Generic_Sequence_T.h" +#include "Array_Traits_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +template<typename T_array, typename T_slice, typename T_tag> +class unbounded_array_sequence +{ +public: + typedef T_array * element_type; + typedef T_array value_type; + typedef T_slice * T_slice_ptr; + typedef T_slice_ptr * const_value_type; + typedef value_type & subscript_type; + typedef value_type const & const_subscript_type; + + typedef details::unbounded_array_allocation_traits<value_type,true> allocation_traits; + typedef details::array_traits <T_array, T_slice, T_tag> element_traits; + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + + inline unbounded_array_sequence() + : impl_() + {} + inline explicit unbounded_array_sequence(CORBA::ULong maximum) + : impl_(maximum) + {} + inline unbounded_array_sequence( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) + : impl_(maximum, length, data, release) + {} + inline CORBA::ULong maximum() const { + return impl_.maximum(); + } + inline CORBA::Boolean release() const { + return impl_.release(); + } + inline CORBA::ULong length() const { + return impl_.length(); + } + inline void length(CORBA::ULong length) { + impl_.length(length); + } + inline value_type const & operator[](CORBA::ULong i) const { + return impl_[i]; + } + inline value_type & operator[](CORBA::ULong i) { + return impl_[i]; + } + inline void replace( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + impl_.replace(maximum, length, data, release); + } + inline value_type const * get_buffer() const { + return impl_.get_buffer(); + } + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + return impl_.get_buffer(orphan); + } + inline void swap(unbounded_array_sequence & rhs) throw() { + impl_.swap(rhs.impl_); + } + static value_type * allocbuf(CORBA::ULong maximum) { + return implementation_type::allocbuf(maximum); + } + static void freebuf(value_type * buffer) { + implementation_type::freebuf(buffer); + } + +private: + implementation_type impl_; +}; +} + +namespace TAO +{ + template <typename stream, typename T_array, typename T_slice, typename T_tag> + bool demarshal_sequence(stream & strm, TAO::unbounded_array_sequence<T_array, T_slice, T_tag> & target) { + typedef TAO::unbounded_array_sequence<T_array, T_slice, T_tag> sequence; + typedef TAO::Array_Traits<T_array, T_slice, T_tag> array_traits; + typedef TAO_Array_Forany_T <T_array, T_slice, T_tag> forany; + + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + for(CORBA::ULong i = 0; i < new_length; ++i) { + forany tmp (array_traits::alloc ()); + bool _tao_marshal_flag = (strm >> tmp); + if (_tao_marshal_flag) { + array_traits::copy (buffer[i], tmp.in ()); + } + array_traits::free (tmp.inout ()); + if (!_tao_marshal_flag) { + return false; + } + } + tmp.swap(target); + return true; + } + + template <typename stream, typename T_array, typename T_slice, typename T_tag> + bool marshal_sequence(stream & strm, const TAO::unbounded_array_sequence<T_array, T_slice, T_tag> & source) { + typedef TAO_FixedArray_Var_T <T_array, T_slice, T_tag> fixed_array; + typedef TAO::Array_Traits<T_array, T_slice, T_tag> array_traits; + typedef TAO_Array_Forany_T <T_array, T_slice, T_tag> forany; + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + for(CORBA::ULong i = 0; i < length; ++i) { + fixed_array tmp_array = array_traits::dup (source[i]); + forany tmp (tmp_array.inout ()); + if (!(strm << tmp)) { + return false; + } + } + return true; + } +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_array_sequence_hpp diff --git a/TAO/tao/Unbounded_Basic_String_Sequence_T.h b/TAO/tao/Unbounded_Basic_String_Sequence_T.h new file mode 100644 index 00000000000..79aed91cb64 --- /dev/null +++ b/TAO/tao/Unbounded_Basic_String_Sequence_T.h @@ -0,0 +1,112 @@ +#ifndef guard_unbounded_basic_string_sequence_hpp +#define guard_unbounded_basic_string_sequence_hpp +/** + * @file + * + * @brief Implement unbounded sequences for strings and wide-strings. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "tao/Unbounded_Reference_Allocation_Traits_T.h" +#include "tao/String_Traits_T.h" +#include "tao/Generic_Sequence_T.h" +#include "tao/String_Sequence_Element_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename charT> +class unbounded_basic_string_sequence +{ +public: + typedef charT character_type; + typedef character_type * value_type; + typedef character_type const * const_value_type; + + typedef details::string_traits<character_type,true> element_traits; + typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits; + + typedef details::string_sequence_element<element_traits> element_type; + + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + + typedef element_type subscript_type; + typedef const_value_type const_subscript_type; + + inline unbounded_basic_string_sequence() + : impl_() + {} + inline explicit unbounded_basic_string_sequence(CORBA::ULong maximum) + : impl_(maximum) + {} + inline unbounded_basic_string_sequence( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release) + : impl_(maximum, length, data, release) + {} + + /* Use default ctor, operator= and dtor */ + inline CORBA::ULong maximum() const { + return impl_.maximum(); + } + inline CORBA::Boolean release() const { + return impl_.release(); + } + inline CORBA::ULong length() const { + return impl_.length(); + } + + inline void length(CORBA::ULong length) { + impl_.length(length); + } + inline const_value_type operator[](CORBA::ULong i) const { + return impl_[i]; + } + inline element_type operator[](CORBA::ULong i) { + return element_type(impl_[i], release()); + } + inline const_value_type const * get_buffer() const { + return impl_.get_buffer(); + } + inline void replace( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + impl_.replace(maximum, length, data, release); + } + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + return impl_.get_buffer(orphan); + } + inline void swap(unbounded_basic_string_sequence & rhs) throw() { + impl_.swap(rhs.impl_); + } + + static value_type * allocbuf(CORBA::ULong maximum) + { + return implementation_type::allocbuf(maximum); + } + static void freebuf(value_type * buffer) + { + implementation_type::freebuf(buffer); + } + + +private: + implementation_type impl_; +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_basic_string_sequence_hpp diff --git a/TAO/tao/Unbounded_Object_Reference_Sequence_T.h b/TAO/tao/Unbounded_Object_Reference_Sequence_T.h new file mode 100644 index 00000000000..37c1b73a251 --- /dev/null +++ b/TAO/tao/Unbounded_Object_Reference_Sequence_T.h @@ -0,0 +1,108 @@ +#ifndef guard_unbounded_object_reference_sequence_hpp +#define guard_unbounded_object_reference_sequence_hpp +/** + * @file + * + * @brief Implement unbounded sequences for object references. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "Unbounded_Reference_Allocation_Traits_T.h" +#include "Object_Reference_Traits_T.h" +#include "Generic_Sequence_T.h" +#include "Object_Reference_Sequence_Element_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +template<typename object_t, typename object_t_var> +class unbounded_object_reference_sequence +{ +public: + typedef object_t object_type; + typedef object_type * value_type; + typedef value_type const const_value_type; + + typedef details::object_reference_traits<object_type,object_t_var,true> element_traits; + typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits; + + typedef details::object_reference_sequence_element<element_traits> element_type; + typedef element_type subscript_type; + typedef value_type const & const_subscript_type; + + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + + inline unbounded_object_reference_sequence() + : impl_() + {} + inline explicit unbounded_object_reference_sequence(CORBA::ULong maximum) + : impl_(maximum) + {} + inline unbounded_object_reference_sequence( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release) + : impl_(maximum, length, data, release) + {} + + /* Use default ctor, operator= and dtor */ + inline CORBA::ULong maximum() const { + return impl_.maximum(); + } + inline CORBA::Boolean release() const { + return impl_.release(); + } + inline CORBA::ULong length() const { + return impl_.length(); + } + + inline void length(CORBA::ULong length) { + impl_.length(length); + } + inline value_type const & operator[](CORBA::ULong i) const { + return impl_[i]; + } + inline element_type operator[](CORBA::ULong i) { + return element_type(impl_[i], release()); + } + inline value_type const * get_buffer() const { + return impl_.get_buffer(); + } + inline void replace( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + impl_.replace(maximum, length, data, release); + } + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + return impl_.get_buffer(orphan); + } + inline void swap(unbounded_object_reference_sequence & rhs) throw() { + impl_.swap(rhs.impl_); + } + + static value_type * allocbuf(CORBA::ULong maximum) + { + return implementation_type::allocbuf(maximum); + } + static void freebuf(value_type * buffer) + { + implementation_type::freebuf(buffer); + } + + +private: + implementation_type impl_; +}; + +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_object_reference_sequence_hpp diff --git a/TAO/tao/Unbounded_Octet_Sequence_T.h b/TAO/tao/Unbounded_Octet_Sequence_T.h new file mode 100644 index 00000000000..a2c0122218f --- /dev/null +++ b/TAO/tao/Unbounded_Octet_Sequence_T.h @@ -0,0 +1,318 @@ +#ifndef guard_unbounded_octet_sequence_hpp +#define guard_unbounded_octet_sequence_hpp +/** + * @file + * + * @brief Implement octet sequences + * + * $Id$ + * + * @author Johnny Willemsen + */ +#include "tao/orbconf.h" + +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + +#include "tao/Unbounded_Value_Allocation_Traits_T.h" +#include "tao/Value_Traits_T.h" +#include "tao/Unbounded_Value_Sequence_T.h" +#include "tao/Range_Checking_T.h" + +#include "tao/Basic_Types.h" +#include "ace/Message_Block.h" +#include "ace/OS_Memory.h" +#include "ace/OS_NS_string.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +template<> +class unbounded_value_sequence<CORBA::Octet> +{ +public: + typedef CORBA::Octet value_type; + typedef CORBA::Octet element_type; + typedef CORBA::Octet const const_value_type; + typedef value_type & subscript_type; + typedef value_type const & const_subscript_type; + + typedef details::unbounded_value_allocation_traits<value_type,true> allocation_traits; + typedef details::value_traits<value_type,true> element_traits; + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + typedef details::range_checking<value_type,true> range; + + inline unbounded_value_sequence<CORBA::Octet>() + : maximum_ (allocation_traits::default_maximum()) + , length_ (0) + , buffer_ (allocation_traits::default_buffer_allocation()) + , release_ (true) + , mb_ (0) + {} + inline explicit unbounded_value_sequence<CORBA::Octet>(CORBA::ULong maximum) + : maximum_(maximum) + , length_(0) + , buffer_(allocbuf(maximum_)) + , release_(true) + , mb_ (0) + {} + inline unbounded_value_sequence<CORBA::Octet>( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) + : maximum_ (maximum), + length_ (length), + buffer_ (data), + release_ (release), + mb_ (0) + {} + inline ~unbounded_value_sequence<CORBA::Octet>() { + if (mb_) + ACE_Message_Block::release (mb_); + if (release_) + freebuf(buffer_); + } + /// Create a sequence of octets from a single message block (i.e. it + /// ignores any chaining in the meesage block). + inline unbounded_value_sequence<CORBA::Octet> (CORBA::ULong length, + const ACE_Message_Block* mb) + : maximum_ (length) + , length_ (length) + , buffer_ (reinterpret_cast <CORBA::Octet *>(mb->rd_ptr ())) + , release_ (false) + , mb_(0) { + // Get the message block flags. + ACE_Message_Block::Message_Flags flg = mb->self_flags (); + + // If the DONT_DELETE flag is disabled just a duplicate would + // help. If the DONT_DELETE flag is enabled a deep copy is needed as + // the contents would be on stack. Just incrementing the ref count + // on the stack based data block would only crash the program when + // the stack unwinds + if (ACE_BIT_DISABLED (flg, + ACE_Message_Block::DONT_DELETE)) + { + this->mb_ = ACE_Message_Block::duplicate (mb); + } + else + { + // As we are in CORBA mode, all the data blocks would be aligned + // on an 8 byte boundary + ACE_Message_Block msgb (*mb, + ACE_CDR::MAX_ALIGNMENT); + + // Get the base pointer of the incoming message block + char *start = ACE_ptr_align_binary (mb->base (), + ACE_CDR::MAX_ALIGNMENT); + + // Get the read and write displacements in the incoming stream + size_t rd_pos = mb->rd_ptr () - start; + size_t wr_pos = mb->wr_ptr () - start; + + this->mb_ = ACE_Message_Block::duplicate (&msgb); + + this->mb_->rd_ptr (rd_pos); + this->mb_->wr_ptr (wr_pos); + } + } + inline CORBA::ULong maximum() const { + return maximum_; + } + inline CORBA::Boolean release() const { + return release_; + } + inline CORBA::ULong length() const { + return length_; + } + inline void length(CORBA::ULong length) { + if (length <= maximum_ || length <= length_) + { + if (length_ < length) + { + // TODO This code does not provide the strong-exception + // guarantee, but it does provide the weak-exception + // guarantee. The problem would appear when + // initialize_range() raises an exception after several + // elements have been modified. One could argue that + // this problem is irrelevant, as the elements already + // modified are unreachable to conforming applications. + element_traits::initialize_range( + buffer_ + length_, buffer_ + length); + } + length_ = length; + return; + } + + unbounded_value_sequence<CORBA::Octet> tmp(length); + tmp.length_ = length; + element_traits::copy_range( + buffer_, buffer_ + length_, tmp.buffer_); + element_traits::initialize_range( + tmp.buffer_ + length_, tmp.buffer_ + length); + swap(tmp); + } + inline value_type const & operator[](CORBA::ULong i) const { + range::check(i, length_, maximum_, "operator[]() const"); + return buffer_[i]; + } + inline value_type & operator[](CORBA::ULong i) { + range::check(i, length_, maximum_, "operator[]() non-const"); + return buffer_[i]; + } + inline void replace( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + unbounded_value_sequence<CORBA::Octet> tmp(maximum, length, data, release); + swap(tmp); + } + inline value_type const * get_buffer() const { + if (buffer_ == 0) + { + buffer_ = allocbuf(maximum_); + } + return buffer_; + } + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + if (orphan && !release_) + { + return 0; + } + if (buffer_ == 0) + { + buffer_ = allocbuf(maximum_); + } + if (!orphan) + { + return buffer_; + } + + unbounded_value_sequence<CORBA::Octet> tmp; + swap(tmp); + tmp.release_ = false; + + return tmp.buffer_; + } + inline void swap(unbounded_value_sequence & rhs) throw() { + std::swap (mb_, rhs.mb_); + std::swap (maximum_, rhs.maximum_); + std::swap (length_, rhs.length_); + std::swap (buffer_, rhs.buffer_); + std::swap (release_, rhs.release_); + } + static value_type * allocbuf(CORBA::ULong maximum) { + return allocation_traits::allocbuf(maximum); + } + static void freebuf(value_type * buffer) { + allocation_traits::freebuf(buffer); + } + + /// Returns the underlying message block, the caller must *not* + /// release the copy. + inline ACE_Message_Block* mb (void) const { + return mb_; + } + + /// Replaces the current buffer with <mb>, using only <length> bytes. + /// It takes a duplicate of <mb> so the user still owns it. + inline void replace (CORBA::ULong length, const ACE_Message_Block* mb) { + unbounded_value_sequence<CORBA::Octet> s (length, mb); + swap (s); + } + + unbounded_value_sequence<CORBA::Octet> ( + const unbounded_value_sequence<CORBA::Octet> &rhs) + : maximum_ (0) + , length_ (0) + , buffer_(0) + , release_(false) + , mb_ (0) + { + unbounded_value_sequence<CORBA::Octet> tmp(rhs.maximum_); + tmp.length_ = rhs.length_; + if (rhs.mb_ == 0) + { + ACE_OS::memcpy (tmp.buffer_, + rhs.buffer_, + rhs.length_); + } + else + { + size_t offset = 0; + for (const ACE_Message_Block *i = rhs.mb_; i != 0; i = i->cont ()) + { + ACE_OS::memcpy (tmp.buffer_ + offset, + i->rd_ptr (), + i->length ()); + + offset += i->length (); + } + } + swap(tmp); + } + + unbounded_value_sequence<CORBA::Octet> & + operator= (const unbounded_value_sequence<CORBA::Octet> & rhs) + { + unbounded_value_sequence<CORBA::Octet> tmp(rhs); + swap(tmp); + return * this; + } + +private: + /// The maximum number of elements the buffer can contain. + CORBA::ULong maximum_; + + /// The current number of elements in the buffer. + CORBA::ULong length_; + + /// The buffer with all the elements, casting must be done in derived + /// classes. + mutable value_type * buffer_; + + /// If true then the sequence should release the buffer when it is + /// destroyed. + CORBA::Boolean release_; + ACE_Message_Block* mb_; +}; + +} // namespace TAO + +#endif + +inline +bool +operator== (const TAO::unbounded_value_sequence<CORBA::Octet> & lhs, + const TAO::unbounded_value_sequence<CORBA::Octet> & rhs) +{ + const CORBA::ULong rlen = rhs.length (); + + if (rlen != lhs.length ()) + { + return false; + } + + for (CORBA::ULong i = 0; i < rlen; ++i) + { + if (rhs[i] != lhs[i]) + { + return false; + } + } + + return true; +} + +inline +bool +operator!= (const TAO::unbounded_value_sequence<CORBA::Octet> & lhs, + const TAO::unbounded_value_sequence<CORBA::Octet> & rhs) +{ + return !(lhs == rhs); +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_octet_sequence_hpp diff --git a/TAO/tao/Unbounded_Reference_Allocation_Traits_T.h b/TAO/tao/Unbounded_Reference_Allocation_Traits_T.h new file mode 100644 index 00000000000..193bcf7c2bc --- /dev/null +++ b/TAO/tao/Unbounded_Reference_Allocation_Traits_T.h @@ -0,0 +1,69 @@ +#ifndef guard_unbounded_reference_allocation_traits_hpp +#define guard_unbounded_reference_allocation_traits_hpp +/** + * @file + * + * @brief Details can be found in the documentation for + * TAO::details::generic_sequence + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, class ref_traits, bool dummy> +struct unbounded_reference_allocation_traits +{ + typedef T value_type; + typedef ref_traits reference_traits; + + inline static CORBA::ULong default_maximum() + { + return 0; + } + + inline static value_type * default_buffer_allocation() + { + return 0; + } + + inline static value_type * allocbuf(CORBA::ULong maximum) + { + value_type * buffer = new value_type[maximum + 1]; + reinterpret_cast<value_type**>(buffer)[0] = buffer + maximum + 1; + + // no throw + reference_traits::zero_range(buffer + 1, buffer + maximum + 1); + + return buffer + 1; + } + + inline static void freebuf(value_type * buffer) + { + if(buffer != 0) + { + value_type * begin = buffer - 1; + value_type * end = reinterpret_cast<value_type*>(*begin); + reference_traits::release_range(buffer, end); + + buffer = begin; + } + delete[] buffer; + } +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_reference_allocation_traits_hpp diff --git a/TAO/tao/Unbounded_Sequence_CDR_T.h b/TAO/tao/Unbounded_Sequence_CDR_T.h new file mode 100644 index 00000000000..e1fdbcbe998 --- /dev/null +++ b/TAO/tao/Unbounded_Sequence_CDR_T.h @@ -0,0 +1,534 @@ +#ifndef guard_unbounded_sequence_cdr +#define guard_unbounded_sequence_cdr +/** + * @file + * + * @brief Extract the sequence + * + * $Id$ + * + * @author Carlos O'Ryan + * @author Johnny Willemsen + */ + +#include "tao/Unbounded_Basic_String_Sequence_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO { + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Short> & target) { + typedef TAO::unbounded_value_sequence <CORBA::Short> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_short_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Long> & target) { + typedef TAO::unbounded_value_sequence <CORBA::Long> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_long_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::ULong> & target) { + typedef TAO::unbounded_value_sequence <CORBA::ULong> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_ulong_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::UShort> & target) { + typedef TAO::unbounded_value_sequence <CORBA::UShort> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_ushort_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Octet> & target) { + typedef TAO::unbounded_value_sequence <CORBA::Octet> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + if (ACE_BIT_DISABLED (strm.start ()->flags (), ACE_Message_Block::DONT_DELETE)) + { + TAO_ORB_Core* orb_core = strm.orb_core (); + if (orb_core != 0 && strm.orb_core ()->resource_factory ()-> + input_cdr_allocator_type_locked () == 1) + { + tmp.replace (new_length, strm.start ()); + tmp.mb ()->wr_ptr (tmp.mb()->rd_ptr () + new_length); + strm.skip_bytes (new_length); + tmp.swap(target); + return true; + } + } + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_octet_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } +#else + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Octet> & target) { + typedef TAO::unbounded_value_sequence <CORBA::Octet> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_octet_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } +#endif + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Char> & target) { + typedef TAO::unbounded_value_sequence <CORBA::Char> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_char_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + +# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::WChar> & target) { + typedef TAO::unbounded_value_sequence <CORBA::WChar> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_wchar_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } +#endif + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Float> & target) { + typedef TAO::unbounded_value_sequence <CORBA::Float> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_float_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Double> & target) { + typedef TAO::unbounded_value_sequence <CORBA::Double> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_double_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::ULongLong> & target) { + typedef TAO::unbounded_value_sequence <CORBA::ULongLong> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_ulonglong_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::LongDouble> & target) { + typedef TAO::unbounded_value_sequence <CORBA::LongDouble> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_longdouble_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <CORBA::Boolean> & target) { + typedef TAO::unbounded_value_sequence <CORBA::Boolean> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + if (!strm.read_boolean_array (buffer, new_length)) { + return false; + } + tmp.swap(target); + return true; + } + + template <typename stream, typename value_t> + bool demarshal_sequence(stream & strm, TAO::unbounded_value_sequence <value_t> & target) { + typedef TAO::unbounded_value_sequence <value_t> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + for(CORBA::ULong i = 0; i < new_length; ++i) { + if (!(strm >> buffer[i])) { + return false; + } + } + tmp.swap(target); + return true; + } + + template <typename stream, typename charT> + bool demarshal_sequence(stream & strm, TAO::details::unbounded_basic_string_sequence <charT> & target) { + typedef TAO::details::unbounded_basic_string_sequence <charT> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + for(CORBA::ULong i = 0; i < new_length; ++i) { + if (!(strm >> buffer[i])) { + return false; + } + } + tmp.swap(target); + return true; + } + + template <typename stream, typename object_t, typename object_t_var> + bool demarshal_sequence(stream & strm, TAO::unbounded_object_reference_sequence<object_t, object_t_var> & target) { + typedef TAO::unbounded_object_reference_sequence<object_t, object_t_var> sequence; + ::CORBA::ULong new_length = 0; + if (!(strm >> new_length)) { + return false; + } + if (new_length > strm.length()) { + return false; + } + sequence tmp(new_length); + tmp.length(new_length); + typename sequence::value_type * buffer = tmp.get_buffer(); + for(CORBA::ULong i = 0; i < new_length; ++i) { + if (!(strm >> buffer[i])) { + return false; + } + } + tmp.swap(target); + return true; + } +} + +namespace TAO { + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Short> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_short_array (source.get_buffer (), length); + } + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Long> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_long_array (source.get_buffer (), length); + } + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::ULong> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_ulong_array (source.get_buffer (), length); + } + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::UShort> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_ushort_array (source.get_buffer (), length); + } + +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Octet> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + if (source.mb ()) { + return strm.write_octet_array_mb (source.mb ()); + } + return strm.write_octet_array (source.get_buffer (), length); + } +#else + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Octet> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_octet_array (source.get_buffer (), length); + } +#endif + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Char> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_char_array (source.get_buffer (), length); + } + +# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::WChar> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_wchar_array (source.get_buffer (), length); + } +#endif + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Float> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_float_array (source.get_buffer (), length); + } + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Double> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_double_array (source.get_buffer (), length); + } + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::ULongLong> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_ulonglong_array (source.get_buffer (), length); + } + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::LongDouble> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_longdouble_array (source.get_buffer (), length); + } + + template <typename stream> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <CORBA::Boolean> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + return strm.write_boolean_array (source.get_buffer (), length); + } + + template <typename stream, typename value_t> + bool marshal_sequence(stream & strm, const TAO::unbounded_value_sequence <value_t> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + for(CORBA::ULong i = 0; i < length; ++i) { + if (!(strm << source[i])) { + return false; + } + } + return true; + } + + template <typename stream, typename charT> + bool marshal_sequence(stream & strm, const TAO::details::unbounded_basic_string_sequence <charT> & source) { + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + for(CORBA::ULong i = 0; i < length; ++i) { + if (!(strm << source[i])) { + return false; + } + } + return true; + } + + template <typename stream, typename object_t, typename object_t_var> + bool marshal_sequence(stream & strm, const TAO::unbounded_object_reference_sequence<object_t, object_t_var> & source) { + typedef typename TAO::unbounded_object_reference_sequence<object_t, object_t_var>::object_type objec_t; + ::CORBA::ULong const length = source.length (); + if (!(strm << length)) { + return false; + } + for(CORBA::ULong i = 0; i < length; ++i) { + if (!TAO::Objref_Traits<objec_t>::marshal (source[i], strm)) { + return false; + } + } + return true; + } +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif /* guard_unbounded_sequence_cdr */ diff --git a/TAO/tao/Unbounded_String_Sequence_T.h b/TAO/tao/Unbounded_String_Sequence_T.h new file mode 100644 index 00000000000..9b126308dcd --- /dev/null +++ b/TAO/tao/Unbounded_String_Sequence_T.h @@ -0,0 +1,43 @@ +#ifndef guard_unbounded_string_sequence_hpp +#define guard_unbounded_string_sequence_hpp +/** + * @file + * + * @brief Implement unbounded sequences for strings. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "tao/Unbounded_Basic_String_Sequence_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +class unbounded_string_sequence + : public details::unbounded_basic_string_sequence<char> +{ +public: + inline unbounded_string_sequence() + : details::unbounded_basic_string_sequence<char>() + {} + inline explicit unbounded_string_sequence(CORBA::ULong maximum) + : details::unbounded_basic_string_sequence<char>(maximum) + {} + inline unbounded_string_sequence( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) + : details::unbounded_basic_string_sequence<char>( + maximum, length, data, release) + {} +}; + +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_string_sequence_hpp diff --git a/TAO/tao/Unbounded_Value_Allocation_Traits_T.h b/TAO/tao/Unbounded_Value_Allocation_Traits_T.h new file mode 100644 index 00000000000..e435d0f1fbc --- /dev/null +++ b/TAO/tao/Unbounded_Value_Allocation_Traits_T.h @@ -0,0 +1,54 @@ +#ifndef guard_unbounded_value_allocation_traits_hpp +#define guard_unbounded_value_allocation_traits_hpp +/** + * @file + * + * @brief Details can be found in the documentation for + * TAO::details::generic_sequence + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Basic_Types.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, bool dummy> +struct unbounded_value_allocation_traits +{ + typedef T value_type; + + inline static CORBA::ULong default_maximum() + { + return 0; + } + + inline static value_type * default_buffer_allocation() + { + return 0; + } + + inline static value_type * allocbuf(CORBA::ULong maximum) + { + return new value_type[maximum]; + } + + inline static void freebuf(value_type * buffer) + { + delete[] buffer; + } +}; + +} // namespace details +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_value_allocation_traits_hpp diff --git a/TAO/tao/Unbounded_Value_Sequence_T.h b/TAO/tao/Unbounded_Value_Sequence_T.h new file mode 100644 index 00000000000..e39893e1f5c --- /dev/null +++ b/TAO/tao/Unbounded_Value_Sequence_T.h @@ -0,0 +1,101 @@ +#ifndef guard_unbounded_value_sequence_hpp +#define guard_unbounded_value_sequence_hpp +/** + * @file + * + * @brief Implement unbounded sequences for types with value-like + * semantics. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include "tao/Unbounded_Value_Allocation_Traits_T.h" +#include "tao/Value_Traits_T.h" +#include "tao/Generic_Sequence_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +template<class T> +class unbounded_value_sequence +{ +public: + typedef T value_type; + typedef T element_type; + typedef T const const_value_type; + typedef value_type & subscript_type; + typedef value_type const & const_subscript_type; + + typedef details::unbounded_value_allocation_traits<value_type,true> allocation_traits; + typedef details::value_traits<value_type,true> element_traits; + typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; + + inline unbounded_value_sequence() + : impl_() + {} + inline explicit unbounded_value_sequence(CORBA::ULong maximum) + : impl_(maximum) + {} + inline unbounded_value_sequence( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) + : impl_(maximum, length, data, release) + {} + /* Use default ctor, operator= and dtor */ + inline CORBA::ULong maximum() const { + return impl_.maximum(); + } + inline CORBA::Boolean release() const { + return impl_.release(); + } + inline CORBA::ULong length() const { + return impl_.length(); + } + inline void length(CORBA::ULong length) { + impl_.length(length); + } + inline value_type const & operator[](CORBA::ULong i) const { + return impl_[i]; + } + inline value_type & operator[](CORBA::ULong i) { + return impl_[i]; + } + inline void replace( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) { + impl_.replace(maximum, length, data, release); + } + inline value_type const * get_buffer() const { + return impl_.get_buffer(); + } + inline value_type * get_buffer(CORBA::Boolean orphan = false) { + return impl_.get_buffer(orphan); + } + inline void swap(unbounded_value_sequence & rhs) throw() { + impl_.swap(rhs.impl_); + } + static value_type * allocbuf(CORBA::ULong maximum) { + return implementation_type::allocbuf(maximum); + } + static void freebuf(value_type * buffer) { + implementation_type::freebuf(buffer); + } + +private: + implementation_type impl_; +}; + +} // namespace TAO + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_unbounded_string_sequence_hpp + diff --git a/TAO/tao/Unbounded_Wstring_Sequence_T.h b/TAO/tao/Unbounded_Wstring_Sequence_T.h new file mode 100644 index 00000000000..4fd6886b564 --- /dev/null +++ b/TAO/tao/Unbounded_Wstring_Sequence_T.h @@ -0,0 +1,39 @@ +#ifndef guard_unbounded_wstring_sequence_hpp +#define guard_unbounded_wstring_sequence_hpp +/** + * @file + * + * @brief Implement unbounded sequences for wide strings. + * + * $Id$ + * + * @author Carlos O'Ryan + */ +#include "tao/Unbounded_Basic_String_Sequence_T.h" + +namespace TAO +{ + +class unbounded_wstring_sequence + : public details::unbounded_basic_string_sequence<CORBA::WChar> +{ +public: + inline unbounded_wstring_sequence() + : details::unbounded_basic_string_sequence<CORBA::WChar>() + {} + inline /* explicit */ unbounded_wstring_sequence(CORBA::ULong maximum) + : details::unbounded_basic_string_sequence<CORBA::WChar>(maximum) + {} + inline unbounded_wstring_sequence( + CORBA::ULong maximum, + CORBA::ULong length, + value_type * data, + CORBA::Boolean release = false) + : details::unbounded_basic_string_sequence<CORBA::WChar>( + maximum, length, data, release) + {} +}; + +} // namespace TAO + +#endif // guard_unbounded_wstring_sequence_hpp diff --git a/TAO/tao/UserException.h b/TAO/tao/UserException.h index f3f2dcec89f..9fef2c2ea16 100644 --- a/TAO/tao/UserException.h +++ b/TAO/tao/UserException.h @@ -72,10 +72,9 @@ namespace CORBA /// function is not CORBA compliant. virtual ACE_CString _info (void) const; - //protected: // when msvc6 is dropped we can make this protected + protected: /// Default constructor. UserException (void); - }; } diff --git a/TAO/tao/Value_Traits_T.h b/TAO/tao/Value_Traits_T.h new file mode 100644 index 00000000000..a16c7a02d89 --- /dev/null +++ b/TAO/tao/Value_Traits_T.h @@ -0,0 +1,53 @@ +#ifndef guard_value_traits_hpp +#define guard_value_traits_hpp +/** + * @file + * + * @brief Implement the element manipulation traits for types with + * value-like semantics. + * + * $Id$ + * + * @author Carlos O'Ryan + */ + +#include <algorithm> + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +namespace details +{ + +template<typename T, bool dummy> +struct value_traits +{ + typedef T value_type; + typedef T const const_value_type; + + inline static void zero_range( + value_type * begin , value_type * end) + { + std::fill(begin, end, value_type ()); + } + + inline static void initialize_range( + value_type * begin, value_type * end) + { + std::fill(begin, end, value_type ()); + } + + inline static void copy_range( + value_type * begin, value_type * end, value_type *dst) + { + std::copy(begin, end, dst); + } +}; + +} // namespace details +} // namespace CORBA + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // guard_value_traits_hpp diff --git a/TAO/tao/Valuetype_Adapter_Factory.cpp b/TAO/tao/Valuetype_Adapter_Factory.cpp new file mode 100644 index 00000000000..5cee721f6af --- /dev/null +++ b/TAO/tao/Valuetype_Adapter_Factory.cpp @@ -0,0 +1,14 @@ +// $Id$ +#include "tao/Valuetype_Adapter_Factory.h" + +ACE_RCSID (tao, + Valuetype_Adapter_Factory, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO_Valuetype_Adapter_Factory::~TAO_Valuetype_Adapter_Factory (void) +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype_Adapter_Factory.h b/TAO/tao/Valuetype_Adapter_Factory.h new file mode 100644 index 00000000000..dabd7e7159a --- /dev/null +++ b/TAO/tao/Valuetype_Adapter_Factory.h @@ -0,0 +1,55 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Valuetype_Adapter_Factory.h + * + * $Id$ + * + * @author Kees van Marle <kvmarle@remedy.nl> + */ +//============================================================================= + + +#ifndef TAO_VALUETYPE_ADAPTER_FACTORY_H +#define TAO_VALUETYPE_ADAPTER_FACTORY_H + +#include /**/ "ace/pre.h" +#include "ace/Service_Object.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/SystemException.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_Valuetype_Adapter; + +/** + * @class TAO_Valuetype_Adapter_Factory + * + * @brief TAO_Valuetype_Adapter_Factory. + * + * Class that creates one instance of TAO_Valuetype_Adapter per + * ORB on the ORB's first usage of its valuetype_adapter_. This is a base + * class for the actual implementation in the TAO_Valuetype library. + */ +class TAO_Export TAO_Valuetype_Adapter_Factory + : public ACE_Service_Object +{ +public: + virtual ~TAO_Valuetype_Adapter_Factory (void); + + virtual TAO_Valuetype_Adapter * create ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_VALUETYPE_ADAPTER_FACTORY_H */ diff --git a/TAO/tao/Var_Size_Argument_T.h b/TAO/tao/Var_Size_Argument_T.h index 29941828854..72760ec5ac8 100644 --- a/TAO/tao/Var_Size_Argument_T.h +++ b/TAO/tao/Var_Size_Argument_T.h @@ -118,7 +118,7 @@ namespace TAO }; /** - * @struct Basic_Tag + * @struct Var_Size_Tag * * @brief Struct for fixed size IDL type arguments id tag. * diff --git a/TAO/tao/WCharSeqC.cpp b/TAO/tao/WCharSeqC.cpp index 6de54e5b49f..7d9e6cff8ce 100644 --- a/TAO/tao/WCharSeqC.cpp +++ b/TAO/tao/WCharSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_WCHARSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::WCharSeq::WCharSeq (void) CORBA::WCharSeq::WCharSeq ( ::CORBA::ULong max ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::WChar > (max) @@ -67,7 +67,7 @@ CORBA::WCharSeq::WCharSeq ( ::CORBA::WChar * buffer, ::CORBA::Boolean release ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::WChar > (max, length, buffer, release) @@ -76,7 +76,7 @@ CORBA::WCharSeq::WCharSeq ( CORBA::WCharSeq::WCharSeq ( const WCharSeq &seq ) - : TAO_Unbounded_Sequence< + : TAO::unbounded_value_sequence< CORBA::WChar > (seq) @@ -107,15 +107,7 @@ void CORBA::WCharSeq::_tao_any_destructor ( const CORBA::WCharSeq &_tao_sequence ) { - const ::CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - return strm.write_wchar_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } ::CORBA::Boolean operator>> ( @@ -123,33 +115,7 @@ void CORBA::WCharSeq::_tao_any_destructor ( CORBA::WCharSeq &_tao_sequence ) { - ::CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - return strm.read_wchar_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); - - } - - return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_WCharSeq_CPP_ */ diff --git a/TAO/tao/WCharSeqC.h b/TAO/tao/WCharSeqC.h index 387004f7c3c..3a3676e8b57 100644 --- a/TAO/tao/WCharSeqC.h +++ b/TAO/tao/WCharSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_WCHARSEQ_CH_) #define _CORBA_WCHARSEQ_CH_ - + class WCharSeq; - + typedef TAO_FixedSeq_Var_T< - WCharSeq, - CORBA::WChar + WCharSeq > WCharSeq_var; - + typedef TAO_Seq_Out_T< - WCharSeq, - WCharSeq_var, - CORBA::WChar + WCharSeq > WCharSeq_out; - + class TAO_Export WCharSeq : public - TAO_Unbounded_Sequence< + TAO::unbounded_value_sequence< CORBA::WChar > { @@ -95,14 +92,14 @@ namespace CORBA WCharSeq ( ::CORBA::ULong max, ::CORBA::ULong length, - ::CORBA::WChar* buffer, - ::CORBA::Boolean release = 0 + ::CORBA::WChar* buffer, + ::CORBA::Boolean release = false ); WCharSeq (const WCharSeq &); ~WCharSeq (void); - + static void _tao_any_destructor (void *); - + typedef WCharSeq_var _var_type; }; diff --git a/TAO/tao/WStringSeqC.cpp b/TAO/tao/WStringSeqC.cpp index 12ab5b23d1b..8a6b8ad0bdd 100644 --- a/TAO/tao/WStringSeqC.cpp +++ b/TAO/tao/WStringSeqC.cpp @@ -43,7 +43,7 @@ namespace TAO } -// TAO_IDL - Generated from +// TAO_IDL - Generated from // be\be_visitor_sequence/sequence_cs.cpp:65 #if !defined (_CORBA_WSTRINGSEQ_CS_) @@ -55,7 +55,7 @@ CORBA::WStringSeq::WStringSeq (void) CORBA::WStringSeq::WStringSeq ( ::CORBA::ULong max ) - : TAO_Unbounded_WString_Sequence + : TAO::unbounded_wstring_sequence (max) {} @@ -65,14 +65,14 @@ CORBA::WStringSeq::WStringSeq ( ::CORBA::WChar * * buffer, ::CORBA::Boolean release ) - : TAO_Unbounded_WString_Sequence + : TAO::unbounded_wstring_sequence (max, length, buffer, release) {} CORBA::WStringSeq::WStringSeq ( const WStringSeq &seq ) - : TAO_Unbounded_WString_Sequence + : TAO::unbounded_wstring_sequence (seq) {} @@ -101,22 +101,7 @@ void CORBA::WStringSeq::_tao_any_destructor ( const CORBA::WStringSeq &_tao_sequence ) { - const ::CORBA::ULong _tao_seq_len = _tao_sequence.length (); - - if (strm << _tao_seq_len) - { - // Encode all elements. - ::CORBA::Boolean _tao_marshal_flag = true; - - for ( ::CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm << _tao_sequence[i].in ()); - } - - return _tao_marshal_flag; - } - - return false; + return TAO::marshal_sequence(strm, _tao_sequence); } ::CORBA::Boolean operator>> ( @@ -124,41 +109,7 @@ void CORBA::WStringSeq::_tao_any_destructor ( CORBA::WStringSeq &_tao_sequence ) { - ::CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return false; - } - - // Set the length of the sequence. - _tao_sequence.length (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return true; - } - - // Retrieve all the elements. - ::CORBA::Boolean _tao_marshal_flag = true; - - for ( ::CORBA::ULong i = 0; i < _tao_seq_len && _tao_marshal_flag; ++i) - { - _tao_marshal_flag = (strm >> _tao_sequence[i].out ()); - - } - - return _tao_marshal_flag; - - } - -return false; + return TAO::demarshal_sequence(strm, _tao_sequence); } #endif /* _TAO_CDR_OP_CORBA_WStringSeq_CPP_ */ diff --git a/TAO/tao/WStringSeqC.h b/TAO/tao/WStringSeqC.h index 04adbf29512..99af9022e39 100644 --- a/TAO/tao/WStringSeqC.h +++ b/TAO/tao/WStringSeqC.h @@ -59,33 +59,30 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace CORBA { - + // TAO_IDL - Generated from // be\be_visitor_sequence/sequence_ch.cpp:101 #if !defined (_CORBA_WSTRINGSEQ_CH_) #define _CORBA_WSTRINGSEQ_CH_ - + class WStringSeq; - + typedef - TAO_MngSeq_Var_T< - WStringSeq, - TAO_SeqElem_WString_Manager + TAO_VarSeq_Var_T< + WStringSeq > WStringSeq_var; - + typedef - TAO_MngSeq_Out_T< - WStringSeq, - WStringSeq_var, - TAO_SeqElem_WString_Manager + TAO_Seq_Out_T< + WStringSeq > WStringSeq_out; - + class TAO_Export WStringSeq : public - TAO_Unbounded_WString_Sequence + TAO::unbounded_wstring_sequence { public: WStringSeq (void); @@ -93,14 +90,14 @@ namespace CORBA WStringSeq ( ::CORBA::ULong max, ::CORBA::ULong length, - ::CORBA::WChar ** buffer, - ::CORBA::Boolean release = 0 + ::CORBA::WChar ** buffer, + ::CORBA::Boolean release = false ); WStringSeq (const WStringSeq &); ~WStringSeq (void); - + static void _tao_any_destructor (void *); - + typedef WStringSeq_var _var_type; }; diff --git a/TAO/tao/Wait_On_Read.cpp b/TAO/tao/Wait_On_Read.cpp index 7cd1115fe39..e510aee3f81 100644 --- a/TAO/tao/Wait_On_Read.cpp +++ b/TAO/tao/Wait_On_Read.cpp @@ -88,10 +88,10 @@ TAO_Wait_On_Read::wait (ACE_Time_Value * max_wait_time, ACE_TEXT ("registering handle for cleanup \n"), this->transport_->id ())); - ACE_Event_Handler *eh = + ACE_Event_Handler * const eh = this->transport_->event_handler_i (); - ACE_Reactor *r = + ACE_Reactor * const r = this->transport_->orb_core ()->reactor (); if (r->register_handler (eh, diff --git a/TAO/tao/WrongTransactionC.cpp b/TAO/tao/WrongTransactionC.cpp index c051cb19370..8c7368c54cf 100644 --- a/TAO/tao/WrongTransactionC.cpp +++ b/TAO/tao/WrongTransactionC.cpp @@ -78,7 +78,7 @@ CORBA::WrongTransaction::WrongTransaction (const ::CORBA::WrongTransaction &_tao CORBA::WrongTransaction& CORBA::WrongTransaction::operator= (const ::CORBA::WrongTransaction &_tao_excp) { - this->ACE_NESTED_CLASS (CORBA, UserException)::operator= (_tao_excp); + this->::CORBA::UserException::operator= (_tao_excp); return *this; } diff --git a/TAO/tao/corba.h b/TAO/tao/corba.h index fe1bb730e4f..1fbb3357d66 100644 --- a/TAO/tao/corba.h +++ b/TAO/tao/corba.h @@ -68,9 +68,8 @@ // TAO specific files, avoid them as much as possible. #include "tao/CDR.h" - -#include "tao/Managed_Types.h" #include "tao/Object_KeyC.h" +#include "tao/String_Manager_T.h" #if TAO_HAS_INTERCEPTORS == 1 #include "tao/PortableInterceptorC.h" diff --git a/TAO/tao/operation_details.i b/TAO/tao/operation_details.i index a570229cf4b..a65462899cd 100644 --- a/TAO/tao/operation_details.i +++ b/TAO/tao/operation_details.i @@ -98,12 +98,12 @@ TAO_Operation_Details::reply_service_info (void) const ACE_INLINE void TAO_Operation_Details::reset_request_service_info (void) { - this->request_service_context ().service_info ()._deallocate_buffer (); + this->request_service_context ().service_info ().length (0); } ACE_INLINE void TAO_Operation_Details::reset_reply_service_info (void) { - this->reply_service_context ().service_info ()._deallocate_buffer (); + this->reply_service_context ().service_info ().length (0); } ACE_INLINE void diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index ffdd877612b..1df2e0b5079 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -1,4 +1,5 @@ //$Id$ + project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { sharedname = TAO dynamicflags = TAO_BUILD_DLL @@ -120,7 +121,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { LongLongSeqC.cpp LongSeqC.cpp LRU_Connection_Purging_Strategy.cpp - Managed_Types.cpp MCAST_Parser.cpp Messaging_PolicyValueC.cpp Messaging_SyncScopeC.cpp @@ -176,7 +176,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { Request_Dispatcher.cpp Resource_Factory.cpp Resume_Handle.cpp - Sequence.cpp Server_Strategy_Factory.cpp ServerRequestInterceptor_Adapter.cpp ServerRequestInterceptor_Adapter_Factory.cpp @@ -184,6 +183,7 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { Service_Context.cpp Services_Activate.cpp ShortSeqC.cpp + String_Alloc.cpp StringSeqC.cpp Stub.cpp Stub_Factory.cpp @@ -218,6 +218,7 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { UserException.cpp UShortSeqC.cpp Valuetype_Adapter.cpp + Valuetype_Adapter_Factory.cpp Wait_On_Leader_Follower.cpp Wait_On_LF_No_Upcall.cpp Wait_On_Reactor.cpp @@ -381,7 +382,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { LongSeqC.h LongSeqS.h LRU_Connection_Purging_Strategy.h - Managed_Types.h MCAST_Parser.h Messaging_PolicyValueC.h Messaging_SyncScopeC.h @@ -450,8 +450,6 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { Resource_Factory.h Resume_Handle.h Seq_Out_T.h - Sequence.h - Sequence_T.h Seq_Var_T.h Server_Strategy_Factory.h Service_Callbacks.h @@ -465,6 +463,7 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { Special_Basic_Argument_T.h StringSeqC.h StringSeqS.h + String_Alloc.h Stub_Factory.h Stub.h Synch_Invocation.h @@ -509,6 +508,7 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { UShortSeqC.h UShortSeqS.h Valuetype_Adapter.h + Valuetype_Adapter_Factory.h Var_Array_Argument_T.h varbase.h VarOut_T.h diff --git a/bin/fuzz.pl b/bin/fuzz.pl index 4a759544538..dd779336fc9 100755 --- a/bin/fuzz.pl +++ b/bin/fuzz.pl @@ -208,7 +208,7 @@ sub check_for_id_string () } } -# check for _MSC_VER >= 1200 +# check for _MSC_VER sub check_for_msc_ver_string () { print "Running _MSC_VER check\n"; @@ -229,10 +229,18 @@ sub check_for_msc_ver_string () $found = 1; $mscline = $.; } + if ($disable == 0 and /\_MSC_VER \< 1300/) { + $found = 1; + $mscline = $.; + } + if ($disable == 0 and /\_MSC_VER \<= 1300/) { + $found = 1; + $mscline = $.; + } } close (FILE); if ($found == 1) { - print_error ("$file:$mscline: Incorrect _MSC_VER >= 1200 found"); + print_error ("$file:$mscline: Incorrect _MSC_VER check found"); } } else { diff --git a/bin/make_release b/bin/make_release index d7d52fda0bf..a0c73c050c7 100755 --- a/bin/make_release +++ b/bin/make_release @@ -817,9 +817,7 @@ sub generate_makefiles () { bin/mwc.pl -type vc8 $mpc_option $exclude_option $vc8_option; \ bin/mwc.pl -type vc8 $mpc_option $exclude_option $ce_option; \ bin/mwc.pl -type vc71 $mpc_option $exclude_option; \ - bin/mwc.pl -type vc6 $mpc_option $exclude_option; \ bin/mwc.pl -type borland $mpc_option $exclude_option; \ - bin/mwc.pl -type vc6 $static_option; \ bin/mwc.pl -type vc71 $static_option; \ find ./ -name '*.ds[p,w]' | /usr/bin/xargs chmod 0644;\ find ./ -name '*.bor' | /usr/bin/xargs chmod 0644;\ |