summaryrefslogtreecommitdiff
path: root/cppe/src/IceE/FactoryTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/src/IceE/FactoryTable.cpp')
-rw-r--r--cppe/src/IceE/FactoryTable.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/cppe/src/IceE/FactoryTable.cpp b/cppe/src/IceE/FactoryTable.cpp
new file mode 100644
index 00000000000..da2bc0e35e3
--- /dev/null
+++ b/cppe/src/IceE/FactoryTable.cpp
@@ -0,0 +1,33 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICEE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <IceE/FactoryTable.h>
+#include <IceE/UserExceptionFactory.h>
+
+//
+// This constructor initializes the single global IceE::factoryTable instance
+// from the outside (if it hasn't been initialized yet). The constructor here
+// is triggered by a file-static instance of FactoryTable in each
+// slice2cpp-generated header file that uses non-local exceptions or non-abstract classes.
+// This ensures that IceE::factoryTable is always initialized before it is used.
+//
+IceE::FactoryTable::FactoryTable()
+{
+
+ IceE::factoryTableWrapper.initialize();
+}
+
+//
+// Similarly, the destructor calls the finalize() method on the factory table wrapper which,
+// once the tables reference count drops to zero, deletes the table.
+//
+IceE::FactoryTable::~FactoryTable()
+{
+ IceE::factoryTableWrapper.finalize();
+}