|
From: <mk...@us...> - 2003-05-02 20:59:08
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv3500/Source
Modified Files:
DataArchive.cpp DataManager.cpp Date.cpp Link.cpp
Log Message:
see CHANGES
Index: DataArchive.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/DataArchive.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DataArchive.cpp 23 Apr 2003 09:14:22 -0000 1.7
--- DataArchive.cpp 2 May 2003 20:59:05 -0000 1.8
***************
*** 377,385 ****
InterfaceProxy *proxy = InterfaceRegistry::getInterfaceRegistry().getInterface(t->classhash);
if (!proxy) {
if (path_str) {
SIMDATA_LOG(LOG_ARCHIVE, LOG_ERROR, "getObject(" << path_str << "):");
}
SIMDATA_LOG(LOG_ARCHIVE, LOG_ERROR, "Interface proxy [" << t->classhash << "] not found.");
! throw MissingInterface("Missing interface for " + t->classhash.str());
}
Object *dup = proxy->createObject();
--- 377,393 ----
InterfaceProxy *proxy = InterfaceRegistry::getInterfaceRegistry().getInterface(t->classhash);
if (!proxy) {
+ std::string msg = "Missing interface for";
if (path_str) {
SIMDATA_LOG(LOG_ARCHIVE, LOG_ERROR, "getObject(" << path_str << "):");
+ msg = msg + " '" + path_str + "'";
+ } else {
+ path_map::iterator i = _pathmap.find(key);
+ if (i != _pathmap.end()) {
+ msg = msg + " '" + i->second + "'";
+ }
}
SIMDATA_LOG(LOG_ARCHIVE, LOG_ERROR, "Interface proxy [" << t->classhash << "] not found.");
! msg = msg + " " + t->classhash.str();
! throw MissingInterface(msg);
}
Object *dup = proxy->createObject();
***************
*** 403,407 ****
SIMDATA_LOG(LOG_ARCHIVE, LOG_DEBUG, "got object " << dup->getClassName());
dup->_setPath(key);
! dup->unpack(p);
if (chain) {
dup->postCreate();
--- 411,421 ----
SIMDATA_LOG(LOG_ARCHIVE, LOG_DEBUG, "got object " << dup->getClassName());
dup->_setPath(key);
! try {
! dup->unpack(p);
! } catch (DataUnderflow &e) {
! e.clear();
! SIMDATA_LOG(LOG_ARCHIVE, LOG_ERROR, "INTERNAL ERROR: Object extraction incomplete for class '" << dup->getClassName() << "'.");
! throw CorruptArchive("Object extraction incomplete for class '" + std::string(dup->getClassName()) + "'");
! }
if (chain) {
dup->postCreate();
***************
*** 433,437 ****
cache_map::const_iterator i = static_map.find(key);
if (i == static_map.end()) return 0;
! return &((*i).second);
}
--- 447,472 ----
cache_map::const_iterator i = static_map.find(key);
if (i == static_map.end()) return 0;
! return &(i->second);
! }
!
! void DataArchive::cleanStatic() {
! std::vector<ObjectID> unused;
! unused.reserve(64);
! if (!static_map.empty()) {
! cache_map::const_iterator i = static_map.begin();
! cache_map::const_iterator j = static_map.end();
! for (; i != j; i++) {
! if (i->second.unique()) {
! unused.push_back(i->first);
! }
! }
! }
! if (!unused.empty()) {
! std::vector<ObjectID>::iterator i = unused.begin();
! std::vector<ObjectID>::iterator j = unused.end();
! for (; i != j; i++) {
! static_map.erase(static_map.find(*i));
! }
! }
}
Index: DataManager.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/DataManager.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DataManager.cpp 23 Apr 2003 09:14:22 -0000 1.2
--- DataManager.cpp 2 May 2003 20:59:05 -0000 1.3
***************
*** 103,106 ****
--- 103,107 ----
DataArchive *archive = 0;
if (idx != _archive_map.end()) {
+ assert(idx->second >= 0 && idx->second < _archives.size());
archive = _archives[idx->second];
}
***************
*** 119,122 ****
--- 120,131 ----
}
+ void DataManager::cleanStatic() {
+ std::vector<DataArchive*>::iterator i;
+ for (i = _archives.begin(); i != _archives.end(); i++) {
+ if (*i) {
+ (*i)->cleanStatic();
+ }
+ }
+ }
NAMESPACE_END // namespace simdata
Index: Date.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Date.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Date.cpp 28 Jan 2003 23:26:07 -0000 1.2
--- Date.cpp 2 May 2003 20:59:05 -0000 1.3
***************
*** 358,364 ****
int Zulu::reduce() {
int days = 0;
! if (overflow()) {
! days = (int) (m_time * 0.00001162790697674418);
! m_time -= days * 86000.0f;
}
return days;
--- 358,366 ----
int Zulu::reduce() {
int days = 0;
! if (overflow() || m_time < 0.0) {
! days = (int) (m_time * 0.00001157407407407407);
! if (m_time < 0.0) days--;
! m_time -= days * 86400.0f;
! std::cout << m_time << " : " << days << std::endl;
}
return days;
Index: Link.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Link.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Link.cpp 23 Apr 2003 09:14:23 -0000 1.1
--- Link.cpp 2 May 2003 20:59:05 -0000 1.2
***************
*** 89,95 ****
Path _p(path);
LinkBase _ppb;
! try {
_ppb = archive->getObject(_p);
! }
catch (Exception e) {
e.details();
--- 89,104 ----
Path _p(path);
LinkBase _ppb;
! /*
! * XXX this is a bit tricky. if we don't surpress the exception,
! * we probably leave partially constructed objects in an incomplete
! * state. if we eat the exception, the object ends up with a null
! * pointer, but there's no way to globally catch the error...
! * XXX for now, pass on the exception.
! */
! //try {
!
_ppb = archive->getObject(_p);
! //}
! /*
catch (Exception e) {
e.details();
***************
*** 97,100 ****
--- 106,110 ----
return;
}
+ */
*this = _ppb;
Object* p = _reference;
|