From: <mk...@us...> - 2003-09-18 00:27:48
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Source In directory sc8-pr-cvs1:/tmp/cvs-serv24484/Source Modified Files: Tag: b0_4_0 DataArchive.cpp Date.cpp InterfaceRegistry.cpp Log Message: Index: DataArchive.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/DataArchive.cpp,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -C2 -d -r1.15.2.1 -r1.15.2.2 *** DataArchive.cpp 22 Aug 2003 00:21:45 -0000 1.15.2.1 --- DataArchive.cpp 18 Sep 2003 00:27:38 -0000 1.15.2.2 *************** *** 26,29 **** --- 26,31 ---- #include <iomanip> + #include <sstream> + NAMESPACE_SIMDATA *************** *** 81,87 **** bool machine_little = isLittleEndian(); if (data_little != machine_little) { ! char msg[128]; ! sprintf(msg, "le(machine, data) = (%d, %d)", machine_little, data_little); ! throw BadByteOrder(msg); } } --- 83,89 ---- bool machine_little = isLittleEndian(); if (data_little != machine_little) { ! std::stringstream msg; ! msg << "le(machine, data) = (" << machine_little << ", " << data_little << ")"; ! throw BadByteOrder(msg.str()); } } Index: Date.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Date.cpp,v retrieving revision 1.7.2.3 retrieving revision 1.7.2.4 diff -C2 -d -r1.7.2.3 -r1.7.2.4 *** Date.cpp 18 Sep 2003 00:10:33 -0000 1.7.2.3 --- Date.cpp 18 Sep 2003 00:27:38 -0000 1.7.2.4 *************** *** 22,25 **** --- 22,34 ---- #include <SimData/Date.h> + #include <ctime> + + // for fast timing routines + #ifdef _WIN32 + #include <Windows.h> + #else + #include <sys/time.h> + #include <unistd.h> + #endif *************** *** 31,38 **** #ifdef _WIN32 - NAMESPACE_SIMDATA_END - #include <Windows.h> - #include <ctime> - NAMESPACE_SIMDATA static LARGE_INTEGER _tstart, _tend; static LARGE_INTEGER freq; --- 40,43 ---- *************** *** 72,78 **** #else - - #include <sys/time.h> - #include <unistd.h> static struct timeval _tstart, _tend; --- 77,80 ---- Index: InterfaceRegistry.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/InterfaceRegistry.cpp,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** InterfaceRegistry.cpp 16 Aug 2003 07:56:40 -0000 1.10 --- InterfaceRegistry.cpp 18 Sep 2003 00:27:38 -0000 1.10.2.1 *************** *** 68,113 **** } ! MemberAccessorBase * InterfaceProxy::getAccessor(const char *name, const char *cname) const { ! if (!cname) cname = "?"; ! throw InterfaceError("variable \"" + std::string(name) + "\" not defined in interface to class " + cname); ! } ! ! const TypeAdapter InterfaceProxy::get(Object *o, const char *name) const { ! return getAccessor(name)->get(o); ! } ! ! void InterfaceProxy::set(Object *o, const char *name, const TypeAdapter &v) { ! getAccessor(name)->set(o, v); ! } ! ! void InterfaceProxy::push_back(Object *o, const char *name, const TypeAdapter &v) { ! try { ! getAccessor(name)->push_back(o, v); ! } catch (TypeMismatch &e) { ! e.appendMessage(std::string("Error encountered adding to list variable \"") + name + "\" in class \"" + getClassName() + "\"."); ! throw; } } ! void InterfaceProxy::set_enum(Object *o, const char *name, const char *v) { ! getAccessor(name)->set(o, TypeAdapter(v)); ! } ! ! void InterfaceProxy::clear(Object *o, const char *name) { ! getAccessor(name)->clear(o); ! } ! ! bool InterfaceProxy::variableExists(const char *) const { ! return false; ! } ! ! bool InterfaceProxy::variableRequired(const char *name) const { ! throw InterfaceError("Variable '"+std::string(name)+"' not found in interface to class '" + getClassName() + "'"); ! return false; ! } ! ! std::string InterfaceProxy::variableType(const char *name) const { ! throw InterfaceError("Variable '"+std::string(name)+"' not found in interface to class '" + getClassName() + "'"); ! return ""; } --- 68,103 ---- } ! void InterfaceProxy::addInterface(ObjectInterfaceBase* interface, ! std::string const &classname, ! hasht const &classhash) { ! std::vector<std::string> names = interface->getVariableNames(); ! std::vector<std::string>::iterator name = names.begin(); ! for (; name != names.end(); ++name) { ! if (_interfaces.find(*name) != _interfaces.end()) { ! // variable multiply defined ! std::stringstream ss; ! ss << "variable \"" << *name << "\"" ! << " multiply defined in interface to class " ! << classname << " or parent interface."; ! std::cout << ss.str() << std::endl; ! throw InterfaceError(ss.str()); ! } ! _interfaces[*name] = interface; ! _variableNames.push_back(*name); ! if (interface->variableRequired(*name)) { ! _requiredNames.push_back(*name); ! } } + _classNames.push_back(classname); + _classHashes.push_back(classhash); } ! ObjectInterfaceBase *InterfaceProxy::findInterface(std::string const &varname, bool required) const { ! InterfaceMap::const_iterator iter = _interfaces.find(varname); ! if (iter == _interfaces.end()) { ! if (!required) return 0; ! throw InterfaceError("Variable \"" + varname + "\" not defined in interface to class \"" + getClassName() + "\""); ! } ! return iter->second; } *************** *** 122,145 **** } ! bool InterfaceProxy::isSubclass(std::string const &) const { ! return false; ! } ! ! bool InterfaceProxy::isSubclass(hasht const &) const { ! return false; ! } ! ! void InterfaceProxy::pack(Object *, Packer &) const { ! } ! ! void InterfaceProxy::unpack(Object *, UnPacker &) const { ! } ! ! std::vector<std::string> InterfaceProxy::getVariableNames() const { ! return std::vector<std::string>(); } ! std::vector<std::string> InterfaceProxy::getRequiredNames() const { ! return std::vector<std::string>(); } --- 112,121 ---- } ! bool InterfaceProxy::isSubclass(std::string const &classname) const { ! return std::find(_classNames.begin(), _classNames.end(), classname) != _classNames.end(); } ! bool InterfaceProxy::isSubclass(hasht const &classhash) const { ! return std::find(_classHashes.begin(), _classHashes.end(), classhash) != _classHashes.end(); } |