* Replaced DownloadFactory's m_variables with a torrent::Object map.

* Starting work on moving the download commands to the new command
framework.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@901 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-05-16 14:39:03 +00:00
parent 032bae7030
commit 9fe72cb3b5
11 changed files with 414 additions and 56 deletions
+14 -10
View File
@@ -42,19 +42,23 @@
namespace utils {
class CommandSlot;
class CommandVariable;
class CommandDownloadSlot;
}
// By using a static array we avoid allocating the variables on the
// heap. This should reduce memory use and improve cache locality.
#define COMMAND_SLOTS_SIZE 100
#define COMMAND_VARIABLES_SIZE 100
#define COMMAND_SLOTS_SIZE 100
#define COMMAND_VARIABLES_SIZE 100
#define COMMAND_DOWNLOAD_SLOTS_SIZE 50
#define ADDING_COMMANDS
extern utils::CommandSlot commandSlots[COMMAND_SLOTS_SIZE];
extern utils::CommandSlot* commandSlotsItr;
extern utils::CommandVariable commandVariables[COMMAND_VARIABLES_SIZE];
extern utils::CommandVariable* commandVariablesItr;
extern utils::CommandSlot commandSlots[COMMAND_SLOTS_SIZE];
extern utils::CommandSlot* commandSlotsItr;
extern utils::CommandVariable commandVariables[COMMAND_VARIABLES_SIZE];
extern utils::CommandVariable* commandVariablesItr;
extern utils::CommandDownloadSlot commandDownloadSlots[COMMAND_DOWNLOAD_SLOTS_SIZE];
extern utils::CommandDownloadSlot* commandDownloadSlotsItr;
void initialize_commands();
@@ -74,17 +78,17 @@ add_variable("get_" key, "set_" key, key, &utils::CommandVariable::get_string, &
#define ADD_COMMAND_SLOT(key, function, slot, parm, doc) \
commandSlotsItr->set_slot(slot); \
variables->insert(key, commandSlotsItr++, &utils::CommandSlot::function, utils::VariableMap::flag_dont_delete | utils::VariableMap::flag_public_xmlrpc, parm, doc);
variables->insert(key, commandSlotsItr++, &utils::CommandSlot::function, NULL, utils::VariableMap::flag_dont_delete | utils::VariableMap::flag_public_xmlrpc, parm, doc);
#define ADD_COMMAND_SLOT_PRIVATE(key, function, slot) \
commandSlotsItr->set_slot(slot); \
variables->insert(key, commandSlotsItr++, &utils::CommandSlot::function, utils::VariableMap::flag_dont_delete);
variables->insert(key, commandSlotsItr++, &utils::CommandSlot::function, NULL, utils::VariableMap::flag_dont_delete);
#define ADD_COMMAND_COPY(key, function, parm, doc) \
variables->insert(key, (commandSlotsItr - 1), &utils::CommandSlot::function, utils::VariableMap::flag_dont_delete | utils::VariableMap::flag_public_xmlrpc, parm, doc);
variables->insert(key, (commandSlotsItr - 1), &utils::CommandSlot::function, NULL, utils::VariableMap::flag_dont_delete | utils::VariableMap::flag_public_xmlrpc, parm, doc);
#define ADD_COMMAND_COPY_PRIVATE(key, function) \
variables->insert(key, (commandSlotsItr - 1), &utils::CommandSlot::function, utils::VariableMap::flag_dont_delete);
variables->insert(key, (commandSlotsItr - 1), &utils::CommandSlot::function, NULL, utils::VariableMap::flag_dont_delete);
#define ADD_COMMAND_VALUE_TRI(key, set, get) \
ADD_COMMAND_SLOT_PRIVATE(key, call_value, utils::object_value_fn(set)) \