/** Get the help entry for this class */ RevBayesCore::RbHelpMove* Move::getHelpEntry( void ) const { // create the help function entry that we will fill with some values RevBayesCore::RbHelpMove *help = new RevBayesCore::RbHelpMove(); RevBayesCore::RbHelpMove &helpEntry = *help; // name helpEntry.setName( getConstructorFunctionName() ); // aliases std::vector<std::string> aliases = getConstructorFunctionAliases(); helpEntry.setAliases( aliases ); // title helpEntry.setTitle( getHelpTitle() ); // description helpEntry.setDescription( getHelpDescription() ); // create the constructor RevBayesCore::RbHelpFunction help_constructor = RevBayesCore::RbHelpFunction(); // usage help_constructor.setUsage( getConstructorUsage() ); // arguments const MemberRules& rules = getParameterRules(); std::vector<RevBayesCore::RbHelpArgument> arguments = std::vector<RevBayesCore::RbHelpArgument>(); for ( size_t i=0; i<rules.size(); ++i ) { const ArgumentRule &the_rule = rules[i]; RevBayesCore::RbHelpArgument argument = RevBayesCore::RbHelpArgument(); argument.setLabel( the_rule.getArgumentLabel() ); argument.setDescription( the_rule.getArgumentDescription() ); std::string type = "<any>"; if ( the_rule.getArgumentDagNodeType() == ArgumentRule::CONSTANT ) { type = "<constant>"; } else if ( the_rule.getArgumentDagNodeType() == ArgumentRule::STOCHASTIC ) { type = "<stochastic>"; } else if ( the_rule.getArgumentDagNodeType() == ArgumentRule::DETERMINISTIC ) { type = "<deterministic>"; } argument.setArgumentDagNodeType( type ); std::string passing_method = "value"; if ( the_rule.getEvaluationType() == ArgumentRule::BY_CONSTANT_REFERENCE ) { passing_method = "const reference"; } else if ( the_rule.getEvaluationType() == ArgumentRule::BY_REFERENCE ) { passing_method = "reference"; } argument.setArgumentPassingMethod( passing_method ); argument.setValueType( the_rule.getArgumentTypeSpec()[0].getType() ); if ( the_rule.hasDefault() ) { std::stringstream ss; the_rule.getDefaultVariable().getRevObject().printValue( ss, true); argument.setDefaultValue( ss.str() ); } else { argument.setDefaultValue( "" ); } // loop options std::vector<std::string> options = std::vector<std::string>(); const OptionRule *opt_rule = dynamic_cast<const OptionRule*>( &the_rule ); if ( opt_rule != NULL ) { options = opt_rule->getOptions(); } argument.setOptions( options ); // add the argument to the argument list arguments.push_back( argument ); } help_constructor.setArguments( arguments ); // return value help_constructor.setReturnType( getClassType() ); // details help_constructor.setDetails( getConstructorDetails() ); // example help_constructor.setExample( getConstructorExample() ); // std::vector<RevBayesCore::RbHelpFunction> constructors; constructors.push_back( help_constructor ); helpEntry.setConstructors( constructors ); helpEntry.setMethods( getHelpMethods() ); helpEntry.setReferences( getHelpReferences() ); // author helpEntry.setAuthor( getHelpAuthor() ); // see also helpEntry.setSeeAlso( getHelpSeeAlso() ); return help; }
/** * Get the help entry for this class */ void Function::addSpecificHelpFields(RevBayesCore::RbHelpEntry *e) const { // create the help function entry that we will fill with some values RevBayesCore::RbHelpFunction *help = static_cast<RevBayesCore::RbHelpFunction*>( e ); RevBayesCore::RbHelpFunction &helpEntry = *help; // usage helpEntry.setUsage( getHelpUsage() ); // arguments const MemberRules& rules = getArgumentRules(); std::vector<RevBayesCore::RbHelpArgument> arguments = std::vector<RevBayesCore::RbHelpArgument>(); for ( size_t i=0; i<rules.size(); ++i ) { const ArgumentRule &the_rule = rules[i]; RevBayesCore::RbHelpArgument argument = RevBayesCore::RbHelpArgument(); argument.setLabel( the_rule.getArgumentLabel() ); argument.setDescription( the_rule.getArgumentDescription() ); std::string type = "<any>"; if ( the_rule.getArgumentDagNodeType() == ArgumentRule::CONSTANT ) { type = "<constant>"; } else if ( the_rule.getArgumentDagNodeType() == ArgumentRule::STOCHASTIC ) { type = "<stochastic>"; } else if ( the_rule.getArgumentDagNodeType() == ArgumentRule::DETERMINISTIC ) { type = "<deterministic>"; } argument.setArgumentDagNodeType( type ); std::string passing_method = "pass by value"; if ( the_rule.getEvaluationType() == ArgumentRule::BY_CONSTANT_REFERENCE ) { passing_method = "pass by const reference"; } else if ( the_rule.getEvaluationType() == ArgumentRule::BY_REFERENCE ) { passing_method = "pass by reference"; } argument.setArgumentPassingMethod( passing_method ); argument.setValueType( the_rule.getArgumentTypeSpec()[0].getType() ); if ( the_rule.hasDefault() ) { std::stringstream ss; the_rule.getDefaultVariable().getRevObject().printValue( ss, true); argument.setDefaultValue( ss.str() ); } else { argument.setDefaultValue( "" ); } // loop options std::vector<std::string> options = std::vector<std::string>(); const OptionRule *opt_rule = dynamic_cast<const OptionRule*>( &the_rule ); if ( opt_rule != NULL ) { options = opt_rule->getOptions(); } argument.setOptions( options ); // add the argument to the argument list arguments.push_back( argument ); } helpEntry.setArguments( arguments ); // return value helpEntry.setReturnType( getReturnType().getType() ); // details helpEntry.setDetails( getHelpDetails() ); // example helpEntry.setExample( getHelpExample() ); }