- "You got another thing comin'" -- Judas Priest
- Add get_request() method to (Dynamic)SubRequest. - Implement most of ConcreteHistory. It is a fairly complex class, with some real evilness in it. It should be thouroughly documented ASAP. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@699 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
68b92db976
commit
cb8e8dabc7
|
@ -66,10 +66,10 @@ ConcreteEnvironment::ConcreteEnvironment(const ConcreteEnvironment& ce) :
|
|||
|
||||
|
||||
|
||||
const Environment::ConstProcesses
|
||||
const Environment::Processes&
|
||||
ConcreteEnvironment::get_processes() const
|
||||
{
|
||||
return ConstProcesses(_processes.begin(), _processes.end());
|
||||
return _processes;
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,10 +82,10 @@ ConcreteEnvironment::get_processes()
|
|||
|
||||
|
||||
|
||||
const Environment::ConstResources
|
||||
const Environment::Resources&
|
||||
ConcreteEnvironment::get_resources() const
|
||||
{
|
||||
return map<int, const Resource*>(_resources.begin(), _resources.end());
|
||||
return _resources;
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,10 +98,10 @@ ConcreteEnvironment::get_resources()
|
|||
|
||||
|
||||
|
||||
const Environment::ConstRequests
|
||||
const Environment::Requests
|
||||
ConcreteEnvironment::get_request_queue(resource_key_t resource_key) const
|
||||
{
|
||||
ConstRequests request_queue;
|
||||
Requests request_queue;
|
||||
|
||||
typedef Processes::const_iterator it1_t;
|
||||
|
||||
|
@ -126,7 +126,7 @@ ConcreteEnvironment::get_request_queue(resource_key_t resource_key) const
|
|||
const v4_t& subr = (*it3)->get_subrequests();
|
||||
for(it4_t it4 = subr.begin(); it4 != subr.end(); it4++)
|
||||
{
|
||||
if((*it4)->get_resource() == resource_key)
|
||||
if((*it4)->get_resource_key() == resource_key)
|
||||
{
|
||||
request_queue.push_back(*it3);
|
||||
break;
|
||||
|
|
|
@ -47,9 +47,6 @@ namespace sgpem
|
|||
{
|
||||
|
||||
public:
|
||||
typedef std::vector<Process*> Processes;
|
||||
typedef std::map<resource_key_t, Resource*> Resources;
|
||||
|
||||
/// \brief Standard constructor.
|
||||
/// Builds an empty environment.
|
||||
ConcreteEnvironment();
|
||||
|
@ -69,7 +66,7 @@ namespace sgpem
|
|||
/// always safe.
|
||||
///
|
||||
/// \return a constant set of snapshots of processes
|
||||
virtual const ConstProcesses
|
||||
virtual const Processes&
|
||||
get_processes() const;
|
||||
|
||||
|
||||
|
@ -101,7 +98,7 @@ namespace sgpem
|
|||
///
|
||||
/// \return a indexed constant set of snapshot of resources.
|
||||
/// \see DynamicSybrequest::get_resource()
|
||||
virtual const ConstResources
|
||||
virtual const Resources&
|
||||
get_resources() const;
|
||||
|
||||
|
||||
|
@ -126,7 +123,7 @@ namespace sgpem
|
|||
///
|
||||
/// \param resource The resource the requests are for
|
||||
/// \return The current ready requests queue.
|
||||
virtual const ConstRequests
|
||||
virtual const Requests
|
||||
get_request_queue(resource_key_t resource_key) const;
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
|
||||
#include "concrete_history.hh"
|
||||
|
||||
#include "dynamic_process.hh"
|
||||
#include "dynamic_thread.hh"
|
||||
#include "dynamic_resource.hh"
|
||||
#include "dynamic_request.hh"
|
||||
#include "dynamic_sub_request.hh"
|
||||
|
||||
#include "static_process.hh"
|
||||
#include "static_thread.hh"
|
||||
#include "static_resource.hh"
|
||||
|
@ -38,6 +44,40 @@ using namespace sgpem;
|
|||
using namespace std;
|
||||
using memory::smart_ptr;
|
||||
|
||||
|
||||
// ---------------
|
||||
// For all your evil-doers on Earth, this is your punishment!
|
||||
|
||||
template<typename T>
|
||||
static bool deep_remove(std::vector<T*>& v, const T& obj)
|
||||
{
|
||||
typedef typename std::vector<T*> Vector;
|
||||
for(typename Vector::iterator it = v.begin(); it != v.end(); it++)
|
||||
if(**it == obj)
|
||||
{
|
||||
delete *it;
|
||||
v.erase(it);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
static T* deep_find(const std::vector<T*>& v, const T& obj)
|
||||
{
|
||||
typedef typename std::vector<T*> Vector;
|
||||
for(typename Vector::const_iterator it = v.begin(); it != v.end(); it++)
|
||||
if(**it == obj)
|
||||
{
|
||||
return *it;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// -----------------
|
||||
|
||||
ConcreteHistory::ConcreteHistory()
|
||||
: History(), _snapshots()
|
||||
{
|
||||
|
@ -85,23 +125,18 @@ ConcreteHistory::get_environment_at(position index) const
|
|||
void
|
||||
ConcreteHistory::remove(resource_key_t resource_key)
|
||||
{
|
||||
// Pay attention that initial isn't deleted by reset()
|
||||
ConcreteEnvironment& initial = *_snapshots.front();
|
||||
ConcreteEnvironment::Resources& resources = initial.get_resources();
|
||||
ConcreteEnvironment::Resources::iterator found = resources.find(resource_key);
|
||||
if(found == resources.end())
|
||||
{
|
||||
notify_change();
|
||||
return; // not found, just return. Can we do this better (without a reset)?
|
||||
}
|
||||
return;
|
||||
|
||||
reset(false);
|
||||
|
||||
// FIXME: I'm really tired, check that the next two lines do
|
||||
// what they're meant to do!
|
||||
delete found->second;
|
||||
resources.erase(found);
|
||||
|
||||
|
||||
#warning "write me!"
|
||||
// FIXME write me : check for subrequests to remove
|
||||
|
||||
|
@ -110,47 +145,92 @@ ConcreteHistory::remove(resource_key_t resource_key)
|
|||
|
||||
|
||||
void
|
||||
ConcreteHistory::remove(const Process& process)
|
||||
ConcreteHistory::remove(Process& process)
|
||||
{
|
||||
|
||||
reset(false);
|
||||
|
||||
// Pay attention that initial isn't deleted by reset()
|
||||
ConcreteEnvironment& initial = *_snapshots.front();
|
||||
ConcreteEnvironment::Processes& processes = initial.get_processes();
|
||||
ConcreteEnvironment::Processes::iterator found = find(processes.begin(), processes.end(), &process);
|
||||
if(found == processes.end())
|
||||
{
|
||||
notify_change();
|
||||
return; // not found, just return. Can we do this better (without a reset)?
|
||||
}
|
||||
|
||||
// FIXME: I'm really tired, check that the next two lines do
|
||||
// what they're meant to do!
|
||||
delete *found;
|
||||
processes.erase(found);
|
||||
|
||||
notify_change();
|
||||
bool found = deep_remove<Process>(processes, process);
|
||||
if(found)
|
||||
reset(true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConcreteHistory::remove(const Thread& thread)
|
||||
ConcreteHistory::remove(Thread& thread)
|
||||
{
|
||||
#warning "write me!"
|
||||
DynamicThread& dyn_thr = dynamic_cast<DynamicThread&>(thread);
|
||||
|
||||
// Pay attention that initial isn't deleted by reset()
|
||||
ConcreteEnvironment& initial = *_snapshots.front();
|
||||
ConcreteEnvironment::Processes& processes = initial.get_processes();
|
||||
|
||||
Process* found = deep_find<Process>(processes, dyn_thr.get_process());
|
||||
|
||||
if(found == NULL)
|
||||
return; // not found, just return.
|
||||
|
||||
DynamicProcess& dynamic_found = dynamic_cast<DynamicProcess&>(*found);
|
||||
bool removed = deep_remove<DynamicThread>(dynamic_found.get_dynamic_threads(), dyn_thr);
|
||||
|
||||
if(removed)
|
||||
reset(true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConcreteHistory::remove(const Request& request)
|
||||
ConcreteHistory::remove(Request& request)
|
||||
{
|
||||
#warning "write me!"
|
||||
DynamicRequest& dyn_req = dynamic_cast<DynamicRequest&>(request);
|
||||
DynamicThread& dyn_thr = dyn_req.get_thread();
|
||||
DynamicProcess& dyn_proc = dyn_thr.get_process();
|
||||
|
||||
// Pay attention that initial isn't deleted by reset()
|
||||
ConcreteEnvironment& initial = *_snapshots.front();
|
||||
ConcreteEnvironment::Processes& processes = initial.get_processes();
|
||||
|
||||
Process* proc_ref = deep_find<Process>(processes, dyn_proc);
|
||||
DynamicProcess* dyn_proc_ref = dynamic_cast<DynamicProcess*>(proc_ref);
|
||||
if(dyn_proc_ref == NULL)
|
||||
return; // not found, just return.
|
||||
DynamicThread* thr_ref = deep_find<DynamicThread>(dyn_proc_ref->get_dynamic_threads(), dyn_thr);
|
||||
if(thr_ref == NULL)
|
||||
return; // not found, just return.
|
||||
|
||||
bool removed = deep_remove<DynamicRequest>(thr_ref->get_dynamic_requests(), dyn_req);
|
||||
|
||||
if(removed)
|
||||
reset(true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConcreteHistory::remove(const SubRequest& subrequest)
|
||||
ConcreteHistory::remove(SubRequest& subrequest)
|
||||
{
|
||||
#warning "write me!"
|
||||
DynamicSubRequest& dyn_sub = dynamic_cast<DynamicSubRequest&>(subrequest);
|
||||
DynamicRequest& dyn_req = dyn_sub.get_request();
|
||||
DynamicThread& dyn_thr = dyn_req.get_thread();
|
||||
DynamicProcess& dyn_proc = dyn_thr.get_process();
|
||||
|
||||
// Pay attention that initial isn't deleted by reset()
|
||||
ConcreteEnvironment& initial = *_snapshots.front();
|
||||
ConcreteEnvironment::Processes& processes = initial.get_processes();
|
||||
|
||||
Process* proc_ref = deep_find<Process>(processes, dyn_proc);
|
||||
DynamicProcess* dyn_proc_ref = dynamic_cast<DynamicProcess*>(proc_ref);
|
||||
if(dyn_proc_ref == NULL)
|
||||
return; // not found, just return.
|
||||
DynamicThread* thr_ref = deep_find<DynamicThread>(dyn_proc_ref->get_dynamic_threads(), dyn_thr);
|
||||
if(thr_ref == NULL)
|
||||
return; // not found, just return.
|
||||
DynamicRequest* req_ref = deep_find<DynamicRequest>(thr_ref->get_dynamic_requests(), dyn_req);
|
||||
if(req_ref == NULL)
|
||||
return; // not found, just return.
|
||||
|
||||
bool removed = deep_remove<DynamicSubRequest>(req_ref->get_dynamic_subrequests(), dyn_sub);
|
||||
|
||||
if(removed)
|
||||
reset(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,7 +240,17 @@ ConcreteHistory::add_resource(const Glib::ustring& name,
|
|||
size_t places,
|
||||
size_t availability)
|
||||
{
|
||||
#warning "write me!"
|
||||
reset(false);
|
||||
|
||||
// And preemptable and availability?? FIXME!
|
||||
|
||||
StaticResource* core = new StaticResource(name, places);
|
||||
DynamicResource* resource = new DynamicResource(core);
|
||||
|
||||
#warning "write me! insert into map and get iterator in an efficient way."
|
||||
|
||||
notify_change();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,6 +268,7 @@ ConcreteHistory::add_process(const Glib::ustring& name,
|
|||
processes.push_back(proc);
|
||||
|
||||
notify_change();
|
||||
return *proc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -197,6 +288,7 @@ ConcreteHistory::add_thread(const Glib::ustring& name,
|
|||
DynamicThread* thread = new DynamicThread(core, &parent_process);
|
||||
|
||||
notify_change();
|
||||
return *thread;
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,7 +296,18 @@ DynamicRequest&
|
|||
ConcreteHistory::add_request(Thread& owner,
|
||||
time_t instant)
|
||||
{
|
||||
#warning "write me!"
|
||||
reset(false);
|
||||
|
||||
DynamicThread& dyn_owner = dynamic_cast<DynamicThread&>(owner);
|
||||
StaticThread& owner_core = dyn_owner.get_core();
|
||||
|
||||
StaticRequest* core = new StaticRequest(&owner_core, instant);
|
||||
DynamicRequest* req = new DynamicRequest(core, &dyn_owner);
|
||||
|
||||
dyn_owner.get_requests().push_back(req);
|
||||
|
||||
notify_change();
|
||||
return *req;
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,25 +317,30 @@ ConcreteHistory::add_subrequest(Request& request,
|
|||
time_t duration,
|
||||
size_t places)
|
||||
{
|
||||
#warning "write me!"
|
||||
reset(false);
|
||||
|
||||
DynamicRequest& dyn_request = dynamic_cast<DynamicRequest&>(request);
|
||||
StaticRequest& request_core = dyn_request.get_core();
|
||||
|
||||
StaticSubRequest* core = new StaticSubRequest(&request_core, resource_key, duration, places);
|
||||
DynamicSubRequest* subreq = new DynamicSubRequest(core, &dyn_request);
|
||||
|
||||
dyn_request.get_subrequests().push_back(subreq);
|
||||
|
||||
notify_change();
|
||||
return *subreq;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ConcreteHistory::reset(bool notify)
|
||||
{
|
||||
assert(_snapshots.size() > 0);
|
||||
Snapshots::iterator it = _snapshots.begin();
|
||||
ConcreteEnvironment* model = *it;
|
||||
|
||||
it++; // Skip first environment that we saved
|
||||
|
||||
for_each(it, _snapshots.end(), ptr_fun(operator delete));
|
||||
_snapshots.clear();
|
||||
_snapshots.push_back(new ConcreteEnvironment());
|
||||
|
||||
// FIXME write code to copy processes and threads and subrequests......
|
||||
#warning "write me!"
|
||||
|
||||
delete model;
|
||||
_snapshots.resize(1); // Truncate to keep only our "model"
|
||||
|
||||
if(notify)
|
||||
notify_change();
|
||||
|
|
|
@ -57,10 +57,10 @@ namespace sgpem
|
|||
virtual const ConcreteEnvironment& get_environment_at(position index) const throw(std::out_of_range);
|
||||
|
||||
virtual void remove(resource_key_t resource_key);
|
||||
virtual void remove(const Process& process);
|
||||
virtual void remove(const Thread& thread);
|
||||
virtual void remove(const Request& request);
|
||||
virtual void remove(const SubRequest& subrequest);
|
||||
virtual void remove(Process& process);
|
||||
virtual void remove(Thread& thread);
|
||||
virtual void remove(Request& request);
|
||||
virtual void remove(SubRequest& subrequest);
|
||||
|
||||
|
||||
virtual ResourcePair& add_resource(const Glib::ustring& name,
|
||||
|
|
|
@ -45,10 +45,6 @@ DynamicRequest::DynamicRequest(StaticRequest *core,
|
|||
|
||||
DynamicRequest::~DynamicRequest()
|
||||
{
|
||||
typedef std::vector<DynamicRequest*> Requests;
|
||||
Requests& siblings = _dynamic_thread->get_dynamic_requests();
|
||||
siblings.erase(find(siblings.begin(), siblings.end(), this));
|
||||
|
||||
for_each(_dynamic_subrequests.begin(), _dynamic_subrequests.end(), ptr_fun(operator delete));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,8 @@
|
|||
using namespace sgpem;
|
||||
|
||||
DynamicSubRequest::DynamicSubRequest(StaticSubRequest* core,
|
||||
DynamicRequest* owner,
|
||||
resource_key_t key) :
|
||||
_static_subrequest(core), _owner(owner), _resource_key(key),
|
||||
DynamicRequest* owner) :
|
||||
_static_subrequest(core), _owner(owner),
|
||||
_queue_position(-1)
|
||||
{
|
||||
assert(core != NULL);
|
||||
|
@ -41,9 +40,6 @@ DynamicSubRequest::DynamicSubRequest(StaticSubRequest* core,
|
|||
|
||||
DynamicSubRequest::~DynamicSubRequest()
|
||||
{
|
||||
typedef std::vector<DynamicSubRequest*> SubRequests;
|
||||
SubRequests& siblings = _owner->get_dynamic_subrequests();
|
||||
siblings.erase(find(siblings.begin(), siblings.end(), this));
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,7 +54,7 @@ DynamicSubRequest::operator==(const SubRequest& op2) const
|
|||
SubRequest::resource_key_t
|
||||
DynamicSubRequest::get_resource_key() const
|
||||
{
|
||||
return _resource_key;
|
||||
return _static_subrequest->get_resource_key();
|
||||
}
|
||||
|
||||
unsigned int
|
||||
|
@ -85,6 +81,14 @@ DynamicSubRequest::set_queue_position(int position)
|
|||
_queue_position = position;
|
||||
}
|
||||
|
||||
|
||||
DynamicRequest&
|
||||
DynamicSubRequest::get_request()
|
||||
{
|
||||
return *_owner;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DynamicSubRequest::serialize(SerializeVisitor& translator) const
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "sub_request.hh"
|
||||
#include "dynamic_request.hh"
|
||||
#include "dynamic_resource.hh"
|
||||
#include "static_sub_request.hh"
|
||||
|
||||
|
@ -31,7 +32,6 @@
|
|||
namespace sgpem
|
||||
{
|
||||
class DynamicSubRequest;
|
||||
class DynamicRequest;
|
||||
class SerializeVisitor;
|
||||
class Resource;
|
||||
class StaticSubRequest;
|
||||
|
@ -40,8 +40,7 @@ namespace sgpem
|
|||
{
|
||||
public:
|
||||
DynamicSubRequest(StaticSubRequest* core,
|
||||
DynamicRequest* owner,
|
||||
resource_key_t resource);
|
||||
DynamicRequest* owner);
|
||||
|
||||
virtual ~DynamicSubRequest();
|
||||
|
||||
|
@ -56,6 +55,8 @@ namespace sgpem
|
|||
int get_queue_position() const;
|
||||
void set_queue_position(int position);
|
||||
|
||||
virtual DynamicRequest& get_request();
|
||||
|
||||
void serialize(SerializeVisitor& translator) const;
|
||||
|
||||
StaticSubRequest& get_core();
|
||||
|
@ -64,11 +65,9 @@ namespace sgpem
|
|||
private:
|
||||
memory::smart_ptr<StaticSubRequest> _static_subrequest;
|
||||
DynamicRequest* _owner;
|
||||
resource_key_t _resource_key;
|
||||
int _queue_position;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -54,10 +54,6 @@ DynamicThread::DynamicThread(const DynamicThread &other) :
|
|||
|
||||
DynamicThread::~DynamicThread()
|
||||
{
|
||||
typedef std::vector<DynamicThread*> Threads;
|
||||
Threads& siblings = _parent->get_dynamic_threads();
|
||||
siblings.erase(find(siblings.begin(), siblings.end(), this));
|
||||
|
||||
for_each(_dynamic_requests.begin(), _dynamic_requests.end(), ptr_fun(operator delete));
|
||||
}
|
||||
|
||||
|
|
|
@ -60,9 +60,9 @@ namespace sgpem
|
|||
public:
|
||||
typedef SubRequest::resource_key_t resource_key_t;
|
||||
|
||||
typedef std::vector<const Process*> ConstProcesses;
|
||||
typedef std::map<resource_key_t, const Resource*> ConstResources;
|
||||
typedef std::vector<const Request*> ConstRequests;
|
||||
typedef std::vector<Process*> Processes;
|
||||
typedef std::map<resource_key_t, Resource*> Resources;
|
||||
typedef std::vector<Request*> Requests;
|
||||
|
||||
/// \brief Returns an indexed set of snapshots of the processes
|
||||
/// Returns a standard vector of Process objects describing
|
||||
|
@ -71,7 +71,7 @@ namespace sgpem
|
|||
///
|
||||
/// \return a constant set of snapshots of processes
|
||||
|
||||
virtual const ConstProcesses
|
||||
virtual const Processes&
|
||||
get_processes() const = 0;
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ namespace sgpem
|
|||
///
|
||||
/// \return an indexed constant set of snapshot of resources.
|
||||
|
||||
virtual const ConstResources
|
||||
virtual const Resources&
|
||||
get_resources() const = 0;
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ namespace sgpem
|
|||
/// \param resource the resource the requests are for
|
||||
/// \return the current ready requests queue (constant).
|
||||
|
||||
virtual const ConstRequests
|
||||
virtual const Requests
|
||||
get_request_queue(resource_key_t resource_key) const = 0;
|
||||
|
||||
|
||||
|
|
|
@ -71,10 +71,10 @@ namespace sgpem
|
|||
virtual const Environment& get_environment_at() const throw(std::out_of_range) = 0;
|
||||
|
||||
virtual void remove(resource_key_t resource_key) = 0;
|
||||
virtual void remove(const Process& process) = 0;
|
||||
virtual void remove(const Thread& thread) = 0;
|
||||
virtual void remove(const Request& request) = 0;
|
||||
virtual void remove(const SubRequest& subrequest) = 0;
|
||||
virtual void remove(Process& process) = 0;
|
||||
virtual void remove(Thread& thread) = 0;
|
||||
virtual void remove(Request& request) = 0;
|
||||
virtual void remove(SubRequest& subrequest) = 0;
|
||||
|
||||
|
||||
virtual ResourcePair& add_resource(const Glib::ustring& name,
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
using namespace sgpem;
|
||||
|
||||
StaticSubRequest::StaticSubRequest(StaticRequest* req,
|
||||
StaticResource* resource,
|
||||
resource_key_t resource_key,
|
||||
unsigned int length,
|
||||
unsigned int places) :
|
||||
_static_request(req), _static_resource(resource),
|
||||
_static_request(req), _resource_key(resource_key),
|
||||
_length(length), _places(places)
|
||||
{
|
||||
assert(req != NULL && resource != NULL);
|
||||
|
@ -42,13 +42,13 @@ StaticSubRequest::~StaticSubRequest()
|
|||
{
|
||||
typedef std::vector<StaticSubRequest*> SubRequests;
|
||||
SubRequests siblings& = _static_request.get_subrequests();
|
||||
siblings.erase(find(siblings.begin(), siblings.end(), this);
|
||||
siblings.erase(find(siblings.begin(), siblings.end(), this));
|
||||
}
|
||||
|
||||
StaticResource&
|
||||
StaticSubRequest::get_static_resource()
|
||||
SubRequest::get_resource_key
|
||||
StaticSubRequest::get_resource_key() const
|
||||
{
|
||||
return *_static_resource;
|
||||
return _resource_key;
|
||||
}
|
||||
|
||||
StaticRequest&
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "sub_request.hh"
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
class StaticSubRequest;
|
||||
|
@ -32,16 +34,18 @@ namespace sgpem
|
|||
class SG_DLLLOCAL StaticSubRequest
|
||||
{
|
||||
public:
|
||||
typedef SubRequest::resource_key_t resource_key_t;
|
||||
|
||||
StaticSubRequest(StaticRequest* req,
|
||||
StaticResource* resource,
|
||||
resource_key_t resource_key,
|
||||
unsigned int length,
|
||||
unsigned int places = 1);
|
||||
|
||||
virtual ~StaticSubRequest();
|
||||
|
||||
StaticResource& get_static_resource();
|
||||
resource_key_t get_resource_key() const;
|
||||
|
||||
StaticRequest& get_static_request();
|
||||
StaticRequest& get_request();
|
||||
|
||||
unsigned int get_places() const;
|
||||
|
||||
|
@ -49,9 +53,10 @@ namespace sgpem
|
|||
|
||||
private:
|
||||
StaticSubRequest(const StaticSubRequest&);
|
||||
StaticSubRequest& operator=(const StaticSubRequest&);
|
||||
|
||||
StaticRequest* _static_request;
|
||||
StaticResource* _static_resource;
|
||||
resource_key_t _resource_key;
|
||||
unsigned int _length;
|
||||
unsigned int _places;
|
||||
};
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace sgpem
|
|||
{
|
||||
class SubRequest;
|
||||
class SerializeVisitor;
|
||||
class Request;
|
||||
class Resource;
|
||||
|
||||
class SG_DLLEXPORT SubRequest
|
||||
|
@ -38,7 +39,7 @@ namespace sgpem
|
|||
|
||||
virtual bool operator==(const SubRequest& op2) const = 0;
|
||||
|
||||
virtual resource_key_t get_resource() = 0;
|
||||
virtual resource_key_t get_resource_key() const = 0;
|
||||
|
||||
virtual unsigned int get_places() const = 0;
|
||||
|
||||
|
@ -46,6 +47,8 @@ namespace sgpem
|
|||
|
||||
virtual int get_queue_position() const = 0;
|
||||
|
||||
virtual Request& get_request() = 0;
|
||||
|
||||
virtual void serialize(SerializeVisitor& translator) const = 0;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue