MCPcopy Create free account
hub / github.com/dmlc/dmlc-core / SetDefault

Method SetDefault

include/dmlc/parameter.h:654–663  ·  view source on GitHub ↗

implement set head to default value

Source from the content-addressed store, hash-verified

652 }
653 // implement set head to default value
654 void SetDefault(void *head) const override {
655 if (!has_default_) {
656 std::ostringstream os;
657 os << "Required parameter " << key_
658 << " of " << type_ << " is not presented";
659 throw dmlc::ParamError(os.str());
660 } else {
661 this->Get(head) = default_value_;
662 }
663 }
664 // return reference of self as derived type
665 inline TEntry &self() {
666 return *(static_cast<TEntry*>(this));

Callers 1

RunInitMethod · 0.80

Calls 3

ParamErrorClass · 0.85
strMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected