00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _CJNS_RPN_
00021 #define _CJNS_RPN_ 1
00022
00023 #include "CjNodeSelector.hh"
00024 #include <string>
00025 #include "JLOG.hh"
00026
00027 namespace jmitie {
00028 namespace corelib {
00029 class CjNS_RPN: public CjNodeSelector {
00030 public:
00031 static std::string getName_static() { return "RPN"; }
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 preferring nodes with a higher number of routes that ingress and egress the node. Can also consider transit only routes.";
00036 if(opt=="usage") return getProperty_static("desc") + "\n" \
00037 "[transit]\tInstead of considering all routes at the interfaces of each node, only consider routes that transit the node (2*N fewer than if were considered)"\
00038 "[ave]\tSpecifies whether the number of routes is to be divided by the out-degree.\n"\
00039 "[exp=float]\tIf specified the [average] number of routes is taken to this exponent before being placed in selection wheel.\n"\
00040 "[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";
00041 throw std::invalid_argument("CjNS_RPN::getProperty_static(" + opt + "): Unknown property requested.");
00042 }
00043
00044 CjNS_RPN(std::string args, const ctor_va_t &);
00045 virtual bool selectNode( select_arg_t &, unsigned int & node );
00046 virtual ~CjNS_RPN() { JLOG(5, std::cout << "CjNS_RPN being destroyed." << std::endl; ) };
00047
00048 protected:
00049 bool m_transit;
00050 bool m_average;
00051 bool m_dupe_link_ok;
00052 double m_exp;
00053 bool m_exp_set;
00054
00055 };
00056 }
00057 }
00058
00059 #endif // _CJNS_RPN_