[hydra-commits] beagles: branch ice/slice-preserving-translators r589 - in /ice/branches/slic...
SVN commits to the Hydra project
hydra-commits at lists.digium.com
Sat Apr 24 09:15:51 CDT 2010
Author: beagles
Date: Sat Apr 24 09:15:51 2010
New Revision: 589
URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=589
Log:
replacing object factory approach for slice preservation with 'preserve' meta data
Modified:
ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice
ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp
ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice
ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp
Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice?view=diff&rev=589&r1=588&r2=589
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/Test.ice Sat Apr 24 09:15:51 2010
@@ -33,6 +33,7 @@
string kmd;
};
+["preserve"]
exception BaseUnsliceable extends Base
{
};
Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp?view=diff&rev=589&r1=588&r2=589
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/exceptions/TestI.cpp Sat Apr 24 09:15:51 2010
@@ -13,46 +13,8 @@
using namespace std;
using namespace Test;
-template <typename T>
-class PreserverFactory : public IceInternal::UserExceptionFactory
-{
-public:
- void createAndThrow() {
- throw Preserver();
- }
-private:
- class Preserver : virtual public T
- {
- public:
- vector< ::Ice::Byte > __skippedSlices;
- void __write(IceInternal::BasicStream* stream) const
- {
- stream->writeBlob(__skippedSlices);
- T::__write(stream);
- }
- void __read(IceInternal::BasicStream* stream, bool rid)
- {
- stream->readSkippedSlicesBlob(__skippedSlices);
- T::__read(stream, rid);
- }
- void ice_throw() const
- {
- throw *this;
- }
- ~Preserver() throw() {}
- };
-};
-
TestI::TestI(const Ice::CommunicatorPtr& communicator)
{
- // the factoryTable interface is... interesting. if you add an exception factory
- // with the same name as one already in the table, it just increments the reference
- // count on the existing factory, without even comparing the factory object
- // handles to see if it is in fact the same factory being added. so for now we
- // need to explicitly remove the factory that the slice2cpp translator generated
- // before adding our own
- IceInternal::factoryTable->removeExceptionFactory("::Test::BaseUnsliceable");
- IceInternal::factoryTable->addExceptionFactory("::Test::BaseUnsliceable", new PreserverFactory<BaseUnsliceable>);
}
void
Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice?view=diff&rev=589&r1=588&r2=589
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/Test.ice Sat Apr 24 09:15:51 2010
@@ -29,6 +29,7 @@
B pb;
};
+["preserve"]
class BU extends B
{
};
Modified: ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp?view=diff&rev=589&r1=588&r2=589
==============================================================================
--- ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp (original)
+++ ice/branches/slice-preserving-translators/cpp/test/Ice/slicing/objects/TestI.cpp Sat Apr 24 09:15:51 2010
@@ -14,35 +14,8 @@
using namespace std;
using namespace Test;
-template <typename T>
-class PreserverFactory : public Ice::ObjectFactory
-{
-public:
- Ice::ObjectPtr create(const string& type) {
- return new Preserver();
- }
- void destroy() {}
-private:
- class Preserver : virtual public T
- {
- public:
- vector< ::Ice::Byte > __skippedSlices;
- void __write(IceInternal::BasicStream* stream) const
- {
- stream->writeBlob(__skippedSlices);
- T::__write(stream);
- }
- void __read(IceInternal::BasicStream* stream, bool rid)
- {
- stream->readSkippedSlicesBlob(__skippedSlices);
- T::__read(stream, rid);
- }
- };
-};
-
TestI::TestI(const Ice::CommunicatorPtr& communicator)
{
- communicator->addObjectFactory(new PreserverFactory<BU>, BU::ice_staticId());
}
Ice::ObjectPtr
More information about the asterisk-scf-commits
mailing list