• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisioncb48a7e91de1ee9ad19fac02c5206040b8f5eeff (tree)
Zeit2013-07-23 11:29:46
AutorKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Log Message

Reimplement MolDSException::Deserialization to load multiple exceptions. #31730

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1413 1136aad2-a195-0410-b898-f5ea1d11b9d8

Ändern Zusammenfassung

Diff

--- a/src/base/MolDSException.cpp
+++ b/src/base/MolDSException.cpp
@@ -143,6 +143,19 @@ void MolDSException::serialize(Archive& ar, const unsigned int ver){
143143 this->backtracePtr[i]=reinterpret_cast<void*>(p);
144144 }
145145 }
146+
147+ bool hasnext = this->nextException.get() != NULL;
148+ ar & hasnext;
149+ MolDSException* pe = NULL;
150+ if(Archive::is_saving::value){
151+ pe = this->nextException.get();
152+ }
153+ if(hasnext){
154+ ar & pe;
155+ }
156+ if(!Archive::is_saving::value){
157+ this->nextException.reset(pe);
158+ }
146159 }
147160
148161 void MolDSException::Serialize(std::ostream& os){
@@ -157,6 +170,21 @@ MolDSException MolDSException::Deserialize(std::istream& is){
157170 boost::scoped_ptr<MolDSException> sp(p);
158171 ia >> p;
159172 sp.reset(p);
160- return *p;
173+
174+ while(!is.eof()){
175+ try{
176+ boost::archive::text_iarchive ia(is);
177+ MolDSException* pnext = NULL;
178+ ia >> pnext;
179+ p->LastException()->nextException.reset(pnext);
180+ p = pnext;
181+ }
182+ catch(...){
183+ p->LastException()->nextException.reset();
184+ break;
185+ }
186+ }
187+
188+ return *sp.get();
161189 }
162190 }
--- a/src/base/MolDSException.h
+++ b/src/base/MolDSException.h
@@ -44,11 +44,22 @@ private:
4444 void GetBacktrace(int bufsize);
4545 size_t backtraceSize;
4646 boost::shared_array<void*> backtracePtr;
47+
4748 typedef std::map<int, int> intKeyValueMap_t;
4849 intKeyValueMap_t intKeyValueMap;
4950 //typedef std::map<int, other> otherKeyValueMap_t;
5051 //otherKeyValueMap_t otherKeyValueMap;
52+
5153 boost::shared_ptr<MolDSException> nextException;
54+ MolDSException* LastException(){
55+ if(this->nextException.get()==NULL){
56+ return this;
57+ }
58+ else{
59+ return this->nextException->LastException();
60+ }
61+ }
62+
5263 friend class boost::serialization::access;
5364 template<class Archive>
5465 void serialize(Archive& ar, const unsigned int ver);