summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2005-07-04 02:06:23 +0000
committerMichi Henning <michi@zeroc.com>2005-07-04 02:06:23 +0000
commit11440f12c77b43a7d43e948e15df35c4b71c7e00 (patch)
treea93bf57b23a16939e6e1c99f42b9263191247704 /cpp/src/slice2cpp
parentMade Ice.ObjectImpl abstract. (diff)
downloadice-11440f12c77b43a7d43e948e15df35c4b71c7e00.tar.bz2
ice-11440f12c77b43a7d43e948e15df35c4b71c7e00.tar.xz
ice-11440f12c77b43a7d43e948e15df35c4b71c7e00.zip
Made Ice::Object abstract.
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp51
-rw-r--r--cpp/src/slice2cpp/Gen.h28
2 files changed, 33 insertions, 46 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 6f6aa7c2627..1581902013b 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2452,38 +2452,25 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
*/
}
- if(!p->isAbstract() && !p->isLocal())
+ if(!p->isLocal())
{
- H << sp << nl << "void __copyMembers(" << fixKwd(p->scoped() + "Ptr") + ") const;";
+ H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;";
C << sp;
- C << nl << "void ";
- C << nl << fixKwd(p->scoped()).substr(2) << "::__copyMembers(" << fixKwd(p->scoped() + "Ptr") << " __to) const";
+ C << nl << "::Ice::ObjectPtr";
+ C << nl << fixKwd(p->scoped()).substr(2) << "::ice_clone() const";
C << sb;
- if(base)
+ if(!p->isAbstract())
{
- emitUpcall(base, "::__copyMembers(__to);");
+ C << nl << fixKwd(p->scope()) << p->name() << "Ptr __p = new " << fixKwd(p->scoped()) << "(*this);";
+ C << nl << "return __p;";
}
- for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
+ else
{
- C << nl << "__to->" << fixKwd((*q)->name()) << " = " << fixKwd((*q)->name()) << ';';
+ C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);";
}
C << eb;
- H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;";
-
- C << sp;
- C << nl << "::Ice::ObjectPtr";
- C << nl << fixKwd(p->scoped()).substr(2) << "::ice_clone() const";
- C << sb;
- C << nl << fixKwd(p->scope()) << p->name() << "Ptr __p = new " << fixKwd(p->scoped()) << ';';
- emitUpcall(p, "::__copyMembers(__p);");
- C << nl << "return __p;";
- C << eb;
- }
-
- if(!p->isLocal())
- {
ClassList allBases = p->allBases();
StringList ids;
#if defined(__IBMCPP__) && defined(NDEBUG)
@@ -3126,32 +3113,32 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
C << sp << nl << "void" << nl << scoped.substr(2) << "::__incRef()";
C << sb;
- C << nl << "IceUtil::gcRecMutex._m->lock();";
+ C << nl << "IceInternal::gcRecMutex._m->lock();";
C << nl << "assert(_ref >= 0);";
C << nl << "if(_ref == 0)";
C << sb;
C.zeroIndent();
C << nl << "#ifdef NDEBUG // To avoid annoying warnings about variables that are not used...";
C.restoreIndent();
- C << nl << "IceUtil::gcObjects.insert(this);";
+ C << nl << "IceInternal::gcObjects.insert(this);";
C.zeroIndent();
C << nl << "#else";
C.restoreIndent();
- C << nl << "std::pair<IceUtil::GCObjectSet::iterator, bool> rc = IceUtil::gcObjects.insert(this);";
+ C << nl << "std::pair<IceInternal::GCObjectSet::iterator, bool> rc = IceInternal::gcObjects.insert(this);";
C << nl << "assert(rc.second);";
C.zeroIndent();
C << nl << "#endif";
C.restoreIndent();
C << eb;
C << nl << "++_ref;";
- C << nl << "IceUtil::gcRecMutex._m->unlock();";
+ C << nl << "IceInternal::gcRecMutex._m->unlock();";
C << eb;
H << nl << "virtual void __decRef();";
C << sp << nl << "void" << nl << scoped.substr(2) << "::__decRef()";
C << sb;
- C << nl << "IceUtil::gcRecMutex._m->lock();";
+ C << nl << "IceInternal::gcRecMutex._m->lock();";
C << nl << "bool doDelete = false;";
C << nl << "assert(_ref > 0);";
C << nl << "if(--_ref == 0)";
@@ -3161,17 +3148,17 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
C.zeroIndent();
C << nl << "#ifdef NDEBUG // To avoid annoying warnings about variables that are not used...";
C.restoreIndent();
- C << nl << "IceUtil::gcObjects.erase(this);";
+ C << nl << "IceInternal::gcObjects.erase(this);";
C.zeroIndent();
C << nl << "#else";
C.restoreIndent();
- C << nl << "IceUtil::GCObjectSet::size_type num = IceUtil::gcObjects.erase(this);";
+ C << nl << "IceInternal::GCObjectSet::size_type num = IceInternal::gcObjects.erase(this);";
C << nl << "assert(num == 1);";
C.zeroIndent();
C << nl << "#endif";
C.restoreIndent();
C << eb;
- C << nl << "IceUtil::gcRecMutex._m->unlock();";
+ C << nl << "IceInternal::gcRecMutex._m->unlock();";
C << nl << "if(doDelete)";
C << sb;
C << nl << "delete this;";
@@ -3185,9 +3172,9 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
//
if(canBeCyclic)
{
- H << nl << "virtual void __gcReachable(::IceUtil::GCObjectMultiSet&) const;";
+ H << nl << "virtual void __gcReachable(::IceInternal::GCObjectMultiSet&) const;";
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__gcReachable(::IceUtil::GCObjectMultiSet& _c) const";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__gcReachable(::IceInternal::GCObjectMultiSet& _c) const";
C << sb;
string vc6Prefix;
diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h
index dc81ae2c361..f57b6adeca9 100644
--- a/cpp/src/slice2cpp/Gen.h
+++ b/cpp/src/slice2cpp/Gen.h
@@ -16,7 +16,7 @@
namespace Slice
{
-class Gen : public ::IceUtil::noncopyable
+class Gen : private ::IceUtil::noncopyable
{
public:
@@ -55,7 +55,7 @@ private:
bool _checksum;
bool _stream;
- class TypesVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class TypesVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -85,7 +85,7 @@ private:
bool _stream;
};
- class ProxyDeclVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class ProxyDeclVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -105,7 +105,7 @@ private:
std::string _dllExport;
};
- class ProxyVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class ProxyVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -127,7 +127,7 @@ private:
std::string _dllExport;
};
- class DelegateVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class DelegateVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -149,7 +149,7 @@ private:
std::string _dllExport;
};
- class DelegateMVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class DelegateMVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -171,7 +171,7 @@ private:
std::string _dllExport;
};
- class DelegateDVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class DelegateDVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -193,7 +193,7 @@ private:
std::string _dllExport;
};
- class ObjectDeclVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class ObjectDeclVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -211,7 +211,7 @@ private:
std::string _dllExport;
};
- class ObjectVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class ObjectVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -240,7 +240,7 @@ private:
bool _stream;
};
- class IceInternalVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class IceInternalVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -259,7 +259,7 @@ private:
std::string _dllExport;
};
- class HandleVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class HandleVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -279,7 +279,7 @@ private:
bool _stream;
};
- class ImplVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class ImplVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -308,7 +308,7 @@ private:
void writeReturn(::IceUtil::Output&, const TypePtr&);
};
- class AsyncVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class AsyncVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
@@ -326,7 +326,7 @@ private:
std::string _dllExport;
};
- class AsyncImplVisitor : public ::IceUtil::noncopyable, public ParserVisitor
+ class AsyncImplVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public: