Update of /cvsroot/objecthandler/ObjectHandler/oh
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17973/oh
Modified Files:
object.cpp object.hpp objecthandler.cpp objecthandler.hpp
Log Message:
cleaner processing for
- permanent objects
- autogeneration of source for loop functions
Index: object.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/object.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** object.hpp 17 Jun 2006 10:50:50 -0000 1.8
--- object.hpp 18 Jun 2006 13:41:51 -0000 1.9
***************
*** 66,70 ****
ObjectHandler::instance().storeObject(instanceName, object);
*/
! Object() : anonymous_(false) {};
//! Default destructor.
--- 66,70 ----
ObjectHandler::instance().storeObject(instanceName, object);
*/
! Object() : anonymous_(false), permanent_(false) {};
//! Default destructor.
***************
*** 93,108 ****
}
! const bool &anonymous() {
return anonymous_;
}
! void setAnonymous(const bool &anonymous) {
! anonymous_ = anonymous;
}
! const bool &permanent() {
return permanent_;
}
! void setPermanent(const bool &permanent) {
! permanent_ = permanent;
}
private:
--- 93,108 ----
}
! const bool &anonymous() const {
return anonymous_;
}
! void setAnonymous() {
! anonymous_ = true;
}
! const bool &permanent() const {
return permanent_;
}
! void setPermanent() {
! permanent_ = true;
}
private:
***************
*** 122,125 ****
--- 122,134 ----
}
+ /*
+ Helper template Object subclass implementing behavior required by
+ the majority of classes derived from Object for managing
+ the reference to the contained library object.
+
+ Object subclasses requiring customized processing of the reference to
+ the contained library object should bypass LibraryObject and inherit
+ directly from Object.
+ */
template <class LibraryClass>
class LibraryObject : public Object {
***************
*** 131,136 ****
if (ret)
return ret;
! else
! throw Exception("unsuccessful attempt to recast pointer");
}
template <>
--- 140,151 ----
if (ret)
return ret;
! else {
! std::ostringstream msg;
! msg << "Error retrieving library object - unable to convert reference"
! " from type " << std::endl << " " << typeid(LibraryClass).name() <<
! " to type " << std::endl << " " << typeid(LibraryDerivedClass).name();
! throw Exception(msg.str());
! }
!
}
template <>
Index: object.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/object.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** object.cpp 19 May 2006 15:12:41 -0000 1.1
--- object.cpp 18 Jun 2006 13:41:51 -0000 1.2
***************
*** 98,101 ****
--- 98,109 ----
std::ostream& operator<<(std::ostream& out, const Object &object) {
+ static const int COL_WIDTH = 20;
+ out << std::endl;
+ out << std::left << "anonymous = " << std::setw(COL_WIDTH)
+ << std::setiosflags(std::ios_base::boolalpha)
+ << object.anonymous() << std::endl;
+ out << std::left << "permanent = " << std::setw(COL_WIDTH)
+ << std::setiosflags(std::ios_base::boolalpha)
+ << object.permanent() << std::endl;
out << std::endl;
const std::vector < std::string > propertyNames = object.propertyNames();
***************
*** 104,109 ****
std::string propertyName = *it;
const boost::any propertyValue = object.propertyValue(propertyName);
! out << std::left << "property = " << std::setw(10) << propertyName <<
! " value = " << propertyValue << std::endl;
}
out << std::endl;
--- 112,117 ----
std::string propertyName = *it;
const boost::any propertyValue = object.propertyValue(propertyName);
! out << std::left << "property = " << std::setw(COL_WIDTH) << propertyName
! << " value = " << propertyValue << std::endl;
}
out << std::endl;
Index: objecthandler.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/objecthandler.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** objecthandler.hpp 16 Jun 2006 16:15:36 -0000 1.6
--- objecthandler.hpp 18 Jun 2006 13:41:51 -0000 1.7
***************
*** 47,51 ****
/*! Any existing Object with that instance name is deleted.
*/
! virtual std::string storeObject(const std::string &instanceName,
const boost::shared_ptr < Object > &object);
--- 47,51 ----
/*! Any existing Object with that instance name is deleted.
*/
! virtual std::string storeObject(std::string instanceName,
const boost::shared_ptr < Object > &object);
***************
*** 61,66 ****
boost::dynamic_pointer_cast < T > (object);
if (!ret)
! throw Exception("Error retrieving object with id '" + id +
! "' - unsuccessful attempt to recast pointer");
return ret;
}
--- 61,67 ----
boost::dynamic_pointer_cast < T > (object);
if (!ret)
! throw Exception("Error retrieving object with id '"
! + id + "' - unable to convert reference to type '"
! + typeid(T).name() + "'");
return ret;
}
Index: objecthandler.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/objecthandler.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** objecthandler.cpp 11 Jun 2006 12:38:22 -0000 1.1
--- objecthandler.cpp 18 Jun 2006 13:41:51 -0000 1.2
***************
*** 51,55 ****
}
! std::string ObjectHandler::storeObject(const std::string &instanceName,
const boost::shared_ptr<Object> &object) {
repository_[instanceName] = object;
--- 51,55 ----
}
! std::string ObjectHandler::storeObject(std::string instanceName,
const boost::shared_ptr<Object> &object) {
repository_[instanceName] = object;
|