Update of /cvsroot/objecthandler/ObjectHandler/ohxl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29706/ohxl
Modified Files:
callingrange.cpp callingrange.hpp objecthandlerxl.cpp
objecthandlerxl.hpp
Log Message:
InstanceName replaced with ObjectID
Index: objecthandlerxl.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/objecthandlerxl.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** objecthandlerxl.cpp 16 Jul 2006 17:11:19 -0000 1.10
--- objecthandlerxl.cpp 17 Jul 2006 10:11:40 -0000 1.11
***************
*** 35,39 ****
namespace ObjHandler {
! unsigned long ObjectHandlerXL::instanceNameCount_ = 0;
// std::map cannot be exported across DLL boundaries
--- 35,39 ----
namespace ObjHandler {
! unsigned long ObjectHandlerXL::objectIDCount_ = 0;
// std::map cannot be exported across DLL boundaries
***************
*** 109,141 ****
std::string ObjectHandlerXL::storeObject(
! std::string instanceName,
const boost::shared_ptr<Object> &object) {
resetCaller(true);
! if (instanceName.empty()) {
! instanceName = generateInstanceName();
object->setAnonymous();
}
boost::shared_ptr<CallingRange> callingRange = getCallingRange();
! callingRange->deleteObject(instanceName, object);
! checkName(instanceName);
! callingRange->registerObject(instanceName, object);
! std::string instanceNameCounter = ObjectHandler::storeObject(instanceName, object);
! return instanceNameCounter + "#" + callingRange->updateCount();
}
! boost::shared_ptr<Object> ObjectHandlerXL::retrieveObjectImpl(const std::string &instanceName) const {
! std::string instanceNameStub;
! int counterOffset = instanceName.length() - 5;
! if (counterOffset >= 0 && instanceName[counterOffset] == '#')
! instanceNameStub = instanceName.substr(0, counterOffset);
else
! instanceNameStub = instanceName;
! return ObjectHandler::retrieveObjectImpl(instanceNameStub);
}
! std::string ObjectHandlerXL::generateInstanceName() {
/*
The user has provided a null string as the object ID so generate a name automatically.
--- 109,141 ----
std::string ObjectHandlerXL::storeObject(
! std::string objectID,
const boost::shared_ptr<Object> &object) {
resetCaller(true);
! if (objectID.empty()) {
! objectID = generateObjectID();
object->setAnonymous();
}
boost::shared_ptr<CallingRange> callingRange = getCallingRange();
! callingRange->deleteObject(objectID, object);
! checkName(objectID);
! callingRange->registerObject(objectID, object);
! std::string objectIDCounter = ObjectHandler::storeObject(objectID, object);
! return objectIDCounter + "#" + callingRange->updateCount();
}
! boost::shared_ptr<Object> ObjectHandlerXL::retrieveObjectImpl(const std::string &objectID) const {
! std::string objectIDStub;
! int counterOffset = objectID.length() - 5;
! if (counterOffset >= 0 && objectID[counterOffset] == '#')
! objectIDStub = objectID.substr(0, counterOffset);
else
! objectIDStub = objectID;
! return ObjectHandler::retrieveObjectImpl(objectIDStub);
}
! std::string ObjectHandlerXL::generateObjectID() {
/*
The user has provided a null string as the object ID so generate a name automatically.
***************
*** 147,151 ****
static const int COUNT_BASE = 16;
! if (instanceNameCount_ == ULONG_MAX) {
std::ostringstream msg;
msg << "ObjectHandler has exceeded the maximum limit of " << ULONG_MAX
--- 147,151 ----
static const int COUNT_BASE = 16;
! if (objectIDCount_ == ULONG_MAX) {
std::ostringstream msg;
msg << "ObjectHandler has exceeded the maximum limit of " << ULONG_MAX
***************
*** 156,160 ****
}
std::ostringstream s;
! s << "obj_" << std::setw(COUNT_WIDTH) << std::setfill('0') << std::setbase(COUNT_BASE) << instanceNameCount_++;
return s.str();
}
--- 156,160 ----
}
std::ostringstream s;
! s << "obj_" << std::setw(COUNT_WIDTH) << std::setfill('0') << std::setbase(COUNT_BASE) << objectIDCount_++;
return s.str();
}
***************
*** 184,188 ****
if (deletePermanent) {
callingRanges_.clear();
! instanceNameCount_ = 0;
}
ObjectHandler::deleteAllObjects(deletePermanent);
--- 184,188 ----
if (deletePermanent) {
callingRanges_.clear();
! objectIDCount_ = 0;
}
ObjectHandler::deleteAllObjects(deletePermanent);
Index: objecthandlerxl.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/objecthandlerxl.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** objecthandlerxl.hpp 16 Jul 2006 17:11:19 -0000 1.10
--- objecthandlerxl.hpp 17 Jul 2006 10:11:40 -0000 1.11
***************
*** 54,60 ****
Performance in such special cases is sub-optimal.
*/
! virtual std::string storeObject(std::string instanceName,
const boost::shared_ptr < Object > &object);
! virtual boost::shared_ptr < Object > retrieveObjectImpl(const std::string &instanceName) const;
virtual void collectGarbage(const bool &deletePermanent = false);
virtual void deleteAllObjects(const bool &deletePermanent = false);
--- 54,60 ----
Performance in such special cases is sub-optimal.
*/
! virtual std::string storeObject(std::string objectID,
const boost::shared_ptr < Object > &object);
! virtual boost::shared_ptr < Object > retrieveObjectImpl(const std::string &objectID) const;
virtual void collectGarbage(const bool &deletePermanent = false);
virtual void deleteAllObjects(const bool &deletePermanent = false);
***************
*** 70,76 ****
private:
boost::shared_ptr < CallingRange > getCallingRange();
! virtual std::string generateInstanceName();
void clearCallingRange(boost::shared_ptr < CallingRange > callingRange);
! static unsigned long instanceNameCount_;
};
--- 70,76 ----
private:
boost::shared_ptr < CallingRange > getCallingRange();
! virtual std::string generateObjectID();
void clearCallingRange(boost::shared_ptr < CallingRange > callingRange);
! static unsigned long objectIDCount_;
};
Index: callingrange.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/callingrange.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** callingrange.cpp 16 Jul 2006 17:11:18 -0000 1.6
--- callingrange.cpp 17 Jul 2006 10:11:40 -0000 1.7
***************
*** 85,92 ****
void CallingRange::deleteObject(
! const std::string &instanceName,
boost::shared_ptr<Object> object) {
std::map<std::string, boost::shared_ptr<Object> >::const_iterator i;
! i = residentObjects_.find(instanceName);
if (i != residentObjects_.end()) {
ObjectHandler::instance().deleteObject(i->first);
--- 85,92 ----
void CallingRange::deleteObject(
! const std::string &objectID,
boost::shared_ptr<Object> object) {
std::map<std::string, boost::shared_ptr<Object> >::const_iterator i;
! i = residentObjects_.find(objectID);
if (i != residentObjects_.end()) {
ObjectHandler::instance().deleteObject(i->first);
***************
*** 96,102 ****
void CallingRange::registerObject(
! const std::string &instanceName,
boost::shared_ptr<Object> object) {
! residentObjects_[instanceName] = object;
}
--- 96,102 ----
void CallingRange::registerObject(
! const std::string &objectID,
boost::shared_ptr<Object> object) {
! residentObjects_[objectID] = object;
}
Index: callingrange.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/callingrange.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** callingrange.hpp 18 Jun 2006 13:41:51 -0000 1.5
--- callingrange.hpp 17 Jul 2006 10:11:40 -0000 1.6
***************
*** 36,42 ****
return key_;
}
! void deleteObject(const std::string &instanceName,
boost::shared_ptr<Object> object);
! void registerObject(const std::string &instanceName,
boost::shared_ptr<Object> object);
void clearNonPermanent();
--- 36,42 ----
return key_;
}
! void deleteObject(const std::string &objectID,
boost::shared_ptr<Object> object);
! void registerObject(const std::string &objectID,
boost::shared_ptr<Object> object);
void clearNonPermanent();
|