Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

IDEA::PlasmaReactivePlannerImpl Class Reference

#include <PlasmaReactivePlannerImpl.hh>

Inheritance diagram for IDEA::PlasmaReactivePlannerImpl:

IDEA::ReactivePlannerImpl IDEA::DefaultReactor IDEA::Reactor IDEA::MessageObserver List of all members.

Public Methods

 PlasmaReactivePlannerImpl (const std::string &name, const PslDatabase *database, const AgentTimingService *ats, const std::string &heuristicFile, bool readHeuristicsFile, const std::string &noBranchFile, bool readNoBranchFile)
 Constructor.

 ~PlasmaReactivePlannerImpl ()
 Destructor.

const FreeStrategygetFreeStrategy () const
 Returns the strategy to use when we free a token.

void addRevocableAuthority (int authority)
 Adds authority to the set of authorities of constraints which the invoking planner can revoke.

bool isRevocable (int authority) const
 Returns true if the invoking planner can revoke constraints with authority authority.

int getAuthority ()
 Returns the authority of the planner of the invoking reactive planner.

void setFreeGoalTokens ()
 Invoking this method will enable the freeing of goal-tokens in case of a recovery.

void stopReacting ()
 Stops the reactive planner as soon as possible if it is reacting.

virtual StatusType startReacting (const Time &time)
 Starts a reactive planner cycle for tick time.

void setForgettingThePast (bool value)
const PslDatabasegetDatabase () const
const AgentTimingServicegetAgentTimingService () const
const std::string & getName () const
 Returns the name of the invoking observer.

bool hasPendingMessages ()
 Returns true if the invoking observer has pending messages in the queue.

int getNrOfPendingMessages ()
 Returns the number of pending messages in the queue.

UpdatePolicysetUpdatePolicy (UpdatePolicy *policy, bool deleteInst=false)
 Sets the update-policy to policy and will delete the old one if it was constructed by the constructor of the invoking observer or if it was set with deleteInst true.

UpdatePolicygetUpdatePolicy () const
 Returns the current UpdatePolicy of the invoking observer.

AcceptorPolicysetAcceptorPolicy (AcceptorPolicy *policy, bool deleteInst=false)
 Sets the acceptor-policy to policy and will delete the old one if it was constructed by the constructor of the invoking observer or if it was set with deleteInst true.

AcceptorPolicygetAcceptorPolicy () const
 Returns the current AcceptorPolicy of the invoking observer.

virtual void startUpdating ()
 Forces the invoking observer to start updating any of the messages in the queue using the UpdatePolicy of the invoking observer.

bool isUpdating () const
 Returns true if the invoking observer is in the process of updating messages in the queue, otherwise returns false.

bool isActive () const
 Returns true if the invoking observer is active otherwise false.

bool updatesInSeperateThread () const
 Returns true if the invoking observer will update messages in a seperate thread. Otherwise returns false.


Protected Types

typedef ACE_Thread_Condition<
ThreadMutex
ConditionVariable

Protected Methods

const IntSetgetRevocableAuthorities () const
const PlannergetPlanner () const
bool freeGoalTokens () const
 Returns true if the invoking reactive planner should free goal tokens in case of an attempt recovery. Otherwise returns false.

void finalizeTokens ()
void scheduleForFinalization (const PslToken *token)
int notify (MessageHandle message)
 Notifies the invoking observer that a message has been observed.

virtual int activate ()
 Activates the invoking message-observer.

virtual void deActivate ()
 De-activates the invoking message-observer.

void updateInternal (const MessageHandle &message)
 Updates the message by checking type and extracting data and invoking the correct update method depending on the type.

virtual void updateUserDefinedMessage (const Time &time, const MessageData *data)
 Invoked when a user-defined-message is being updated.

virtual void onQueueEmpty ()
 This method is invoked when the queue becomes empty. No signal is signalled at initialization (empty).

virtual void onQueueNonEmpty ()
 This method is invoked when the queue becomes non-empty.

int update ()
 Pops MessageHandle instance from the top of the queue and asks the UpdatePolicy if the message should be updated and if so will update based upon type of the message and release the handle when done.

int svc (void)
 Main thred function used when invoking class has been constructed with threaded option true.


Protected Attributes

MessageHandleQueue m_ObservedMessages
 A queue containing MessageHandle instance to be updated. The queue sorts the message conform the binary function latestTime (that is the top of the queue is the MessageHandle whose getTime is latest).

std::string m_Name
 Name of the invoking observer.

UpdatePolicym_UpdatePolicy
 Policy used for when to start updating and till what message in the queue.

bool m_DeleteUpdatePolicy
 Indicating if the destructor of the invoking observer should delete the update-policy.

bool m_Updating
 Indiates if the observer is updating messages.

bool m_Active
 Indicates if the invoking observer is active.

bool m_Threaded
 Boolean indicating if the messages will be udpated in a seperate thread.

ThreadMutex m_Mutex
ConditionVariablem_StartCondition
 If the invoking class runs it's own thread to update the messages this variable is used to notify the thread to start updating.

AcceptorPolicym_AcceptorPolicy
 Policy used for what message to accept to push in the queue.

bool m_DeleteAcceptorPolicy
 Indicating if the destructor of the invoking observer should delete the acceptor-policy.


Private Methods

void getFutureTokens (const PslTimeline *timeline, PslTokenList &tokensExecuting, PslTokenList &tokensInTheFuture) const
 Queries the tokens on timeline timeline and will store tokens which are scheduled completely in the futur in tokensInTheFuture and the tokens which is currently executing in tokensExecuting.

StatusType free (const PslToken *pslTok)
 Frees token pslTok.

StatusType relax (const PslToken *pslTok)
 Relaxes token pslTok.


Detailed Description

class PlasmaReactivePlannerImpl


Member Typedef Documentation

typedef ACE_Thread_Condition< ThreadMutex > IDEA::MessageObserver::ConditionVariable [protected, inherited]
 


Constructor & Destructor Documentation

IDEA::PlasmaReactivePlannerImpl::PlasmaReactivePlannerImpl const std::string &    name,
const PslDatabase   database,
const AgentTimingService   ats,
const std::string &    heuristicFile,
bool    readHeuristicsFile,
const std::string &    noBranchFile,
bool    readNoBranchFile
 

Constructor.

IDEA::PlasmaReactivePlannerImpl::~PlasmaReactivePlannerImpl  
 

Destructor.


Member Function Documentation

int IDEA::MessageObserver::activate   [protected, virtual, inherited]
 

Activates the invoking message-observer.

release all the messages we did not update

void IDEA::ReactivePlannerImpl::addRevocableAuthority int    authority [inherited]
 

Adds authority to the set of authorities of constraints which the invoking planner can revoke.

void IDEA::MessageObserver::deActivate   [protected, virtual, inherited]
 

De-activates the invoking message-observer.

void IDEA::DefaultReactor::finalizeTokens   [protected, inherited]
 

StatusType IDEA::PlasmaReactivePlannerImpl::free const PslToken   pslTok [private, virtual]
 

Frees token pslTok.

Reimplemented from IDEA::ReactivePlannerImpl.

bool IDEA::ReactivePlannerImpl::freeGoalTokens   [protected, inherited]
 

Returns true if the invoking reactive planner should free goal tokens in case of an attempt recovery. Otherwise returns false.

AcceptorPolicy* IDEA::MessageObserver::getAcceptorPolicy   const [inline, inherited]
 

Returns the current AcceptorPolicy of the invoking observer.

const AgentTimingService * IDEA::DefaultReactor::getAgentTimingService   [inherited]
 

int IDEA::ReactivePlannerImpl::getAuthority   [inherited]
 

Returns the authority of the planner of the invoking reactive planner.

const PslDatabase * IDEA::DefaultReactor::getDatabase   [inherited]
 

const FreeStrategy & IDEA::ReactivePlannerImpl::getFreeStrategy   [inherited]
 

Returns the strategy to use when we free a token.

void IDEA::PlasmaReactivePlannerImpl::getFutureTokens const PslTimeline   timeline,
PslTokenList   tokensExecuting,
PslTokenList   tokensInTheFuture
const [private, virtual]
 

Queries the tokens on timeline timeline and will store tokens which are scheduled completely in the futur in tokensInTheFuture and the tokens which is currently executing in tokensExecuting.

Reimplemented from IDEA::ReactivePlannerImpl.

const std::string& IDEA::MessageObserver::getName   const [inline, inherited]
 

Returns the name of the invoking observer.

int IDEA::MessageObserver::getNrOfPendingMessages   [inline, inherited]
 

Returns the number of pending messages in the queue.

const Planner * IDEA::ReactivePlannerImpl::getPlanner   [protected, inherited]
 

const IntSet & IDEA::ReactivePlannerImpl::getRevocableAuthorities   [protected, inherited]
 

UpdatePolicy* IDEA::MessageObserver::getUpdatePolicy   const [inline, inherited]
 

Returns the current UpdatePolicy of the invoking observer.

bool IDEA::MessageObserver::hasPendingMessages   [inherited]
 

Returns true if the invoking observer has pending messages in the queue.

Will take into account the logic of the UpdatePolicy, that is it will take the message at the top of the queue and check with the updatePolicy ( updateNextMessage( msg ) ) if it would be updated if we would invoke update. So there can be messages in the queue ( getNrOfPendingMessages() != 0 ) and this method returns false.

bool IDEA::MessageObserver::isActive   const [inline, inherited]
 

Returns true if the invoking observer is active otherwise false.

bool IDEA::ReactivePlannerImpl::isRevocable int    authority const [inherited]
 

Returns true if the invoking planner can revoke constraints with authority authority.

bool IDEA::MessageObserver::isUpdating   [inherited]
 

Returns true if the invoking observer is in the process of updating messages in the queue, otherwise returns false.

int IDEA::MessageObserver::notify MessageHandle    message [protected, inherited]
 

Notifies the invoking observer that a message has been observed.

virtual void IDEA::MessageObserver::onQueueEmpty   [inline, protected, virtual, inherited]
 

This method is invoked when the queue becomes empty. No signal is signalled at initialization (empty).

virtual void IDEA::MessageObserver::onQueueNonEmpty   [inline, protected, virtual, inherited]
 

This method is invoked when the queue becomes non-empty.

StatusType IDEA::PlasmaReactivePlannerImpl::relax const PslToken   pslTok [private, virtual]
 

Relaxes token pslTok.

Reimplemented from IDEA::ReactivePlannerImpl.

void IDEA::DefaultReactor::scheduleForFinalization const PslToken   token [protected, inherited]
 

AcceptorPolicy * IDEA::MessageObserver::setAcceptorPolicy AcceptorPolicy   policy,
bool    deleteInst = false
[inherited]
 

Sets the acceptor-policy to policy and will delete the old one if it was constructed by the constructor of the invoking observer or if it was set with deleteInst true.

Returns the old acceptor-policy if it was not deleted otherwise 0.

The acceptor-policy is used to decide to accept messages when the invoking class is notified. Be aware the new policy will override the message-types to accept passed in the constructor of the invoking class.

void IDEA::DefaultReactor::setForgettingThePast bool    value [inherited]
 

void IDEA::ReactivePlannerImpl::setFreeGoalTokens   [inherited]
 

Invoking this method will enable the freeing of goal-tokens in case of a recovery.

UpdatePolicy * IDEA::MessageObserver::setUpdatePolicy UpdatePolicy   policy,
bool    deleteInst = false
[inherited]
 

Sets the update-policy to policy and will delete the old one if it was constructed by the constructor of the invoking observer or if it was set with deleteInst true.

Returns the old update-policy if it was not deleted otherwise 0.

The update-policy is used to trigger the updating of the messages.

StatusType IDEA::ReactivePlannerImpl::startReacting const Time   time [virtual, inherited]
 

Starts a reactive planner cycle for tick time.

void IDEA::MessageObserver::startUpdating   [virtual, inherited]
 

Forces the invoking observer to start updating any of the messages in the queue using the UpdatePolicy of the invoking observer.

void IDEA::ReactivePlannerImpl::stopReacting   [inherited]
 

Stops the reactive planner as soon as possible if it is reacting.

int IDEA::MessageObserver::svc void    [protected, inherited]
 

Main thred function used when invoking class has been constructed with threaded option true.

int IDEA::MessageObserver::update   [protected, inherited]
 

Pops MessageHandle instance from the top of the queue and asks the UpdatePolicy if the message should be updated and if so will update based upon type of the message and release the handle when done.

Returns -1 in case of an error.

void IDEA::MessageObserver::updateInternal const MessageHandle   message [protected, inherited]
 

Updates the message by checking type and extracting data and invoking the correct update method depending on the type.

bool IDEA::MessageObserver::updatesInSeperateThread   const [inline, inherited]
 

Returns true if the invoking observer will update messages in a seperate thread. Otherwise returns false.

void IDEA::MessageObserver::updateUserDefinedMessage const Time   time,
const MessageData   data
[protected, virtual, inherited]
 

Invoked when a user-defined-message is being updated.

To be implemented in the specialization.

Reimplemented in IDEA::BoomerangRelay, and IDEA::SimulatorResponseScheduler.


Member Data Documentation

AcceptorPolicy* IDEA::MessageObserver::m_AcceptorPolicy [protected, inherited]
 

Policy used for what message to accept to push in the queue.

bool IDEA::MessageObserver::m_Active [protected, inherited]
 

Indicates if the invoking observer is active.

bool IDEA::MessageObserver::m_DeleteAcceptorPolicy [protected, inherited]
 

Indicating if the destructor of the invoking observer should delete the acceptor-policy.

bool IDEA::MessageObserver::m_DeleteUpdatePolicy [protected, inherited]
 

Indicating if the destructor of the invoking observer should delete the update-policy.

ThreadMutex IDEA::MessageObserver::m_Mutex [protected, inherited]
 

std::string IDEA::MessageObserver::m_Name [protected, inherited]
 

Name of the invoking observer.

MessageHandleQueue IDEA::MessageObserver::m_ObservedMessages [protected, inherited]
 

A queue containing MessageHandle instance to be updated. The queue sorts the message conform the binary function latestTime (that is the top of the queue is the MessageHandle whose getTime is latest).

ConditionVariable* IDEA::MessageObserver::m_StartCondition [protected, inherited]
 

If the invoking class runs it's own thread to update the messages this variable is used to notify the thread to start updating.

bool IDEA::MessageObserver::m_Threaded [protected, inherited]
 

Boolean indicating if the messages will be udpated in a seperate thread.

UpdatePolicy* IDEA::MessageObserver::m_UpdatePolicy [protected, inherited]
 

Policy used for when to start updating and till what message in the queue.

bool IDEA::MessageObserver::m_Updating [protected, inherited]
 

Indiates if the observer is updating messages.


Contact information
© IDEA
Generated on Fri Feb 3 17:09:46 2006 for IDEA.