summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2002-03-13 03:55:22 +0000
committerMatthew Newhook <matthew@zeroc.com>2002-03-13 03:55:22 +0000
commit0ac325172b7608a2fa0c366a7665940ef14c562f (patch)
tree47e65b54c6e4e870a7b3e78f032bcb88f65f96be /cpp
parentbug fix (diff)
downloadice-0ac325172b7608a2fa0c366a7665940ef14c562f.tar.bz2
ice-0ac325172b7608a2fa0c366a7665940ef14c562f.tar.xz
ice-0ac325172b7608a2fa0c366a7665940ef14c562f.zip
Initial version of library demo.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/demo/Freeze/Makefile2
-rw-r--r--cpp/demo/Freeze/library/.depend18
-rw-r--r--cpp/demo/Freeze/library/BookFactory.cpp37
-rw-r--r--cpp/demo/Freeze/library/BookFactory.h34
-rw-r--r--cpp/demo/Freeze/library/Client.cpp33
-rw-r--r--cpp/demo/Freeze/library/Collocated.cpp92
-rw-r--r--cpp/demo/Freeze/library/Grammar.y141
-rw-r--r--cpp/demo/Freeze/library/Library.ice233
-rw-r--r--cpp/demo/Freeze/library/LibraryI.cpp286
-rw-r--r--cpp/demo/Freeze/library/LibraryI.h69
-rw-r--r--cpp/demo/Freeze/library/Makefile90
-rw-r--r--cpp/demo/Freeze/library/Parser.cpp578
-rw-r--r--cpp/demo/Freeze/library/Parser.h100
-rw-r--r--cpp/demo/Freeze/library/RunParser.cpp156
-rw-r--r--cpp/demo/Freeze/library/Scanner.l282
-rw-r--r--cpp/demo/Freeze/library/Server.cpp92
-rw-r--r--cpp/demo/Freeze/library/books32
-rw-r--r--cpp/demo/Freeze/library/config9
-rw-r--r--cpp/demo/Freeze/library/db/.dummy0
-rw-r--r--cpp/demo/Freeze/phonebook/PhoneBook.ice16
20 files changed, 2294 insertions, 6 deletions
diff --git a/cpp/demo/Freeze/Makefile b/cpp/demo/Freeze/Makefile
index bf98d484b6e..2c3ccf0bcc5 100644
--- a/cpp/demo/Freeze/Makefile
+++ b/cpp/demo/Freeze/Makefile
@@ -12,7 +12,7 @@ top_srcdir = ../..
include $(top_srcdir)/config/Make.rules
-SUBDIRS = phonebook bench
+SUBDIRS = phonebook bench library
$(EVERYTHING)::
@for subdir in $(SUBDIRS); \
diff --git a/cpp/demo/Freeze/library/.depend b/cpp/demo/Freeze/library/.depend
new file mode 100644
index 00000000000..5e147b66475
--- /dev/null
+++ b/cpp/demo/Freeze/library/.depend
@@ -0,0 +1,18 @@
+Library.o: Library.cpp ../../../include/Ice/Stream.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/BuiltinSequences.h Library.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ObjectFactory.h
+Grammar.o: Grammar.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h
+Scanner.o: Scanner.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h Grammar.h
+Parser.o: Parser.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h
+RunParser.o: RunParser.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h
+Client.o: Client.cpp ../../../include/Ice/Application.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h
+LibraryI.o: LibraryI.cpp ../../../include/Freeze/Freeze.h ../../../include/Freeze/Initialize.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Freeze/DBF.h ../../../include/Freeze/DB.h ../../../include/Freeze/DBException.h ../../../include/Freeze/EvictorF.h ../../../include/Freeze/Evictor.h ../../../include/Freeze/Map.h LibraryI.h ../../../include/IceUtil/RWRecMutex.h Library.h LibraryTypes.h
+LibraryTypes.o: LibraryTypes.cpp ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Buffer.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h LibraryTypes.h ../../../include/Freeze/Map.h ../../../include/Freeze/DB.h ../../../include/Ice/CommunicatorF.h ../../../include/Freeze/DBException.h ../../../include/Freeze/DBF.h ../../../include/Freeze/EvictorF.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Library.h
+BookFactory.o: BookFactory.cpp BookFactory.h LibraryI.h ../../../include/IceUtil/RWRecMutex.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/Cond.h Library.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h LibraryTypes.h ../../../include/Freeze/Map.h ../../../include/Freeze/DB.h ../../../include/Ice/CommunicatorF.h ../../../include/Freeze/DBException.h ../../../include/Freeze/DBF.h ../../../include/Freeze/EvictorF.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h
+Server.o: Server.cpp ../../../include/Freeze/Application.h ../../../include/Ice/Application.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Freeze/Freeze.h ../../../include/Freeze/Initialize.h ../../../include/Freeze/DBF.h ../../../include/Freeze/DB.h ../../../include/Freeze/DBException.h ../../../include/Freeze/EvictorF.h ../../../include/Freeze/Evictor.h ../../../include/Freeze/Map.h BookFactory.h LibraryI.h ../../../include/IceUtil/RWRecMutex.h Library.h LibraryTypes.h
+Grammar.o: Grammar.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h
+Scanner.o: Scanner.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h Grammar.h
+Parser.o: Parser.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h
+RunParser.o: RunParser.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Parser.h Library.h
+LibraryI.o: LibraryI.cpp ../../../include/Freeze/Freeze.h ../../../include/Freeze/Initialize.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Freeze/DBF.h ../../../include/Freeze/DB.h ../../../include/Freeze/DBException.h ../../../include/Freeze/EvictorF.h ../../../include/Freeze/Evictor.h ../../../include/Freeze/Map.h LibraryI.h ../../../include/IceUtil/RWRecMutex.h Library.h LibraryTypes.h
+LibraryTypes.o: LibraryTypes.cpp ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/Buffer.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h LibraryTypes.h ../../../include/Freeze/Map.h ../../../include/Freeze/DB.h ../../../include/Ice/CommunicatorF.h ../../../include/Freeze/DBException.h ../../../include/Freeze/DBF.h ../../../include/Freeze/EvictorF.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h Library.h
+BookFactory.o: BookFactory.cpp BookFactory.h LibraryI.h ../../../include/IceUtil/RWRecMutex.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Config.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/Cond.h Library.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/Proxy.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h LibraryTypes.h ../../../include/Freeze/Map.h ../../../include/Freeze/DB.h ../../../include/Ice/CommunicatorF.h ../../../include/Freeze/DBException.h ../../../include/Freeze/DBF.h ../../../include/Freeze/EvictorF.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h
+Collocated.o: Collocated.cpp ../../../include/Freeze/Application.h ../../../include/Ice/Application.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Handle.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/Properties.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Communicator.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Object.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/Ice/BasicStream.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/Direct.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/RequestQueueF.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Freeze/Freeze.h ../../../include/Freeze/Initialize.h ../../../include/Freeze/DBF.h ../../../include/Freeze/DB.h ../../../include/Freeze/DBException.h ../../../include/Freeze/EvictorF.h ../../../include/Freeze/Evictor.h ../../../include/Freeze/Map.h BookFactory.h LibraryI.h ../../../include/IceUtil/RWRecMutex.h Library.h LibraryTypes.h Parser.h
diff --git a/cpp/demo/Freeze/library/BookFactory.cpp b/cpp/demo/Freeze/library/BookFactory.cpp
new file mode 100644
index 00000000000..7833f36366e
--- /dev/null
+++ b/cpp/demo/Freeze/library/BookFactory.cpp
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <BookFactory.h>
+
+using namespace std;
+using namespace Ice;
+
+BookFactory::BookFactory(const LibraryIPtr& library, const Freeze::EvictorPtr& evictor) :
+ _library(library),
+ _evictor(evictor)
+{
+}
+
+ObjectPtr
+BookFactory::create(const string& type)
+{
+ assert(type == "::Book");
+ return new BookI(_library, _evictor);
+}
+
+void
+BookFactory::destroy()
+{
+ //
+ // Break cyclic object dependencies
+ //
+ _library = 0;
+ _evictor = 0;
+}
diff --git a/cpp/demo/Freeze/library/BookFactory.h b/cpp/demo/Freeze/library/BookFactory.h
new file mode 100644
index 00000000000..6b050d460b7
--- /dev/null
+++ b/cpp/demo/Freeze/library/BookFactory.h
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef BOOK_FACTORY_H
+#define BOOK_FACTORY_H
+
+#include <LibraryI.h>
+
+class BookFactory : virtual public Ice::ObjectFactory
+{
+public:
+
+ BookFactory(const LibraryIPtr&, const Freeze::EvictorPtr&);
+
+ //
+ // Operations from ObjectFactory
+ //
+ virtual Ice::ObjectPtr create(const std::string&);
+ virtual void destroy();
+
+private:
+
+ LibraryIPtr _library;
+ Freeze::EvictorPtr _evictor;
+};
+
+#endif
diff --git a/cpp/demo/Freeze/library/Client.cpp b/cpp/demo/Freeze/library/Client.cpp
new file mode 100644
index 00000000000..4f312b9a5dd
--- /dev/null
+++ b/cpp/demo/Freeze/library/Client.cpp
@@ -0,0 +1,33 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Application.h>
+#include <Parser.h>
+
+using namespace std;
+
+class LibraryClient : public Ice::Application
+{
+ virtual int run(int argc, char* argv[]);
+};
+
+int
+main(int argc, char* argv[])
+{
+ LibraryClient app;
+ return app.main(argc, argv, "config");
+}
+
+int
+LibraryClient::run(int argc, char* argv[])
+{
+ int runParser(int, char*[], const Ice::CommunicatorPtr&);
+ return runParser(argc, argv, communicator());
+}
diff --git a/cpp/demo/Freeze/library/Collocated.cpp b/cpp/demo/Freeze/library/Collocated.cpp
new file mode 100644
index 00000000000..b18d92e39aa
--- /dev/null
+++ b/cpp/demo/Freeze/library/Collocated.cpp
@@ -0,0 +1,92 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Freeze/Application.h>
+#include <BookFactory.h>
+#include <Parser.h>
+
+using namespace std;
+
+class LibraryCollocated : public Freeze::Application
+{
+public:
+
+ LibraryCollocated(const string& dbEnvName) :
+ Freeze::Application(dbEnvName)
+ {
+ }
+
+ virtual int runFreeze(int argc, char* argv[], const Freeze::DBEnvironmentPtr&);
+};
+
+int
+main(int argc, char* argv[])
+{
+ LibraryCollocated app("db");
+ return app.main(argc, argv, "config");
+}
+
+int
+LibraryCollocated::runFreeze(int argc, char* argv[], const Freeze::DBEnvironmentPtr& dbEnv)
+{
+ Ice::PropertiesPtr properties = communicator()->getProperties();
+ string value;
+
+ Freeze::DBPtr dbBooks = dbEnv->openDB("books", true);
+ Freeze::DBPtr dbAuthor = dbEnv->openDB("authors", true);
+
+ //
+ // Create an Evictor for books.
+ //
+ Freeze::EvictorPersistenceMode mode;
+ value = properties->getProperty("Library.SaveAfterMutatingOperation");
+ if(!value.empty() && atoi(value.c_str()) > 0)
+ {
+ mode = Freeze::SaveAfterMutatingOperation;
+ }
+ else
+ {
+ mode = Freeze::SaveUponEviction;
+ }
+
+ Freeze::EvictorPtr evictor = dbBooks->createEvictor(mode);
+ value = properties->getProperty("Library.EvictorSize");
+ if(!value.empty())
+ {
+ evictor->setSize(atoi(value.c_str()));
+ }
+
+ //
+ // Create an Object Adapter, use the Evictor as Servant Locator.
+ //
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("LibraryAdapter");
+ adapter->addServantLocator(evictor, "book");
+
+ //
+ // Create the library, and add it to the Object Adapter.
+ //
+ LibraryIPtr library = new LibraryI(adapter, dbAuthor, evictor);
+ adapter->add(library, Ice::stringToIdentity("library"));
+
+ //
+ // Create and install a factory and initializer for books.
+ //
+ Ice::ObjectFactoryPtr bookFactory = new BookFactory(library, evictor);
+ communicator()->addObjectFactory(bookFactory, "::Book");
+
+ //
+ // Everything ok, let's go.
+ //
+ int runParser(int, char*[], const Ice::CommunicatorPtr&);
+ int status = runParser(argc, argv, communicator());
+ adapter->deactivate();
+
+ return status;
+}
diff --git a/cpp/demo/Freeze/library/Grammar.y b/cpp/demo/Freeze/library/Grammar.y
new file mode 100644
index 00000000000..576b7c33bbc
--- /dev/null
+++ b/cpp/demo/Freeze/library/Grammar.y
@@ -0,0 +1,141 @@
+%{
+
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <Parser.h>
+
+using namespace std;
+using namespace Ice;
+
+void
+yyerror(const char* s)
+{
+ parser->error(s);
+}
+
+%}
+
+%pure_parser
+
+%token TOK_HELP
+%token TOK_EXIT
+%token TOK_ADD_BOOK
+%token TOK_FIND_ISBN
+%token TOK_FIND_AUTHORS
+%token TOK_NEXT_FOUND_BOOK
+%token TOK_PRINT_CURRENT
+%token TOK_RENT_BOOK
+%token TOK_RETURN_BOOK
+%token TOK_REMOVE_CURRENT
+%token TOK_SET_EVICTOR_SIZE
+%token TOK_SHUTDOWN
+%token TOK_STRING
+
+%%
+
+// ----------------------------------------------------------------------
+start
+// ----------------------------------------------------------------------
+: commands
+{
+}
+|
+{
+}
+;
+
+// ----------------------------------------------------------------------
+commands
+// ----------------------------------------------------------------------
+: commands command
+{
+}
+| command
+{
+}
+;
+
+// ----------------------------------------------------------------------
+command
+// ----------------------------------------------------------------------
+: TOK_HELP ';'
+{
+ parser->usage();
+}
+| TOK_EXIT ';'
+{
+ return 0;
+}
+| TOK_ADD_BOOK strings ';'
+{
+ parser->addBook($2);
+}
+| TOK_FIND_ISBN strings ';'
+{
+ parser->findIsbn($2);
+}
+| TOK_FIND_AUTHORS strings ';'
+{
+ parser->findAuthors($2);
+}
+| TOK_NEXT_FOUND_BOOK ';'
+{
+ parser->nextFoundBook();
+}
+| TOK_PRINT_CURRENT ';'
+{
+ parser->printCurrent();
+}
+| TOK_RENT_BOOK strings ';'
+{
+ parser->rentCurrent($2);
+}
+| TOK_RETURN_BOOK ';'
+{
+ parser->returnCurrent();
+}
+| TOK_REMOVE_CURRENT ';'
+{
+ parser->removeCurrent();
+}
+| TOK_SET_EVICTOR_SIZE strings ';'
+{
+ parser->setEvictorSize($2);
+}
+| TOK_SHUTDOWN ';'
+{
+ parser->shutdown();
+}
+| error ';'
+{
+ yyerrok;
+}
+| ';'
+{
+}
+;
+
+// ----------------------------------------------------------------------
+strings
+// ----------------------------------------------------------------------
+: TOK_STRING strings
+{
+ $$ = $2;
+ $$.push_front($1.front());
+}
+| TOK_STRING
+{
+ $$ = $1
+}
+;
+
+%%
diff --git a/cpp/demo/Freeze/library/Library.ice b/cpp/demo/Freeze/library/Library.ice
new file mode 100644
index 00000000000..d89b61c2161
--- /dev/null
+++ b/cpp/demo/Freeze/library/Library.ice
@@ -0,0 +1,233 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef LIBRARY_ICE
+#define LIBRARY_ICE
+
+/**
+ *
+ * This exception is raised in the case of a database failure.
+ *
+ **/
+exception DatabaseException
+{
+ string message;
+};
+
+/**
+ *
+ * This exception is raised if the book already exists.
+ *
+ **/
+exception BookExistsException
+{
+};
+
+/**
+ *
+ * This exception is raised if a book has already been rented.
+ *
+ **/
+exception BookRentedException
+{
+};
+
+/**
+ *
+ * This exception is raised if the book has not been rented.
+ *
+ **/
+exception BookNotRentedException
+{
+};
+
+/**
+ *
+ * A description of a book.
+ *
+ **/
+struct BookDescription
+{
+ /** The ISBN number of the book. */
+ string isbn;
+
+ /** The title of the book. */
+ string title;
+
+ /** The authors of the book. */
+ string authors;
+};
+
+/**
+ *
+ * This class represents a book.
+ *
+ **/
+class Book
+{
+ /**
+ *
+ * Get a description of the book.
+ *
+ * @return The book description.
+ *
+ **/
+ ["nonmutating"] BookDescription getBookDescription();
+
+ /**
+ *
+ * Destroy the book. [destroy] is nonmutating. It doesn't change
+ * the state of the Book. It removes the Book completely, but
+ * doesn't touch state.
+ *
+ * @throws DatabaseException Raised if there is a problem with the
+ * database system.
+ *
+ **/
+ ["nonmutating"] void destroy()
+ throws DatabaseException;
+
+ /**
+ *
+ * Rent the book to the specified customer.
+ *
+ * @param name The name of the customer.
+ *
+ * @throws BookRentedException Raised if the book has already been
+ * rented.
+ *
+ **/
+ void rentBook(string name)
+ throws BookRentedException;
+
+ /**
+ *
+ * Get the name of the renter.
+ *
+ * @return The name the current rental customer.
+ *
+ * @throws BookNotRentedException Raised if the book is not
+ * currently rented.
+ *
+ **/
+ ["nonmutating"] string getRenterName()
+ throws BookNotRentedException;
+
+ /**
+ *
+ * Return the book.
+ *
+ * @throws BookNotRentedException Raised if the book is not
+ * currently rented.
+ *
+ **/
+ void returnBook()
+ throws BookNotRentedException;
+
+ /**
+ *
+ * The description for this book. Once a book has been created
+ * this information is immutable.
+ *
+ **/
+ BookDescription _description;
+
+ /**
+ *
+ * The name of the current rental customer, or the empty string if
+ * the book is not currently rented.
+ *
+ **/
+ string _rentalCustomerName;
+};
+
+/**
+ *
+ * A sequence of book proxies.
+ *
+ **/
+sequence<Book*> BookPrxSeq;
+
+/**
+ *
+ * This interface represents a library.
+ *
+ **/
+interface Library
+{
+ /**
+ *
+ * Create a book with the given description.
+ *
+ * @param description The book description.
+ *
+ * @return A proxy for the new book.
+ *
+ * @throws DatabaseException Raised if there is a problem with the
+ * database.
+ *
+ * @throws BookExistsException Raised if the book already exists.
+ *
+ **/
+ Book* createBook(BookDescription description)
+ throws DatabaseException, BookExistsException;
+
+ /**
+ *
+ * Find a book by its ISBN number.
+ *
+ * @param isbn The ISBN number.
+ *
+ * @return The result of the search, or an null proxy if the book
+ * was not found.
+ *
+ * @throws DatabaseException Raised if there is a problem with the database.
+ *
+ **/
+ ["nonmutating"] Book* findByIsbn(string isbn)
+ throws DatabaseException;
+
+ /**
+ *
+ * Find all books with a given authors.
+ *
+ * @param title The search parameters.
+ *
+ * @return The result of the search, or an empty sequence if no
+ * books were found.
+ *
+ * @throws DatabaseException Raised if there is a problem with the database.
+ *
+ **/
+ ["nonmutating"] BookPrxSeq findByAuthors(string authors)
+ throws DatabaseException;
+
+ /**
+ *
+ * Set the evictor size.
+ *
+ * @param size The new size for the evictor.
+ *
+ * @throws DatabaseException Raised if there is a problem with the
+ * database.
+ *
+ **/
+ ["nonmutating"] void setEvictorSize(int size)
+ throws DatabaseException;
+
+ /**
+ *
+ * Shutdown the server.
+ *
+ **/
+ ["nonmutating"] void shutdown();
+};
+
+#endif
diff --git a/cpp/demo/Freeze/library/LibraryI.cpp b/cpp/demo/Freeze/library/LibraryI.cpp
new file mode 100644
index 00000000000..f9187c2c602
--- /dev/null
+++ b/cpp/demo/Freeze/library/LibraryI.cpp
@@ -0,0 +1,286 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Freeze/Freeze.h>
+#include <LibraryI.h>
+
+using namespace std;
+
+BookI::BookI(const LibraryIPtr& library, const Freeze::EvictorPtr& evictor) :
+ _library(library),
+ _evictor(evictor)
+{
+}
+
+BookI::~BookI()
+{
+}
+
+void
+BookI::destroy(const Ice::Current&)
+{
+ IceUtil::RWRecMutex::RLock sync(*this);
+
+ try
+ {
+ _library->remove(_description);
+
+ //
+ // This can throw EvictorDeactivatedException (which indicates
+ // an internal error). The exception is currently ignored.
+ //
+ _evictor->destroyObject(createIdentity(_description.isbn));
+ }
+ catch(const Freeze::DBNotFoundException&)
+ {
+ //
+ // Raised by remove. Ignore.
+ //
+ }
+ catch(const Freeze::DBException& ex)
+ {
+ DatabaseException e;
+ e.message = ex.message;
+ throw e;
+ }
+}
+
+::BookDescription
+BookI::getBookDescription(const Ice::Current&)
+{
+ // Immutable
+ return _description;
+}
+
+::std::string
+BookI::getRenterName(const Ice::Current&)
+{
+ IceUtil::RWRecMutex::RLock sync(*this);
+
+ if (_rentalCustomerName.empty())
+ {
+ throw BookNotRentedException();
+ }
+ return _rentalCustomerName;
+}
+
+void
+BookI::rentBook(const ::std::string& name, const Ice::Current&)
+{
+ IceUtil::RWRecMutex::WLock sync(*this);
+
+ if (!_rentalCustomerName.empty())
+ {
+ throw BookRentedException();
+ }
+ _rentalCustomerName = name;
+}
+
+void
+BookI::returnBook(const Ice::Current&)
+{
+ IceUtil::RWRecMutex::WLock sync(*this);
+
+ if (_rentalCustomerName.empty())
+ {
+ throw BookNotRentedException();
+ }
+ _rentalCustomerName.clear();;
+}
+
+Ice::Identity
+BookI::createIdentity(const string& isbn)
+{
+ //
+ // Note that the identity category is important since the locator
+ // was installed for the category 'book'.
+ //
+ Ice::Identity ident;
+ ident.category = "book";
+ ident.name = isbn;
+
+ return ident;
+}
+
+class IsbnToBook
+{
+public:
+
+ IsbnToBook(const Ice::ObjectAdapterPtr& adapter) :
+ _adapter(adapter)
+ {
+ }
+
+ BookPrx
+ operator()(const string& isbn)
+ {
+ Ice::Identity ident = BookI::createIdentity(isbn);
+ return BookPrx::uncheckedCast(_adapter->createProxy(ident));
+ }
+
+private:
+
+ Ice::ObjectAdapterPtr _adapter;
+};
+
+LibraryI::LibraryI(const Ice::ObjectAdapterPtr& adapter, const Freeze::DBPtr& db, const Freeze::EvictorPtr& evictor) :
+ _adapter(adapter),
+ _evictor(evictor),
+ _authors(db)
+{
+}
+
+LibraryI::~LibraryI()
+{
+}
+
+::BookPrx
+LibraryI::createBook(const ::BookDescription& description, const Ice::Current&)
+{
+ IceUtil::RWRecMutex::WLock sync(*this);
+
+ BookPrx book = IsbnToBook(_adapter)(description.isbn);
+ try
+ {
+ book = IsbnToBook(_adapter)(description.isbn);
+ book->ice_ping();
+
+ //
+ // The book already exists.
+ //
+ throw BookExistsException();
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ //
+ // Book doesn't exist, ignore the exception.
+ //
+ }
+
+ BookPtr bookI = new BookI(this, _evictor);
+ bookI->_description = description;
+
+ Ice::Identity ident = BookI::createIdentity(description.isbn);
+ _evictor->createObject(ident, bookI);
+
+ Ice::StringSeq isbnSeq;
+
+ StringIsbnSeqDict::iterator p = _authors.find(description.authors);
+ if (p != _authors.end())
+ {
+ isbnSeq = p->second;
+ }
+
+ isbnSeq.push_back(description.isbn);
+ _authors.insert(make_pair(description.authors, isbnSeq));
+
+ return book;
+}
+
+::BookPrx
+LibraryI::findByIsbn(const string& isbn, const Ice::Current&)
+{
+ //
+ // No locking is necessary since no internal mutable state is
+ // accessed.
+ //
+ //IceUtil::RWRecMutex::RLock sync(*this);
+
+ try
+ {
+ Ice::Identity ident = BookI::createIdentity(isbn);
+ BookPrx book = IsbnToBook(_adapter)(isbn);
+ book->ice_ping();
+ return book;
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ //
+ // Book doesn't exist, return a null proxy.
+ //
+ return BookPrx();
+ }
+}
+
+::BookPrxSeq
+LibraryI::findByAuthors(const string& authors, const Ice::Current&)
+{
+ IceUtil::RWRecMutex::RLock sync(*this);
+
+ StringIsbnSeqDict::const_iterator p = _authors.find(authors);
+
+ BookPrxSeq books;
+
+ if (p != _authors.end())
+ {
+ books.reserve(p->second.size());
+ transform(p->second.begin(), p->second.end(), back_inserter(books), IsbnToBook(_adapter));
+ }
+
+ return books;
+}
+
+void
+LibraryI::setEvictorSize(::Ice::Int size, const Ice::Current&)
+{
+ //
+ // No synchronization necessary, _evictor is immutable.
+ //
+ _evictor->setSize(size);
+}
+
+void
+LibraryI::shutdown(const Ice::Current& current)
+{
+ //
+ // No synchronization necessary, _adapter is immutable.
+ //
+ _adapter->getCommunicator()->shutdown();
+}
+
+void
+LibraryI::remove(const BookDescription& description)
+{
+ IceUtil::RWRecMutex::WLock sync(*this);
+
+ try
+ {
+ StringIsbnSeqDict::iterator p = _authors.find(description.authors);
+
+ //
+ // If the title isn't found then raise a record not found
+ // exception.
+ //
+ if (p == _authors.end())
+ {
+ throw Freeze::DBNotFoundException(__FILE__, __LINE__);
+ }
+
+ Ice::StringSeq isbnSeq = p->second;
+ isbnSeq.erase(remove_if(isbnSeq.begin(), isbnSeq.end(), bind2nd(equal_to<string>(), description.isbn)),
+ isbnSeq.end());
+
+ if (isbnSeq.empty())
+ {
+ _authors.erase(p);
+ }
+ else
+ {
+ _authors.insert(make_pair(description.authors, isbnSeq));
+ }
+ }
+ catch(const Freeze::DBException& ex)
+ {
+ DatabaseException e;
+ e.message = ex.message;
+ throw e;
+ }
+}
+
diff --git a/cpp/demo/Freeze/library/LibraryI.h b/cpp/demo/Freeze/library/LibraryI.h
new file mode 100644
index 00000000000..6c6166e0b83
--- /dev/null
+++ b/cpp/demo/Freeze/library/LibraryI.h
@@ -0,0 +1,69 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef LIBRARY_I_H
+#define LIBRARY_I_H
+
+#include <IceUtil/RWRecMutex.h>
+
+#include <Library.h>
+#include <LibraryTypes.h>
+
+class LibraryI : public Library, public IceUtil::RWRecMutex
+{
+public:
+
+ LibraryI(const Ice::ObjectAdapterPtr&, const Freeze::DBPtr&, const Freeze::EvictorPtr&);
+ virtual ~LibraryI();
+
+ virtual ::BookPrx createBook(const ::BookDescription&, const Ice::Current&);
+ virtual ::BookPrx findByIsbn(const ::std::string&, const Ice::Current&);
+ virtual ::BookPrxSeq findByAuthors(const ::std::string&, const Ice::Current&);
+ virtual void setEvictorSize(::Ice::Int, const Ice::Current&);
+ virtual void shutdown(const Ice::Current&);
+
+ void remove(const BookDescription&);
+
+private:
+
+ Ice::ObjectAdapterPtr _adapter;
+ Freeze::EvictorPtr _evictor;
+
+ //
+ // This is a dictionary of authors to a sequence of isbn numbers
+ // for efficient lookup of books by authors.
+ //
+ StringIsbnSeqDict _authors;
+};
+
+typedef IceUtil::Handle<LibraryI> LibraryIPtr;
+
+class BookI : public Book, public IceUtil::RWRecMutex
+{
+public:
+
+ BookI(const LibraryIPtr&, const Freeze::EvictorPtr&);
+ virtual ~BookI();
+
+ virtual ::BookDescription getBookDescription(const Ice::Current&);
+ virtual void destroy(const Ice::Current&);
+ virtual void rentBook(const ::std::string&, const Ice::Current&);
+ virtual ::std::string getRenterName(const Ice::Current&);
+ virtual void returnBook(const Ice::Current&);
+
+ static Ice::Identity createIdentity(const ::std::string&);
+
+private:
+
+ LibraryIPtr _library;
+ Freeze::EvictorPtr _evictor;
+};
+
+#endif
diff --git a/cpp/demo/Freeze/library/Makefile b/cpp/demo/Freeze/library/Makefile
new file mode 100644
index 00000000000..0950861b854
--- /dev/null
+++ b/cpp/demo/Freeze/library/Makefile
@@ -0,0 +1,90 @@
+# **********************************************************************
+#
+# Copyright (c) 2001
+# MutableRealms, Inc.
+# Huntsville, AL, USA
+#
+# All Rights Reserved
+#
+# **********************************************************************
+
+top_srcdir = ../../..
+
+CLIENT = client
+SERVER = server
+COLLOCATED = collocated
+
+TARGETS = $(CLIENT) $(SERVER) $(COLLOCATED)
+
+OBJS = Library.o
+
+COBJS = Grammar.o \
+ Scanner.o \
+ Parser.o \
+ RunParser.o \
+ Client.o \
+
+SOBJS = LibraryI.o \
+ LibraryTypes.o \
+ BookFactory.o \
+ Server.o
+
+COLOBJS = Grammar.o \
+ Scanner.o \
+ Parser.o \
+ RunParser.o \
+ LibraryI.o \
+ LibraryTypes.o \
+ BookFactory.o \
+ Collocated.o
+
+SRCS = $(OBJS:.o=.cpp) \
+ $(COBJS:.o=.cpp) \
+ $(SOBJS:.o=.cpp) \
+ $(COLOBJS:.o=.cpp)
+
+include $(top_srcdir)/config/Make.rules
+
+CPPFLAGS := -I. -I$(DB_HOME)/include $(CPPFLAGS)
+LDFLAGS := $(LDFLAGS) -L$(DB_HOME)/lib
+
+$(CLIENT): $(OBJS) $(COBJS)
+ rm -f $@
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) -lFreeze -ldb -lreadline -lcurses
+
+$(SERVER): $(OBJS) $(SOBJS)
+ rm -f $@
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) -lFreeze -ldb $(LIBS)
+
+$(COLLOCATED): $(OBJS) $(COLOBJS)
+ rm -f $@
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) $(LIBS) -lFreeze -ldb -lreadline -lcurses
+
+Grammar.cpp Grammar.h: Grammar.y
+ bison -dvt Grammar.y
+ rm -f Grammar.cpp ; mv Grammar.tab.c Grammar.cpp
+ rm -f Grammar.h ; mv Grammar.tab.h Grammar.h
+
+Scanner.cpp: Scanner.l Grammar.h
+ flex Scanner.l
+ rm -f Scanner.cpp ; mv lex.yy.c Scanner.cpp
+
+clean::
+ -rm -f Grammar.cpp Grammar.h Grammar.output
+ -rm -f Scanner.cpp lex.yy.c
+
+Library.h Library.cpp: Library.ice $(SLICE2CPP)
+ rm -f Library.h Library.cpp
+ $(SLICE2CPP) -I$(slicedir) Library.ice
+
+clean::
+ rm -f Library.h Library.cpp
+
+LibraryTypes.h LibraryTypes.cpp: Library.ice $(SLICE2FREEZE)
+ rm -f LibraryTypes.h LibraryTypes.cpp
+ $(SLICE2FREEZE) -I$(slicedir) --dict StringIsbnSeqDict,string,Ice::StringSeq LibraryTypes $(slicedir)/Ice/BuiltinSequences.ice Library.ice
+
+clean::
+ rm -f LibraryTypes.h LibraryTypes.cpp
+
+include .depend
diff --git a/cpp/demo/Freeze/library/Parser.cpp b/cpp/demo/Freeze/library/Parser.cpp
new file mode 100644
index 00000000000..3f3a1708668
--- /dev/null
+++ b/cpp/demo/Freeze/library/Parser.cpp
@@ -0,0 +1,578 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <Parser.h>
+
+#ifdef HAVE_READLINE
+# include <readline/readline.h>
+# include <readline/history.h>
+#endif
+
+using namespace std;
+using namespace Ice;
+
+extern FILE* yyin;
+
+Parser* parser;
+
+void
+Parser::usage()
+{
+ cout <<
+ "help Print this message.\n"
+ "exit, quit Exit this program.\n"
+ "add isbn title authors Create new book.\n"
+ "isbn NUMBER Find the book with given ISBN number.\n"
+ "authors NAME Find all books with the given authors.\n"
+ "next Set the current book to the next one that was found.\n"
+ "current Display the current book.\n"
+ "rent NAME Rent the current book for customer NAME.\n"
+ "return Return the currently rented book.\n"
+ "remove Permanently remove the current book from the library.\n"
+ "size SIZE Set the evictor size for books to SIZE.\n"
+ "shutdown Shut the library server down.\n";
+}
+
+ParserPtr
+Parser::createParser(const CommunicatorPtr& communicator, const LibraryPrx& library)
+{
+ return new Parser(communicator, library);
+}
+
+void
+Parser::addBook(const list<string>& _args)
+{
+ if (_args.size() != 3)
+ {
+ error("`add' requires at least three arguments (type `help' for more info)");
+ return;
+ }
+
+ try
+ {
+ list<string> args = _args;
+
+ BookDescription desc;
+ desc.isbn = args.front();
+ args.pop_front();
+ desc.title = args.front();
+ args.pop_front();
+ desc.authors = args.front();
+
+ BookPrx book = _library->createBook(desc);
+ cout << "added new book with isbn " << desc.isbn << endl;
+ }
+ catch(const DatabaseException& ex)
+ {
+ error(ex.message);
+ }
+ catch(const BookExistsException& ex)
+ {
+ error("The book already exists.");
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::findIsbn(const list<string>& args)
+{
+ if (args.size() != 1)
+ {
+ error("`isbn' requires exactly one argument (type `help' for more info)");
+ return;
+ }
+
+ try
+ {
+ _foundBooks.clear();
+
+ BookPrx book = _library->findByIsbn(args.front());
+ if (!book)
+ {
+ cout << "No book with that ISBN number exists." << endl;
+ }
+ else
+ {
+ _foundBooks.push_back(book);
+ _current = _foundBooks.begin();
+ printCurrent();
+ }
+ }
+ catch(const DatabaseException& ex)
+ {
+ error(ex.message);
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::findAuthors(const list<string>& args)
+{
+ if (args.size() != 1)
+ {
+ error("`authors' requires exactly one argument (type `help' for more info)");
+ return;
+ }
+
+ try
+ {
+ _foundBooks = _library->findByAuthors(args.front());
+ _current = _foundBooks.begin();
+ printCurrent();
+ }
+ catch(const DatabaseException& ex)
+ {
+ error(ex.message);
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::nextFoundBook()
+{
+ if (_current != _foundBooks.end())
+ {
+ ++_current;
+ }
+ printCurrent();
+}
+
+void
+Parser::printCurrent()
+{
+ try
+ {
+ if (_current != _foundBooks.end())
+ {
+ BookDescription desc = (*_current)->getBookDescription();
+ string renter;
+ try
+ {
+ renter = (*_current)->getRenterName();
+ }
+ catch(const BookNotRentedException&)
+ {
+ }
+
+ cout << "current book is:" << endl;
+ cout << "isbn: " << desc.isbn << endl;
+ cout << "title: " << desc.title << endl;
+ cout << "authors: " << desc.authors << endl;
+ if (!renter.empty())
+ {
+ cout << "rented: " << renter << endl;
+ }
+ }
+ else
+ {
+ cout << "No current book" << endl;
+ }
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::rentCurrent(const list<string>& args)
+{
+ if (args.size() != 1)
+ {
+ error("`rent' requires exactly one argument (type `help' for more info)");
+ return;
+ }
+
+ try
+ {
+ if (_current != _foundBooks.end())
+ {
+ (*_current)->rentBook(args.front());
+ cout << "The book is now rented by `" << args.front() << "'" << endl;
+ }
+ else
+ {
+ cout << "No current book" << endl;
+ }
+ }
+ catch(const BookRentedException&)
+ {
+ cout << "The book has already been rented." << endl;
+ }
+ catch(const DatabaseException& ex)
+ {
+ error(ex.message);
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::returnCurrent()
+{
+ try
+ {
+ if (_current != _foundBooks.end())
+ {
+ (*_current)->returnBook();
+ cout << "The book has been returned." << endl;
+ }
+ else
+ {
+ cout << "No current book" << endl;
+ }
+ }
+ catch(const BookNotRentedException&)
+ {
+ cout << "The book is not current rented." << endl;
+ }
+ catch(const DatabaseException& ex)
+ {
+ error(ex.message);
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::removeCurrent()
+{
+ try
+ {
+ if (_current != _foundBooks.end())
+ {
+ (*_current)->destroy();
+ cout << "removed current book" << endl;
+ }
+ else
+ {
+ cout << "No current book" << endl;
+ }
+ }
+ catch(const DatabaseException& ex)
+ {
+ error(ex.message);
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::setEvictorSize(const list<string>& args)
+{
+ if (args.size() != 1)
+ {
+ error("`size' requires exactly one argument (type `help' for more info)");
+ return;
+ }
+
+ try
+ {
+ _library->setEvictorSize(atoi(args.front().c_str()));
+ }
+ catch(const DatabaseException& ex)
+ {
+ error(ex.message);
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::shutdown()
+{
+ try
+ {
+ _library->shutdown();
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+Parser::getInput(char* buf, int& result, int maxSize)
+{
+ if (!_commands.empty())
+ {
+ if (_commands == ";")
+ {
+ result = 0;
+ }
+ else
+ {
+#if defined(_MSC_VER) && !defined(_STLP_MSVC)
+ // COMPILERBUG: Stupid Visual C++ defines min and max as macros
+ result = _MIN(maxSize, static_cast<int>(_commands.length()));
+#else
+ result = min(maxSize, static_cast<int>(_commands.length()));
+#endif
+ strncpy(buf, _commands.c_str(), result);
+ _commands.erase(0, result);
+ if (_commands.empty())
+ {
+ _commands = ";";
+ }
+ }
+ }
+ else if (isatty(fileno(yyin)))
+ {
+#ifdef HAVE_READLINE
+
+ char* line = readline(parser->getPrompt());
+ if (!line)
+ {
+ result = 0;
+ }
+ else
+ {
+ if (*line)
+ {
+ add_history(line);
+ }
+
+ result = strlen(line) + 1;
+ if (result > maxSize)
+ {
+ free(line);
+ error("input line too long");
+ result = 0;
+ }
+ else
+ {
+ strcpy(buf, line);
+ strcat(buf, "\n");
+ free(line);
+ }
+ }
+
+#else
+
+ cout << parser->getPrompt() << flush;
+
+ string line;
+ while (true)
+ {
+ char c = static_cast<char>(getc(yyin));
+ if (c == EOF)
+ {
+ if (line.size())
+ {
+ line += '\n';
+ }
+ break;
+ }
+
+ line += c;
+
+ if (c == '\n')
+ {
+ break;
+ }
+ }
+
+ result = line.length();
+ if (result > maxSize)
+ {
+ error("input line too long");
+ buf[0] = EOF;
+ result = 1;
+ }
+ else
+ {
+ strcpy(buf, line.c_str());
+ }
+
+#endif
+ }
+ else
+ {
+ if (((result = fread(buf, 1, maxSize, yyin)) == 0) && ferror(yyin))
+ {
+ error("input in flex scanner failed");
+ buf[0] = EOF;
+ result = 1;
+ }
+ }
+}
+
+void
+Parser::nextLine()
+{
+ _currentLine++;
+}
+
+void
+Parser::continueLine()
+{
+ _continue = true;
+}
+
+char*
+Parser::getPrompt()
+{
+ assert(_commands.empty() && isatty(fileno(yyin)));
+
+ if (_continue)
+ {
+ _continue = false;
+ return "(cont) ";
+ }
+ else
+ {
+ return ">>> ";
+ }
+}
+
+void
+Parser::error(const char* s)
+{
+ if (_commands.empty() && !isatty(fileno(yyin)))
+ {
+ cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
+ }
+ else
+ {
+ cerr << "error: " << s << endl;
+ }
+ _errors++;
+}
+
+void
+Parser::error(const string& s)
+{
+ error(s.c_str());
+}
+
+void
+Parser::warning(const char* s)
+{
+ if (_commands.empty() && !isatty(fileno(yyin)))
+ {
+ cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
+ }
+ else
+ {
+ cerr << "warning: " << s << endl;
+ }
+}
+
+void
+Parser::warning(const string& s)
+{
+ warning(s.c_str());
+}
+
+int
+Parser::parse(FILE* file, bool debug)
+{
+ extern int yydebug;
+ yydebug = debug ? 1 : 0;
+
+ assert(!parser);
+ parser = this;
+
+ _errors = 0;
+ _commands.empty();
+ yyin = file;
+ assert(yyin);
+
+ _currentFile = "";
+ _currentLine = 0;
+ _continue = false;
+ nextLine();
+
+ _foundBooks.clear();
+ _current = _foundBooks.end();
+
+ int status = yyparse();
+ if (_errors)
+ {
+ status = EXIT_FAILURE;
+ }
+
+ parser = 0;
+ return status;
+}
+
+int
+Parser::parse(const string& commands, bool debug)
+{
+ extern int yydebug;
+ yydebug = debug ? 1 : 0;
+
+ assert(!parser);
+ parser = this;
+
+ _errors = 0;
+ _commands = commands;
+ assert(!_commands.empty());
+ yyin = 0;
+
+ _currentFile = "<command line>";
+ _currentLine = 0;
+ _continue = false;
+ nextLine();
+
+ _foundBooks.clear();
+ _current = _foundBooks.end();
+
+ int status = yyparse();
+ if (_errors)
+ {
+ status = EXIT_FAILURE;
+ }
+
+ parser = 0;
+ return status;
+}
+
+Parser::Parser(const CommunicatorPtr& communicator, const LibraryPrx& library) :
+ _communicator(communicator),
+ _library(library)
+{
+}
diff --git a/cpp/demo/Freeze/library/Parser.h b/cpp/demo/Freeze/library/Parser.h
new file mode 100644
index 00000000000..78e50772f01
--- /dev/null
+++ b/cpp/demo/Freeze/library/Parser.h
@@ -0,0 +1,100 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef PARSER_H
+#define PARSER_H
+
+#include <IceUtil/Handle.h>
+#include <Ice/Ice.h>
+#include <Library.h>
+#include <list>
+
+#ifdef WIN32
+# include <io.h>
+# define isatty _isatty
+# define fileno _fileno
+// '_isatty' : inconsistent dll linkage. dllexport assumed.
+# pragma warning( disable : 4273 )
+#endif
+
+//
+// Stuff for flex and bison
+//
+
+#define YYSTYPE std::list<std::string>
+#define YY_DECL int yylex(YYSTYPE* yylvalp)
+YY_DECL;
+int yyparse();
+
+//
+// I must set the initial stack depth to the maximum stack depth to
+// disable bison stack resizing. The bison stack resizing routines use
+// simple malloc/alloc/memcpy calls, which do not work for the
+// YYSTYPE, since YYSTYPE is a C++ type, with constructor, destructor,
+// assignment operator, etc.
+//
+#define YYMAXDEPTH 20000 // 20000 should suffice. Bison default is 10000 as maximum.
+#define YYINITDEPTH YYMAXDEPTH // Initial depth is set to max depth, for the reasons described above.
+
+class Parser;
+typedef ::IceUtil::Handle<Parser> ParserPtr;
+
+class Parser : public ::IceUtil::SimpleShared
+{
+public:
+
+ static ParserPtr createParser(const Ice::CommunicatorPtr&, const LibraryPrx&);
+
+ void usage();
+
+ void addBook(const std::list<std::string>&);
+ void findIsbn(const std::list<std::string>&);
+ void findAuthors(const std::list<std::string>&);
+ void nextFoundBook();
+ void printCurrent();
+ void rentCurrent(const std::list<std::string>&);
+ void returnCurrent();
+ void removeCurrent();
+ void setEvictorSize(const std::list<std::string>&);
+ void shutdown();
+
+ void getInput(char*, int&, int);
+ void nextLine();
+ void continueLine();
+ char* getPrompt();
+
+ void error(const char*);
+ void error(const std::string&);
+
+ void warning(const char*);
+ void warning(const std::string&);
+
+ int parse(FILE*, bool);
+ int parse(const std::string&, bool);
+
+private:
+
+ Parser(const Ice::CommunicatorPtr&, const LibraryPrx&);
+
+ BookPrxSeq _foundBooks;
+ BookPrxSeq::iterator _current;
+
+ std::string _commands;
+ Ice::CommunicatorPtr _communicator;
+ LibraryPrx _library;
+ bool _continue;
+ int _errors;
+ int _currentLine;
+ std::string _currentFile;
+};
+
+extern Parser* parser; // The current parser for bison/flex
+
+#endif
diff --git a/cpp/demo/Freeze/library/RunParser.cpp b/cpp/demo/Freeze/library/RunParser.cpp
new file mode 100644
index 00000000000..816753bb4a2
--- /dev/null
+++ b/cpp/demo/Freeze/library/RunParser.cpp
@@ -0,0 +1,156 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <Parser.h>
+
+using namespace std;
+
+void
+usage(const char* appName)
+{
+ cerr << "Usage: " << appName << " [options] [file...]\n";
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ "-e COMMANDS Execute COMMANDS.\n"
+ "-d, --debug Print debug messages.\n"
+ ;
+}
+
+int
+runParser(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+{
+ string commands;
+ bool debug = false;
+
+ int idx = 1;
+ while (idx < argc)
+ {
+ if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0)
+ {
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ }
+ else if (strcmp(argv[idx], "-v") == 0 || strcmp(argv[idx], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
+ else if (strcmp(argv[idx], "-e") == 0)
+ {
+ if (idx + 1 >= argc)
+ {
+ cerr << argv[0] << ": argument expected for`" << argv[idx] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ commands += argv[idx + 1];
+ commands += ';';
+
+ for (int i = idx ; i + 2 < argc ; ++i)
+ {
+ argv[i] = argv[i + 2];
+ }
+ argc -= 2;
+ }
+ else if (strcmp(argv[idx], "-d") == 0 || strcmp(argv[idx], "--debug") == 0)
+ {
+ debug = true;
+ for (int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
+ else if (argv[idx][0] == '-')
+ {
+ cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ else
+ {
+ ++idx;
+ }
+ }
+
+ if (argc >= 2 && !commands.empty())
+ {
+ cerr << argv[0] << ": `-e' option cannot be used if input files are given" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ Ice::PropertiesPtr properties = communicator->getProperties();
+ const char* refProperty = "Library.Library";
+ string ref = properties->getProperty(refProperty);
+ if (ref.empty())
+ {
+ cerr << argv[0] << ": property `" << refProperty << "' not set" << endl;
+ return EXIT_FAILURE;
+ }
+
+ Ice::ObjectPrx base = communicator->stringToProxy(ref);
+ LibraryPrx phoneBook = LibraryPrx::checkedCast(base);
+ if (!phoneBook)
+ {
+ cerr << argv[0] << ": invalid object reference" << endl;
+ return EXIT_FAILURE;
+ }
+
+ ParserPtr parser = Parser::createParser(communicator, phoneBook);
+ int status = EXIT_SUCCESS;
+
+ if (argc < 2) // No files given
+ {
+ if (!commands.empty()) // Commands were given
+ {
+ int parseStatus = parser->parse(commands, debug);
+ if (parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ else // No commands, let's use standard input
+ {
+ int parseStatus = parser->parse(stdin, debug);
+ if (parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ }
+ else // Process files given on the command line
+ {
+ for (idx = 1 ; idx < argc ; ++idx)
+ {
+ FILE* file = fopen(argv[idx], "r");
+ if (file == NULL)
+ {
+ cerr << argv[0] << ": can't open file `" << argv[idx] << "': " << strerror(errno) << endl;
+ return EXIT_FAILURE;
+ }
+
+ int parseStatus = parser->parse(file, debug);
+
+ fclose(file);
+
+ if (parseStatus == EXIT_FAILURE)
+ {
+ status = EXIT_FAILURE;
+ }
+ }
+ }
+
+ return status;
+}
diff --git a/cpp/demo/Freeze/library/Scanner.l b/cpp/demo/Freeze/library/Scanner.l
new file mode 100644
index 00000000000..f481addc728
--- /dev/null
+++ b/cpp/demo/Freeze/library/Scanner.l
@@ -0,0 +1,282 @@
+%{
+
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <Parser.h>
+#include <Grammar.h>
+
+using namespace std;
+using namespace Ice;
+
+#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize)
+
+%}
+
+WS [ \t\v\f\r]
+NL [\n]
+
+%option noyywrap
+
+%%
+
+"//" {
+ // C++-style comment
+ int c;
+ do
+ {
+ c = yyinput();
+ if (c == '\n')
+ {
+ parser->nextLine();
+ }
+ }
+ while (c != '\n' && c != EOF);
+}
+
+"/*" {
+ // C-style comment
+ while (true)
+ {
+ int c = yyinput();
+ if (c == '\n')
+ {
+ parser->nextLine();
+ }
+ else if (c == '*')
+ {
+ int next = yyinput();
+ if (next == '/')
+ {
+ break;
+ }
+ else
+ {
+ unput(next);
+ }
+ }
+ else if (c == EOF)
+ {
+ parser->warning("EOF in comment");
+ break;
+ }
+ }
+}
+
+"help" {
+ return TOK_HELP;
+}
+
+"quit"|"exit" {
+ return TOK_EXIT;
+}
+
+"add" {
+ return TOK_ADD_BOOK;
+}
+
+"isbn" {
+ return TOK_FIND_ISBN;
+}
+
+"authors" {
+ return TOK_FIND_AUTHORS;
+}
+
+"next" {
+ return TOK_NEXT_FOUND_BOOK;
+}
+
+"current" {
+ return TOK_PRINT_CURRENT;
+}
+
+"rent" {
+ return TOK_RENT_BOOK;
+}
+
+"return" {
+ return TOK_RETURN_BOOK;
+}
+
+"remove" {
+ return TOK_REMOVE_CURRENT;
+}
+
+"size" {
+ return TOK_SET_EVICTOR_SIZE;
+}
+
+"shutdown" {
+ return TOK_SHUTDOWN;
+}
+
+{WS}*(\\{WS}*{NL})? {
+ int len = strlen(yytext);
+ for (int i = 0; i < len; ++i)
+ {
+ if (yytext[i] == '\\')
+ {
+ parser->continueLine();
+ }
+ else if (yytext[i] == '\n')
+ {
+ parser->nextLine();
+ }
+ }
+}
+
+{NL}|; {
+ int len = strlen(yytext);
+ for (int i = 0; i < len; ++i)
+ {
+ if (yytext[i] == '\n')
+ {
+ parser->nextLine();
+ }
+ }
+ return ';';
+}
+
+\" {
+ // "..."-type strings
+ string s;
+ while (true)
+ {
+ char c = static_cast<char>(yyinput());
+ if (c == '"')
+ {
+ break;
+ }
+ else if (c == EOF)
+ {
+ parser->warning("EOF in string");
+ break;
+ }
+ else if (c == '\n')
+ {
+ s += c;
+ parser->nextLine();
+ }
+ else if (c == '\\')
+ {
+ char next = static_cast<char>(yyinput());
+ switch (next)
+ {
+ case '\\':
+ case '"':
+ {
+ s += next;
+ break;
+ }
+
+ case 'n':
+ {
+ s += '\n';
+ break;
+ }
+
+ case 'r':
+ {
+ s += '\r';
+ break;
+ }
+
+ case 't':
+ {
+ s += '\t';
+ break;
+ }
+
+ case 'v':
+ {
+ s += '\v';
+ break;
+ }
+
+ case 'f':
+ {
+ s += '\f';
+ break;
+ }
+
+ default:
+ {
+ s += c;
+ unput(next);
+ }
+ }
+ }
+ else
+ {
+ s += c;
+ }
+ }
+ yylvalp->clear();
+ yylvalp->push_back(s);
+ return TOK_STRING;
+}
+
+\' {
+ // '...'-type strings
+ string s;
+ while (true)
+ {
+ char c = static_cast<char>(yyinput());
+ if (c == '\'')
+ {
+ break;
+ }
+ else if (c == EOF)
+ {
+ parser->warning("EOF in string");
+ break;
+ }
+ else if (c == '\n')
+ {
+ s += c;
+ parser->nextLine();
+ }
+ else
+ {
+ s += c;
+ }
+ }
+ yylvalp->clear();
+ yylvalp->push_back(s);
+ return TOK_STRING;
+}
+
+. {
+ // Simple strings
+ string s;
+ s += yytext[0];
+ while (true)
+ {
+ char c = static_cast<char>(yyinput());
+ if (c == EOF)
+ {
+ break;
+ }
+ else if (isspace(c) || c == ';')
+ {
+ unput(c);
+ break;
+ }
+
+ s += c;
+ }
+ yylvalp->clear();
+ yylvalp->push_back(s);
+ return TOK_STRING;
+}
+
+%%
diff --git a/cpp/demo/Freeze/library/Server.cpp b/cpp/demo/Freeze/library/Server.cpp
new file mode 100644
index 00000000000..d7677cfef25
--- /dev/null
+++ b/cpp/demo/Freeze/library/Server.cpp
@@ -0,0 +1,92 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Freeze/Application.h>
+#include <BookFactory.h>
+
+using namespace std;
+
+class LibraryServer : public Freeze::Application
+{
+public:
+
+ LibraryServer(const string& dbEnvName) :
+ Freeze::Application(dbEnvName)
+ {
+ }
+
+ virtual int runFreeze(int argc, char* argv[], const Freeze::DBEnvironmentPtr&);
+};
+
+int
+main(int argc, char* argv[])
+{
+ LibraryServer app("db");
+ return app.main(argc, argv, "config");
+}
+
+int
+LibraryServer::runFreeze(int argc, char* argv[], const Freeze::DBEnvironmentPtr& dbEnv)
+{
+ Ice::PropertiesPtr properties = communicator()->getProperties();
+ string value;
+
+ Freeze::DBPtr dbBooks = dbEnv->openDB("books", true);
+ Freeze::DBPtr dbAuthor = dbEnv->openDB("authors", true);
+
+ //
+ // Create an Evictor for books.
+ //
+ Freeze::EvictorPersistenceMode mode;
+ value = properties->getProperty("Library.SaveAfterMutatingOperation");
+ if(!value.empty() && atoi(value.c_str()) > 0)
+ {
+ mode = Freeze::SaveAfterMutatingOperation;
+ }
+ else
+ {
+ mode = Freeze::SaveUponEviction;
+ }
+
+ Freeze::EvictorPtr evictor = dbBooks->createEvictor(mode);
+ value = properties->getProperty("Library.EvictorSize");
+ if(!value.empty())
+ {
+ evictor->setSize(atoi(value.c_str()));
+ }
+
+ //
+ // Create an Object Adapter, use the Evictor as Servant Locator.
+ //
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("LibraryAdapter");
+ adapter->addServantLocator(evictor, "book");
+
+ //
+ // Create the library, and add it to the Object Adapter.
+ //
+ LibraryIPtr library = new LibraryI(adapter, dbAuthor, evictor);
+ adapter->add(library, Ice::stringToIdentity("library"));
+
+ //
+ // Create and install a factory and initializer for books.
+ //
+ Ice::ObjectFactoryPtr bookFactory = new BookFactory(library, evictor);
+ communicator()->addObjectFactory(bookFactory, "::Book");
+
+ //
+ // Everything ok, let's go.
+ //
+ adapter->activate();
+ shutdownOnInterrupt();
+ communicator()->waitForShutdown();
+ ignoreInterrupt();
+
+ return EXIT_SUCCESS;
+}
diff --git a/cpp/demo/Freeze/library/books b/cpp/demo/Freeze/library/books
new file mode 100644
index 00000000000..45464404470
--- /dev/null
+++ b/cpp/demo/Freeze/library/books
@@ -0,0 +1,32 @@
+add '096447963X' 'The Dragon Style (Learn to Play Go, Volume III)' 'Janice Kim, Jeong Soo-Hyun' ;
+add '0964479613' 'Learn to Play Go: A Master's Guide to the Ultimate Game (Volume I)' 'Janice Kim, Jeong Soo-Hyun' ;
+add '0964479621' 'The Way of the Moving Horse (Learn to Play Go, Volume II)' 'Janice Kim, Jeong Soo-Hyun' ;
+add '0964479648' 'Battle Strategies (Learn to Play Go Series)' 'Janice Kim, Jeong Soo-Hyun' ;
+add '0201889544' 'The C++ Programming Language' 'Bjarne Stroustrup' ;
+add '0201543303' 'The Design and Evolution of C++' 'Bjarne Stroustrup' ;
+add '0201700735' 'The C++ Programming Language Special Edition' 'Bjarne Stroustrup' ;
+add '0201379260' 'The C++ Standard Library : A Tutorial and Reference' 'Nicolai M. Josuttis' ;
+add '0201749629' 'Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library' 'Scott Meyers' ;
+add '0201924889' 'Effective C++: 50 Specific Ways to Improve Your Programs and Design' 'Scott Meyers' ;
+add '020163371X' 'More Effective C++: 35 New Ways to Improve Your Programs and Designs' 'Scott Meyers' ;
+add '0201615622' 'Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions' 'Herb Sutter' ;
+add '020170434X' 'More Exceptional C++' 'Herb Sutter' ;
+add '0201704315' 'Modern C++ Design: Generic Programming and Design Patterns Applied' 'Andrei Alexandrescu' ;
+add '0735616353' 'Microsoft Visual C++ .NET Deluxe Learning Edition' 'Microsoft Corporation' ;
+add '0735615497' 'Programming with Microsoft Visual C++ .NET, Sixth Edition (Core Reference)' 'George Shepherd, David Kruglinski' ;
+add '0735614229' 'Applied Microsoft .NET Framework Programming' 'Jeffrey Richter' ;
+add '0735613702' 'Programming Windows(r) with C# (Core Reference)' 'Charles Petzold' ;
+add '0201729555' 'C# Primer: A Practical Approach' 'Stanley B. Lippman' ;
+add '0201824701' 'C++ Primer' 'Stanley B. Lippman, Josee Lajoie' ;
+add '0201485184' 'Essential C++' 'Stanley B. Lippman' ;
+add '020170353X' 'Accelerated C++: Practical Programming by Example' 'Andrew Koenig, Barbara E. Moo' ;
+add '0201423391' 'Ruminations on C++ : A Decade of Programming Insight and Experience' 'Andrew Koenig, Barbara E. Moo' ;
+add '0201179288' 'C Traps and Pitfalls' 'Andrew Koenig' ;
+add '0131103628' 'The C Programming Language' 'Brian W. Kernighan, Dennis M. Ritchie' ;
+add '020161586X' 'The Practice of Programming' 'Brian W. Kernighan, Rob Pike' ;
+add '013937681X' 'UNIX Programming Environment, The' 'Brian W. Kernighan, Rob Pike' ;
+add '0201563177' 'Advanced Programming in the UNIX(R) Environment' 'W. Richard Stevens' ;
+add '0201633469' 'The Protocols (TCP/IP Illustrated, Volume 1)' 'W. Richard Stevens' ;
+add '0201634953' 'TCP for Transactions, HTTP, NNTP, and the UNIX(R) Domain Protocols (TCP/IP Illustrated, Volume 3)' 'W. Richard Stevens' ;
+add '013490012X' 'UNIX Network Programming, Volume 1: Networking APIs - Sockets and XTI' 'W. Richard Stevens' ;
+add '0130810819' 'UNIX Network Programming: Interprocess Communications' 'W. Richard Stevens' ;
diff --git a/cpp/demo/Freeze/library/config b/cpp/demo/Freeze/library/config
new file mode 100644
index 00000000000..b99c1206db4
--- /dev/null
+++ b/cpp/demo/Freeze/library/config
@@ -0,0 +1,9 @@
+Ice.Adapter.LibraryAdapter.Endpoints=tcp -p 10000
+Ice.ConnectionWarnings=1
+#Ice.Trace.Network=3
+#Ice.Trace.Protocol=1
+Library.Library=library:tcp -p 10000
+Library.EvictorSize=3
+#Library.SaveAfterMutatingOperation=1
+Freeze.Trace.DB=1
+Freeze.Trace.Evictor=2
diff --git a/cpp/demo/Freeze/library/db/.dummy b/cpp/demo/Freeze/library/db/.dummy
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/cpp/demo/Freeze/library/db/.dummy
diff --git a/cpp/demo/Freeze/phonebook/PhoneBook.ice b/cpp/demo/Freeze/phonebook/PhoneBook.ice
index 9b21a47cee5..b902b09a6d0 100644
--- a/cpp/demo/Freeze/phonebook/PhoneBook.ice
+++ b/cpp/demo/Freeze/phonebook/PhoneBook.ice
@@ -21,7 +21,8 @@ exception DatabaseException
class Contact
{
["nonmutating"] string getName();
- void setName(string name) throws DatabaseException;
+ void setName(string name)
+ throws DatabaseException;
["nonmutating"] string getAddress();
void setAddress(string address);
@@ -34,7 +35,8 @@ class Contact
// the Contact. It removes the Contact completely, but doesn't
// touch state.
//
- ["nonmutating"] void destroy() throws DatabaseException;
+ ["nonmutating"] void destroy()
+ throws DatabaseException;
string _name;
string _address;
@@ -46,9 +48,13 @@ sequence<Ice::Identity> Identities; // Needed for slice2freeze
interface PhoneBook
{
- Contact* createContact() throws DatabaseException;
- ["nonmutating"] Contacts findContacts(string name) throws DatabaseException;
- void setEvictorSize(int size) throws DatabaseException;
+ Contact* createContact()
+ throws DatabaseException;
+ ["nonmutating"] Contacts findContacts(string name)
+ throws DatabaseException;
+
+ void setEvictorSize(int size)
+ throws DatabaseException;
["nonmutating"] void shutdown();
};