- Mega-update. Take it while it's hot... but my brain's frying!
- Fixed all Dynamic and Static entities lacking proper destructors: Dynamic entities need to delete Dynamic children, Static entities need only to delete them from the list of their siblings - Added methods to get Static "core" from Dynamic*. - Now get_core() is a pure virtual function into DynamicSchedulable. A quite nice solution(?), really, if I can say that myself... ;-) - ConcreteHistory is half-implemented. It's the other half that worries me. - TODO: finish off ConcreteHistory, and check that things get destroyed properly (no leaks allowed, use valgrind). - TODO: rework Simulation - TODO: Scheduler rewrite - *A side note*: this code is becoming a mess. I prefer references over pointers, but someone other prefer pointers over references, and what happens is that you've to continously pass from one to another when invoking other methods... this is bad. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@694 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
787d24964b
commit
7d62f4b937
25 changed files with 564 additions and 321 deletions
|
@ -19,20 +19,34 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "dynamic_sub_request.hh"
|
||||
#include "dynamic_request.hh"
|
||||
|
||||
#include "smartp.tcc"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
using namespace sgpem;
|
||||
|
||||
DynamicSubRequest::DynamicSubRequest(StaticSubRequest* core, resource_key_t key) :
|
||||
_static_subrequest(core), _resource_key(key),
|
||||
DynamicSubRequest::DynamicSubRequest(StaticSubRequest* core,
|
||||
DynamicRequest* owner,
|
||||
resource_key_t key) :
|
||||
_static_subrequest(core), _owner(owner), _resource_key(key),
|
||||
_queue_position(-1)
|
||||
{
|
||||
assert(core != NULL);
|
||||
owner->get_subrequests().push_back(this);
|
||||
}
|
||||
|
||||
|
||||
DynamicSubRequest::~DynamicSubRequest()
|
||||
{
|
||||
typedef std::vector<DynamicSubRequest*> SubRequests;
|
||||
SubRequests& siblings = _owner->get_dynamic_subrequests();
|
||||
siblings.erase(find(siblings.begin(), siblings.end(), this));
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DynamicSubRequest::operator==(const SubRequest& op2) const
|
||||
{
|
||||
|
@ -77,3 +91,16 @@ DynamicSubRequest::serialize(SerializeVisitor& translator) const
|
|||
//blah blah blah TODO
|
||||
}
|
||||
|
||||
|
||||
StaticSubRequest&
|
||||
DynamicSubRequest::get_core()
|
||||
{
|
||||
return *_static_subrequest;
|
||||
}
|
||||
|
||||
|
||||
const StaticSubRequest&
|
||||
DynamicSubRequest::get_core() const
|
||||
{
|
||||
return *_static_subrequest;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue