- Timestamp:
- 22/11/11 16:58:21 (6 months ago)
- Location:
- trunk/bindings/cpp
- Files:
-
- 3 edited
-
NeXusFile.cpp (modified) (6 diffs)
-
NeXusFile.hpp (modified) (2 diffs)
-
NeXusStream.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bindings/cpp/NeXusFile.cpp
r1771 r1772 165 165 } 166 166 167 File::File(c har *filename, const NXaccess access) : m_close_handle (true) {167 File::File(const char *filename, const NXaccess access) : m_close_handle (true) { 168 168 this->initOpenFile(string(filename), access); 169 169 } … … 269 269 270 270 std::string File::getPath(){ 271 char cPath[ 1024];272 273 memset(cPath,0, 1024*sizeof(char));274 NXstatus status = NXgetpath(this->m_file_id,cPath, 1024);271 char cPath[2048]; 272 273 memset(cPath,0,sizeof(cPath)); 274 NXstatus status = NXgetpath(this->m_file_id,cPath, sizeof(cPath)-1); 275 275 if (status != NX_OK) { 276 276 stringstream msg; … … 555 555 template <typename NumT> 556 556 void File::putAttr(const std::string& name, const NumT value) { 557 NumT data[1]; 558 data[0] = value; 557 559 AttrInfo info; 558 560 info.name = name; … … 920 922 } 921 923 char* value = new char[info.dims[0]+1]; // probably do not need +1, but being safe 922 this->getData(value); 924 try{ 925 this->getData(value); 926 } 927 catch (const Exception& e) 928 { 929 delete[] value; 930 throw e; 931 } 923 932 res = string(value, info.dims[0]); 924 933 delete[] value; … … 971 980 } 972 981 973 void File::getEntries(std::map<std::string, std::string> & map) 974 { 982 void File::getEntries(std::map<std::string, std::string> & result) 983 { 984 result.clear(); 975 985 this->initGroupDir(); 976 986 pair<string,string> temp; … … 981 991 } 982 992 else { 983 map.insert(temp);993 result.insert(temp); 984 994 } 985 995 } -
trunk/bindings/cpp/NeXusFile.hpp
r1742 r1772 181 181 * \param access How to access the file. 182 182 */ 183 File(c har *filename, const NXaccess access = NXACC_READ);183 File(const char *filename, const NXaccess access = NXACC_READ); 184 184 185 185 /** … … 687 687 * but avoids the map copy of getEntries(). 688 688 * 689 * \param mapThe map that will be filled with the entries690 */ 691 void getEntries(std::map<std::string, std::string> & map);689 * \param result The map that will be filled with the entries 690 */ 691 void getEntries(std::map<std::string, std::string> & result); 692 692 693 693 /** -
trunk/bindings/cpp/NeXusStream.hpp
r1536 r1772 129 129 Attr(const std::string& name, const Attr& d) { m_holder = d.m_holder->clone(); setName(name); } 130 130 Attr(const Attr& a) : m_holder(NULL) { m_holder = a.m_holder->clone(); } 131 Attr& operator=(const Attr& a) { if (this != &a) { delete m_holder; m_holder = a.m_holder->clone(); return *this; }}131 Attr& operator=(const Attr& a) { if (this != &a) { delete m_holder; m_holder = a.m_holder->clone(); } return *this; } 132 132 void setName(const std::string& name) { m_holder->setName(name); } 133 133 virtual void readFromFile(File& nf) const { m_holder->readFromFile(nf); } … … 268 268 } 269 269 Data(const Data& d) : ObjectWithAttr(d), m_holder(NULL) { m_holder = d.m_holder->clone(); } 270 Data& operator=(const Data& d) { if (this != &d) { delete m_holder; m_holder = d.m_holder->clone(); return *this; }}270 Data& operator=(const Data& d) { if (this != &d) { delete m_holder; m_holder = d.m_holder->clone(); } return *this; } 271 271 virtual void readFromFile(File& nf) const; 272 272 virtual void writeToFile(File& nf) const;
Note: See TracChangeset
for help on using the changeset viewer.
