Update of /cvsroot/objecthandler/ObjectHandler/ohxl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv938/ohxl
Modified Files:
callingrange.cpp callingrange.hpp objecthandlerxl.cpp
objecthandlerxl.hpp register.cpp unregister.cpp
Log Message:
logging for calling ranges
Index: objecthandlerxl.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/objecthandlerxl.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** objecthandlerxl.cpp 1 Jun 2006 10:52:08 -0000 1.3
--- objecthandlerxl.cpp 2 Jun 2006 13:59:05 -0000 1.4
***************
*** 163,165 ****
--- 163,181 ----
}
+ void ObjectHandlerXL::dump(std::ostream& out) {
+ ObjectHandlerBase::dump(out);
+
+ out << std::endl << "calling ranges:";
+ if (callingRanges_.empty()) {
+ out << " none." << std::endl;
+ } else {
+ out << std::endl << std::endl;
+ std::map < std::string, boost::shared_ptr < CallingRange > >::const_iterator i;
+ for (i = callingRanges_.begin(); i != callingRanges_.end(); i++) {
+ boost::shared_ptr < CallingRange > callingRange = i->second;
+ out << *callingRange.get();
+ }
+ }
+ }
+
}
Index: objecthandlerxl.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/objecthandlerxl.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** objecthandlerxl.hpp 1 Jun 2006 13:59:47 -0000 1.3
--- objecthandlerxl.hpp 2 Jun 2006 13:59:05 -0000 1.4
***************
*** 62,65 ****
--- 62,66 ----
*/
virtual void resetCaller();
+ virtual void dump(std::ostream&);
private:
std::map < std::string, boost::shared_ptr < CallingRange > > callingRanges_;
Index: callingrange.hpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/callingrange.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** callingrange.hpp 1 Jun 2006 10:52:08 -0000 1.1
--- callingrange.hpp 2 Jun 2006 13:59:05 -0000 1.2
***************
*** 31,35 ****
CallingRange();
~CallingRange();
! bool isValid();
const std::string &getKey() {
return key_;
--- 31,35 ----
CallingRange();
~CallingRange();
! bool isValid() const;
const std::string &getKey() {
return key_;
***************
*** 39,42 ****
--- 39,43 ----
void update();
std::string updateCount();
+ friend std::ostream &operator<<(std::ostream&, const CallingRange&);
private:
static int keyCount_;
***************
*** 46,49 ****
--- 47,51 ----
bool busy_;
int updateCount_;
+ std::string getAddressString() const;
};
Index: register.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/register.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** register.cpp 1 Jun 2006 13:59:47 -0000 1.2
--- register.cpp 2 Jun 2006 13:59:05 -0000 1.3
***************
*** 210,214 ****
Excel(xlfRegister, 0, 10, &xDll,
TempStrNoSize("\x0F""ohLogAllObjects"), // function code name
! TempStrNoSize("\x01""L"), // parameter codes
TempStrNoSize("\x0F""ohLogAllObjects"), // function display name
TempStrNoSize("\x00"""), // comma-delimited list of parameters
--- 210,214 ----
Excel(xlfRegister, 0, 10, &xDll,
TempStrNoSize("\x0F""ohLogAllObjects"), // function code name
! TempStrNoSize("\x02""L#"), // parameter codes
TempStrNoSize("\x0F""ohLogAllObjects"), // function display name
TempStrNoSize("\x00"""), // comma-delimited list of parameters
Index: callingrange.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/callingrange.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** callingrange.cpp 1 Jun 2006 10:52:08 -0000 1.1
--- callingrange.cpp 2 Jun 2006 13:59:05 -0000 1.2
***************
*** 30,45 ****
int CallingRange::keyCount_ = 0;
- std::string CallingRange::getKeyCount() {
- static const int KEY_WIDTH = 5;
- static const int KEY_BASE = 16;
- static const double KEY_MAX = pow((double)KEY_BASE, KEY_WIDTH);
-
- if (keyCount_ > KEY_MAX)
- throw Exception("CallingRange::getKeyCount: max key value exceeded");
- std::ostringstream s;
- s << '_' << std::setw(KEY_WIDTH) << std::setfill('0') << std::setbase(KEY_BASE) << keyCount_++;
- return s.str();
- }
-
CallingRange::CallingRange() : busy_(false), updateCount_(0) {
--- 30,33 ----
***************
*** 52,56 ****
if (xRet.xltype != xltypeBool || !xRet.val.boolean)
throw Exception("error on call to xlfSetName");
-
}
--- 40,43 ----
***************
*** 62,65 ****
--- 49,64 ----
}
+ std::string CallingRange::getKeyCount() {
+ static const int KEY_WIDTH = 5;
+ static const int KEY_BASE = 16;
+ static const double KEY_MAX = pow((double)KEY_BASE, KEY_WIDTH);
+
+ if (keyCount_ > KEY_MAX)
+ throw Exception("CallingRange::getKeyCount: max key value exceeded");
+ std::ostringstream s;
+ s << '_' << std::setw(KEY_WIDTH) << std::setfill('0') << std::setbase(KEY_BASE) << keyCount_++;
+ return s.str();
+ }
+
void CallingRange::clear() {
std::vector < std::string >::const_iterator i;
***************
*** 75,79 ****
}
! bool CallingRange::isValid() {
// XLOPERs which might need freeing in the event of an exception
--- 74,78 ----
}
! bool CallingRange::isValid() const {
// XLOPERs which might need freeing in the event of an exception
***************
*** 109,112 ****
--- 108,141 ----
}
+ std::string CallingRange::getAddressString() const {
+
+ // XLOPER which might need freeing in the event of an exception
+
+ XLOPER xDef;
+
+ try {
+
+ Excel(xlfGetName, &xDef, 1, TempStrStl(key_));
+
+ std::string address;
+ operToScalar(address, xDef);
+ Excel(xlFree, 0, 1, &xDef);
+ return address;
+
+ } catch (const std::exception &e) {
+
+ // free any memory that may have been allocated
+
+ Excel(xlFree, 0, 1, &xDef);
+
+ // propagate the exception
+
+ std::ostringstream err;
+ err << "CallingRange::getAddressString: " << e.what();
+ throw Exception(err.str());
+ }
+
+ }
+
void CallingRange::update() {
/*
***************
*** 140,142 ****
--- 169,184 ----
}
+ std::ostream& operator<<(std::ostream& out, const CallingRange &callingRange) {
+ out << "name: " << callingRange.key_ << std::endl;
+ out << "reference: " << callingRange.getAddressString() << std::endl;
+ out << "valid: " << (callingRange.isValid() ? "TRUE" : "FALSE") << std::endl;
+ out << "update count: " << callingRange.updateCount_ << std::endl;
+ out << "resident objects: " << callingRange.residentObjects_.size() << std::endl;
+ std::vector < std::string >::const_iterator i;
+ for (i = callingRange.residentObjects_.begin(); i != callingRange.residentObjects_.end(); i++)
+ out << " instance name: " << *i << std::endl;
+ out << std::endl;
+ return out;
+ }
+
}
Index: unregister.cpp
===================================================================
RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/unregister.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** unregister.cpp 1 Jun 2006 13:59:47 -0000 1.2
--- unregister.cpp 2 Jun 2006 13:59:05 -0000 1.3
***************
*** 215,219 ****
Excel(xlfRegister, 0, 10, &xDll,
TempStrNoSize("\x0F""ohLogAllObjects"), // function code name
! TempStrNoSize("\x01""L"), // parameter codes
TempStrNoSize("\x0F""ohLogAllObjects"), // function display name
TempStrNoSize("\x00"""), // comma-delimited list of parameters
--- 215,219 ----
Excel(xlfRegister, 0, 10, &xDll,
TempStrNoSize("\x0F""ohLogAllObjects"), // function code name
! TempStrNoSize("\x02""L#"), // parameter codes
TempStrNoSize("\x0F""ohLogAllObjects"), // function display name
TempStrNoSize("\x00"""), // comma-delimited list of parameters
|