Update of /cvsroot/objecthandler/ObjectHandler/oh
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2303/oh
Modified Files:
object.hpp objecthandlerbase.cpp objecthandlerbase.hpp
Log Message:
revise processing for instance names
Index: objecthandlerbase.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/objecthandlerbase.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** objecthandlerbase.cpp 25 May 2006 10:45:35 -0000 1.2
--- objecthandlerbase.cpp 1 Jun 2006 10:52:08 -0000 1.3
***************
*** 32,46 ****
std::string ObjectHandlerBase::storeObject(const std::string &instanceName,
const obj_ptr &object) {
- object->setInstanceName(boost::shared_ptr < Object::InstanceName > (new Object::InstanceName(instanceName)));
objectList_[instanceName] = object;
return instanceName;
}
! obj_ptr ObjectHandlerBase::retrieveObject(const std::string &fullName) const {
! ObjectList::const_iterator result = objectList_.find(fullName);
if (result == objectList_.end()) {
std::ostringstream msg;
msg << "ObjectHandler error: attempt to retrieve object "
! << "with unknown instance name '" << fullName << "'";
throw Exception(msg.str());
} else
--- 32,45 ----
std::string ObjectHandlerBase::storeObject(const std::string &instanceName,
const obj_ptr &object) {
objectList_[instanceName] = object;
return instanceName;
}
! obj_ptr ObjectHandlerBase::retrieveObject(const std::string &instanceName) const {
! ObjectList::const_iterator result = objectList_.find(instanceName);
if (result == objectList_.end()) {
std::ostringstream msg;
msg << "ObjectHandler error: attempt to retrieve object "
! << "with unknown instance name '" << instanceName << "'";
throw Exception(msg.str());
} else
***************
*** 48,53 ****
}
! void ObjectHandlerBase::deleteObject(const std::string &fullName) {
! objectList_.erase(fullName);
}
--- 47,52 ----
}
! void ObjectHandlerBase::deleteObject(const std::string &instanceName) {
! objectList_.erase(instanceName);
}
***************
*** 77,82 ****
boost::regex r(regex);
for (ObjectList::const_iterator i=objectList_.begin(); i!=objectList_.end(); i++) {
! std::string stubName = i->second->getStubName();
! if (regex_match(stubName, r)) instanceNames.push_back(stubName);
}
}
--- 76,81 ----
boost::regex r(regex);
for (ObjectList::const_iterator i=objectList_.begin(); i!=objectList_.end(); i++) {
! std::string instanceName = i->first;
! if (regex_match(instanceName, r)) instanceNames.push_back(instanceName);
}
}
Index: object.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/object.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** object.hpp 19 May 2006 15:12:41 -0000 1.1
--- object.hpp 1 Jun 2006 10:52:08 -0000 1.2
***************
*** 45,75 ****
class Object {
public:
- //! Processing for the identifier for this Object.
- /*! This base class is empty and may be overridden
- to provide platform-specific behavior.
- */
- class InstanceName {
- public:
- InstanceName(const std::string &fullName) : fullName_(fullName) {}
- virtual ~InstanceName() {}
- const std::string &getStubName() {
- return stubName_;
- }
- const std::string &getFullName() {
- return fullName_;
- }
- const std::string &getKey() {
- return key_;
- }
- virtual bool isValid() {
- return true;
- }
- protected:
- InstanceName() {}
- std::string stubName_;
- std::string fullName_;
- std::string key_;
- };
-
//! \name Constructors & Destructors
//@{
--- 45,48 ----
***************
*** 104,128 ****
mProps = p;
}
-
- void setInstanceName(const boost::shared_ptr < InstanceName > &instanceName) {
- instanceName_ = instanceName;
- }
- const std::string &getStubName() {
- return instanceName_->getStubName();
- }
- const std::string &getFullName() {
- return instanceName_->getFullName();
- }
- const std::string &getKey() {
- return instanceName_->getKey();
- }
- bool isValid() {
- return instanceName_->isValid();
- }
private:
boost::shared_ptr<ValueObject> mProps;
Object& operator= (const Object&);
Object(const Object&);
- boost::shared_ptr< InstanceName > instanceName_;
};
--- 77,84 ----
Index: objecthandlerbase.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/oh/objecthandlerbase.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** objecthandlerbase.hpp 19 May 2006 15:12:41 -0000 1.1
--- objecthandlerbase.hpp 1 Jun 2006 10:52:08 -0000 1.2
***************
*** 55,63 ****
/*! Throws exception if no Object exists with that handle.
*/
! virtual obj_ptr retrieveObject(const std::string &fullName) const;
//! Delete Object with given handle.
/*! Does nothing if no Object exists with that handle.
*/
! virtual void deleteObject(const std::string &fullName);
//! Delete all Objects in repository.
/*! Does nothing if repository is already empty.
--- 55,63 ----
/*! Throws exception if no Object exists with that handle.
*/
! virtual obj_ptr retrieveObject(const std::string &instanceName) const;
//! Delete Object with given handle.
/*! Does nothing if no Object exists with that handle.
*/
! virtual void deleteObject(const std::string &instanceName);
//! Delete all Objects in repository.
/*! Does nothing if repository is already empty.
|