implement set value
| 607 | typedef TEntry EntryType; |
| 608 | // implement set value |
| 609 | void Set(void *head, const std::string &value) const override { |
| 610 | std::istringstream is(value); |
| 611 | is >> this->Get(head); |
| 612 | if (!is.fail()) { |
| 613 | while (!is.eof()) { |
| 614 | int ch = is.get(); |
| 615 | if (ch == EOF) { |
| 616 | is.clear(); break; |
| 617 | } |
| 618 | if (!isspace(ch)) { |
| 619 | is.setstate(std::ios::failbit); break; |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | if (is.fail()) { |
| 625 | std::ostringstream os; |
| 626 | os << "Invalid Parameter format for " << key_ |
| 627 | << " expect " << type_ << " but value=\'" << value<< '\''; |
| 628 | throw dmlc::ParamError(os.str()); |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | std::string GetStringValue(void *head) const override { |
| 633 | std::ostringstream os; |