28 #if ! defined (octave_url_handle_manager)
29 #define octave_url_handle_manager 1
31 #include "octave-config.h"
52 : m_handle_map (), m_handle_free_list (),
53 m_next_handle (-1.0 - (
rand () + 1.0) / (RAND_MAX + 2.0)) { }
65 iterator p = (
math::isnan (val) ? m_handle_map.end ()
66 : m_handle_map.find (val));
68 return (p != m_handle_map.end ()) ? p->first :
url_handle ();
79 return get_object (
lookup (val));
84 return get_object (
lookup (val));
89 iterator p = (h.
ok () ? m_handle_map.find (h) : m_handle_map.end ());
91 return (p != m_handle_map.end ()) ? p->second :
url_transfer ();
95 const std::string& user,
96 const std::string& passwd,
104 error (
"support for URL transfers was disabled when Octave was built");
106 m_handle_map[h] = obj;
113 Matrix retval (1, m_handle_map.size ());
116 for (
const auto& h_obj : m_handle_map)
120 retval(i++) = h.
value ();
129 typedef std::map<url_handle, url_transfer>::iterator iterator;
130 typedef std::map<url_handle, url_transfer>::const_iterator const_iterator;
132 typedef std::set<url_handle>::iterator free_list_iterator;
133 typedef std::set<url_handle>::const_iterator const_free_list_iterator;
136 std::map<url_handle, url_transfer> m_handle_map;
139 std::set<url_handle> m_handle_free_list;
142 double m_next_handle;
145 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type lookup(const T *x, octave_idx_type n, T y)
bool is_real_scalar() const
double double_value(bool frc_str_conv=false) const
url_handle lookup(const octave_value &val)
url_handle make_url_handle(const std::string &host, const std::string &user, const std::string &passwd, std::ostream &os)
url_handle lookup(double val)
url_transfer get_object(double val)
url_transfer get_object(const url_handle &h)
~url_handle_manager()=default
url_transfer get_object(const octave_value &val)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void() error(const char *fmt,...)