Changeset 1719
- Timestamp:
- 27/10/11 23:04:16 (7 months ago)
- Location:
- trunk/bindings/cpp
- Files:
-
- 2 edited
-
NeXusFile.cpp (modified) (5 diffs)
-
NeXusFile.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bindings/cpp/NeXusFile.cpp
r1711 r1719 570 570 571 571 void File::putAttr(const std::string& name, const std::string value) { 572 if (value.empty()) {573 throw Exception("Supplied empty value to putAttr");574 }575 572 string my_value(value); 573 if (my_value.empty()) 574 my_value = " "; // Make a default "space" to avoid errors. 576 575 AttrInfo info; 577 576 info.name = name; 578 info.length = my_value.size();577 info.length = static_cast<int>(my_value.size()); 579 578 info.type = CHAR; 580 579 this->putAttr(info, &(my_value[0])); … … 960 959 } 961 960 962 map<string, string> File::getEntries() { 961 map<string, string> File::getEntries() 962 { 963 map<string, string> result; 964 this->getEntries(result); 965 return result; 966 } 967 968 void File::getEntries(std::map<std::string, std::string> & map) 969 { 963 970 this->initGroupDir(); 964 965 map<string, string> result;966 967 971 pair<string,string> temp; 968 972 while (true) { … … 972 976 } 973 977 else { 974 result.insert(temp);978 map.insert(temp); 975 979 } 976 980 } 977 978 return result; 979 } 981 } 982 980 983 981 984 void File::getSlab(void* data, const vector<int>& start, … … 1127 1130 return infos; 1128 1131 } 1132 1133 bool File::hasAttr(const std::string & name) 1134 { 1135 this->initAttrDir(); 1136 AttrInfo temp; 1137 while(true) { 1138 temp = this->getNextAttr(); 1139 if (temp.name == NULL_STR) { 1140 break; 1141 } 1142 if (temp.name == name) 1143 return true; 1144 } 1145 return false; 1146 } 1147 1129 1148 1130 1149 NXlink File::getGroupID() { … … 1720 1739 NXDLL_EXPORT void File::putSlab(std::vector<uint64_t>& data, int start, int size); 1721 1740 1741 template 1742 NXDLL_EXPORT void File::putSlab(std::vector<float>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1743 template 1744 NXDLL_EXPORT void File::putSlab(std::vector<double>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1745 template 1746 NXDLL_EXPORT void File::putSlab(std::vector<int8_t>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1747 template 1748 NXDLL_EXPORT void File::putSlab(std::vector<uint8_t>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1749 template 1750 NXDLL_EXPORT void File::putSlab(std::vector<int16_t>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1751 template 1752 NXDLL_EXPORT void File::putSlab(std::vector<uint16_t>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1753 template 1754 NXDLL_EXPORT void File::putSlab(std::vector<int32_t>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1755 template 1756 NXDLL_EXPORT void File::putSlab(std::vector<uint32_t>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1757 template 1758 NXDLL_EXPORT void File::putSlab(std::vector<int64_t>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1759 template 1760 NXDLL_EXPORT void File::putSlab(std::vector<uint64_t>& data, std::vector<int64_t> & start, std::vector<int64_t> & size); 1761 1722 1762 template 1723 1763 NXDLL_EXPORT void File::getAttr(const std::string& name, double& value); -
trunk/bindings/cpp/NeXusFile.hpp
r1711 r1719 673 673 std::map<std::string, std::string> getEntries(); 674 674 675 /** Return the entries available in the current place in the file, 676 * but avoids the map copy of getEntries(). 677 * 678 * \param map The map that will be filled with the entries 679 */ 680 void getEntries(std::map<std::string, std::string> & map); 681 675 682 /** 676 683 * \copydoc NeXus::File::getSlab(void*, const std::vector<int64_t>&, … … 696 703 */ 697 704 std::vector<AttrInfo> getAttrInfos(); 705 706 /** 707 * \return true if the current point in the file has the named attribute 708 * \param name the name of the attribute to look for. 709 */ 710 bool hasAttr(const std::string & name); 698 711 699 712 /**
Note: See TracChangeset
for help on using the changeset viewer.
