Changeset 2901 in Sophya
- Timestamp:
- Jan 16, 2006, 10:01:10 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitsmanager.cc
r2898 r2901 64 64 } 65 65 66 /*! 67 Return a NULL pointer if no handler is registered for object \b o . 68 The returned pointer should not be used directly and should NOT 69 be deleted. For read/write operations, the Clone() method should 70 be called on the returned object. 71 */ 66 72 FitsHandlerInterface* FitsManager::FindHandler(AnyDataObj & o) 67 73 { … … 80 86 } 81 87 } 88 return fhi ; 89 } 90 91 /*! 92 Throws an exception ( NotFoundExc ) if the write operation can not be performed. 93 */ 94 void FitsManager::Write(FitsInOutFile& os, AnyDataObj & o) 95 { 96 FitsHandlerInterface * fhi = FindHandler(o); 82 97 if (fhi == NULL) { 83 string msg = "FitsManager:: FindHandler() Handler not found for ";98 string msg = "FitsManager::Write()/FindHandler() Handler not found for "; 84 99 msg += typeid(o).name(); 85 100 throw NotFoundExc(msg); 86 101 } 87 else return fhi; 88 } 89 90 void FitsManager::Write(FitsInOutFile& os, AnyDataObj & o) 91 { 92 FitsHandlerInterface * fhi2 = FindHandler(o)->Clone(); 102 FitsHandlerInterface * fhi2 = fhi->Clone(); 93 103 fhi2->SetDataObj(o); 94 104 fhi2->Write(os); 105 delete fhi2 ; 95 106 return; 96 107 } 97 108 109 /*! 110 Throws an exception ( NotFoundExc ) if the read operation can not be performed. 111 */ 98 112 void FitsManager::Read(FitsInOutFile& is, AnyDataObj & o) 99 113 { 100 FitsHandlerInterface * fhi2 = FindHandler(o)->Clone(); 114 FitsHandlerInterface * fhi = FindHandler(o); 115 if (fhi == NULL) { 116 string msg = "FitsManager::Read()/FindHandler() Handler not found for "; 117 msg += typeid(o).name(); 118 throw NotFoundExc(msg); 119 } 120 FitsHandlerInterface * fhi2 = fhi->Clone(); 101 121 fhi2->SetDataObj(o); 102 122 fhi2->Read(is); … … 105 125 } 106 126 127 /*! 128 Return a NULL pointer if no handler is found capable of reading 129 the current HDU. 130 The returned pointer should not be used directly and should NOT 131 be deleted. For read/write operations, the Clone() method should 132 be called on the returned object. 133 */ 107 134 FitsHandlerInterface * FitsManager::FindReader(FitsInOutFile& is) 108 135 { … … 120 147 } 121 148 } 149 return fhi; 150 } 151 152 /*! 153 Throws an exception ( NotFoundExc ) if the read operation can not be performed. 154 In case of success, the calling function is responsible for deleting 155 the returned FitsHandlerInterface object, when the correspondind data object 156 is not needed any more. 157 */ 158 FitsHandlerInterface * FitsManager::Read(FitsInOutFile& is) 159 { 160 FitsHandlerInterface * fhi = FindReader(is); 122 161 if (fhi == NULL) { 123 string msg = "FitsManager:: FindReader() Reader/Handler not found ";162 string msg = "FitsManager::Read()/FindReader() Reader/Handler not found "; 124 163 msg += is.FileName(); 125 164 char buff[64]; … … 129 168 throw NotFoundExc(msg); 130 169 } 131 else return fhi;132 }133 134 FitsHandlerInterface * FitsManager::Read(FitsInOutFile& is)135 {136 170 FitsHandlerInterface * fhi2 = FindReader(is)->Clone(); 137 171 fhi2->Read(is);
Note:
See TracChangeset
for help on using the changeset viewer.