00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CJNS_R_
00021 #define _CJNS_R_ 1
00022
00023 #include "CjNodeSelector.hh"
00024 #include <string>
00025 #include "JLOG.hh"
00026
00027 namespace jmitie {
00028 namespace corelib {
00029 class CjNS_R: public CjNodeSelector {
00030 public:
00031 static std::string getName_static() { return "R"; }
00032 virtual std::string getName() const { return getName_static(); }
00033 std::string getProperty(const std::string & prop) const { return getProperty_static(prop); }
00034 static std::string getProperty_static(const std::string & opt) {
00035 if(opt=="desc") return "Select a node based at random with a uniform porbability.";
00036 if(opt=="usage") return getProperty_static("desc") + "\n" \
00037 "[dupe_ok]\tIf specified, and if this is the second selector in a process, the selector may return a node which is already connected to this node.\n";
00038 throw std::invalid_argument("CjNS_R::getProperty_static(" + opt + "): Unknown property requested.");
00039 }
00040
00041 CjNS_R(std::string args, const ctor_va_t & );
00042 virtual bool selectNode( select_arg_t &, unsigned int & node );
00043 virtual ~CjNS_R() { JLOG(5, std::cout << "CjNS_R being destroyed." << std::endl; ) };
00044
00045 protected:
00046 bool m_dupe_link_ok;
00047
00048 };
00049 }
00050 }
00051
00052 #endif // _CJNS_R_