Update of /cvsroot/objecthandler/ObjectHandler/oh
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16574/oh
Modified Files:
object.hpp
Log Message:
support for
- objects as input parameters which may default to null pointers
- instantiation of a QuantLib::Handle which is not linked to an Observable
Index: object.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/object.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** object.hpp 11 Jun 2006 12:38:21 -0000 1.6
--- object.hpp 16 Jun 2006 10:14:10 -0000 1.7
***************
*** 32,43 ****
#include <iostream>
#define OH_GET_OBJECT( NAME, ID, OBJECT_CLASS ) \
! boost::shared_ptr < OBJECT_CLASS > NAME = \
! ObjHandler::ObjectHandler::instance().retrieveObject< OBJECT_CLASS >(ID);
#define OH_GET_REFERENCE( NAME, ID, OBJECT_CLASS, LIBRARY_CLASS ) \
OH_GET_OBJECT(NAME ## temp, ID, OBJECT_CLASS ) \
! const boost::shared_ptr < LIBRARY_CLASS > NAME = \
! NAME ## temp->getLibraryObject < LIBRARY_CLASS >();
namespace ObjHandler {
--- 32,53 ----
#include <iostream>
+ // get a boost shared pointer to a class derived from Object
#define OH_GET_OBJECT( NAME, ID, OBJECT_CLASS ) \
! boost::shared_ptr<OBJECT_CLASS> NAME = \
! ObjHandler::ObjectHandler::instance().retrieveObject<OBJECT_CLASS>(ID);
+ // get a boost shared pointer to the client library object referenced by an ObjHandler::Object
#define OH_GET_REFERENCE( NAME, ID, OBJECT_CLASS, LIBRARY_CLASS ) \
OH_GET_OBJECT(NAME ## temp, ID, OBJECT_CLASS ) \
! /*const*/ boost::shared_ptr<LIBRARY_CLASS> NAME = \
! NAME ## temp->getLibraryObject<LIBRARY_CLASS>();
!
! // OH_GET_REF_DEFAULT - like OH_GET_REFERENCE but only attempt retrieval if id supplied
! #define OH_GET_REF_DEFAULT( NAME, ID, OBJECT_CLASS, LIBRARY_CLASS ) \
! /*const*/ boost::shared_ptr<LIBRARY_CLASS> NAME; \
! if (!ID.empty()) { \
! OH_GET_OBJECT(NAME ## temp, ID, OBJECT_CLASS ) \
! NAME = NAME ## temp->getLibraryObject<LIBRARY_CLASS>(); \
! }
namespace ObjHandler {
***************
*** 116,120 ****
public:
template <class LibraryDerivedClass>
! const boost::shared_ptr<LibraryDerivedClass> getLibraryObject() const {
boost::shared_ptr<LibraryDerivedClass> ret =
boost::dynamic_pointer_cast<LibraryDerivedClass>(libraryObject_);
--- 126,130 ----
public:
template <class LibraryDerivedClass>
! /*const*/ boost::shared_ptr<LibraryDerivedClass> getLibraryObject() const {
boost::shared_ptr<LibraryDerivedClass> ret =
boost::dynamic_pointer_cast<LibraryDerivedClass>(libraryObject_);
***************
*** 125,129 ****
}
template <>
! const boost::shared_ptr<LibraryClass> getLibraryObject<LibraryClass>() const {
return libraryObject_;
}
--- 135,139 ----
}
template <>
! /*const*/ boost::shared_ptr<LibraryClass> getLibraryObject<LibraryClass>() const {
return libraryObject_;
}
|