map -> vector optimization with custom waves

more comment updates

git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@551 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
w1z7ard
2007-10-09 01:03:14 +00:00
parent 9049178e8d
commit 3dc6d8df21
4 changed files with 10 additions and 10 deletions

View File

@ -477,8 +477,8 @@ CustomWave::~CustomWave()
{
for (std::map<int, PerPointEqn*>::iterator pos = per_point_eqn_tree.begin(); pos != per_point_eqn_tree.end(); ++pos)
delete(pos->second);
for (std::vector<PerPointEqn*>::iterator pos = per_point_eqn_tree.begin(); pos != per_point_eqn_tree.end(); ++pos)
delete(*pos);
for (std::map<int, PerFrameEqn*>::iterator pos = per_frame_eqn_tree.begin(); pos != per_frame_eqn_tree.end(); ++pos)
delete(pos->second);
@ -543,7 +543,7 @@ int CustomWave::add_per_point_eqn(char * name, GenExpr * gen_expr)
/* Insert the per pixel equation into the preset per pixel database */
per_point_eqn_tree.insert(std::make_pair(per_point_eqn->index, per_point_eqn));
per_point_eqn_tree.push_back(per_point_eqn);
/* Done */
return PROJECTM_SUCCESS;
@ -591,8 +591,8 @@ void CustomWave::evalPerPointEqns()
/* Evaluate per pixel equations */
for (k = 0; k < samples;k++)
for (std::map<int, PerPointEqn*>::iterator pos = per_point_eqn_tree.begin(); pos != per_point_eqn_tree.end();++pos) {
pos->second->evaluate(k);
for (std::vector<PerPointEqn*>::iterator pos = per_point_eqn_tree.begin(); pos != per_point_eqn_tree.end();++pos) {
(*pos)->evaluate(k);
}
}

View File

@ -36,6 +36,8 @@ class GenExpr;
class PerPointEqn;
class Preset;
#include <vector>
#include "Common.hpp"
#include "Param.hpp"
#include "PerFrameEqn.hpp"
@ -116,7 +118,7 @@ public:
/* Data structures to hold per frame and per point equations */
std::map<std::string,InitCond*> init_cond_tree;
std::map<int, PerFrameEqn*> per_frame_eqn_tree;
std::map<int, PerPointEqn*> per_point_eqn_tree;
std::vector<PerPointEqn*> per_point_eqn_tree;
std::map<std::string,InitCond*> per_frame_init_eqn_tree;
/* Denotes the index of the last character for each string buffer */

View File

@ -59,15 +59,13 @@ public:
/// Load a preset by filename with input and output buffers specified.
/// This is the only proper way to allocate a new preset.
/// \param absoluteFilePath the absolute file path of a preset to load from the file system
/// \param presetName a descriptive name for the preset. Usually just the file name
/// \param presetInputs a const reference to read only projectM engine variables
/// \param presetOutputs initialized and filled with data parsed from a preset
Preset(const std::string & absoluteFilePath, const std::string & presetName, const PresetInputs & presetInputs, PresetOutputs & presetOutputs);
/// Load a preset from a stream with input and output buffers specified.
/// This is the only proper way to allocate a new preset.
/// Load a preset from an input stream with input and output buffers specified.
/// \param in an already initialized input stream to read the preset file from
/// \param presetName a descriptive name for the preset. Usually just the file name
/// \param presetInputs a const reference to read only projectM engine variables

View File

@ -42,7 +42,7 @@ public:
/// Allocate a new preset given this iterator's associated preset name
/// \param presetInputs the preset inputs to associate with the preset upon construction
/// \param presetOutputs the preset outputs to associate with the preset upon construction
/// \returns a pointer of the newly allocated preset
/// \returns an autopointer of the newly allocated preset
std::auto_ptr<Preset> allocate(const PresetInputs & presetInputs, PresetOutputs & presetOutputs);
/// Set the chooser asocciated with this iterator